Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 1949 invoked from network); 23 Jan 2002 01:43:41 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 23 Jan 2002 01:43:41 -0000 Received: (qmail 20117 invoked by uid 97); 23 Jan 2002 01:43:10 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 20093 invoked by uid 97); 23 Jan 2002 01:43:09 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 20080 invoked by uid 97); 23 Jan 2002 01:43:09 -0000 Date: 22 Jan 2002 23:53:39 -0000 Message-ID: <20020122235339.64042.qmail@icarus.apache.org> From: amyroh@apache.org To: jakarta-tomcat-4.0-cvs@apache.org Subject: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans HttpConnectorMBean.java LoaderMBean.java LoggerMBean.java ManagerMBean.java RealmMBean.java StandardContextMBean.java StandardEngineMBean.java StandardHostMBean.java StandardServerMBean.java StandardServiceMBean.java ValveBaseMBean.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N amyroh 02/01/22 15:53:39 Modified: catalina/src/share/org/apache/catalina/mbeans HttpConnectorMBean.java LoaderMBean.java LoggerMBean.java ManagerMBean.java RealmMBean.java StandardContextMBean.java StandardEngineMBean.java StandardHostMBean.java StandardServerMBean.java StandardServiceMBean.java ValveBaseMBean.java Log: Add addXxxx, removeXxxx, and findXxxx operations for MBeans. Revision Changes Path 1.2 +4 -16 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/HttpConnectorMBean.java Index: HttpConnectorMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/HttpConnectorMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HttpConnectorMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ HttpConnectorMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/HttpConnectorMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/HttpConnectorMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -76,7 +76,7 @@ * org.apache.catalina.http.HttpConnector component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class HttpConnectorMBean extends BaseModelMBean { @@ -104,18 +104,6 @@ // ------------------------------------------------------------- Attributes - - /** - * Return the parent (Service) that owns this connector. - */ - public Service getParent() { - - if (this.resource == null) - return (null); - Connector connector = (Connector) this.resource; - return (connector.getService()); - - } // ------------------------------------------------------------- Operations 1.2 +4 -16 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoaderMBean.java Index: LoaderMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoaderMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LoaderMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ LoaderMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoaderMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoaderMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -76,7 +76,7 @@ * org.apache.catalina.Loader component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class LoaderMBean extends BaseModelMBean { @@ -104,18 +104,6 @@ // ------------------------------------------------------------- Attributes - - /** - * Return the parent (Container) that owns this Loader. - */ - public Container getParent() { - - if (this.resource == null) - return (null); - Loader loader = (Loader) this.resource; - return (loader.getContainer()); - - } // ------------------------------------------------------------- Operations 1.2 +4 -16 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoggerMBean.java Index: LoggerMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoggerMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- LoggerMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ LoggerMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoggerMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/LoggerMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -76,7 +76,7 @@ * org.apache.catalina.Logger component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class LoggerMBean extends BaseModelMBean { @@ -104,18 +104,6 @@ // ------------------------------------------------------------- Attributes - - /** - * Return the parent (Container) that owns this logger. - */ - public Container getParent() { - - if (this.resource == null) - return (null); - Logger logger = (Logger) this.resource; - return (logger.getContainer()); - - } // ------------------------------------------------------------- Operations 1.2 +4 -16 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ManagerMBean.java Index: ManagerMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ManagerMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ManagerMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ ManagerMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ManagerMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/ManagerMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -76,7 +76,7 @@ * org.apache.catalina.Manager component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class ManagerMBean extends BaseModelMBean { @@ -104,18 +104,6 @@ // ------------------------------------------------------------- Attributes - - /** - * Return the parent (Container) that owns this Manager. - */ - public Container getParent() { - - if (this.resource == null) - return (null); - Manager manager = (Manager) this.resource; - return (manager.getContainer()); - - } // ------------------------------------------------------------- Operations 1.2 +4 -17 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/RealmMBean.java Index: RealmMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/RealmMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RealmMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ RealmMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/RealmMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/RealmMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -76,7 +76,7 @@ * org.apache.catalina.Realm component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class RealmMBean extends BaseModelMBean { @@ -103,19 +103,6 @@ // ------------------------------------------------------------- Attributes - - - /** - * Return the parent (Container) that owns this Realm. - */ - public Container getParent() { - - if (this.resource == null) - return (null); - Realm realm = (Realm) this.resource; - return (realm.getContainer()); - - } // ------------------------------------------------------------- Operations 1.2 +125 -13 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java Index: StandardContextMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StandardContextMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ StandardContextMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardContextMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -66,8 +66,12 @@ import javax.management.MBeanException; import javax.management.RuntimeOperationsException; -import org.apache.catalina.Context; -import org.apache.catalina.Host; +import org.apache.catalina.Loader; +import org.apache.catalina.Logger; +import org.apache.catalina.Manager; +import org.apache.catalina.Realm; +import org.apache.catalina.Valve; +import org.apache.catalina.core.StandardContext; import org.apache.commons.modeler.BaseModelMBean; @@ -76,7 +80,7 @@ * org.apache.catalina.core.StandardContext component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class StandardContextMBean extends BaseModelMBean { @@ -105,20 +109,128 @@ // ------------------------------------------------------------- Attributes + + // ------------------------------------------------------------- Operations + + /** - * Return the parent (Host) that owns this Context. + * Add a new Valve to those assoicated with this Context + * + * @param valve MBean Name of the Valve to be added + * + * @exception Exception if an MBean cannot be created or registered */ - public Host getParent() { + public void addValve(String valve) + throws Exception { - if (this.resource == null) - return (null); - Context context = (Context) this.resource; - return ((Host) context.getParent()); + StandardContext context = (StandardContext) this.resource; + // look up valve's MBean in MBeanServer + BaseModelMBean valveMBean = null; + //Valve valveObj = valveMBean.getManagedResource(); + Valve valveObj = null; + context.addValve(valveObj); } - // ------------------------------------------------------------- Operations + /** + * Remove the specified Valve from those associated this Context + * + * @param valve MBean Name of the Valve to be removed + * + * @exception Exception if an MBean cannot be created or registered + */ + public void removeValve(String valve) + throws Exception { + + StandardContext context = (StandardContext) this.resource; + // look up valve's MBean in MBeanServer + BaseModelMBean valveMBean = null; + //Valve valveObj = valveMBean.getManagedResource(); + Valve valveObj = null; + context.removeValve(valveObj); + + } + + + /** + * Associate the specified Loader with this Context + * + * @param loader MBean Name of the Loader with this Context + * + * @exception Exception if an MBean cannot be created or registered + */ + public void setLoader(String loader) + throws Exception { + + StandardContext context = (StandardContext) this.resource; + // look up loader's MBean in MBeanServer + BaseModelMBean loaderMBean = null; + //Loader loaderObj = loaderMBean.getManagedResource(); + Loader loaderObj = null; + context.setLoader(loaderObj); + + } + + + /** + * Associate the specified Logger with this Context + * + * @param logger MBean Name of the Logger with this Context + * + * @exception Exception if an MBean cannot be created or registered + */ + public void setLogger(String logger) + throws Exception { + + StandardContext context = (StandardContext) this.resource; + // look up logger's MBean in MBeanServer + BaseModelMBean loggerMBean = null; + //logger loggerObj = loggerMBean.getManagedResource(); + Logger loggerObj = null; + context.setLogger(loggerObj); + + } + + + /** + * Associate the specified Manager with this Context + * + * @param manager MBean Name of the Manager with this Context + * + * @exception Exception if an MBean cannot be created or registered + */ + public void setManager(String manager) + throws Exception { + + StandardContext context = (StandardContext) this.resource; + // look up manager's MBean in MBeanServer + BaseModelMBean managerMBean = null; + // Manager managerObj = managerMBean.getManagedResource(); + Manager managerObj = null; + context.setManager(managerObj); + + } + + + /** + * Associate the specified Realm with this Context + * + * @param realm MBean Name of the Realm with this Context + * + * @exception Exception if an MBean cannot be created or registered + */ + public void setRealm(String realm) + throws Exception { + + StandardContext context = (StandardContext) this.resource; + // look up realm's MBean in MBeanServer + BaseModelMBean realmMBean = null; + // Realm realmObj = realmMBean.getManagedResource(); + Realm realmObj = null; + context.setRealm(realmObj); + + } } 1.5 +57 -105 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java Index: StandardEngineMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StandardEngineMBean.java 14 Jan 2002 20:10:00 -0000 1.4 +++ StandardEngineMBean.java 22 Jan 2002 23:53:39 -0000 1.5 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v 1.4 2002/01/14 20:10:00 amyroh Exp $ - * $Revision: 1.4 $ - * $Date: 2002/01/14 20:10:00 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardEngineMBean.java,v 1.5 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.5 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -75,17 +75,6 @@ import org.apache.catalina.Valve; import org.apache.catalina.core.StandardHost; import org.apache.catalina.core.StandardEngine; -import org.apache.catalina.logger.FileLogger; -import org.apache.catalina.logger.SystemErrLogger; -import org.apache.catalina.logger.SystemOutLogger; -import org.apache.catalina.realm.JDBCRealm; -import org.apache.catalina.realm.JNDIRealm; -import org.apache.catalina.realm.MemoryRealm; -import org.apache.catalina.valves.AccessLogValve; -import org.apache.catalina.valves.RemoteAddrValve; -import org.apache.catalina.valves.RemoteHostValve; -import org.apache.catalina.valves.RequestDumperValve; -import org.apache.catalina.valves.ValveBase; import org.apache.commons.modeler.BaseModelMBean; @@ -94,7 +83,7 @@ * org.apache.catalina.core.StandardEngine component.

* * @author Craig R. McClanahan - * @version $Revision: 1.4 $ $Date: 2002/01/14 20:10:00 $ + * @version $Revision: 1.5 $ $Date: 2002/01/22 23:53:39 $ */ public class StandardEngineMBean extends BaseModelMBean { @@ -123,163 +112,126 @@ // ------------------------------------------------------------- Attributes - /** - * Return the parent (Service) that owns this Engine. - */ - public Service getParent() { - - if (this.resource == null) - return (null); - Engine engine = (Engine) this.resource; - return (engine.getService()); - - } - // ------------------------------------------------------------- Operations /** - * Create a new AccessLogger. + * Add a new Host to those assoicated with this Engine + * + * @param host MBean Name of the new Host to be added * * @exception Exception if an MBean cannot be created or registered */ - public void createAccessLogger() + public void addHost(String host) throws Exception { - AccessLogValve accessLogger = new AccessLogValve(); - StandardEngine engine = (StandardEngine) this.resource; - accessLogger.setContainer(engine); - engine.addValve(accessLogger); - MBeanUtils.createMBean(accessLogger); + // look up host's MBean in MBeanServer + BaseModelMBean hostMBean = null; + //Host hostObj = hostMBean.getManagedResource(); + Host hostObj = null; + engine.addChild(hostObj); } /** - * Delete AccessLogger. + * Remove the specified Host from those associated with this Engine * - * @exception Exception if an MBean cannot be deleted or deregistered + * @param host MBean Name of the specified Host to be removed + * + * @exception Exception if an MBean cannot be created or registered */ - public void deleteAccessLogger(String pattern) + public void removeHost(String host) throws Exception { StandardEngine engine = (StandardEngine) this.resource; - Valve [] valves = engine.getValves(); - for (int i=0; iHost. + * Add a new Valve to those assoicated with this Engine * - * @param name The new Host's name + * @param valve MBean Name of the new Valve to be added * * @exception Exception if an MBean cannot be created or registered */ - public void createHost(String name) + public void addValve(String valve) throws Exception { - StandardHost host = new StandardHost(); - - host.setName(name); - Engine engine = (Engine) this.resource; - engine.addChild(host); - MBeanUtils.createMBean(host); + StandardEngine engine = (StandardEngine) this.resource; + // look up valve's MBean in MBeanServer + BaseModelMBean valveMBean = null; + //Valve valveObj = valveMBean.getManagedResource(); + Valve valveObj = null; + engine.addValve(valveObj); } /** - * Create a new Logger. + * Remove the specified Valve from those assoicated with this Engine * - * @param type the type of Logger to be created -- FIX ME + * @param valve MBean Name of the Valve to be removed * * @exception Exception if an MBean cannot be created or registered */ - public void createLogger(String type) + public void removeValve(String valve) throws Exception { - Logger logger = null; - - if (type.equals("FileLogger")) { - logger = new FileLogger(); - } else if (type.equals("SystemErrLogger")) { - logger = new SystemErrLogger(); - } else if (type.equals("SystemOutLogger")) { - logger = new SystemOutLogger(); - } - StandardEngine engine = (StandardEngine) this.resource; - logger.setContainer((Container) engine); - engine.setLogger(logger); - MBeanUtils.createMBean(logger); + // look up valve's MBean in MBeanServer + BaseModelMBean valveMBean = null; + //Valve valveObj = valveMBean.getManagedResource(); + Valve valveObj = null; + engine.removeValve(valveObj); } /** - * Create a new Realm. + * Associate the specified Logger with this Engine * - * @param type the type of Realm to be created -- FIX ME + * @param logger MBean Name of the Logger with this Engine * * @exception Exception if an MBean cannot be created or registered */ - public void createRealm(String type) + public void setLogger(String logger) throws Exception { - Realm realm = null; - - if (type.equals("JDBCRealm")) { - realm = new JDBCRealm(); - } else if (type.equals("JNDIRealm")) { - realm = new JNDIRealm(); - } else if (type.equals("MemoryRealm")) { - realm = new MemoryRealm(); - } - StandardEngine engine = (StandardEngine) this.resource; - realm.setContainer((Container) engine); - engine.setRealm(realm); - MBeanUtils.createMBean(realm); - + // look up logger's MBean in MBeanServer + BaseModelMBean loggerMBean = null; + //logger loggerObj = loggerMBean.getManagedResource(); + Logger loggerObj = null; + engine.setLogger(loggerObj); + } /** - * Create a new RequestFilterValve. + * Associate the specified Realm with this Engine * - * @param type the type of valve to be created -- FIX ME need to pass type + * @param realm MBean Name of the Realm with this Engine * * @exception Exception if an MBean cannot be created or registered */ - public void createRequestFilterValve(String type) //type needed? + public void setRealm(String realm) throws Exception { - Valve valve = null; - - if (type.equals("RemoteAddrValve")) { - valve = new RemoteAddrValve(); - } else if (type.equals("RemostHostValve")) { - valve = new RemoteHostValve(); - } else if (type.equals("RequestDumperValve")) { - valve = new RequestDumperValve(); - } - StandardEngine engine = (StandardEngine) this.resource; - ((ValveBase)valve).setContainer((Container) engine); - engine.addValve(valve); - MBeanUtils.createMBean(valve); + // look up realm's MBean in MBeanServer + BaseModelMBean realmMBean = null; + // Realm realmObj = realmMBean.getManagedResource(); + Realm realmObj = null; + engine.setRealm(realmObj); } 1.2 +205 -11 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java Index: StandardHostMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StandardHostMBean.java 7 Nov 2001 01:36:36 -0000 1.1 +++ StandardHostMBean.java 22 Jan 2002 23:53:39 -0000 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v 1.1 2001/11/07 01:36:36 amyroh Exp $ - * $Revision: 1.1 $ - * $Date: 2001/11/07 01:36:36 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardHostMBean.java,v 1.2 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.2 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -65,10 +65,18 @@ import javax.management.MBeanException; +import javax.management.MBeanServer; import javax.management.RuntimeOperationsException; import org.apache.catalina.Engine; import org.apache.catalina.Host; +import org.apache.catalina.Logger; +import org.apache.catalina.Realm; +import org.apache.catalina.Valve; +import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.StandardHost; import org.apache.commons.modeler.BaseModelMBean; +import org.apache.commons.modeler.Registry; +import org.apache.commons.modeler.ManagedBean; /** @@ -76,7 +84,7 @@ * org.apache.catalina.core.StandardHost component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class StandardHostMBean extends BaseModelMBean { @@ -105,20 +113,206 @@ // ------------------------------------------------------------- Attributes + + // ------------------------------------------------------------- Operations + + + /** + * Add an alias name that should be mapped to this Host + * + * @param alias The alias to be added + * + * @exception Exception if an MBean cannot be created or registered + */ + public void addAlias(String alias) + throws Exception { + + StandardHost host = (StandardHost) this.resource; + host.addAlias(alias); + + } + + + /** + * Add a new Context to those assoicated with this Host + * + * @param context MBean Name of the Context to be added + * + * @exception Exception if an MBean cannot be created or registered + */ + public void addContext(String context) + throws Exception { + + StandardHost host = (StandardHost) this.resource; + // look up context's MBean in MBeanServer + StandardContextMBean contextMBean = null; + //StandardContext contextObj = contextMBean.getManagedResource(); + StandardContext contextObj = null; + host.addChild(contextObj); + + } + + /** - * Return the parent (Engine) that owns this Host. + * Add a new Valve to those assoicated with this Host + * + * @param valve MBean Name of the Valve to be added + * + * @exception Exception if an MBean cannot be created or registered */ - public Engine getParent() { + public void addValve(String valve) + throws Exception { - if (this.resource == null) - return (null); - Host host = (Host) this.resource; - return ((Engine) host.getParent()); + StandardHost host = (StandardHost) this.resource; + // look up valve's MBean in MBeanServer + BaseModelMBean valveMBean = null; + //Valve valveObj = valveMBean.getManagedResource(); + Valve valveObj = null; + host.addValve(valveObj); } - // ------------------------------------------------------------- Operations + /** + * Return the set of alias names for this Host + * + * @exception Exception if an MBean cannot be created or registered + */ + public String [] findAliases() + throws Exception { + + StandardHost host = (StandardHost) this.resource; + return host.findAliases(); + + } + + + /** + * Return the MBean Names of the Valves assoicated with this Host + * + * @exception Exception if an MBean cannot be created or registered + */ + public String [] getValves() + throws Exception { + + Registry registry = MBeanUtils.createRegistry(); + MBeanServer mserver = MBeanUtils.createServer(); + StandardHost host = (StandardHost) this.resource; + + String mname = MBeanUtils.createManagedName(host); + ManagedBean managed = registry.findManagedBean(mname); + String domain = null; + if (managed != null) { + domain = managed.getDomain(); + } + if (domain == null) + domain = mserver.getDefaultDomain(); + Valve [] valves = host.getValves(); + String [] mbeanNames = new String[valves.length]; + for (int i=0; iorg.apache.catalina.core.StandardServer
component.

* * @author Amy Roh - * @version $Revision: 1.3 $ $Date: 2001/11/14 03:51:06 $ + * @version $Revision: 1.4 $ $Date: 2002/01/22 23:53:39 $ */ public class StandardServerMBean extends BaseModelMBean { @@ -112,28 +110,44 @@ // ------------------------------------------------------------- Operations + /** - * Create a new child Service and Engine. + * Add a new Service assciate with this Server * - * @param name The new Service's name + * @param service MBean Name of the Service to be added * * @exception Exception if an MBean cannot be created or registered */ - public void createService(String name) + public void addService(String service) throws Exception { - StandardService service = new StandardService(); - - service.setName(name); Server server = (Server) this.resource; - server.addService(service); - MBeanUtils.createMBean(service); - - StandardEngine engine = new StandardEngine(); - service.setContainer(engine); - MBeanUtils.createMBean(engine); + // look up service's MBean in MBeanServer + StandardServiceMBean serviceMBean = null; + //Service serviceObj = serviceMBean.getManagedResource(); + Service serviceObj = null; + server.addService(serviceObj); } + /** + * Remove an existing child Service + * + * @param service MBean Name of the Service to be removed + * + * @exception Exception if an MBean cannot be created or registered + */ + public void removeService(String service) + throws Exception { + + Server server = (Server) this.resource; + // look up service's MBean in MBeanServer + StandardServiceMBean serviceMBean = null; + //Service service = serviceMBean.getManagedResource(); + Service serviceObj = null; + MBeanUtils.destroyMBean(serviceObj); + server.removeService(serviceObj); + + } } 1.6 +24 -43 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java Index: StandardServiceMBean.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StandardServiceMBean.java 14 Jan 2002 20:10:00 -0000 1.5 +++ StandardServiceMBean.java 22 Jan 2002 23:53:39 -0000 1.6 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v 1.5 2002/01/14 20:10:00 amyroh Exp $ - * $Revision: 1.5 $ - * $Date: 2002/01/14 20:10:00 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/StandardServiceMBean.java,v 1.6 2002/01/22 23:53:39 amyroh Exp $ + * $Revision: 1.6 $ + * $Date: 2002/01/22 23:53:39 $ * * ==================================================================== * @@ -67,9 +67,7 @@ import javax.management.MBeanException; import javax.management.RuntimeOperationsException; import org.apache.catalina.Connector; -import org.apache.catalina.Server; import org.apache.catalina.Service; -import org.apache.catalina.connector.http.HttpConnector; import org.apache.commons.modeler.BaseModelMBean; @@ -78,7 +76,7 @@ * org.apache.catalina.core.StandardService component.

* * @author Amy Roh - * @version $Revision: 1.5 $ $Date: 2002/01/14 20:10:00 $ + * @version $Revision: 1.6 $ $Date: 2002/01/22 23:53:39 $ */ public class StandardServiceMBean extends BaseModelMBean { @@ -107,65 +105,48 @@ // ------------------------------------------------------------- Attributes - /** - * Return the parent (Server) that owns this Service. - */ - public Server getParent() { - - if (this.resource == null) - return (null); - Service service = (Service) this.resource; - return (service.getServer()); - - } - // ------------------------------------------------------------- Operations /** - * Create a new Connector. + * Add a new Connector assciate with this Service * - * @param address The IP address on which to bind - * @param port TCP port number to listen on + * @param connector MBean Name of the Connector to be added * * @exception Exception if an MBean cannot be created or registered */ - public void createConnector(String address, int port) + public void addConnector(String connector) throws Exception { - HttpConnector connector = new HttpConnector(); - - connector.setAddress(address); - connector.setPort(port); Service service = (Service) this.resource; - service.addConnector(connector); - MBeanUtils.createMBean(connector); + // look up connector's MBean in MBeanServer + BaseModelMBean connectorMBean = null; + //Connector = connectorMBean.getManagedResource(); + Connector connectorObj = null; + service.addConnector(connectorObj); } /** - * Delete Connector. + * Remove an existing Connector associated with this Service + * + * @param connector MBean Name of the Connector to be removed * - * @exception Exception if an MBean cannot be deleted or deregistered + * @exception Exception if an MBean cannot be created or registered */ - public void deleteConnector(String address, int port) + public void removeConnector(String connector) throws Exception { Service service = (Service) this.resource; - Connector [] conns = service.findConnectors(); - for (int i=0; iorg.apache.catalina.valves.ValveBase component.

* * @author Amy Roh - * @version $Revision: 1.1 $ $Date: 2001/11/07 01:36:36 $ + * @version $Revision: 1.2 $ $Date: 2002/01/22 23:53:39 $ */ public class ValveBaseMBean extends BaseModelMBean { @@ -104,18 +104,6 @@ // ------------------------------------------------------------- Attributes - - /** - * Return the parent (Container) that owns this Valve. - */ - public Container getParent() { - - if (this.resource == null) - return (null); - ValveBase valve = (ValveBase) this.resource; - return ((Container) valve.getContainer()); - - } // ------------------------------------------------------------- Operations -- To unsubscribe, e-mail: For additional commands, e-mail: