[Ejtools-cvs] applications/management.browser/src/main/org/ejtools/management/browser/model Node.jav
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 09:49:32
|
Update of /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser/model In directory sc8-pr-cvs1:/tmp/cvs-serv21061/management.browser/src/main/org/ejtools/management/browser/model Modified Files: Node.java Server.java Log Message: Add more javadocs. Adjust workspace persistence. Index: Node.java =================================================================== RCS file: /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser/model/Node.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Node.java 27 Nov 2003 01:39:48 -0000 1.4 --- Node.java 13 Dec 2003 22:31:56 -0000 1.5 *************** *** 1,213 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.browser.model; ! ! import java.awt.Component; ! import java.beans.Customizer; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.Comparator; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Node extends CustomBeanContextServicesSupport implements BeanContextChildComponentProxy ! { ! /** Description of the Field */ ! protected transient Customizer c = null; ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(Node.class); ! ! ! /** Constructor for the Node object */ ! public Node() ! { ! super(); ! } ! ! ! /** ! * Gets the component attribute of the Node object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! if (c == null) ! { ! c = new GenericCustomizer(true, this); ! } ! return (Component) c; ! } ! ! ! /** ! * Gets the name attribute of the Node object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public Iterator iterator() ! { ! Iterator iterator = super.iterator(); ! ! // Create a vector from the iterator ! Vector vector = new Vector(); ! while (iterator.hasNext()) ! { ! vector.addElement(iterator.next()); ! } ! ! // Apply the comparator ! Collections.sort(vector, ! new Comparator() ! { ! public int compare(Object o1, Object o2) ! { ! Class c1 = o1.getClass(); ! Class c2 = o2.getClass(); ! ! if ((c1 == ManagedObject.class) && (c2 == ManagedObject.class)) ! { ! int ret = ((ManagedObject) o1).getJ2EEType().compareTo(((ManagedObject) o2).getJ2EEType()); ! if (ret == 0) ! { ! ret = o1.toString().compareTo(o2.toString()); ! } ! return ret; ! } ! else ! { ! int ret = o1.getClass().getName().compareTo(o2.getClass().getName()); ! if (ret == 0) ! { ! ret = o1.toString().compareTo(o2.toString()); ! } ! return ret; ! } ! } ! ! ! public boolean equals(Object obj) ! { ! return true; ! // Ever called? ! } ! }); ! ! // Return the result ! return vector.iterator(); ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public String toString() ! { ! return (name == null || "".equals(name)) ? "Default" : name; ! } ! ! ! /** Description of the Method */ ! protected void createHierarchy() ! { ! logger.debug("Create Hierarchy in " + this.getName() + " parent is " + this.getBeanContext()); ! ! ArrayList moved = new ArrayList(); ! ! // Create the hierachy ! ArrayList copy = new ArrayList(this); ! for (int i = 0; i < copy.size(); i++) ! { ! ManagedObject resource = (ManagedObject) copy.get(i); ! if (!moved.contains(resource)) ! { ! String search = resource.getJ2EEType() + "=" + resource.getName(); ! ! ArrayList toMove = new ArrayList(this); ! for (int j = 0; j < toMove.size(); j++) ! { ! ManagedObject other = (ManagedObject) toMove.get(j); ! String canonical = other.getCanonicalName(); ! if (canonical.indexOf(search) >= 0) ! { ! this.remove(other); ! resource.add(other); ! moved.add(other); ! } ! } ! } ! } ! ! // Recurse through all children which have children ! Iterator iterator = this.iterator(); ! while (iterator.hasNext()) ! { ! ManagedObject resource = (ManagedObject) iterator.next(); ! if (!resource.isEmpty()) ! { ! resource.createHierarchy(); ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param spacer Description of the Parameter ! */ ! protected void dumpHierarchy(String spacer) ! { ! Iterator iterator = this.iterator(); ! while (iterator.hasNext()) ! { ! Node node = (Node) iterator.next(); ! logger.info(spacer + node.getName()); ! node.dumpHierarchy(spacer + "+-"); ! } ! } ! ! ! /** ! * Setter for the name attribute ! * ! * @param name The new name value ! */ ! protected void setName(String name) ! { ! String old = this.name; ! this.name = name; ! this.firePropertyChange("name", old, this.name); ! } ! } --- 1,213 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.browser.model; ! ! import java.awt.Component; ! import java.beans.Customizer; ! import java.beans.beancontext.BeanContextChildComponentProxy; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.Comparator; ! import java.util.Iterator; ! import java.util.Vector; ! ! import org.apache.log4j.Logger; ! import org.ejtools.adwt.GenericCustomizer; ! import org.ejtools.beans.beancontext.CustomBeanContextServicesSupport; ! ! /** ! * Description of the Class ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public abstract class Node extends CustomBeanContextServicesSupport implements BeanContextChildComponentProxy ! { ! /** Description of the Field */ ! protected transient Customizer c = null; ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(Node.class); ! ! ! /** Constructor for the Node object */ ! public Node() ! { ! super(); ! } ! ! ! /** ! * Gets the component attribute of the Node object ! * ! * @return The component value ! */ ! public Component getComponent() ! { ! if (c == null) ! { ! c = new GenericCustomizer(true, this); ! } ! return (Component) c; ! } ! ! ! /** ! * Gets the name attribute of the Node object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public Iterator iterator() ! { ! Iterator iterator = super.iterator(); ! ! // Create a vector from the iterator ! Vector vector = new Vector(); ! while (iterator.hasNext()) ! { ! vector.addElement(iterator.next()); ! } ! ! // Apply the comparator ! Collections.sort(vector, ! new Comparator() ! { ! public int compare(Object o1, Object o2) ! { ! Class c1 = o1.getClass(); ! Class c2 = o2.getClass(); ! ! if ((c1 == ManagedObject.class) && (c2 == ManagedObject.class)) ! { ! int ret = ((ManagedObject) o1).getJ2EEType().compareTo(((ManagedObject) o2).getJ2EEType()); ! if (ret == 0) ! { ! ret = o1.toString().compareTo(o2.toString()); ! } ! return ret; ! } ! else ! { ! int ret = o1.getClass().getName().compareTo(o2.getClass().getName()); ! if (ret == 0) ! { ! ret = o1.toString().compareTo(o2.toString()); ! } ! return ret; ! } ! } ! ! ! public boolean equals(Object obj) ! { ! return true; ! // Ever called? ! } ! }); ! ! // Return the result ! return vector.iterator(); ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Returned Value ! */ ! public String toString() ! { ! return (name == null || "".equals(name)) ? "Default" : name; ! } ! ! ! /** Description of the Method */ ! protected void createHierarchy() ! { ! logger.debug("Create Hierarchy in " + this.getName() + " parent is " + this.getBeanContext()); ! ! ArrayList moved = new ArrayList(); ! ! // Create the hierachy ! ArrayList copy = new ArrayList(this); ! for (int i = 0; i < copy.size(); i++) ! { ! ManagedObject resource = (ManagedObject) copy.get(i); ! if (!moved.contains(resource)) ! { ! String search = resource.getJ2EEType() + "=" + resource.getName(); ! ! ArrayList toMove = new ArrayList(this); ! for (int j = 0; j < toMove.size(); j++) ! { ! ManagedObject other = (ManagedObject) toMove.get(j); ! String canonical = other.getCanonicalName(); ! if (canonical.indexOf(search) >= 0) ! { ! this.remove(other); ! resource.add(other); ! moved.add(other); ! } ! } ! } ! } ! ! // Recurse through all children which have children ! Iterator iterator = this.iterator(); ! while (iterator.hasNext()) ! { ! ManagedObject resource = (ManagedObject) iterator.next(); ! if (!resource.isEmpty()) ! { ! resource.createHierarchy(); ! } ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param spacer Description of the Parameter ! */ ! protected void dumpHierarchy(String spacer) ! { ! Iterator iterator = this.iterator(); ! while (iterator.hasNext()) ! { ! Node node = (Node) iterator.next(); ! logger.info(spacer + node.getName()); ! node.dumpHierarchy(spacer + "+-"); ! } ! } ! ! ! /** ! * Setter for the name attribute ! * ! * @param name The new name value ! */ ! protected void setName(String name) ! { ! String old = this.name; ! this.name = name; ! this.firePropertyChange("name", old, this.name); ! } ! } Index: Server.java =================================================================== RCS file: /cvsroot/ejtools/applications/management.browser/src/main/org/ejtools/management/browser/model/Server.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Server.java 27 Nov 2003 01:39:48 -0000 1.5 --- Server.java 13 Dec 2003 22:31:57 -0000 1.6 *************** *** 1,533 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.management.browser.model; ! ! import java.beans.beancontext.BeanContextServices; ! import java.util.Collection; [...1037 lines suppressed...] ! protected void setCount(int count) ! { ! int oldCount = this.count; ! this.count = count; ! this.firePropertyChange("count", new Integer(oldCount), new Integer(count)); ! } ! ! ! /** ! * Setter for the defaultDomain attribute ! * ! * @param defaultDomain The new defaultDomain value ! */ ! protected void setDefaultDomain(String defaultDomain) ! { ! String oldDomain = this.defaultDomain; ! this.defaultDomain = defaultDomain; ! this.firePropertyChange("defaultDomain", oldDomain, defaultDomain); ! } ! } |