tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanFactory.java
Date Wed, 06 Feb 2002 22:03:54 GMT
amyroh      02/02/06 14:03:54

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanFactory.java
  Log:
  Hard code to look for object names in Registry instead of full mbean names.
  
  Revision  Changes    Path
  1.5       +85 -35    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java
  
  Index: MBeanFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MBeanFactory.java	29 Jan 2002 23:10:49 -0000	1.4
  +++ MBeanFactory.java	6 Feb 2002 22:03:54 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
1.4 2002/01/29 23:10:49 amyroh Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/01/29 23:10:49 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanFactory.java,v
1.5 2002/02/06 22:03:54 amyroh Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/02/06 22:03:54 $
    *
    * ====================================================================
    *
  @@ -102,7 +102,7 @@
    * <code>org.apache.catalina.core.StandardServer</code> component.</p>
    *
    * @author Amy Roh
  - * @version $Revision: 1.4 $ $Date: 2002/01/29 23:10:49 $
  + * @version $Revision: 1.5 $ $Date: 2002/02/06 22:03:54 $
    */
   
   public class MBeanFactory extends BaseModelMBean {
  @@ -145,6 +145,25 @@
   
       // ------------------------------------------------------------- Operations
   
  +    /**
  +     * Return the managed bean definition for the specified bean type
  +     *
  +     * @param type MBean type
  +     */
  +    public String findObjectName(String type) {
  +
  +        if (type.equals("org.apache.catalina.core.StandardContext")) {
  +            return "StandardContext";
  +        } else if (type.equals("org.apache.catalina.core.StandardDefaultContext")) {
  +            return "DefaultContext";
  +        } else if (type.equals("org.apache.catalina.core.StandardEngine")) {
  +            return "StandardEngine";
  +        } else if (type.equals("org.apache.catalina.core.StandardHost")) {
  +            return "StandardHost";
  +        } else return null;
  +
  +    }
  +
   
       /**
        * Create a new AccessLoggerValve.
  @@ -156,13 +175,15 @@
       public String createAccessLoggerValve(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -189,7 +210,8 @@
       public String createDefaultContext(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardHost";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -222,13 +244,15 @@
       public String createFileLogger(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -257,7 +281,8 @@
       public String createHttp10Connector(String parent, String address, int port)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardService";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -295,7 +320,8 @@
       public String createHttp11Connector(String parent, String address, int port)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardService";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -331,13 +357,15 @@
       public String createJDBCRealm(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -364,13 +392,15 @@
       public String createJNDIRealm(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -397,13 +427,15 @@
       public String createMemoryRealm(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -430,13 +462,15 @@
       public String createRemoteAddrValve(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -463,13 +497,15 @@
       public String createRemoteHostValve(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -496,13 +532,15 @@
       public String createRequestDumperValve(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -529,13 +567,15 @@
       public String createSingleSignOn(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -563,7 +603,8 @@
       public String createStandardContext(String parent, String path)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardHost";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -598,7 +639,8 @@
       public String createStandardEngine(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardService";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -632,7 +674,8 @@
       public String createStandardHost(String parent, String name)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardEngine";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -666,13 +709,15 @@
       public String createStandardManager(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -701,7 +746,8 @@
       public String createStandardService(String parent, String name)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        String tname = "StandardServer";
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
  @@ -736,13 +782,15 @@
       public String createSystemErrLogger(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  @@ -769,13 +817,15 @@
       public String createSystemOutLogger(String parent)
           throws Exception {
   
  -        ManagedBean managed = registry.findManagedBean(parent);
  +        ObjectName pname = new ObjectName(parent);
  +        String type = pname.getKeyProperty("type");
  +        String tname = findObjectName(type);
  +        ManagedBean managed = registry.findManagedBean(tname);
           String domain = null;
           if (managed != null)
               domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  -        ObjectName pname = new ObjectName(parent);
           Object obj = mserver.getAttribute(pname, "managedResource");
           Container container = null;
           if (obj instanceof Container) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message