FileDocCategorySizeDatePackage
ClusterStats.javaAPI DocGlassfish v2 API12423Fri May 04 22:25:50 BST 2007com.sun.enterprise.admin.monitor.stats.lb

ClusterStats

public class ClusterStats extends Object implements com.sun.enterprise.admin.monitor.stats.lb.ClusterStatsInterface, com.sun.enterprise.admin.monitor.stats.lb.CommonBean
This generated bean class ClusterStats matches the schema element 'cluster-stats'. Generated on Fri Aug 19 00:43:43 IST 2005

Fields Summary
private String
_Id
private final List
_InstanceStats
Constructors Summary
public ClusterStats()

	// List<InstanceStats>

	  
		_Id = "";
	
public ClusterStats(ClusterStats source)

		_Id = source._Id;
		for (java.util.Iterator it = source._InstanceStats.iterator(); 
			it.hasNext(); ) {
			_InstanceStats.add(new com.sun.enterprise.admin.monitor.stats.lb.InstanceStats((com.sun.enterprise.admin.monitor.stats.lb.InstanceStats)it.next()));
		}
	
Methods Summary
public intaddInstanceStats(com.sun.enterprise.admin.monitor.stats.lb.InstanceStats value)

		_InstanceStats.add(value);
		return _InstanceStats.size()-1;
	
public voidchangePropertyByName(java.lang.String name, java.lang.Object value)

		if (name == null) return;
		name = name.intern();
		if (name.equals("id"))
			setId((java.lang.String)value);
		else if (name.equals("instanceStats"))
			addInstanceStats((InstanceStats)value);
		else if (name.equals("instanceStats[]"))
			setInstanceStats((InstanceStats[]) value);
		else
			throw new IllegalArgumentException(name+" is not a valid property name for ClusterStats");
	
public com.sun.enterprise.admin.monitor.stats.lb.CommonBean[]childBeans(boolean recursive)

		java.util.List children = new java.util.LinkedList();
		childBeans(recursive, children);
		com.sun.enterprise.admin.monitor.stats.lb.CommonBean[] result = new com.sun.enterprise.admin.monitor.stats.lb.CommonBean[children.size()];
		return (com.sun.enterprise.admin.monitor.stats.lb.CommonBean[]) children.toArray(result);
	
public voidchildBeans(boolean recursive, java.util.List beans)

		for (java.util.Iterator it = _InstanceStats.iterator(); 
			it.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.InstanceStats element = (com.sun.enterprise.admin.monitor.stats.lb.InstanceStats)it.next();
			if (element != null) {
				if (recursive) {
					element.childBeans(true, beans);
				}
				beans.add(element);
			}
		}
	
public booleanequals(java.lang.Object o)

		if (o == this)
			return true;
		if (!(o instanceof com.sun.enterprise.admin.monitor.stats.lb.ClusterStats))
			return false;
		com.sun.enterprise.admin.monitor.stats.lb.ClusterStats inst = (com.sun.enterprise.admin.monitor.stats.lb.ClusterStats) o;
		if (!(_Id == null ? inst._Id == null : _Id.equals(inst._Id)))
			return false;
		if (sizeInstanceStats() != inst.sizeInstanceStats())
			return false;
		// Compare every element.
		for (java.util.Iterator it = _InstanceStats.iterator(), it2 = inst._InstanceStats.iterator(); 
			it.hasNext() && it2.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.InstanceStats element = (com.sun.enterprise.admin.monitor.stats.lb.InstanceStats)it.next();
			com.sun.enterprise.admin.monitor.stats.lb.InstanceStats element2 = (com.sun.enterprise.admin.monitor.stats.lb.InstanceStats)it2.next();
			if (!(element == null ? element2 == null : element.equals(element2)))
				return false;
		}
		return true;
	
public java.util.ListfetchInstanceStatsList()

		return _InstanceStats;
	
public java.lang.ObjectfetchPropertyByName(java.lang.String name)

		if (name.equals("id"))
			return getId();
		if (name.equals("instanceStats[]"))
			return getInstanceStats();
		throw new IllegalArgumentException(name+" is not a valid property name for ClusterStats");
	
public java.lang.StringgetId()

		return _Id;
	
public com.sun.enterprise.admin.monitor.stats.lb.InstanceStats[]getInstanceStats()

		InstanceStats[] arr = new InstanceStats[_InstanceStats.size()];
		return (InstanceStats[]) _InstanceStats.toArray(arr);
	
public com.sun.enterprise.admin.monitor.stats.lb.InstanceStatsgetInstanceStats(int index)

		return (InstanceStats)_InstanceStats.get(index);
	
public inthashCode()

		int result = 17;
		result = 37*result + (_Id == null ? 0 : _Id.hashCode());
		result = 37*result + (_InstanceStats == null ? 0 : _InstanceStats.hashCode());
		return result;
	
public voidreadNode(org.w3c.dom.Node node)

		if (node.hasAttributes()) {
			org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
			org.w3c.dom.Attr attr;
			attr = (org.w3c.dom.Attr) attrs.getNamedItem("id");
			if (attr != null) {
				_Id = attr.getValue();
			}
		}
		org.w3c.dom.NodeList children = node.getChildNodes();
		for (int i = 0, size = children.getLength(); i < size; ++i) {
			org.w3c.dom.Node childNode = children.item(i);
			String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
			String childNodeValue = "";
			if (childNode.getFirstChild() != null) {
				childNodeValue = childNode.getFirstChild().getNodeValue();
			}
			if (childNodeName == "instance-stats") {
				InstanceStats aInstanceStats = new com.sun.enterprise.admin.monitor.stats.lb.InstanceStats();
				aInstanceStats.readNode(childNode);
				_InstanceStats.add(aInstanceStats);
			}
			else {
				// Found extra unrecognized childNode
			}
		}
	
public intremoveInstanceStats(com.sun.enterprise.admin.monitor.stats.lb.InstanceStats value)

		int pos = _InstanceStats.indexOf(value);
		if (pos >= 0) {
			_InstanceStats.remove(pos);
		}
		return pos;
	
public voidsetId(java.lang.String value)

		_Id = value;
	
public voidsetInstanceStats(com.sun.enterprise.admin.monitor.stats.lb.InstanceStats[] value)

		if (value == null)
			value = new InstanceStats[0];
		_InstanceStats.clear();
		for (int i = 0; i < value.length; ++i) {
			_InstanceStats.add(value[i]);
		}
	
public voidsetInstanceStats(int index, com.sun.enterprise.admin.monitor.stats.lb.InstanceStats value)

		_InstanceStats.set(index, value);
	
public intsizeInstanceStats()

		return _InstanceStats.size();
	
public java.lang.StringtoString()

		java.io.StringWriter sw = new java.io.StringWriter();
		try {
			writeNode(sw, "ClusterStats", "");
		} catch (java.io.IOException e) {
			// How can we actually get an IOException on a StringWriter?
			// We'll just ignore it.
		}
		return sw.toString();
	
public voidvalidate()

		boolean restrictionFailure = false;
		// Validating property id
		if (getId() == null) {
			throw new com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.ValidateException("getId() == null", "id", this);	// NOI18N
		}
		// Validating property instanceStats
		for (int _index = 0; _index < sizeInstanceStats(); ++_index) {
			com.sun.enterprise.admin.monitor.stats.lb.InstanceStats element = getInstanceStats(_index);
			if (element != null) {
				element.validate();
			}
		}
	
public voidwriteNode(java.io.Writer out, java.lang.String nodeName, java.lang.String indent)

		out.write(indent);
		out.write("<");
		out.write(nodeName);
		// id is an attribute
		if (_Id != null) {
			out.write(" id");	// NOI18N
			out.write("='");	// NOI18N
			com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats.writeXML(out, _Id, true);
			out.write("'");	// NOI18N
		}
		out.write(">\n");
		String nextIndent = indent + "	";
		for (java.util.Iterator it = _InstanceStats.iterator(); 
			it.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.InstanceStats element = (com.sun.enterprise.admin.monitor.stats.lb.InstanceStats)it.next();
			if (element != null) {
				element.writeNode(out, "instance-stats", nextIndent);
			}
		}
		out.write(indent);
		out.write("</"+nodeName+">\n");