Thread: [Ejtools-cvs] CVS: applications/management/src/main/net/sourceforge/ejtools/management/model Connect
Brought to you by:
letiemble
From: Laurent E. <let...@us...> - 2002-04-22 17:38:45
|
Update of /cvsroot/ejtools/applications/management/src/main/net/sourceforge/ejtools/management/model In directory usw-pr-cvs1:/tmp/cvs-serv28897/management/src/main/net/sourceforge/ejtools/management/model Added Files: ConnectionService.java ConnectionServiceProvider.java Log Message: Initial Import --- NEW FILE: ConnectionService.java --- package net.sourceforge.ejtools.management.model; import java.util.Set; import javax.management.Attribute; import javax.management.MBeanInfo; import javax.management.ObjectName; import javax.management.QueryExp; import javax.management.j2ee.Management; import javax.management.j2ee.ManagementHome; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; /** * Description of the Class * * @author letiembl * @created 13 décembre 2001 */ public class ConnectionService { /** 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 transient Management remote = null; /** Description of the Field */ protected String url = null; /** Constructor */ protected ConnectionService() { } /** * Gets the attribute attribute of the ConnectionService object * * @param name Description of the Parameter * @param attribute Description of the Parameter * @return The attribute value * @exception Exception Description of the Exception */ public Object getAttribute(ObjectName name, String attribute) throws Exception { return getEJB().getAttribute(name, attribute); } /** * Getter for the defaultDomain attribute * * @return The value * @exception Exception Description of Exception */ public String getDefaultDomain() throws Exception { return getEJB().getDefaultDomain(); } /** * Getter for the mBeanCount attribute * * @return The value * @exception Exception Description of Exception */ public Integer getMBeanCount() throws Exception { return getEJB().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 getEJB().getMBeanInfo(name); } /** * Description of the Method * * @param name Description of the Parameter * @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(ObjectName name, String action, Object[] params, String[] signatures) throws Exception { return getEJB().invoke(name, action, params, signatures); } /** * Description of the Method * * @param name Description of Parameter * @param query Description of the Parameter * @return Description of the Returned Value * @exception Exception Description of Exception */ public Set queryNames(ObjectName name, QueryExp query) throws Exception { return getEJB().queryNames(name, query); } /** * Sets the attribute attribute of the ConnectionService object * * @param name The new attribute value * @param attribute The new attribute value * @exception Exception Description of the Exception */ public void setAttribute(ObjectName name, Attribute attribute) throws Exception { getEJB().setAttribute(name, attribute); } // public Set queryNames(ObjectName name) throws Exception // { // return (getEJB().queryNames(name)); // } /** * Setter for the eJBName attribute * * @param ejbName The new value */ public void setEJBName(String ejbName) { this.ejbName = ejbName; remote = null; } /** * Setter for the factory attribute * * @param factory The new value */ public void setFactory(String factory) { this.factory = factory; remote = null; } /** * Setter for the packages attribute * * @param pkgs The new value */ public void setPackages(String pkgs) { this.pkgs = pkgs; remote = null; } /** * Setter for the url attribute * * @param url The new value */ public void setURL(String url) { this.url = url; remote = null; } /** * Description of the Method * * @return Description of the Returned Value * @exception Exception Description of Exception */ protected Management getEJB() throws Exception { if (remote == null) { remote = getHome().create(); } return remote; } /** * Description of the Method * * @return Description of the Returned Value * @exception Exception Description of Exception */ protected ManagementHome getHome() throws Exception { InitialContext context = new InitialContext(); Object ref = context.lookup(this.ejbName); ManagementHome home = (ManagementHome) PortableRemoteObject.narrow(ref, ManagementHome.class); return home; } } --- NEW FILE: ConnectionServiceProvider.java --- package net.sourceforge.ejtools.management.model; import java.beans.beancontext.BeanContextServiceProvider; import java.beans.beancontext.BeanContextServices; import java.beans.beancontext.BeanContextServicesSupport; import java.util.Iterator; import java.util.Vector; /** * Description of the Class * * @author letiembl * @created 13 décembre 2001 */ public class ConnectionServiceProvider extends BeanContextServicesSupport implements BeanContextServiceProvider { /** Description of the Field */ protected ConnectionService service = null; /** * Getter for the currentServiceSelectors attribute * * @param bcs Description of Parameter * @param serviceClass Description of Parameter * @return The value */ public Iterator getCurrentServiceSelectors(BeanContextServices bcs, java.lang.Class serviceClass) { return (new Vector()).iterator(); } /** * Getter for the service attribute * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param serviceClass Description of Parameter * @param serviceSelector Description of Parameter * @return The value */ public Object getService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) { if (service == null) { service = new ConnectionService(); } return service; } /** * Description of the Method * * @param bcs Description of Parameter * @param requestor Description of Parameter * @param service Description of Parameter */ public void releaseService(BeanContextServices bcs, java.lang.Object requestor, java.lang.Object service) { } /** Description of the Method */ protected void initializeBeanContextResources() { ((BeanContextServices) getBeanContext()).addService(ConnectionService.class, this); } } |