FileDocCategorySizeDatePackage
CacheMapping.javaAPI DocGlassfish v2 API21289Fri May 04 22:34:42 BST 2007com.sun.enterprise.tools.common.dd.webapp

CacheMapping

public class CacheMapping extends com.sun.enterprise.tools.common.dd.SunBaseBean
This generated bean class CacheMapping matches the schema element cache-mapping Generated on Fri Apr 02 16:57:40 PST 2004

Fields Summary
static Vector
comparators
public static final String
SERVLET_NAME
public static final String
URL_PATTERN
public static final String
CACHE_HELPER_REF
public static final String
DISPATCHER
public static final String
TIMEOUT
public static final String
TIMEOUTNAME
public static final String
TIMEOUTSCOPE
public static final String
REFRESH_FIELD
public static final String
REFRESHFIELDNAME
public static final String
REFRESHFIELDSCOPE
public static final String
HTTP_METHOD
public static final String
KEY_FIELD
public static final String
KEYFIELDNAME
public static final String
KEYFIELDSCOPE
public static final String
CONSTRAINT_FIELD
Constructors Summary
public CacheMapping()

	// NOI18N

	  
		this(Common.USE_DEFAULT_VALUES);
	
public CacheMapping(int options)

		super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
		// Properties (see root bean comments for the bean graph)
		this.createProperty("servlet-name", 	// NOI18N
			SERVLET_NAME, Common.SEQUENCE_OR | 
			Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createProperty("url-pattern", 	// NOI18N
			URL_PATTERN, Common.SEQUENCE_OR | 
			Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createProperty("cache-helper-ref", 	// NOI18N
			CACHE_HELPER_REF, Common.SEQUENCE_OR | 
			Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createProperty("dispatcher", 	// NOI18N
			DISPATCHER, 
			Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createProperty("timeout", 	// NOI18N
			TIMEOUT, 
			Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createAttribute(TIMEOUT, "name", "Name", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createAttribute(TIMEOUT, "scope", "Scope", 
						AttrProp.CDATA,
						null, "request.attribute");
		this.createProperty("refresh-field", 	// NOI18N
			REFRESH_FIELD, 
			Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 
			Boolean.class);
		this.createAttribute(REFRESH_FIELD, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(REFRESH_FIELD, "scope", "Scope", 
						AttrProp.CDATA,
						null, "request.parameter");
		this.createProperty("http-method", 	// NOI18N
			HTTP_METHOD, 
			Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY, 
			String.class);
		this.createProperty("key-field", 	// NOI18N
			KEY_FIELD, 
			Common.TYPE_0_N | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 
			Boolean.class);
		this.createAttribute(KEY_FIELD, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(KEY_FIELD, "scope", "Scope", 
						AttrProp.CDATA,
						null, "request.parameter");
		this.createProperty("constraint-field", 	// NOI18N
			CONSTRAINT_FIELD, 
			Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			ConstraintField.class);
		this.createAttribute(CONSTRAINT_FIELD, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(CONSTRAINT_FIELD, "scope", "Scope", 
						AttrProp.CDATA,
						null, "request.parameter");
		this.createAttribute(CONSTRAINT_FIELD, "cache-on-match", "CacheOnMatch", 
						AttrProp.CDATA,
						null, "true");
		this.createAttribute(CONSTRAINT_FIELD, "cache-on-match-failure", "CacheOnMatchFailure", 
						AttrProp.CDATA,
						null, "false");
		this.initialize(options);
	
Methods Summary
public static voidaddComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.add(c);
	
public intaddConstraintField(com.sun.enterprise.tools.common.dd.webapp.ConstraintField value)

		return this.addValue(CONSTRAINT_FIELD, value);
	
public intaddDispatcher(java.lang.String value)

		return this.addValue(DISPATCHER, value);
	
public intaddHttpMethod(java.lang.String value)

		return this.addValue(HTTP_METHOD, value);
	
public intaddKeyField(boolean value)

		return this.addValue(KEY_FIELD, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
	
public voiddump(java.lang.StringBuffer str, java.lang.String indent)

		String s;
		Object o;
		org.netbeans.modules.schema2beans.BaseBean n;
		str.append(indent);
		str.append("ServletName");	// NOI18N
		str.append(indent+"\t");	// NOI18N
		str.append("<");	// NOI18N
		s = this.getServletName();
		str.append((s==null?"null":s.trim()));	// NOI18N
		str.append(">\n");	// NOI18N
		this.dumpAttributes(SERVLET_NAME, 0, str, indent);

		str.append(indent);
		str.append("UrlPattern");	// NOI18N
		str.append(indent+"\t");	// NOI18N
		str.append("<");	// NOI18N
		s = this.getUrlPattern();
		str.append((s==null?"null":s.trim()));	// NOI18N
		str.append(">\n");	// NOI18N
		this.dumpAttributes(URL_PATTERN, 0, str, indent);

		str.append(indent);
		str.append("CacheHelperRef");	// NOI18N
		str.append(indent+"\t");	// NOI18N
		str.append("<");	// NOI18N
		s = this.getCacheHelperRef();
		str.append((s==null?"null":s.trim()));	// NOI18N
		str.append(">\n");	// NOI18N
		this.dumpAttributes(CACHE_HELPER_REF, 0, str, indent);

		str.append(indent);
		str.append("Dispatcher["+this.sizeDispatcher()+"]");	// NOI18N
		for(int i=0; i<this.sizeDispatcher(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			str.append(indent+"\t");	// NOI18N
			str.append("<");	// NOI18N
			s = this.getDispatcher(i);
			str.append((s==null?"null":s.trim()));	// NOI18N
			str.append(">\n");	// NOI18N
			this.dumpAttributes(DISPATCHER, i, str, indent);
		}

		str.append(indent);
		str.append("Timeout");	// NOI18N
		str.append(indent+"\t");	// NOI18N
		str.append("<");	// NOI18N
		s = this.getTimeout();
		str.append((s==null?"null":s.trim()));	// NOI18N
		str.append(">\n");	// NOI18N
		this.dumpAttributes(TIMEOUT, 0, str, indent);

		str.append(indent);
		str.append("RefreshField");	// NOI18N
		str.append(indent+"\t");	// NOI18N
		str.append((this.isRefreshField()?"true":"false"));
		this.dumpAttributes(REFRESH_FIELD, 0, str, indent);

		str.append(indent);
		str.append("HttpMethod["+this.sizeHttpMethod()+"]");	// NOI18N
		for(int i=0; i<this.sizeHttpMethod(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			str.append(indent+"\t");	// NOI18N
			str.append("<");	// NOI18N
			s = this.getHttpMethod(i);
			str.append((s==null?"null":s.trim()));	// NOI18N
			str.append(">\n");	// NOI18N
			this.dumpAttributes(HTTP_METHOD, i, str, indent);
		}

		str.append(indent);
		str.append("KeyField["+this.sizeKeyField()+"]");	// NOI18N
		for(int i=0; i<this.sizeKeyField(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			str.append(indent+"\t");	// NOI18N
			str.append((this.isKeyField(i)?"true":"false"));
			this.dumpAttributes(KEY_FIELD, i, str, indent);
		}

		str.append(indent);
		str.append("ConstraintField["+this.sizeConstraintField()+"]");	// NOI18N
		for(int i=0; i<this.sizeConstraintField(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			n = (org.netbeans.modules.schema2beans.BaseBean) this.getConstraintField(i);
			if (n != null)
				n.dump(str, indent + "\t");	// NOI18N
			else
				str.append(indent+"\tnull");	// NOI18N
			this.dumpAttributes(CONSTRAINT_FIELD, i, str, indent);
		}

	
public java.lang.StringdumpBeanNode()

		StringBuffer str = new StringBuffer();
		str.append("CacheMapping\n");	// NOI18N
		this.dump(str, "\n  ");	// NOI18N
		return str.toString();
	
public java.lang.StringgetCacheHelperRef()

		return (String)this.getValue(CACHE_HELPER_REF);
	
public com.sun.enterprise.tools.common.dd.webapp.ConstraintFieldgetConstraintField(int index)

		return (ConstraintField)this.getValue(CONSTRAINT_FIELD, index);
	
public com.sun.enterprise.tools.common.dd.webapp.ConstraintField[]getConstraintField()

		return (ConstraintField[])this.getValues(CONSTRAINT_FIELD);
	
public java.lang.StringgetDispatcher(int index)

		return (String)this.getValue(DISPATCHER, index);
	
public java.lang.String[]getDispatcher()

		return (String[])this.getValues(DISPATCHER);
	
public java.lang.StringgetHttpMethod(int index)

		return (String)this.getValue(HTTP_METHOD, index);
	
public java.lang.String[]getHttpMethod()

		return (String[])this.getValues(HTTP_METHOD);
	
public boolean[]getKeyField()

		boolean[] ret = null;
		Boolean[] values = (Boolean[])this.getValues(KEY_FIELD);
		if (values != null)
		{
			ret = new boolean[values.length];
			for (int i=0; i<values.length; i++)
				ret[i] = values[i].booleanValue();
		}
		return ret;
	
public java.lang.StringgetKeyFieldName(int index)

		// If our element does not exist, then the attribute does not exist.
		if (size(KEY_FIELD) == 0) {
			return null;
		} else {
			return getAttributeValue(KEY_FIELD, index, "Name");
		}
	
public java.lang.StringgetKeyFieldScope(int index)

		// If our element does not exist, then the attribute does not exist.
		if (size(KEY_FIELD) == 0) {
			return null;
		} else {
			return getAttributeValue(KEY_FIELD, index, "Scope");
		}
	
public java.lang.StringgetRefreshFieldName()

		// If our element does not exist, then the attribute does not exist.
		if (size(REFRESH_FIELD) == 0) {
			return null;
		} else {
			return getAttributeValue(REFRESH_FIELD, "Name");
		}
	
public java.lang.StringgetRefreshFieldScope()

		// If our element does not exist, then the attribute does not exist.
		if (size(REFRESH_FIELD) == 0) {
			return null;
		} else {
			return getAttributeValue(REFRESH_FIELD, "Scope");
		}
	
public java.lang.StringgetServletName()

		return (String)this.getValue(SERVLET_NAME);
	
public java.lang.StringgetTimeout()

		return (String)this.getValue(TIMEOUT);
	
public java.lang.StringgetTimeoutName()

		// If our element does not exist, then the attribute does not exist.
		if (size(TIMEOUT) == 0) {
			return null;
		} else {
			return getAttributeValue(TIMEOUT, "Name");
		}
	
public java.lang.StringgetTimeoutScope()

		// If our element does not exist, then the attribute does not exist.
		if (size(TIMEOUT) == 0) {
			return null;
		} else {
			return getAttributeValue(TIMEOUT, "Scope");
		}
	
public java.lang.StringgetUrlPattern()

		return (String)this.getValue(URL_PATTERN);
	
voidinitialize(int options)

								
	
public booleanisKeyField(int index)

		Boolean ret = (Boolean)this.getValue(KEY_FIELD, index);
		if (ret == null)
			ret = (Boolean)Common.defaultScalarValue(Common.TYPE_BOOLEAN);
		return ((java.lang.Boolean)ret).booleanValue();
	
public booleanisRefreshField()

		Boolean ret = (Boolean)this.getValue(REFRESH_FIELD);
		if (ret == null)
			ret = (Boolean)Common.defaultScalarValue(Common.TYPE_BOOLEAN);
		return ((java.lang.Boolean)ret).booleanValue();
	
public static voidremoveComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.remove(c);
	
public intremoveConstraintField(com.sun.enterprise.tools.common.dd.webapp.ConstraintField value)

		return this.removeValue(CONSTRAINT_FIELD, value);
	
public intremoveDispatcher(java.lang.String value)

		return this.removeValue(DISPATCHER, value);
	
public intremoveHttpMethod(java.lang.String value)

		return this.removeValue(HTTP_METHOD, value);
	
public intremoveKeyField(boolean value)

		return this.removeValue(KEY_FIELD, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
	
public voidremoveKeyField(int index)

		this.removeValue(KEY_FIELD, index);
	
public voidsetCacheHelperRef(java.lang.String value)

		this.setValue(CACHE_HELPER_REF, value);
	
public voidsetConstraintField(int index, com.sun.enterprise.tools.common.dd.webapp.ConstraintField value)

		this.setValue(CONSTRAINT_FIELD, index, value);
	
public voidsetConstraintField(com.sun.enterprise.tools.common.dd.webapp.ConstraintField[] value)

		this.setValue(CONSTRAINT_FIELD, value);
	
public voidsetDispatcher(int index, java.lang.String value)

		this.setValue(DISPATCHER, index, value);
	
public voidsetDispatcher(java.lang.String[] value)

		this.setValue(DISPATCHER, value);
	
public voidsetHttpMethod(int index, java.lang.String value)

		this.setValue(HTTP_METHOD, index, value);
	
public voidsetHttpMethod(java.lang.String[] value)

		this.setValue(HTTP_METHOD, value);
	
public voidsetKeyField(int index, boolean value)

		this.setValue(KEY_FIELD, index, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
	
public voidsetKeyField(boolean[] value)

		Boolean[] values = null;
		if (value != null)
		{
			values = new Boolean[value.length];
			for (int i=0; i<value.length; i++)
				values[i] = new Boolean(value[i]);
		}
		this.setValue(KEY_FIELD, values);
	
public voidsetKeyFieldName(int index, java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(KEY_FIELD) == 0) {
			addValue(KEY_FIELD, "");
		}
		setAttributeValue(KEY_FIELD, index, "Name", value);
	
public voidsetKeyFieldScope(int index, java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(KEY_FIELD) == 0) {
			addValue(KEY_FIELD, "");
		}
		setAttributeValue(KEY_FIELD, index, "Scope", value);
	
public voidsetRefreshField(boolean value)

		this.setValue(REFRESH_FIELD, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE));
	
public voidsetRefreshFieldName(java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(REFRESH_FIELD) == 0) {
			setValue(REFRESH_FIELD, "");
		}
		setAttributeValue(REFRESH_FIELD, "Name", value);
	
public voidsetRefreshFieldScope(java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(REFRESH_FIELD) == 0) {
			setValue(REFRESH_FIELD, "");
		}
		setAttributeValue(REFRESH_FIELD, "Scope", value);
	
public voidsetServletName(java.lang.String value)

		this.setValue(SERVLET_NAME, value);
	
public voidsetTimeout(java.lang.String value)

		this.setValue(TIMEOUT, value);
	
public voidsetTimeoutName(java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(TIMEOUT) == 0) {
			setValue(TIMEOUT, "");
		}
		setAttributeValue(TIMEOUT, "Name", value);
	
public voidsetTimeoutScope(java.lang.String value)

		// Make sure we've got a place to put this attribute.
		if (size(TIMEOUT) == 0) {
			setValue(TIMEOUT, "");
		}
		setAttributeValue(TIMEOUT, "Scope", value);
	
public voidsetUrlPattern(java.lang.String value)

		this.setValue(URL_PATTERN, value);
	
public intsizeConstraintField()

		return this.size(CONSTRAINT_FIELD);
	
public intsizeDispatcher()

		return this.size(DISPATCHER);
	
public intsizeHttpMethod()

		return this.size(HTTP_METHOD);
	
public intsizeKeyField()

		return this.size(KEY_FIELD);
	
public voidvalidate()

		boolean restrictionFailure = false;
		// Validating property servletName
		if (getServletName() != null) {
		}
		int orCount = 0;
		if (getServletName() != null) {
			++orCount;
		}
		// Validating property urlPattern
		if (getUrlPattern() != null) {
		}
		if (getUrlPattern() != null) {
			++orCount;
		}
		// Validating property cacheHelperRef
		if (getCacheHelperRef() != null) {
		}
		if (getCacheHelperRef() != null) {
			++orCount;
		}
		// Validating property dispatcher
		for (int _index = 0; _index < sizeDispatcher(); ++_index) {
			String element = getDispatcher(_index);
			if (element != null) {
			}
		}
		// Validating property timeout
		if (getTimeout() != null) {
		}
		// Validating property timeoutName
		if (getTimeoutName() != null) {
		}
		// Validating property timeoutScope
		if (getTimeoutScope() == null) {
			throw new org.netbeans.modules.schema2beans.ValidateException("getTimeoutScope() == null", "timeoutScope", this);	// NOI18N
		}
		// Validating property refreshField
		// Validating property refreshFieldName
		if (getRefreshFieldName() == null) {
			throw new org.netbeans.modules.schema2beans.ValidateException("getRefreshFieldName() == null", "refreshFieldName", this);	// NOI18N
		}
		// Validating property refreshFieldScope
		if (getRefreshFieldScope() == null) {
			throw new org.netbeans.modules.schema2beans.ValidateException("getRefreshFieldScope() == null", "refreshFieldScope", this);	// NOI18N
		}
		// Validating property httpMethod
		for (int _index = 0; _index < sizeHttpMethod(); ++_index) {
			String element = getHttpMethod(_index);
			if (element != null) {
			}
		}
		// Validating property keyField
		for (int _index = 0; _index < sizeKeyField(); ++_index) {
			boolean element = isKeyField(_index);
		}
		// Validating property keyFieldName
		// Validating property keyFieldScope
		// Validating property constraintField
		for (int _index = 0; _index < sizeConstraintField(); ++_index) {
			com.sun.enterprise.tools.common.dd.webapp.ConstraintField element = getConstraintField(_index);
			if (element != null) {
				element.validate();
			}
		}
		if (orCount != 1) {
			throw new org.netbeans.modules.schema2beans.ValidateException("orCount ("+orCount+") != 1", "mutually exclusive properties", this);	// NOI18N
		}