FileDocCategorySizeDatePackage
Domain.javaAPI DocGlassfish v2 API23405Mon Oct 09 15:08:06 BST 2006com.sun.enterprise.config.serverbeans

Domain

public class Domain extends com.sun.enterprise.config.ConfigBean implements Serializable
This generated bean class Domain matches the DTD element domain

Fields Summary
static Vector
comparators
private static final org.netbeans.modules.schema2beans.Version
runtimeVersion
public static final String
APPLICATIONS
public static final String
RESOURCES
public static final String
CONFIGS
public static final String
SERVERS
public static final String
CLUSTERS
public static final String
NODE_AGENTS
public static final String
LB_CONFIGS
public static final String
LOAD_BALANCERS
public static final String
SYSTEM_PROPERTY
public static final String
ELEMENT_PROPERTY
Constructors Summary
public Domain()


	  
		this(null, Common.USE_DEFAULT_VALUES);
	
public Domain(Node doc, int options)

		this(Common.NO_DEFAULT_VALUES);
		try {
			initFromNode(doc, options);
		}
		catch (Schema2BeansException e) {
			throw new RuntimeException(e);
		}
	
public Domain(int options)

		super(comparators, runtimeVersion);
		initOptions(options);
	
Methods Summary
public java.lang.String_getSchemaLocation()

		if (beanProp().getAttrProp("xsi:schemaLocation", true) == null) {
			createAttribute("xmlns:xsi", "xmlns:xsi", AttrProp.CDATA | AttrProp.IMPLIED, null, "http://www.w3.org/2001/XMLSchema-instance");
			setAttributeValue("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
			createAttribute("xsi:schemaLocation", "xsi:schemaLocation", AttrProp.CDATA | AttrProp.IMPLIED, null, null);
		}
		return getAttributeValue("xsi:schemaLocation");
	
public void_setSchemaLocation(java.lang.String location)

		if (beanProp().getAttrProp("xsi:schemaLocation", true) == null) {
			createAttribute("xmlns:xsi", "xmlns:xsi", AttrProp.CDATA | AttrProp.IMPLIED, null, "http://www.w3.org/2001/XMLSchema-instance");
			setAttributeValue("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
			createAttribute("xsi:schemaLocation", "xsi:schemaLocation", AttrProp.CDATA | AttrProp.IMPLIED, null, location);
		}
		setAttributeValue("xsi:schemaLocation", location);
	
public static voidaddComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.add(c);
	
public intaddElementProperty(ElementProperty value)

		return addElementProperty(value, true);
	
public intaddElementProperty(ElementProperty value, boolean overwrite)

		ElementProperty old = getElementPropertyByName(value.getName());
		if(old != null) {
			throw new ConfigException(StringManager.getManager(Domain.class).getString("cannotAddDuplicate",  "ElementProperty"));
		}
		return this.addValue(ELEMENT_PROPERTY, value, overwrite);
	
public intaddSystemProperty(SystemProperty value)

		return addSystemProperty(value, true);
	
public intaddSystemProperty(SystemProperty value, boolean overwrite)

		SystemProperty old = getSystemPropertyByName(value.getName());
		if(old != null) {
			throw new ConfigException(StringManager.getManager(Domain.class).getString("cannotAddDuplicate",  "SystemProperty"));
		}
		return this.addValue(SYSTEM_PROPERTY, value, overwrite);
	
public static com.sun.enterprise.config.serverbeans.DomaincreateGraph(org.w3c.dom.Node doc)

		return new Domain(doc, Common.NO_DEFAULT_VALUES);
	
public static com.sun.enterprise.config.serverbeans.DomaincreateGraph(java.io.File f)

		java.io.InputStream in = new java.io.FileInputStream(f);
		try {
			return createGraph(in, false);
		} finally {
			in.close();
		}
	
public static com.sun.enterprise.config.serverbeans.DomaincreateGraph(java.io.InputStream in)

		return createGraph(in, false);
	
public static com.sun.enterprise.config.serverbeans.DomaincreateGraph(java.io.InputStream in, boolean validate)

		try {
			Document doc = GraphManager.createXmlDocument(in, validate);
			return createGraph(doc);
		}
		catch (Exception t) {
			throw new RuntimeException(Common.getMessage(
				"DOMGraphCreateFailed_msg",
				t));
		}
	
public static com.sun.enterprise.config.serverbeans.DomaincreateGraph()

		return new Domain();
	
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("Applications");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getApplications();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(APPLICATIONS, 0, str, indent);

		str.append(indent);
		str.append("Resources");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getResources();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(RESOURCES, 0, str, indent);

		str.append(indent);
		str.append("Configs");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getConfigs();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(CONFIGS, 0, str, indent);

		str.append(indent);
		str.append("Servers");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getServers();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(SERVERS, 0, str, indent);

		str.append(indent);
		str.append("Clusters");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getClusters();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(CLUSTERS, 0, str, indent);

		str.append(indent);
		str.append("NodeAgents");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getNodeAgents();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(NODE_AGENTS, 0, str, indent);

		str.append(indent);
		str.append("LbConfigs");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getLbConfigs();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(LB_CONFIGS, 0, str, indent);

		str.append(indent);
		str.append("LoadBalancers");	// NOI18N
		n = (org.netbeans.modules.schema2beans.BaseBean) this.getLoadBalancers();
		if (n != null)
			n.dump(str, indent + "\t");	// NOI18N
		else
			str.append(indent+"\tnull");	// NOI18N
		this.dumpAttributes(LOAD_BALANCERS, 0, str, indent);

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

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

	
public java.lang.StringdumpBeanNode()

		StringBuffer str = new StringBuffer();
		str.append("Domain\n");	// NOI18N
		this.dump(str, "\n  ");	// NOI18N
		return str.toString();
	
public java.lang.StringgetApplicationRoot()
Getter for ApplicationRoot of the Element domain

return
the ApplicationRoot of the Element domain

			return getAttributeValue(ServerTags.APPLICATION_ROOT);
	
public ApplicationsgetApplications()

		return (Applications)this.getValue(APPLICATIONS);
	
public ClustersgetClusters()

		return (Clusters)this.getValue(CLUSTERS);
	
public ConfigsgetConfigs()

		return (Configs)this.getValue(CONFIGS);
	
public static java.lang.StringgetDefaultAttributeValue(java.lang.String attr)

		if(attr == null) return null;
		attr = attr.trim();
	return null;
	
public ElementPropertygetElementProperty(int index)

		return (ElementProperty)this.getValue(ELEMENT_PROPERTY, index);
	
public ElementProperty[]getElementProperty()

		return (ElementProperty[])this.getValues(ELEMENT_PROPERTY);
	
public ElementPropertygetElementPropertyByName(java.lang.String id)

	 if (null != id) { id = id.trim(); }
	ElementProperty[] o = getElementProperty();
	 if (o == null) return null;

	 for (int i=0; i < o.length; i++) {
	     if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
	         return o[i];
	     }
	 }

		return null;
		
	
public LbConfigsgetLbConfigs()

		return (LbConfigs)this.getValue(LB_CONFIGS);
	
public LoadBalancersgetLoadBalancers()

		return (LoadBalancers)this.getValue(LOAD_BALANCERS);
	
public java.lang.StringgetLocale()
Getter for Locale of the Element domain

return
the Locale of the Element domain

			return getAttributeValue(ServerTags.LOCALE);
	
public java.lang.StringgetLogRoot()
Getter for LogRoot of the Element domain

return
the LogRoot of the Element domain

			return getAttributeValue(ServerTags.LOG_ROOT);
	
public NodeAgentsgetNodeAgents()

		return (NodeAgents)this.getValue(NODE_AGENTS);
	
protected java.lang.StringgetRelativeXPath()
get the xpath representation for this element returns something like abc[@name='value'] or abc depending on the type of the bean

	    String ret = null;
	    ret = "domain";
	    return (null != ret ? ret.trim() : null);
	
public ResourcesgetResources()

		return (Resources)this.getValue(RESOURCES);
	
public ServersgetServers()

		return (Servers)this.getValue(SERVERS);
	
public SystemPropertygetSystemProperty(int index)

		return (SystemProperty)this.getValue(SYSTEM_PROPERTY, index);
	
public SystemProperty[]getSystemProperty()

		return (SystemProperty[])this.getValues(SYSTEM_PROPERTY);
	
public SystemPropertygetSystemPropertyByName(java.lang.String id)

	 if (null != id) { id = id.trim(); }
	SystemProperty[] o = getSystemProperty();
	 if (o == null) return null;

	 for (int i=0; i < o.length; i++) {
	     if(o[i].getAttributeValue(Common.convertName(ServerTags.NAME)).equals(id)) {
	         return o[i];
	     }
	 }

		return null;
		
	
protected voidinitFromNode(org.w3c.dom.Node doc, int options)

		if (doc == null)
		{
			doc = GraphManager.createRootElementNode("domain");	// NOI18N
			if (doc == null)
				throw new Schema2BeansException(Common.getMessage(
					"CantCreateDOMRoot_msg", "domain"));
		}
		Node n = GraphManager.getElementNode("domain", doc);	// NOI18N
		if (n == null)
			throw new Schema2BeansException(Common.getMessage(
				"DocRootNotInDOMGraph_msg", "domain", doc.getFirstChild().getNodeName()));

		this.graphManager.setXmlDocument(doc);

		// Entry point of the createBeans() recursive calls
		this.createBean(n, this.graphManager());
		this.initialize(options);
	
protected voidinitOptions(int options)

		// The graph manager is allocated in the bean root
		this.graphManager = new GraphManager(this);
		this.createRoot("domain", "Domain",	// NOI18N
			Common.TYPE_1 | Common.TYPE_BEAN, Domain.class);

		// Properties (see root bean comments for the bean graph)
		initPropertyTables(10);
		this.createProperty("applications", APPLICATIONS, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Applications.class);
		this.createProperty("resources", RESOURCES, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Resources.class);
		this.createProperty("configs", CONFIGS, 
			Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Configs.class);
		this.createProperty("servers", SERVERS, 
			Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Servers.class);
		this.createProperty("clusters", CLUSTERS, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Clusters.class);
		this.createProperty("node-agents", NODE_AGENTS, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			NodeAgents.class);
		this.createProperty("lb-configs", LB_CONFIGS, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			LbConfigs.class);
		this.createProperty("load-balancers", LOAD_BALANCERS, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			LoadBalancers.class);
		this.createProperty("system-property", SYSTEM_PROPERTY, 
			Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			SystemProperty.class);
		this.createAttribute(SYSTEM_PROPERTY, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(SYSTEM_PROPERTY, "value", "Value", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createProperty("property", ELEMENT_PROPERTY, 
			Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			ElementProperty.class);
		this.createAttribute(ELEMENT_PROPERTY, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(ELEMENT_PROPERTY, "value", "Value", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute("application-root", "ApplicationRoot", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createAttribute("log-root", "LogRoot", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createAttribute("locale", "Locale", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.initialize(options);
	
voidinitialize(int options)


	
public ApplicationsnewApplications()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new Applications();
	
public ClustersnewClusters()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new Clusters();
	
public ConfigsnewConfigs()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new Configs();
	
public ElementPropertynewElementProperty()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new ElementProperty();
	
public LbConfigsnewLbConfigs()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new LbConfigs();
	
public LoadBalancersnewLoadBalancers()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new LoadBalancers();
	
public NodeAgentsnewNodeAgents()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new NodeAgents();
	
public ResourcesnewResources()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new Resources();
	
public ServersnewServers()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new Servers();
	
public SystemPropertynewSystemProperty()
Create a new bean using it's default constructor. This does not add it to any bean graph.

		return new SystemProperty();
	
private synchronized voidreadObject(java.io.ObjectInputStream in)

		try{
		in.defaultReadObject();
		init(comparators, runtimeVersion);
		//init(comparators, new GenBeans.Version(1, 0, 8));
		final int numStrings = in.readInt();
		final int max_size = in.readInt();
		final StringBuffer sb = new StringBuffer(numStrings * max_size);
		for (int i = 0; i < numStrings; i++){
			sb.append(in.readUTF());
		}
		ByteArrayInputStream bais = new ByteArrayInputStream(sb.toString().getBytes());
		Document doc = GraphManager.createXmlDocument(bais, false);
		initOptions(Common.NO_DEFAULT_VALUES);
		initFromNode(doc, Common.NO_DEFAULT_VALUES);
		}
		catch (Schema2BeansException e) {
			throw new RuntimeException(e);
		}
	
public static voidremoveComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.remove(c);
	
public intremoveElementProperty(ElementProperty value)

		return this.removeValue(ELEMENT_PROPERTY, value);
	
public intremoveElementProperty(ElementProperty value, boolean overwrite)

		return this.removeValue(ELEMENT_PROPERTY, value, overwrite);
	
public intremoveSystemProperty(SystemProperty value)

		return this.removeValue(SYSTEM_PROPERTY, value);
	
public intremoveSystemProperty(SystemProperty value, boolean overwrite)

		return this.removeValue(SYSTEM_PROPERTY, value, overwrite);
	
public voidsetApplicationRoot(java.lang.String v, boolean overwrite)
Modify the ApplicationRoot of the Element domain

param
v the new value
throws
StaleWriteConfigException if overwrite is false and file changed on disk

		setAttributeValue(ServerTags.APPLICATION_ROOT, v, overwrite);
	
public voidsetApplicationRoot(java.lang.String v)
Modify the ApplicationRoot of the Element domain

param
v the new value

		setAttributeValue(ServerTags.APPLICATION_ROOT, v);
	
public voidsetApplications(Applications value)

		this.setValue(APPLICATIONS, value);
	
public voidsetClusters(Clusters value)

		this.setValue(CLUSTERS, value);
	
public voidsetConfigs(Configs value)

		this.setValue(CONFIGS, value);
	
public voidsetElementProperty(ElementProperty[] value)

		this.setValue(ELEMENT_PROPERTY, value);
	
public voidsetLbConfigs(LbConfigs value)

		this.setValue(LB_CONFIGS, value);
	
public voidsetLoadBalancers(LoadBalancers value)

		this.setValue(LOAD_BALANCERS, value);
	
public voidsetLocale(java.lang.String v, boolean overwrite)
Modify the Locale of the Element domain

param
v the new value
throws
StaleWriteConfigException if overwrite is false and file changed on disk

		setAttributeValue(ServerTags.LOCALE, v, overwrite);
	
public voidsetLocale(java.lang.String v)
Modify the Locale of the Element domain

param
v the new value

		setAttributeValue(ServerTags.LOCALE, v);
	
public voidsetLogRoot(java.lang.String v, boolean overwrite)
Modify the LogRoot of the Element domain

param
v the new value
throws
StaleWriteConfigException if overwrite is false and file changed on disk

		setAttributeValue(ServerTags.LOG_ROOT, v, overwrite);
	
public voidsetLogRoot(java.lang.String v)
Modify the LogRoot of the Element domain

param
v the new value

		setAttributeValue(ServerTags.LOG_ROOT, v);
	
public voidsetNodeAgents(NodeAgents value)

		this.setValue(NODE_AGENTS, value);
	
public voidsetResources(Resources value)

		this.setValue(RESOURCES, value);
	
public voidsetServers(Servers value)

		this.setValue(SERVERS, value);
	
public voidsetSystemProperty(SystemProperty[] value)

		this.setValue(SYSTEM_PROPERTY, value);
	
public intsizeElementProperty()

		return this.size(ELEMENT_PROPERTY);
	
public intsizeSystemProperty()

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

	
private synchronized voidwriteObject(java.io.ObjectOutputStream out)

		out.defaultWriteObject();
		final int MAX_SIZE = 0XFFFF;
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
		write(baos);
		final byte [] array = baos.toByteArray();
		final int numStrings = array.length / MAX_SIZE;
		final int leftover = array.length % MAX_SIZE;
		out.writeInt(numStrings + (0 == leftover ? 0 : 1));
		out.writeInt(MAX_SIZE);
		int offset = 0;
		for (int i = 0; i < numStrings; i++){
			out.writeUTF(new String(array, offset, MAX_SIZE));
			offset += MAX_SIZE;
		}
		if (leftover > 0){
			final int count = array.length - offset;
			out.writeUTF(new String(array, offset, count));
		}