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

LoadBalancerStats

public class LoadBalancerStats extends Object implements com.sun.enterprise.admin.monitor.stats.lb.CommonBean, com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStatsInterface
This generated bean class LoadBalancerStats matches the schema element 'load-balancer-stats'. Generated on Fri Aug 19 00:43:43 IST 2005 This class matches the root element of the DTD, and is the root of the bean graph. load-balancer-stats : LoadBalancerStats cluster-stats : ClusterStats[0,n] [attr: id CDATA #REQUIRED ] instance-stats : InstanceStats[0,n] [attr: id CDATA #REQUIRED ] [attr: health CDATA #REQUIRED ] [attr: num-total-requests CDATA #REQUIRED ] [attr: num-active-requests CDATA #REQUIRED ] application-stats : Boolean[0,n] [attr: id CDATA #REQUIRED ] [attr: average-response-time CDATA #REQUIRED ] [attr: min-response-time CDATA #REQUIRED ] [attr: max-response-time CDATA #REQUIRED ] [attr: num-failover-requests CDATA #REQUIRED ] [attr: num-error-requests CDATA #REQUIRED ] [attr: num-active-requests CDATA #REQUIRED ] [attr: num-idempotent-url-requests CDATA #REQUIRED ] [attr: num-total-requests CDATA #REQUIRED ] EMPTY : String

Fields Summary
private List
_ClusterStats
Constructors Summary
public LoadBalancerStats()

	// List<ClusterStats>

	  
	
public LoadBalancerStats(LoadBalancerStats source)

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

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

		if (name == null) return;
		name = name.intern();
		if (name == "clusterStats")
			addClusterStats((ClusterStats)value);
		else if (name == "clusterStats[]")
			setClusterStats((ClusterStats[]) value);
		else
			throw new IllegalArgumentException(name+" is not a valid property name for LoadBalancerStats");
	
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 = _ClusterStats.iterator(); 
			it.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.ClusterStats element = (com.sun.enterprise.admin.monitor.stats.lb.ClusterStats)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.LoadBalancerStats))
			return false;
		com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats inst = (com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStats) o;
		if (sizeClusterStats() != inst.sizeClusterStats())
			return false;
		// Compare every element.
		for (java.util.Iterator it = _ClusterStats.iterator(), it2 = inst._ClusterStats.iterator(); 
			it.hasNext() && it2.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.ClusterStats element = (com.sun.enterprise.admin.monitor.stats.lb.ClusterStats)it.next();
			com.sun.enterprise.admin.monitor.stats.lb.ClusterStats element2 = (com.sun.enterprise.admin.monitor.stats.lb.ClusterStats)it2.next();
			if (!(element == null ? element2 == null : element.equals(element2)))
				return false;
		}
		return true;
	
public java.util.ListfetchClusterStatsList()

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

		if (name.equals("clusterStats[]"))
			return getClusterStats();
		throw new IllegalArgumentException(name+" is not a valid property name for LoadBalancerStats");
	
public com.sun.enterprise.admin.monitor.stats.lb.ClusterStats[]getClusterStats()

		ClusterStats[] arr = new ClusterStats[_ClusterStats.size()];
		return (ClusterStats[]) _ClusterStats.toArray(arr);
	
public com.sun.enterprise.admin.monitor.stats.lb.ClusterStatsgetClusterStats(int index)

		return (ClusterStats)_ClusterStats.get(index);
	
public inthashCode()

		int result = 17;
		result = 37*result + (_ClusterStats == null ? 0 : _ClusterStats.hashCode());
		return result;
	
public static com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStatsread(java.io.InputStream in)

		return read(new org.xml.sax.InputSource(in), false, null, null);
	
public static com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStatsread(org.xml.sax.InputSource in, boolean validate, org.xml.sax.EntityResolver er, org.xml.sax.ErrorHandler eh)

		javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
		dbf.setValidating(validate);
		javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
		if (er != null)	db.setEntityResolver(er);
		if (eh != null)	db.setErrorHandler(eh);
		org.w3c.dom.Document doc = db.parse(in);
		return read(doc);
	
public static com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStatsread(org.w3c.dom.Document document)

		LoadBalancerStats aLoadBalancerStats = new LoadBalancerStats();
		aLoadBalancerStats.readNode(document.getDocumentElement());
		return aLoadBalancerStats;
	
public static com.sun.enterprise.admin.monitor.stats.lb.LoadBalancerStatsreadNoEntityResolver(java.io.InputStream in)

		return read(new org.xml.sax.InputSource(in), false,
			new org.xml.sax.EntityResolver() {
			public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) {
				java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream(new byte[0]);
				return new org.xml.sax.InputSource(bin);
			}
		}
			, null);
	
public voidreadNode(org.w3c.dom.Node node)

		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 == "cluster-stats") {
				ClusterStats aClusterStats = new com.sun.enterprise.admin.monitor.stats.lb.ClusterStats();
				aClusterStats.readNode(childNode);
				_ClusterStats.add(aClusterStats);
			}
			else {
				// Found extra unrecognized childNode
			}
		}
	
public intremoveClusterStats(com.sun.enterprise.admin.monitor.stats.lb.ClusterStats value)

		int pos = _ClusterStats.indexOf(value);
		if (pos >= 0) {
			_ClusterStats.remove(pos);
		}
		return pos;
	
public voidsetClusterStats(com.sun.enterprise.admin.monitor.stats.lb.ClusterStats[] value)

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

		_ClusterStats.set(index, value);
	
public intsizeClusterStats()

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

		java.io.StringWriter sw = new java.io.StringWriter();
		try {
			writeNode(sw, "LoadBalancerStats", "");
		} 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 clusterStats
		for (int _index = 0; _index < sizeClusterStats(); ++_index) {
			com.sun.enterprise.admin.monitor.stats.lb.ClusterStats element = getClusterStats(_index);
			if (element != null) {
				element.validate();
			}
		}
	
public voidwrite(java.io.OutputStream out)

		write(out, null);
	
public voidwrite(java.io.OutputStream out, java.lang.String encoding)

		java.io.Writer w;
		if (encoding == null) {
			encoding = "UTF-8";	// NOI18N
		}
		w = new java.io.BufferedWriter(new java.io.OutputStreamWriter(out, encoding));
		write(w, encoding);
		w.flush();
	
public voidwrite(java.io.Writer out, java.lang.String encoding)

		out.write("<?xml version='1.0'");	// NOI18N
		if (encoding != null)
			out.write(" encoding='"+encoding+"'");	// NOI18N
		out.write(" ?>\n");	// NOI18N
		writeNode(out, "load-balancer-stats", "");	// NOI18N
	
public voidwriteNode(java.io.Writer out, java.lang.String nodeName, java.lang.String indent)

		out.write(indent);
		out.write("<");
		out.write(nodeName);
		out.write(">\n");
		String nextIndent = indent + "	";
		for (java.util.Iterator it = _ClusterStats.iterator(); 
			it.hasNext(); ) {
			com.sun.enterprise.admin.monitor.stats.lb.ClusterStats element = (com.sun.enterprise.admin.monitor.stats.lb.ClusterStats)it.next();
			if (element != null) {
				element.writeNode(out, "cluster-stats", nextIndent);
			}
		}
		out.write(indent);
		out.write("</"+nodeName+">\n");
	
public static voidwriteXML(java.io.Writer out, java.lang.String msg)

		writeXML(out, msg, true);
	
public static voidwriteXML(java.io.Writer out, java.lang.String msg, boolean attribute)

		if (msg == null)
			return;
		int msgLength = msg.length();
		for (int i = 0; i < msgLength; ++i) {
			char c = msg.charAt(i);
			writeXML(out, c, attribute);
		}
	
public static voidwriteXML(java.io.Writer out, char msg, boolean attribute)

		if (msg == '&")
			out.write("&");
		else if (msg == '<")
			out.write("<");
		else if (msg == '>")
			out.write(">");
		else if (attribute && msg == '"")
			out.write(""");
		else if (attribute && msg == '\'")
			out.write("'");
		else if (attribute && msg == '\n")
			out.write("
");
		else if (attribute && msg == '\t")
			out.write("	");
		else
			out.write(msg);