Thread: [Ejtools-cvs] CVS: applications/jmx.browser/src/main/net/sourceforge/ejtools/jmxbrowser/model LocalC
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-04-22 18:03:05
|
Update of /cvsroot/ejtools/applications/jmx.browser/src/main/net/sourceforge/ejtools/jmxbrowser/model In directory usw-pr-cvs1:/tmp/cvs-serv29529/jmx.browser/src/main/net/sourceforge/ejtools/jmxbrowser/model Added Files: LocalConnectionService.java Log Message: Initial Import --- NEW FILE: LocalConnectionService.java --- package net.sourceforge.ejtools.jmxbrowser.model; import java.util.ArrayList; import java.util.Set; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.Attribute; import javax.management.MBeanInfo; import javax.management.ObjectName; import javax.management.QueryExp; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import org.jboss.jmx.adaptor.rmi.RMIAdaptor; /** * Description of the Class * * @author letiembl * @created 13 décembre 2001 */ public class LocalConnectionService implements ConnectionService { /** Description of the Field */ protected transient MBeanServer connector = null; /** Description of the Field */ protected String ejbName = null; /** Description of the Field */ protected String factory = null; /** Description of the Field */ protected String pkgs = null; /** Description of the Field */ protected String url = null; /** Constructor */ protected LocalConnectionService() { } /** * Getter for the attribute attribute * * @param name Description of Parameter * @param attribute Description of Parameter * @return The value * @exception Exception Description of Exception */ public Object getAttribute(ObjectName name, String attribute) throws Exception { return getConnector().getAttribute(name, attribute); } /** * Getter for the defaultDomain attribute * * @return The value * @exception Exception Description of Exception */ public String getDefaultDomain() throws Exception { return getConnector().getDefaultDomain(); } /** * Getter for the mBeanCount attribute * * @return The value * @exception Exception Description of Exception */ public Integer getMBeanCount() throws Exception { return getConnector().getMBeanCount(); } /** * Getter for the mBeanInfo attribute * * @param name Description of Parameter * @return The value * @exception Exception Description of Exception */ public MBeanInfo getMBeanInfo(ObjectName name) throws Exception { return getConnector().getMBeanInfo(name); } /** * Description of the Method * * @param name Description of Parameter * @param action Description of Parameter * @param params Description of Parameter * @param signatures Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public Object invoke(ObjectName name, String action, Object[] params, String[] signatures) throws Exception { return getConnector().invoke(name, action, params, signatures); } /** * Description of the Method * * @param name Description of Parameter * @param exp Description of Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public Set queryMBeans(ObjectName name, QueryExp exp) throws Exception { return getConnector().queryMBeans(name, exp); } /** * Setter for the attribute attribute * * @param name The new value * @param attribute The new value * @exception Exception Description of Exception */ public void setAttribute(ObjectName name, Attribute attribute) throws Exception { getConnector().setAttribute(name, attribute); } /** * Setter for the eJBName attribute * * @param ejbName The new value */ public void setEJBName(String ejbName) { this.ejbName = ejbName; connector = null; } /** * Setter for the factory attribute * * @param factory The new value */ public void setFactory(String factory) { this.factory = factory; connector = null; } /** * Setter for the packages attribute * * @param pkgs The new value */ public void setPackages(String pkgs) { this.pkgs = pkgs; connector = null; } /** * Setter for the url attribute * * @param url The new value */ public void setURL(String url) { this.url = url; connector = null; } /** * Description of the Method * * @return Description of the Returned Value * @exception Exception Description of Exception */ protected MBeanServer getConnector() throws Exception { if (connector == null) { ArrayList servers = MBeanServerFactory.findMBeanServer(null); if (servers == null) throw new Exception("No MBeanServer found."); connector = (MBeanServer)servers.get(0); } return connector; } } |