[Ejtools-cvs] applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean CustomViewDeployer.jav
Brought to you by:
letiemble
Update of /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean In directory sc8-pr-cvs1:/tmp/cvs-serv13614/jmx.browser/src/main/org/ejtools/jmx/browser/mbean Modified Files: CustomViewDeployer.java CustomViewDeployerMBean.java ResultLine.java View.java ViewLine.java Log Message: Address Bug #775745 Address Todo #800902 Address Todo #755528 Remove @created tags Add support for MXJ4 2.0.0 (still beta) Add support for JXM Remoting through RMI Index: CustomViewDeployer.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean/CustomViewDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CustomViewDeployer.java 24 Feb 2003 22:02:40 -0000 1.2 --- CustomViewDeployer.java 27 Nov 2003 01:13:06 -0000 1.3 *************** *** 1,301 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.io.File; ! import java.io.InputStream; ! import java.util.Calendar; ! import java.util.Iterator; ! import java.util.TreeMap; ! ! import javax.management.MBeanNotificationInfo; ! import javax.management.Notification; ! import javax.xml.parsers.DocumentBuilder; ! import javax.xml.parsers.DocumentBuilderFactory; ! import org.w3c.dom.Element; ! import org.w3c.dom.NodeList; ! ! import org.jboss.deployment.DeploymentException; ! import org.jboss.deployment.DeploymentInfo; ! import org.jboss.deployment.SubDeployerSupport; ! import org.xml.sax.InputSource; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @jmx.mbean name="user:service=CustomViewDeployer" ! * extends="org.jboss.deployment.SubDeployerMBean" ! */ ! public class CustomViewDeployer extends SubDeployerSupport implements CustomViewDeployerMBean ! { ! /** Description of the Field */ ! protected TreeMap views = new TreeMap(); ! /** Description of the Field */ ! private MBeanNotificationInfo[] info = null; ! /** Description of the Field */ ! private long sequence = 0; ! /** Description of the Field */ ! public final static String EXTENSION = ".jmxml"; ! /** Description of the Field */ ! public final static String OBJECT_NAME = "user:service=CustomViewDeployer"; ! ! ! /** ! * Description of the Method ! * ! * @jmx:managed-constructor description="default constructor" ! */ ! public CustomViewDeployer() { } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @return Description of the Return Value ! * @jmx.managed-operation ! */ ! public boolean accepts(DeploymentInfo di) ! { ! String urlStr = di.url.toString(); ! return urlStr.endsWith(EXTENSION); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception DeploymentException Description of the Exception ! * @jmx.managed-operation ! */ ! public void create(DeploymentInfo di) ! throws DeploymentException ! { ! try ! { ! NodeList nl = null; ! log.debug("Deploying Custom View, create step: url " + di.url); ! ! String url = di.url.toString(); ! Element top = (Element) (di.document.getElementsByTagName("customview")).item(0); ! ! View custview = new View(); ! custview.setName(url); ! custview.setDisplayName(top.getAttribute("displayName")); ! log.debug("Create view " + custview.getName()); ! ! Element attributes = (Element) (di.document.getElementsByTagName("attributes")).item(0); ! Element operations = (Element) (di.document.getElementsByTagName("operations")).item(0); ! ! nl = attributes.getElementsByTagName("query"); ! log.debug("About to create " + nl.getLength() + " attribute queries"); ! ! for (int i = 0; i < nl.getLength(); i++) ! { ! Element node = (Element) nl.item(i); ! ! String exp = node.getAttribute("exp"); ! String name = node.getAttribute("name"); ! ! custview.addAttributeLine(exp, name); ! log.debug("Query expression " + exp + " which has name " + name); ! } ! ! nl = operations.getElementsByTagName("query"); ! log.debug("About to create " + nl.getLength() + " operation queries"); ! ! for (int i = 0; i < nl.getLength(); i++) ! { ! Element node = (Element) nl.item(i); ! ! String exp = node.getAttribute("exp"); ! String name = node.getAttribute("name"); ! ! custview.addOperationLine(exp, name); ! log.debug("Query expression " + exp + " which has operation " + name); ! } ! ! views.put(url, custview); ! log.debug("View added"); ! ! Notification notification = new Notification("VIEW_ADDED", this, sequence++, Calendar.getInstance().getTime().getTime(), "Custom view " + url); ! this.sendNotification(notification); ! } ! catch (Exception e) ! { ! destroy(di); ! throw new DeploymentException("create operation failed for package " + di.url, e); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @jmx.managed-operation ! */ ! public void destroy(DeploymentInfo di) ! { ! log.debug("Deploying Custom View, destroy step: url " + di.url); ! ! try ! { ! String url = di.url.toString(); ! log.debug("Destroy view " + url); ! ! views.remove(url); ! log.debug("View removed"); ! ! Notification notification = new Notification("VIEW_REMOVED", this, sequence++, Calendar.getInstance().getTime().getTime(), "Custom view " + url); ! this.sendNotification(notification); ! } ! catch (Exception e) ! { ! } ! } ! ! ! /** ! * Gets the notificationInfo attribute of the CustomViewDeployer object ! * ! * @return The notificationInfo value ! */ ! public MBeanNotificationInfo[] getNotificationInfo() ! { ! if (info == null) ! { ! info = new MBeanNotificationInfo[]{ ! new MBeanNotificationInfo(new String[]{"VIEW_ADDED"}, "javax.management.Notification", "Notification that a view has been added"), ! new MBeanNotificationInfo(new String[]{"VIEW_REMOVED"}, "javax.management.Notification", "Notification that a view has been removed") ! }; ! } ! return info; ! } ! ! ! /** ! * Gets the customView attribute of the CustomViewDeployer object ! * ! * @param index Description of the Parameter ! * @return The view value ! * @jmx.managed-operation ! */ ! public View getView(int index) ! { ! Iterator iterator = views.values().iterator(); ! View view = null; ! int i = 0; ! ! while (iterator.hasNext()) ! { ! view = (View) iterator.next(); ! if (index == i) ! { ! break; ! } ! i++; ! } ! ! return view; ! } ! ! ! /** ! * Description of the Method ! * ! * @return The customViews value ! * @jmx.managed-operation ! */ ! public View[] getViews() ! { ! return (View[]) views.values().toArray(new View[0]); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception DeploymentException Description of the Exception ! * @jmx.managed-operation ! */ ! public void init(DeploymentInfo di) ! throws DeploymentException ! { ! boolean debug = log.isDebugEnabled(); ! ! try ! { ! // resolve the watch ! if (di.url.getProtocol().equals("file")) ! { ! File file = new File(di.url.getFile()); ! ! // If not directory we watch the package ! if (!file.isDirectory()) ! { ! di.watch = di.url; ! } ! } ! else ! { ! // We watch the top only, no directory support ! di.watch = di.url; ! } ! ! // Get the document ! parseDocument(di); ! } ! catch (Exception e) ! { ! throw new DeploymentException(e); ! } ! ! // invoke super-class initialization ! processNestedDeployments(di); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception Exception Description of the Exception ! */ ! protected void parseDocument(DeploymentInfo di) ! throws Exception ! { ! DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); ! InputStream stream = null; ! ! // If we are in a xml only get the URL ! if (di.isXML) ! { ! stream = di.localUrl.openStream(); ! } ! // Else load from the jar or directory ! else ! { ! throw new DeploymentException("Can only handle *" + EXTENSION); ! } ! ! // Validate that the stream is not null ! if (stream == null) ! { ! throw new DeploymentException("Failed to find valid *" + EXTENSION); ! } ! ! InputSource is = new InputSource(stream); ! di.document = parser.parse(is); ! } ! } --- 1,299 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.io.File; ! import java.io.InputStream; ! import java.util.Calendar; ! import java.util.Iterator; ! import java.util.TreeMap; ! ! import javax.management.MBeanNotificationInfo; ! import javax.management.Notification; ! import javax.xml.parsers.DocumentBuilder; ! import javax.xml.parsers.DocumentBuilderFactory; ! import org.w3c.dom.Element; ! import org.w3c.dom.NodeList; ! ! import org.jboss.deployment.DeploymentException; ! import org.jboss.deployment.DeploymentInfo; ! import org.jboss.deployment.SubDeployerSupport; ! import org.xml.sax.InputSource; ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 d?cembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! * @jmx.mbean name="user:service=CustomViewDeployer" ! * extends="org.jboss.deployment.SubDeployerMBean" ! */ ! public class CustomViewDeployer extends SubDeployerSupport implements CustomViewDeployerMBean ! { ! /** Description of the Field */ ! protected TreeMap views = new TreeMap(); ! /** Description of the Field */ ! private MBeanNotificationInfo[] info = null; ! /** Description of the Field */ ! private long sequence = 0; ! /** Description of the Field */ ! public final static String EXTENSION = ".jmxml"; ! /** Description of the Field */ ! public final static String OBJECT_NAME = "user:service=CustomViewDeployer"; ! ! ! /** ! * Description of the Method ! * ! * @jmx:managed-constructor description="default constructor" ! */ ! public CustomViewDeployer() { } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @return Description of the Return Value ! * @jmx.managed-operation ! */ ! public boolean accepts(DeploymentInfo di) ! { ! String urlStr = di.url.toString(); ! return urlStr.endsWith(EXTENSION); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception DeploymentException Description of the Exception ! * @jmx.managed-operation ! */ ! public void create(DeploymentInfo di) ! throws DeploymentException ! { ! try ! { ! NodeList nl = null; ! log.debug("Deploying Custom View, create step: url " + di.url); ! ! String url = di.url.toString(); ! Element top = (Element) (di.document.getElementsByTagName("customview")).item(0); ! ! View custview = new View(); ! custview.setName(url); ! custview.setDisplayName(top.getAttribute("displayName")); ! log.debug("Create view " + custview.getName()); ! ! Element attributes = (Element) (di.document.getElementsByTagName("attributes")).item(0); ! Element operations = (Element) (di.document.getElementsByTagName("operations")).item(0); ! ! nl = attributes.getElementsByTagName("query"); ! log.debug("About to create " + nl.getLength() + " attribute queries"); ! ! for (int i = 0; i < nl.getLength(); i++) ! { ! Element node = (Element) nl.item(i); ! ! String exp = node.getAttribute("exp"); ! String name = node.getAttribute("name"); ! ! custview.addAttributeLine(exp, name); ! log.debug("Query expression " + exp + " which has name " + name); ! } ! ! nl = operations.getElementsByTagName("query"); ! log.debug("About to create " + nl.getLength() + " operation queries"); ! ! for (int i = 0; i < nl.getLength(); i++) ! { ! Element node = (Element) nl.item(i); ! ! String exp = node.getAttribute("exp"); ! String name = node.getAttribute("name"); ! ! custview.addOperationLine(exp, name); ! log.debug("Query expression " + exp + " which has operation " + name); ! } ! ! views.put(url, custview); ! log.debug("View added"); ! ! Notification notification = new Notification("VIEW_ADDED", this, sequence++, Calendar.getInstance().getTime().getTime(), "Custom view " + url); ! this.sendNotification(notification); ! } ! catch (Exception e) ! { ! destroy(di); ! throw new DeploymentException("create operation failed for package " + di.url, e); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @jmx.managed-operation ! */ ! public void destroy(DeploymentInfo di) ! { ! log.debug("Deploying Custom View, destroy step: url " + di.url); ! ! try ! { ! String url = di.url.toString(); ! log.debug("Destroy view " + url); ! ! views.remove(url); ! log.debug("View removed"); ! ! Notification notification = new Notification("VIEW_REMOVED", this, sequence++, Calendar.getInstance().getTime().getTime(), "Custom view " + url); ! this.sendNotification(notification); ! } ! catch (Exception e) ! { ! } ! } ! ! ! /** ! * Gets the notificationInfo attribute of the CustomViewDeployer object ! * ! * @return The notificationInfo value ! */ ! public MBeanNotificationInfo[] getNotificationInfo() ! { ! if (info == null) ! { ! info = new MBeanNotificationInfo[]{ ! new MBeanNotificationInfo(new String[]{"VIEW_ADDED"}, "javax.management.Notification", "Notification that a view has been added"), ! new MBeanNotificationInfo(new String[]{"VIEW_REMOVED"}, "javax.management.Notification", "Notification that a view has been removed") ! }; ! } ! return info; ! } ! ! ! /** ! * Gets the customView attribute of the CustomViewDeployer object ! * ! * @param index Description of the Parameter ! * @return The view value ! * @jmx.managed-operation ! */ ! public View getView(int index) ! { ! Iterator iterator = views.values().iterator(); ! View view = null; ! int i = 0; ! ! while (iterator.hasNext()) ! { ! view = (View) iterator.next(); ! if (index == i) ! { ! break; ! } ! i++; ! } ! ! return view; ! } ! ! ! /** ! * Description of the Method ! * ! * @return The customViews value ! * @jmx.managed-operation ! */ ! public View[] getViews() ! { ! return (View[]) views.values().toArray(new View[0]); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception DeploymentException Description of the Exception ! * @jmx.managed-operation ! */ ! public void init(DeploymentInfo di) ! throws DeploymentException ! { ! try ! { ! // resolve the watch ! if (di.url.getProtocol().equals("file")) ! { ! File file = new File(di.url.getFile()); ! ! // If not directory we watch the package ! if (!file.isDirectory()) ! { ! di.watch = di.url; ! } ! } ! else ! { ! // We watch the top only, no directory support ! di.watch = di.url; ! } ! ! // Get the document ! parseDocument(di); ! } ! catch (Exception e) ! { ! throw new DeploymentException(e); ! } ! ! // invoke super-class initialization ! processNestedDeployments(di); ! } ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception Exception Description of the Exception ! */ ! protected void parseDocument(DeploymentInfo di) ! throws Exception ! { ! DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); ! InputStream stream = null; ! ! // If we are in a xml only get the URL ! if (di.isXML) ! { ! stream = di.localUrl.openStream(); ! } ! // Else load from the jar or directory ! else ! { ! throw new DeploymentException("Can only handle *" + EXTENSION); ! } ! ! // Validate that the stream is not null ! if (stream == null) ! { ! throw new DeploymentException("Failed to find valid *" + EXTENSION); ! } ! ! InputSource is = new InputSource(stream); ! di.document = parser.parse(is); ! } ! } Index: CustomViewDeployerMBean.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean/CustomViewDeployerMBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CustomViewDeployerMBean.java 24 Feb 2003 22:02:44 -0000 1.2 --- CustomViewDeployerMBean.java 27 Nov 2003 01:13:06 -0000 1.3 *************** *** 1,74 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! ! /** ! * MBean interface. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CustomViewDeployerMBean extends org.jboss.deployment.SubDeployerMBean ! { ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @return Description of the Return Value ! */ ! boolean accepts(org.jboss.deployment.DeploymentInfo di); ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception org.jboss.deployment.DeploymentException Description of the Exception ! */ ! void create(org.jboss.deployment.DeploymentInfo di) ! throws org.jboss.deployment.DeploymentException; ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! */ ! void destroy(org.jboss.deployment.DeploymentInfo di); ! ! ! /** ! * Gets the customView attribute of the CustomViewDeployer object ! * ! * @param index Description of the Parameter ! * @return The view value ! */ ! org.ejtools.jmx.browser.mbean.View getView(int index); ! ! ! /** ! * Description of the Method ! * ! * @return The customViews value ! */ ! org.ejtools.jmx.browser.mbean.View[] getViews(); ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception org.jboss.deployment.DeploymentException Description of the Exception ! */ ! void init(org.jboss.deployment.DeploymentInfo di) ! throws org.jboss.deployment.DeploymentException; ! ! } --- 1,74 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! ! /** ! * MBean interface. ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public interface CustomViewDeployerMBean extends org.jboss.deployment.SubDeployerMBean ! { ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @return Description of the Return Value ! */ ! boolean accepts(org.jboss.deployment.DeploymentInfo di); ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception org.jboss.deployment.DeploymentException Description of the Exception ! */ ! void create(org.jboss.deployment.DeploymentInfo di) ! throws org.jboss.deployment.DeploymentException; ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! */ ! void destroy(org.jboss.deployment.DeploymentInfo di); ! ! ! /** ! * Gets the customView attribute of the CustomViewDeployer object ! * ! * @param index Description of the Parameter ! * @return The view value ! */ ! org.ejtools.jmx.browser.mbean.View getView(int index); ! ! ! /** ! * Description of the Method ! * ! * @return The customViews value ! */ ! org.ejtools.jmx.browser.mbean.View[] getViews(); ! ! ! /** ! * Description of the Method ! * ! * @param di Description of the Parameter ! * @exception org.jboss.deployment.DeploymentException Description of the Exception ! */ ! void init(org.jboss.deployment.DeploymentInfo di) ! throws org.jboss.deployment.DeploymentException; ! ! } Index: ResultLine.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean/ResultLine.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ResultLine.java 24 Feb 2003 22:02:43 -0000 1.2 --- ResultLine.java 27 Nov 2003 01:13:06 -0000 1.3 *************** *** 1,133 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! ! import javax.management.MBeanFeatureInfo; ! ! import org.ejtools.jmx.MBeanAccessor; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ResultLine extends BeanContextSupport ! { ! /** Description of the Field */ ! protected MBeanAccessor accessor = null; ! /** Description of the Field */ ! protected MBeanFeatureInfo info = null; ! /** Description of the Field */ ! protected int type = -1; ! ! ! /** Constructor */ ! public ResultLine() { } ! ! ! /** ! * Gets the objectName attribute of the ViewLine object ! * ! * @return The objectName value ! */ ! public MBeanAccessor getAccessor() ! { ! return this.accessor; ! } ! ! ! /** ! * Gets the name attribute of the ViewLine object ! * ! * @return The name value ! */ ! public MBeanFeatureInfo getInfo() ! { ! return this.info; ! } ! ! ! /** ! * Gets the name attribute of the ResultLine object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.accessor.getCanonicalName(); ! } ! ! ! /** ! * Gets the type attribute of the ViewLine object ! * ! * @return The type value ! */ ! public int getType() ! { ! return this.type; ! } ! ! ! /** ! * Sets the objectName attribute of the ViewLine object ! * ! * @param accessor The new accessor value ! */ ! public void setAccessor(MBeanAccessor accessor) ! { ! this.accessor = accessor; ! } ! ! ! /** ! * Sets the name attribute of the ViewLine object ! * ! * @param info The new info value ! */ ! public void setInfo(MBeanFeatureInfo info) ! { ! this.info = info; ! } ! ! ! /** ! * Sets the type attribute of the ViewLine object ! * ! * @param type The new type value ! */ ! public void setType(int type) ! { ! this.type = type; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! String result = "<undefined>"; ! if (this.accessor != null) ! { ! result = result + this.accessor.getCanonicalName(); ! } ! if (this.info != null) ! { ! result = result + info.getName(); ! } ! return result; ! } ! } --- 1,133 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! ! import javax.management.MBeanFeatureInfo; ! ! import org.ejtools.jmx.MBeanAccessor; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ResultLine extends BeanContextSupport ! { ! /** Description of the Field */ ! protected MBeanAccessor accessor = null; ! /** Description of the Field */ ! protected MBeanFeatureInfo info = null; ! /** Description of the Field */ ! protected int type = -1; ! ! ! /** Constructor */ ! public ResultLine() { } ! ! ! /** ! * Gets the objectName attribute of the ViewLine object ! * ! * @return The objectName value ! */ ! public MBeanAccessor getAccessor() ! { ! return this.accessor; ! } ! ! ! /** ! * Gets the name attribute of the ViewLine object ! * ! * @return The name value ! */ ! public MBeanFeatureInfo getInfo() ! { ! return this.info; ! } ! ! ! /** ! * Gets the name attribute of the ResultLine object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.accessor.getCanonicalName(); ! } ! ! ! /** ! * Gets the type attribute of the ViewLine object ! * ! * @return The type value ! */ ! public int getType() ! { ! return this.type; ! } ! ! ! /** ! * Sets the objectName attribute of the ViewLine object ! * ! * @param accessor The new accessor value ! */ ! public void setAccessor(MBeanAccessor accessor) ! { ! this.accessor = accessor; ! } ! ! ! /** ! * Sets the name attribute of the ViewLine object ! * ! * @param info The new info value ! */ ! public void setInfo(MBeanFeatureInfo info) ! { ! this.info = info; ! } ! ! ! /** ! * Sets the type attribute of the ViewLine object ! * ! * @param type The new type value ! */ ! public void setType(int type) ! { ! this.type = type; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! String result = "<undefined>"; ! if (this.accessor != null) ! { ! result = result + this.accessor.getCanonicalName(); ! } ! if (this.info != null) ! { ! result = result + info.getName(); ! } ! return result; ! } ! } Index: View.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean/View.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** View.java 10 Feb 2003 20:49:44 -0000 1.1 --- View.java 27 Nov 2003 01:13:06 -0000 1.2 *************** *** 1,305 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.management.MBeanFeatureInfo; ! import javax.management.ObjectName; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.Sort; ! import org.ejtools.jmx.MBeanAccessor; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class View extends BeanContextSupport ! { ! /** Description of the Field */ ! protected String displayName = "<undefined>"; ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(View.class); ! /** Description of the Field */ ! public final static int ATTRIBUTE_TYPE = 0; ! /** Description of the Field */ ! public final static int OPERATION_TYPE = 1; ! ! ! /** Constructor */ ! public View() { } ! ! ! /** ! * Adds a feature to the AttributeLine attribute of the View object ! * ! * @param objectName The feature to be added to the AttributeLine attribute ! * @param name The feature to be added to the AttributeLine attribute ! */ ! public void addAttributeLine(ObjectName objectName, String name) ! { ! ViewLine line = new ViewLine(); ! line.setType(View.ATTRIBUTE_TYPE); ! line.setObjectName(objectName); ! line.setName(name); ! add(line); ! logger.debug("Atrribute Line added (" + objectName + " => " + name + ")"); ! } ! ! ! /** ! * Adds a feature to the AttributeLine attribute of the View object ! * ! * @param expression The feature to be added to the AttributeLine attribute ! * @param name The feature to be added to the AttributeLine attribute ! */ ! public void addAttributeLine(String expression, String name) ! { ! try ! { ! ObjectName objectName = new ObjectName(expression); ! addAttributeLine(objectName, name); ! } ! catch (Exception e) ! { ! logger.error("Exception while creating Attribute Line : " + e.getMessage()); ! } ! } ! ! ! /** ! * Adds a feature to the AttributeResult attribute of the View object ! * ! * @param accessor The feature to be added to the AttributeResult attribute ! * @param info The feature to be added to the AttributeResult attribute ! */ ! public void addAttributeResult(MBeanAccessor accessor, MBeanFeatureInfo info) ! { ! ResultLine line = new ResultLine(); ! line.setType(View.ATTRIBUTE_TYPE); ! line.setAccessor(accessor); ! line.setInfo(info); ! add(line); ! logger.debug("Atrribute Result added (" + accessor + " => " + info + ")"); ! } ! ! ! /** ! * Adds a feature to the OperationLine attribute of the View object ! * ! * @param objectName The feature to be added to the OperationLine attribute ! * @param name The feature to be added to the OperationLine attribute ! */ ! public void addOperationLine(ObjectName objectName, String name) ! { ! ViewLine line = new ViewLine(); ! line.setType(View.OPERATION_TYPE); ! line.setObjectName(objectName); ! line.setName(name); ! add(line); ! logger.debug("Operation Line added (" + objectName + " => " + name + ")"); ! } ! ! ! /** ! * Adds a feature to the OperationLine attribute of the View object ! * ! * @param expression The feature to be added to the OperationLine attribute ! * @param name The feature to be added to the OperationLine attribute ! */ ! public void addOperationLine(String expression, String name) ! { ! try ! { ! ObjectName objectName = new ObjectName(expression); ! addOperationLine(objectName, name); ! } ! catch (Exception e) ! { ! logger.error("Exception while creating Operation Line : " + e.getMessage()); ! } ! } ! ! ! /** ! * Adds a feature to the OperationResult attribute of the View object ! * ! * @param accessor The feature to be added to the OperationResult attribute ! * @param info The feature to be added to the OperationResult attribute ! */ ! public void addOperationResult(MBeanAccessor accessor, MBeanFeatureInfo info) ! { ! ResultLine line = new ResultLine(); ! line.setType(View.OPERATION_TYPE); ! line.setAccessor(accessor); ! line.setInfo(info); ! add(line); ! logger.debug("Operation Result added (" + accessor + " => " + info + ")"); ! } ! ! ! /** ! * Gets the attributeLines attribute of the View object ! * ! * @return The attributeLines value ! */ ! public Collection getAttributeLines() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ViewLine.class); ! while (iterator.hasNext()) ! { ! ViewLine line = (ViewLine) iterator.next(); ! if (line.getType() == View.ATTRIBUTE_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the attributeResults attribute of the View object ! * ! * @return The attributeResults value ! */ ! public Collection getAttributeResults() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ResultLine.class); ! while (iterator.hasNext()) ! { ! ResultLine line = (ResultLine) iterator.next(); ! if (line.getType() == View.ATTRIBUTE_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the displayName attribute of the View object ! * ! * @return The displayName value ! */ ! public String getDisplayName() ! { ! return this.displayName; ! } ! ! ! /** ! * Gets the name attribute of the View object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Gets the operationLines attribute of the View object ! * ! * @return The operationLines value ! */ ! public Collection getOperationLines() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ViewLine.class); ! while (iterator.hasNext()) ! { ! ViewLine line = (ViewLine) iterator.next(); ! if (line.getType() == View.OPERATION_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the operationResults attribute of the View object ! * ! * @return The operationResults value ! */ ! public Collection getOperationResults() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ResultLine.class); ! while (iterator.hasNext()) ! { ! ResultLine line = (ResultLine) iterator.next(); ! if (line.getType() == View.OPERATION_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Iterator iterator() ! { ! return Sort.sortByName(super.iterator()); ! } ! ! ! ! /** ! * Sets the displayName attribute of the View object ! * ! * @param displayName The new displayName value ! */ ! public void setDisplayName(String displayName) ! { ! this.displayName = displayName; ! } ! ! ! /** ! * Sets the name attribute of the View object ! * ! * @param name The new name value ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return this.displayName; ! } ! } --- 1,305 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! import java.util.Collection; ! import java.util.Iterator; ! import java.util.Vector; ! ! import javax.management.MBeanFeatureInfo; ! import javax.management.ObjectName; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.Sort; ! import org.ejtools.jmx.MBeanAccessor; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class View extends BeanContextSupport ! { ! /** Description of the Field */ ! protected String displayName = "<undefined>"; ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(View.class); ! /** Description of the Field */ ! public final static int ATTRIBUTE_TYPE = 0; ! /** Description of the Field */ ! public final static int OPERATION_TYPE = 1; ! ! ! /** Constructor */ ! public View() { } ! ! ! /** ! * Adds a feature to the AttributeLine attribute of the View object ! * ! * @param objectName The feature to be added to the AttributeLine attribute ! * @param name The feature to be added to the AttributeLine attribute ! */ ! public void addAttributeLine(ObjectName objectName, String name) ! { ! ViewLine line = new ViewLine(); ! line.setType(View.ATTRIBUTE_TYPE); ! line.setObjectName(objectName); ! line.setName(name); ! add(line); ! logger.debug("Atrribute Line added (" + objectName + " => " + name + ")"); ! } ! ! ! /** ! * Adds a feature to the AttributeLine attribute of the View object ! * ! * @param expression The feature to be added to the AttributeLine attribute ! * @param name The feature to be added to the AttributeLine attribute ! */ ! public void addAttributeLine(String expression, String name) ! { ! try ! { ! ObjectName objectName = new ObjectName(expression); ! addAttributeLine(objectName, name); ! } ! catch (Exception e) ! { ! logger.error("Exception while creating Attribute Line : " + e.getMessage()); ! } ! } ! ! ! /** ! * Adds a feature to the AttributeResult attribute of the View object ! * ! * @param accessor The feature to be added to the AttributeResult attribute ! * @param info The feature to be added to the AttributeResult attribute ! */ ! public void addAttributeResult(MBeanAccessor accessor, MBeanFeatureInfo info) ! { ! ResultLine line = new ResultLine(); ! line.setType(View.ATTRIBUTE_TYPE); ! line.setAccessor(accessor); ! line.setInfo(info); ! add(line); ! logger.debug("Atrribute Result added (" + accessor + " => " + info + ")"); ! } ! ! ! /** ! * Adds a feature to the OperationLine attribute of the View object ! * ! * @param objectName The feature to be added to the OperationLine attribute ! * @param name The feature to be added to the OperationLine attribute ! */ ! public void addOperationLine(ObjectName objectName, String name) ! { ! ViewLine line = new ViewLine(); ! line.setType(View.OPERATION_TYPE); ! line.setObjectName(objectName); ! line.setName(name); ! add(line); ! logger.debug("Operation Line added (" + objectName + " => " + name + ")"); ! } ! ! ! /** ! * Adds a feature to the OperationLine attribute of the View object ! * ! * @param expression The feature to be added to the OperationLine attribute ! * @param name The feature to be added to the OperationLine attribute ! */ ! public void addOperationLine(String expression, String name) ! { ! try ! { ! ObjectName objectName = new ObjectName(expression); ! addOperationLine(objectName, name); ! } ! catch (Exception e) ! { ! logger.error("Exception while creating Operation Line : " + e.getMessage()); ! } ! } ! ! ! /** ! * Adds a feature to the OperationResult attribute of the View object ! * ! * @param accessor The feature to be added to the OperationResult attribute ! * @param info The feature to be added to the OperationResult attribute ! */ ! public void addOperationResult(MBeanAccessor accessor, MBeanFeatureInfo info) ! { ! ResultLine line = new ResultLine(); ! line.setType(View.OPERATION_TYPE); ! line.setAccessor(accessor); ! line.setInfo(info); ! add(line); ! logger.debug("Operation Result added (" + accessor + " => " + info + ")"); ! } ! ! ! /** ! * Gets the attributeLines attribute of the View object ! * ! * @return The attributeLines value ! */ ! public Collection getAttributeLines() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ViewLine.class); ! while (iterator.hasNext()) ! { ! ViewLine line = (ViewLine) iterator.next(); ! if (line.getType() == View.ATTRIBUTE_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the attributeResults attribute of the View object ! * ! * @return The attributeResults value ! */ ! public Collection getAttributeResults() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ResultLine.class); ! while (iterator.hasNext()) ! { ! ResultLine line = (ResultLine) iterator.next(); ! if (line.getType() == View.ATTRIBUTE_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the displayName attribute of the View object ! * ! * @return The displayName value ! */ ! public String getDisplayName() ! { ! return this.displayName; ! } ! ! ! /** ! * Gets the name attribute of the View object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Gets the operationLines attribute of the View object ! * ! * @return The operationLines value ! */ ! public Collection getOperationLines() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ViewLine.class); ! while (iterator.hasNext()) ! { ! ViewLine line = (ViewLine) iterator.next(); ! if (line.getType() == View.OPERATION_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Gets the operationResults attribute of the View object ! * ! * @return The operationResults value ! */ ! public Collection getOperationResults() ! { ! Vector result = new Vector(); ! Iterator iterator = Sort.getChildrenByClass(iterator(), ResultLine.class); ! while (iterator.hasNext()) ! { ! ResultLine line = (ResultLine) iterator.next(); ! if (line.getType() == View.OPERATION_TYPE) ! { ! result.add(line); ! } ! } ! return result; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public Iterator iterator() ! { ! return Sort.sortByName(super.iterator()); ! } ! ! ! ! /** ! * Sets the displayName attribute of the View object ! * ! * @param displayName The new displayName value ! */ ! public void setDisplayName(String displayName) ! { ! this.displayName = displayName; ! } ! ! ! /** ! * Sets the name attribute of the View object ! * ! * @param name The new name value ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return this.displayName; ! } ! } Index: ViewLine.java =================================================================== RCS file: /cvsroot/ejtools/applications/jmx.browser/src/main/org/ejtools/jmx/browser/mbean/ViewLine.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ViewLine.java 24 Feb 2003 22:02:44 -0000 1.2 --- ViewLine.java 27 Nov 2003 01:13:06 -0000 1.3 *************** *** 1,111 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! ! import javax.management.ObjectName; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ViewLine extends BeanContextSupport ! { ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! protected ObjectName objectName = null; ! /** Description of the Field */ ! protected int type = -1; ! ! ! /** Constructor */ ! public ViewLine() { } ! ! ! /** ! * Gets the name attribute of the ViewLine object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Gets the objectName attribute of the ViewLine object ! * ! * @return The objectName value ! */ ! public ObjectName getObjectName() ! { ! return this.objectName; ! } ! ! ! /** ! * Gets the type attribute of the ViewLine object ! * ! * @return The type value ! */ ! public int getType() ! { ! return this.type; ! } ! ! ! /** ! * Sets the name attribute of the ViewLine object ! * ! * @param name The new name value ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Sets the objectName attribute of the ViewLine object ! * ! * @param objectName The new objectName value ! */ ! public void setObjectName(ObjectName objectName) ! { ! this.objectName = objectName; ! } ! ! ! /** ! * Sets the type attribute of the ViewLine object ! * ! * @param type The new type value ! */ ! public void setType(int type) ! { ! this.type = type; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return (this.objectName != null) ? (this.objectName.getCanonicalName()) : ("<undefined>"); ! } ! } --- 1,111 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx.browser.mbean; ! ! import java.beans.beancontext.BeanContextSupport; ! ! import javax.management.ObjectName; ! ! ! /** ! * Description of the Class ! * ! * @author letiemble ! * @created 13 décembre 2001 ! * @version $Revision$ ! * @todo Javadoc to complete ! */ ! public class ViewLine extends BeanContextSupport ! { ! /** Description of the Field */ ! protected String name = "<undefined>"; ! /** Description of the Field */ ! protected ObjectName objectName = null; ! /** Description of the Field */ ! protected int type = -1; ! ! ! /** Constructor */ ! public ViewLine() { } ! ! ! /** ! * Gets the name attribute of the ViewLine object ! * ! * @return The name value ! */ ! public String getName() ! { ! return this.name; ! } ! ! ! /** ! * Gets the objectName attribute of the ViewLine object ! * ! * @return The objectName value ! */ ! public ObjectName getObjectName() ! { ! return this.objectName; ! } ! ! ! /** ! * Gets the type attribute of the ViewLine object ! * ! * @return The type value ! */ ! public int getType() ! { ! return this.type; ! } ! ! ! /** ! * Sets the name attribute of the ViewLine object ! * ! * @param name The new name value ! */ ! public void setName(String name) ! { ! this.name = name; ! } ! ! ! /** ! * Sets the objectName attribute of the ViewLine object ! * ! * @param objectName The new objectName value ! */ ! public void setObjectName(ObjectName objectName) ! { ! this.objectName = objectName; ! } ! ! ! /** ! * Sets the type attribute of the ViewLine object ! * ! * @param type The new type value ! */ ! public void setType(int type) ! { ! this.type = type; ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! public String toString() ! { ! return (this.objectName != null) ? (this.objectName.getCanonicalName()) : ("<undefined>"); ! } ! } |