FileDocCategorySizeDatePackage
ClientContainer.javaAPI DocGlassfish v2 API23633Fri May 04 22:31:18 BST 2007com.sun.enterprise.config.clientbeans

ClientContainer

public class ClientContainer extends com.sun.enterprise.config.ConfigBean implements Serializable
This generated bean class ClientContainer matches the DTD element client-container

Fields Summary
static Vector
comparators
private static final org.netbeans.modules.schema2beans.Version
runtimeVersion
public static final String
TARGET_SERVER
public static final String
AUTH_REALM
public static final String
CLIENT_CREDENTIAL
public static final String
LOG_SERVICE
public static final String
MESSAGE_SECURITY_CONFIG
public static final String
ELEMENT_PROPERTY
Constructors Summary
public ClientContainer()


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

		this(Common.NO_DEFAULT_VALUES);
		try {
			initFromNode(doc, options);
		}
		catch (Schema2BeansException e) {
			throw new RuntimeException(e);
		}
	
public ClientContainer(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(ClientContainer.class).getString("cannotAddDuplicate",  "ElementProperty"));
		}
		return this.addValue(ELEMENT_PROPERTY, value, overwrite);
	
public intaddMessageSecurityConfig(MessageSecurityConfig value)

		return addMessageSecurityConfig(value, true);
	
public intaddMessageSecurityConfig(MessageSecurityConfig value, boolean overwrite)

		MessageSecurityConfig old = getMessageSecurityConfigByAuthLayer(value.getAuthLayer());
		if(old != null) {
			throw new ConfigException(StringManager.getManager(ClientContainer.class).getString("cannotAddDuplicate",  "MessageSecurityConfig"));
		}
		return this.addValue(MESSAGE_SECURITY_CONFIG, value, overwrite);
	
public intaddTargetServer(TargetServer value)

		return addTargetServer(value, true);
	
public intaddTargetServer(TargetServer value, boolean overwrite)

		TargetServer old = getTargetServerByName(value.getName());
		if(old != null) {
			throw new ConfigException(StringManager.getManager(ClientContainer.class).getString("cannotAddDuplicate",  "TargetServer"));
		}
		return this.addValue(TARGET_SERVER, value, overwrite);
	
public static com.sun.enterprise.config.clientbeans.ClientContainercreateGraph(org.w3c.dom.Node doc)

		return new ClientContainer(doc, Common.NO_DEFAULT_VALUES);
	
public static com.sun.enterprise.config.clientbeans.ClientContainercreateGraph(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.clientbeans.ClientContainercreateGraph(java.io.InputStream in)

		return createGraph(in, false);
	
public static com.sun.enterprise.config.clientbeans.ClientContainercreateGraph(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.clientbeans.ClientContainercreateGraph()

		return new ClientContainer();
	
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("TargetServer["+this.sizeTargetServer()+"]");	// NOI18N
		for(int i=0; i<this.sizeTargetServer(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			n = (org.netbeans.modules.schema2beans.BaseBean) this.getTargetServer(i);
			if (n != null)
				n.dump(str, indent + "\t");	// NOI18N
			else
				str.append(indent+"\tnull");	// NOI18N
			this.dumpAttributes(TARGET_SERVER, i, str, indent);
		}

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

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

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

		str.append(indent);
		str.append("MessageSecurityConfig["+this.sizeMessageSecurityConfig()+"]");	// NOI18N
		for(int i=0; i<this.sizeMessageSecurityConfig(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			n = (org.netbeans.modules.schema2beans.BaseBean) this.getMessageSecurityConfig(i);
			if (n != null)
				n.dump(str, indent + "\t");	// NOI18N
			else
				str.append(indent+"\tnull");	// NOI18N
			this.dumpAttributes(MESSAGE_SECURITY_CONFIG, 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("ClientContainer\n");	// NOI18N
		this.dump(str, "\n  ");	// NOI18N
		return str.toString();
	
public AuthRealmgetAuthRealm()

		return (AuthRealm)this.getValue(AUTH_REALM);
	
public ClientCredentialgetClientCredential()

		return (ClientCredential)this.getValue(CLIENT_CREDENTIAL);
	
public static java.lang.StringgetDefaultAttributeValue(java.lang.String attr)

		if(attr == null) return null;
		attr = attr.trim();
		if(attr.equals(ClientTags.SEND_PASSWORD)) return "true".trim();
	return null;
	
public static java.lang.StringgetDefaultSendPassword()
Get the default value of SendPassword from dtd

		return "true".trim();
	
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(ClientTags.NAME)).equals(id)) {
	         return o[i];
	     }
	 }

		return null;
		
	
public LogServicegetLogService()

		return (LogService)this.getValue(LOG_SERVICE);
	
public MessageSecurityConfiggetMessageSecurityConfig(int index)

		return (MessageSecurityConfig)this.getValue(MESSAGE_SECURITY_CONFIG, index);
	
public MessageSecurityConfig[]getMessageSecurityConfig()

		return (MessageSecurityConfig[])this.getValues(MESSAGE_SECURITY_CONFIG);
	
public MessageSecurityConfiggetMessageSecurityConfigByAuthLayer(java.lang.String id)

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

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

		return null;
		
	
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 = "client-container";
	    return (null != ret ? ret.trim() : null);
	
public TargetServer[]getTargetServer()

		return (TargetServer[])this.getValues(TARGET_SERVER);
	
public TargetServergetTargetServer(int index)

		return (TargetServer)this.getValue(TARGET_SERVER, index);
	
public TargetServergetTargetServerByName(java.lang.String id)

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

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

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

		if (doc == null)
		{
			doc = GraphManager.createRootElementNode("client-container");	// NOI18N
			if (doc == null)
				throw new Schema2BeansException(Common.getMessage(
					"CantCreateDOMRoot_msg", "client-container"));
		}
		Node n = GraphManager.getElementNode("client-container", doc);	// NOI18N
		if (n == null)
			throw new Schema2BeansException(Common.getMessage(
				"DocRootNotInDOMGraph_msg", "client-container", 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("client-container", "ClientContainer",	// NOI18N
			Common.TYPE_1 | Common.TYPE_BEAN, ClientContainer.class);

		// Properties (see root bean comments for the bean graph)
		initPropertyTables(6);
		this.createProperty("target-server", TARGET_SERVER, 
			Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			TargetServer.class);
		this.createAttribute(TARGET_SERVER, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(TARGET_SERVER, "address", "Address", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(TARGET_SERVER, "port", "Port", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createProperty("auth-realm", AUTH_REALM, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			AuthRealm.class);
		this.createAttribute(AUTH_REALM, "name", "Name", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(AUTH_REALM, "classname", "Classname", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createProperty("client-credential", CLIENT_CREDENTIAL, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			ClientCredential.class);
		this.createAttribute(CLIENT_CREDENTIAL, "user-name", "UserName", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(CLIENT_CREDENTIAL, "password", "Password", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(CLIENT_CREDENTIAL, "realm", "Realm", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createProperty("log-service", LOG_SERVICE, 
			Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 
			LogService.class);
		this.createAttribute(LOG_SERVICE, "file", "File", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createAttribute(LOG_SERVICE, "level", "Level", 
						AttrProp.CDATA,
						null, "SEVERE");
		this.createProperty("message-security-config", MESSAGE_SECURITY_CONFIG, 
			Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			MessageSecurityConfig.class);
		this.createAttribute(MESSAGE_SECURITY_CONFIG, "auth-layer", "AuthLayer", 
						AttrProp.CDATA | AttrProp.REQUIRED,
						null, null);
		this.createAttribute(MESSAGE_SECURITY_CONFIG, "default-provider", "DefaultProvider", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						null, null);
		this.createAttribute(MESSAGE_SECURITY_CONFIG, "default-client-provider", "DefaultClientProvider", 
						AttrProp.CDATA | AttrProp.IMPLIED,
						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("send-password", "SendPassword", 
						AttrProp.CDATA,
						null, "true");
		this.initialize(options);
	
voidinitialize(int options)


	
public booleanisSendPassword()
Getter for SendPassword of the Element client-container

return
the SendPassword of the Element client-container

		return toBoolean(getAttributeValue(ClientTags.SEND_PASSWORD));
	
public AuthRealmnewAuthRealm()
Create a new bean using it's default constructor. This does not add it to any bean graph.

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

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

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

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

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

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

		try{
			init(comparators, runtimeVersion);
			String strDocument = in.readUTF();
			// System.out.println("strDocument='"+strDocument+"'");
			ByteArrayInputStream bais = new ByteArrayInputStream(strDocument.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 intremoveMessageSecurityConfig(MessageSecurityConfig value)

		return this.removeValue(MESSAGE_SECURITY_CONFIG, value);
	
public intremoveMessageSecurityConfig(MessageSecurityConfig value, boolean overwrite)

		return this.removeValue(MESSAGE_SECURITY_CONFIG, value, overwrite);
	
public intremoveTargetServer(TargetServer value)

		return this.removeValue(TARGET_SERVER, value);
	
public intremoveTargetServer(TargetServer value, boolean overwrite)

		return this.removeValue(TARGET_SERVER, value, overwrite);
	
public voidsetAuthRealm(AuthRealm value)

		this.setValue(AUTH_REALM, value);
	
public voidsetClientCredential(ClientCredential value)

		this.setValue(CLIENT_CREDENTIAL, value);
	
public voidsetElementProperty(int index, ElementProperty value)

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

		this.setValue(ELEMENT_PROPERTY, value);
	
public voidsetLogService(LogService value)

		this.setValue(LOG_SERVICE, value);
	
public voidsetMessageSecurityConfig(int index, MessageSecurityConfig value)

		this.setValue(MESSAGE_SECURITY_CONFIG, index, value);
	
public voidsetMessageSecurityConfig(MessageSecurityConfig[] value)

		this.setValue(MESSAGE_SECURITY_CONFIG, value);
	
public voidsetSendPassword(boolean v, boolean overwrite)
Modify the SendPassword of the Element client-container

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

		setAttributeValue(ClientTags.SEND_PASSWORD, ""+(v==true), overwrite);
	
public voidsetSendPassword(boolean v)
Modify the SendPassword of the Element client-container

param
v the new value

		setAttributeValue(ClientTags.SEND_PASSWORD, ""+(v==true));
	
public voidsetTargetServer(int index, TargetServer value)

		this.setValue(TARGET_SERVER, index, value);
	
public voidsetTargetServer(TargetServer[] value)

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

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

		return this.size(MESSAGE_SECURITY_CONFIG);
	
public intsizeTargetServer()

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

	
private voidwriteObject(java.io.ObjectOutputStream out)

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		write(baos);
		String str = baos.toString();;
		// System.out.println("str='"+str+"'");
		out.writeUTF(str);