tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1383945 - in /tomcat/trunk/java/org/apache/tomcat/util/modeler: Registry.java modules/MbeansDescriptorsDigesterSource.java modules/MbeansDescriptorsIntrospectionSource.java modules/MbeansDescriptorsSerSource.java modules/ModelerSource.java
Date Wed, 12 Sep 2012 14:00:43 GMT
Author: markt
Date: Wed Sep 12 14:00:42 2012
New Revision: 1383945

URL: http://svn.apache.org/viewvc?rev=1383945&view=rev
Log:
Partial revert of r1383935. Some of this code is required. A closer review is required.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
    tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java?rev=1383945&r1=1383944&r2=1383945&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java Wed Sep 12 14:00:42 2012
@@ -482,7 +482,7 @@ public class Registry implements Registr
             }
 
             // introspection
-            load("MbeansDescriptorsIntrospectionSource", beanClass);
+            load("MbeansDescriptorsIntrospectionSource", beanClass, type);
 
             managed=findManagedBean(type);
             if( managed==null ) {
@@ -535,20 +535,23 @@ public class Registry implements Registr
      *
      * @param sourceType
      * @param source
+     * @param param
      * @return List of descriptors
      * @throws Exception
      */
-    public List<ObjectName> load( String sourceType, Object source)
-            throws Exception {
+    public List<ObjectName> load( String sourceType, Object source,
+            String param) throws Exception {
         if( log.isTraceEnabled()) {
             log.trace("load " + source );
         }
         String location=null;
+        String type=null;
         Object inputsource=null;
 
         if( source instanceof URL ) {
             URL url=(URL)source;
             location=url.toString();
+            type=param;
             inputsource=url.openStream();
             if( sourceType == null ) {
                 sourceType = sourceTypeFromExt(location);
@@ -556,13 +559,16 @@ public class Registry implements Registr
         } else if( source instanceof File ) {
             location=((File)source).getAbsolutePath();
             inputsource=new FileInputStream((File)source);
+            type=param;
             if( sourceType == null ) {
                 sourceType = sourceTypeFromExt(location);
             }
         } else if( source instanceof InputStream ) {
+            type=param;
             inputsource=source;
         } else if( source instanceof Class<?> ) {
             location=((Class<?>)source).getName();
+            type=param;
             inputsource=source;
             if( sourceType== null ) {
                 sourceType="MbeansDescriptorsIntrospectionSource";
@@ -574,7 +580,7 @@ public class Registry implements Registr
         }
         ModelerSource ds=getModelerSource(sourceType);
         List<ObjectName> mbeans =
-            ds.loadDescriptors(this, inputsource);
+            ds.loadDescriptors(this, type, inputsource);
 
         return mbeans;
     }
@@ -659,7 +665,7 @@ public class Registry implements Registr
         log.debug( "Found " + dURL);
         searchedPaths.put( packageName,  dURL );
         try {
-            load("MbeansDescriptorsDigesterSource", dURL);
+            load("MbeansDescriptorsDigesterSource", dURL, null);
         } catch(Exception ex ) {
             log.error("Error loading " + dURL);
         }

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java?rev=1383945&r1=1383944&r2=1383945&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
Wed Sep 12 14:00:42 2012
@@ -38,6 +38,7 @@ public class MbeansDescriptorsDigesterSo
             LogFactory.getLog(MbeansDescriptorsDigesterSource.class);
 
     private Registry registry;
+    private String type;
     private final List<ObjectName> mbeans = new ArrayList<>();
     private static volatile Digester digester = null;
 
@@ -136,14 +137,23 @@ public class MbeansDescriptorsDigesterSo
     }
 
 
+    /** Used if a single component is loaded
+     *
+     * @param type
+     */
+    public void setType( String type ) {
+       this.type=type;
+    }
+
     public void setSource( Object source ) {
         this.source=source;
     }
 
     @Override
-    public List<ObjectName> loadDescriptors( Registry registry, Object source)
-            throws Exception {
+    public List<ObjectName> loadDescriptors( Registry registry, String type,
+            Object source) throws Exception {
         setRegistry(registry);
+        setType(type);
         setSource(source);
         execute();
         return mbeans;

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java?rev=1383945&r1=1383944&r2=1383945&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
Wed Sep 12 14:00:42 2012
@@ -61,9 +61,10 @@ public class MbeansDescriptorsIntrospect
     }
 
     @Override
-    public List<ObjectName> loadDescriptors(Registry registry, Object source)
-            throws Exception {
+    public List<ObjectName> loadDescriptors(Registry registry, String type,
+            Object source) throws Exception {
         setRegistry(registry);
+        setType(type);
         setSource(source);
         execute();
         return mbeans;

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java?rev=1383945&r1=1383944&r2=1383945&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
Wed Sep 12 14:00:42 2012
@@ -30,24 +30,34 @@ import org.apache.tomcat.util.modeler.Ma
 import org.apache.tomcat.util.modeler.Registry;
 
 
-public class MbeansDescriptorsSerSource extends ModelerSource {
-
+public class MbeansDescriptorsSerSource extends ModelerSource
+{
     private static final Log log = LogFactory.getLog(MbeansDescriptorsSerSource.class);
     private Registry registry;
+    private String type;
     private final List<ObjectName> mbeans=new ArrayList<>();
 
     public void setRegistry(Registry reg) {
         this.registry=reg;
     }
 
+    /** Used if a single component is loaded
+     *
+     * @param type
+     */
+    public void setType( String type ) {
+       this.type=type;
+    }
+
     public void setSource( Object source ) {
         this.source=source;
     }
 
     @Override
-    public List<ObjectName> loadDescriptors( Registry registry, Object source)
-            throws Exception {
+    public List<ObjectName> loadDescriptors( Registry registry, String type,
+            Object source) throws Exception {
         setRegistry(registry);
+        setType(type);
         setSource(source);
         execute();
         return mbeans;

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java?rev=1383945&r1=1383944&r2=1383945&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java Wed Sep 12
14:00:42 2012
@@ -32,9 +32,10 @@ public abstract class ModelerSource {
      * Load data, returns a list of items.
      *
      * @param registry
+     * @param type
      * @param source Introspected object or some other source
      * @throws Exception
      */
     public abstract List<ObjectName> loadDescriptors(Registry registry,
-            Object source) throws Exception;
+            String type, Object source) throws Exception;
 }



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


Mime
View raw message