commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules MbeansSource.java
Date Mon, 17 Feb 2003 01:01:35 GMT
costin      2003/02/16 17:01:35

  Modified:    modeler/src/java/org/apache/commons/modeler/modules
                        MbeansSource.java
  Log:
  Add the current loader to the JMX loader list ( the trick is to add an mlet mbean )
  
  Revision  Changes    Path
  1.5       +11 -0     jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java
  
  Index: MbeansSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MbeansSource.java	21 Jan 2003 00:33:45 -0000	1.4
  +++ MbeansSource.java	17 Feb 2003 01:01:35 -0000	1.5
  @@ -8,7 +8,9 @@
   import org.apache.commons.logging.LogFactory;
   
   import javax.management.*;
  +import javax.management.loading.MLet;
   import java.io.InputStream;
  +import java.net.URL;
   
   
   /** This will create mbeans based on a config file.
  @@ -22,6 +24,7 @@
       String location;
       String type;
       Object source;
  +    static boolean loaderLoaded=false;
   
       public void setRegistry(Registry reg) {
           this.registry=reg;
  @@ -80,6 +83,14 @@
   
               MBeanServer server=(MBeanServer)Registry.getServer();
   
  +            if( ! loaderLoaded ) {
  +                // Register a loader that will be find ant classes.
  +                ObjectName defaultLoader= new ObjectName("modeler",
  +                        "loader", "modeler");
  +                MLet mlet=new MLet( new URL[0], this.getClass().getClassLoader());
  +                server.registerMBean(mlet, defaultLoader);
  +                loaderLoaded=true;
  +            }
               // We'll process all nodes at the same level.
               for (Node mbeanN = firstMbeanN; mbeanN != null;
                    mbeanN= DomUtil.getNext(mbeanN, null, Node.ELEMENT_NODE))
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message