[Ejtools-cvs] libraries/common/src/main/org/ejtools/jmx package.html,NONE,1.1 MBeanAccessor.java,1.7
Brought to you by:
letiemble
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv18971/common/src/main/org/ejtools/jmx Modified Files: MBeanAccessor.java MBeanInvokeAccessor.java MBeanServerProxy.java ObjectNameFinder.java Added Files: package.html Log Message: Add more javadocs. Add package.html files. --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!-- EJTools, the Enterprise Java Tools Distributable under LGPL license. See terms of license at www.gnu.org. $Revision: 1.1 $ --> <html> <head/> <body> </body> </html> Index: MBeanAccessor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanAccessor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MBeanAccessor.java 15 Sep 2003 22:23:45 -0000 1.7 --- MBeanAccessor.java 13 Dec 2003 21:27:49 -0000 1.8 *************** *** 1,119 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! import javax.management.Attribute; ! import javax.management.AttributeList; ! import javax.management.MBeanInfo; ! import javax.management.ObjectInstance; ! import javax.management.ObjectName; ! ! /** ! * Tag interface to be implemented by object that provides access to MBean informations ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo JavaDoc to complete ! */ ! public interface MBeanAccessor extends MBeanInvokeAccessor ! { ! /** ! * Gets the objectInstance attribute of the MBeanAccessor object ! * ! * @return The objectInstance value ! * @exception Exception Description of the Exception ! */ ! public ObjectInstance getObjectInstance() ! throws Exception; ! ! ! /** ! * Gets the attributes attribute of the MBeanAccessor object ! * ! * @param as Description of the Parameter ! * @return The attributes value ! * @exception Exception Description of the Exception ! */ ! public AttributeList getAttributes(String as[]) ! throws Exception; ! ! ! /** ! * Sets the attributes attribute of the MBeanAccessor object ! * ! * @param attributelist The new attributes value ! * @return Description of the Return Value ! * @exception Exception Description of the Exception ! */ ! public AttributeList setAttributes(AttributeList attributelist) ! throws Exception; ! ! ! /** ! * Gets the mBeanInfo attribute of the MBeanAccessor object ! * ! * @return The mBeanInfo value ! */ ! public MBeanInfo getMBeanInfo(); ! ! ! /** ! * Gets the instanceOf attribute of the MBeanAccessor object ! * ! * @param s Description of the Parameter ! * @return The instanceOf value ! * @exception Exception Description of the Exception ! */ ! public boolean isInstanceOf(String s) ! throws Exception; ! ! ! /** ! * Sets the attribute attribute of the MBeanAccessor object ! * ! * @param attribute The new attribute value ! * @exception Exception Description of the Exception ! */ ! public void setAttribute(Attribute attribute) ! throws Exception; ! ! ! /** ! * Gets the objectName attribute of the MBeanAccessor object ! * ! * @return The objectName value ! */ ! public ObjectName getObjectName(); ! ! ! /** ! * Gets the canonicalName attribute of the MBeanAccessor object ! * ! * @return The canonicalName value ! */ ! public String getCanonicalName(); ! ! ! /** ! * Gets the attribute attribute of the MBeanAccessor object ! * ! * @param attribute Description of the Parameter ! * @return The attribute value ! * @exception Exception Description of the Exception ! */ ! public Object getAttribute(String attribute) ! throws Exception; ! ! ! /** ! * Description of the Method ! * ! * @exception Exception Description of the Exception ! */ ! public void unregisterMBean() ! throws Exception; ! } --- 1,119 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! import javax.management.Attribute; ! import javax.management.AttributeList; ! import javax.management.MBeanInfo; ! import javax.management.ObjectInstance; ! import javax.management.ObjectName; ! ! /** ! * Tag interface to be implemented by object that provides access to MBean informations ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo JavaDoc to complete ! */ ! public interface MBeanAccessor extends MBeanInvokeAccessor ! { ! /** ! * Gets the objectInstance attribute of the MBeanAccessor object ! * ! * @return The objectInstance value ! * @exception Exception Description of the Exception ! */ ! public ObjectInstance getObjectInstance() ! throws Exception; ! ! ! /** ! * Gets the attributes attribute of the MBeanAccessor object ! * ! * @param as Description of the Parameter ! * @return The attributes value ! * @exception Exception Description of the Exception ! */ ! public AttributeList getAttributes(String as[]) ! throws Exception; ! ! ! /** ! * Sets the attributes attribute of the MBeanAccessor object ! * ! * @param attributelist The new attributes value ! * @return Description of the Return Value ! * @exception Exception Description of the Exception ! */ ! public AttributeList setAttributes(AttributeList attributelist) ! throws Exception; ! ! ! /** ! * Gets the mBeanInfo attribute of the MBeanAccessor object ! * ! * @return The mBeanInfo value ! */ ! public MBeanInfo getMBeanInfo(); ! ! ! /** ! * Gets the instanceOf attribute of the MBeanAccessor object ! * ! * @param s Description of the Parameter ! * @return The instanceOf value ! * @exception Exception Description of the Exception ! */ ! public boolean isInstanceOf(String s) ! throws Exception; ! ! ! /** ! * Sets the attribute attribute of the MBeanAccessor object ! * ! * @param attribute The new attribute value ! * @exception Exception Description of the Exception ! */ ! public void setAttribute(Attribute attribute) ! throws Exception; ! ! ! /** ! * Gets the objectName attribute of the MBeanAccessor object ! * ! * @return The objectName value ! */ ! public ObjectName getObjectName(); ! ! ! /** ! * Gets the canonicalName attribute of the MBeanAccessor object ! * ! * @return The canonicalName value ! */ ! public String getCanonicalName(); ! ! ! /** ! * Gets the attribute attribute of the MBeanAccessor object ! * ! * @param attribute Description of the Parameter ! * @return The attribute value ! * @exception Exception Description of the Exception ! */ ! public Object getAttribute(String attribute) ! throws Exception; ! ! ! /** ! * Description of the Method ! * ! * @exception Exception Description of the Exception ! */ ! public void unregisterMBean() ! throws Exception; ! } Index: MBeanInvokeAccessor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanInvokeAccessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MBeanInvokeAccessor.java 15 Sep 2003 22:23:45 -0000 1.2 --- MBeanInvokeAccessor.java 13 Dec 2003 21:27:49 -0000 1.3 *************** *** 1,30 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! ! /** ! * Tag interface to be implemented by object that provides access to MBean invoke method ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo JavaDoc to complete ! */ ! public interface MBeanInvokeAccessor ! { ! /** ! * Description of the Method ! * ! * @param action Description of the Parameter ! * @param params Description of the Parameter ! * @param signatures Description of the Parameter ! * @return Description of the Return Value ! * @exception Exception Description of the Exception ! */ ! public Object invoke(String action, Object[] params, String[] signatures) ! throws Exception; ! } --- 1,30 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! ! /** ! * Tag interface to be implemented by object that provides access to MBean invoke method ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! * @todo JavaDoc to complete ! */ ! public interface MBeanInvokeAccessor ! { ! /** ! * Description of the Method ! * ! * @param action Description of the Parameter ! * @param params Description of the Parameter ! * @param signatures Description of the Parameter ! * @return Description of the Return Value ! * @exception Exception Description of the Exception ! */ ! public Object invoke(String action, Object[] params, String[] signatures) ! throws Exception; ! } Index: MBeanServerProxy.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/MBeanServerProxy.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MBeanServerProxy.java 15 Sep 2003 22:23:45 -0000 1.7 --- MBeanServerProxy.java 13 Dec 2003 21:27:49 -0000 1.8 *************** *** 1,99 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! ! import javax.management.MBeanServer; ! ! /** ! * A proxy for object that provides MBeanServer fonctionnality ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class MBeanServerProxy implements InvocationHandler ! { ! /** The class to search the method on */ ! protected Class clazz = null; ! /** The real object */ ! protected Object object = null; ! /** Interface implemented by the proxy */ ! private final static Class[] INTERFACES = new Class[]{MBeanServer.class}; ! ! ! /** ! * Constructor for MBeanServerProxy. ! * ! * @param object Real object to proxy ! * @param clazz Class of the proxied object ! */ ! public MBeanServerProxy(Object object, Class clazz) ! { ! this.object = object; ! this.clazz = clazz; ! } ! ! ! /** ! * Invocation method. Delegates the method call to the real object. ! * ! * @param method Method called ! * @param args Method arguments ! * @param obj The method on which the invocation was made ! * @return The return value of the method ! * @exception Throwable In case of Exception ! */ ! public Object invoke(Object obj, Method method, Object[] args) ! throws Throwable ! { ! Method m = this.clazz.getMethod(method.getName(), method.getParameterTypes()); ! if (m != null) ! { ! ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); ! ! try ! { ! Thread.currentThread().setContextClassLoader(this.clazz.getClassLoader()); ! return m.invoke(this.object, args); ! } ! finally ! { ! Thread.currentThread().setContextClassLoader(ctxLoader); ! } ! } ! return null; ! } ! ! ! /** ! * Factory method to create a proxy ! * ! * @param object Real object to proxy ! * @return The proxy created ! */ ! public static MBeanServer createMBeanProxy(Object object) ! { ! return MBeanServerProxy.createMBeanProxy(object, object.getClass()); ! } ! ! ! /** ! * Factory method to create a proxy ! * ! * @param object Real object to proxy ! * @param clazz Class of the proxied object ! * @return The proxy created ! */ ! public static MBeanServer createMBeanProxy(Object object, Class clazz) ! { ! MBeanServerProxy proxy = new MBeanServerProxy(object, clazz); ! return (MBeanServer) Proxy.newProxyInstance(MBeanServerProxy.class.getClassLoader(), MBeanServerProxy.INTERFACES, proxy); ! } ! } --- 1,99 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! import java.lang.reflect.InvocationHandler; ! import java.lang.reflect.Method; ! import java.lang.reflect.Proxy; ! ! import javax.management.MBeanServer; ! ! /** ! * A proxy for object that provides MBeanServer fonctionnality ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class MBeanServerProxy implements InvocationHandler ! { ! /** The class to search the method on */ ! protected Class clazz = null; ! /** The real object */ ! protected Object object = null; ! /** Interface implemented by the proxy */ ! private final static Class[] INTERFACES = new Class[]{MBeanServer.class}; ! ! ! /** ! * Constructor for MBeanServerProxy. ! * ! * @param object Real object to proxy ! * @param clazz Class of the proxied object ! */ ! public MBeanServerProxy(Object object, Class clazz) ! { ! this.object = object; ! this.clazz = clazz; ! } ! ! ! /** ! * Invocation method. Delegates the method call to the real object. ! * ! * @param method Method called ! * @param args Method arguments ! * @param obj The method on which the invocation was made ! * @return The return value of the method ! * @exception Throwable In case of Exception ! */ ! public Object invoke(Object obj, Method method, Object[] args) ! throws Throwable ! { ! Method m = this.clazz.getMethod(method.getName(), method.getParameterTypes()); ! if (m != null) ! { ! ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader(); ! ! try ! { ! Thread.currentThread().setContextClassLoader(this.clazz.getClassLoader()); ! return m.invoke(this.object, args); ! } ! finally ! { ! Thread.currentThread().setContextClassLoader(ctxLoader); ! } ! } ! return null; ! } ! ! ! /** ! * Factory method to create a proxy ! * ! * @param object Real object to proxy ! * @return The proxy created ! */ ! public static MBeanServer createMBeanProxy(Object object) ! { ! return MBeanServerProxy.createMBeanProxy(object, object.getClass()); ! } ! ! ! /** ! * Factory method to create a proxy ! * ! * @param object Real object to proxy ! * @param clazz Class of the proxied object ! * @return The proxy created ! */ ! public static MBeanServer createMBeanProxy(Object object, Class clazz) ! { ! MBeanServerProxy proxy = new MBeanServerProxy(object, clazz); ! return (MBeanServer) Proxy.newProxyInstance(MBeanServerProxy.class.getClassLoader(), MBeanServerProxy.INTERFACES, proxy); ! } ! } Index: ObjectNameFinder.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/jmx/ObjectNameFinder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectNameFinder.java 15 Sep 2003 22:23:45 -0000 1.6 --- ObjectNameFinder.java 13 Dec 2003 21:27:49 -0000 1.7 *************** *** 1,24 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! ! /** ! * Interface implemented by structure that allows ObjectName search by canonical string. ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface ObjectNameFinder ! { ! /** ! * Search an ObjectName by its canonical string ! * ! * @param objectName Canonical value of the ObjectName to search ! */ ! public void findObjectName(String objectName); ! } --- 1,24 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.jmx; ! ! ! /** ! * Interface implemented by structure that allows ObjectName search by canonical string. ! * ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface ObjectNameFinder ! { ! /** ! * Search an ObjectName by its canonical string ! * ! * @param objectName Canonical value of the ObjectName to search ! */ ! public void findObjectName(String objectName); ! } |