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 MbeansDescriptorsIntrospectionSource.java MbeansSource.java ModelerSource.java
Date Thu, 27 Mar 2003 06:18:48 GMT
costin      2003/03/26 22:18:47

  Modified:    modeler/src/java/org/apache/commons/modeler Registry.java
               modeler/src/java/org/apache/commons/modeler/modules
                        MbeansDescriptorsIntrospectionSource.java
                        MbeansSource.java ModelerSource.java
  Log:
  Small bits of refactoring and fixes.
  
  Added a method to allow reseting the metadata cache - in case we use
  class reloading and metadata changes.
  The right solution is to stop using the static fields.
  
  Revision  Changes    Path
  1.26      +9 -0      jakarta-commons/modeler/src/java/org/apache/commons/modeler/Registry.java
  
  Index: Registry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/Registry.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Registry.java	17 Mar 2003 06:48:55 -0000	1.25
  +++ Registry.java	27 Mar 2003 06:18:46 -0000	1.26
  @@ -355,6 +355,15 @@
   
       // -------------------- Loading data from different sources  --------------
   
  +    /** The registry will cache the metadata. In some cases we may
  +     * want to reset the cache, to allow reloading of metadata to happen.
  +     * 
  +     */ 
  +    public void resetMetadata() {
  +        descriptorsByClass = new HashMap();
  +        descriptors = new HashMap();
  +    }
  +    
       /**
        * Load the registry from the XML input found in the specified input
        * stream.
  
  
  
  1.8       +4 -3      jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java
  
  Index: MbeansDescriptorsIntrospectionSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MbeansDescriptorsIntrospectionSource.java	26 Feb 2003 22:17:32 -0000	1.7
  +++ MbeansDescriptorsIntrospectionSource.java	27 Mar 2003 06:18:47 -0000	1.8
  @@ -84,7 +84,7 @@
       }
   
       private static String strArray[]=new String[0];
  -
  +    private static ObjectName objNameArray[]=new ObjectName[0];
       // createMBean == registerClass + registerMBean
   
       private boolean supportedType( Class ret ) {
  @@ -96,8 +96,9 @@
                   ret == java.io.File.class ||
                   ret == Boolean.class ||
                   ret == Boolean.TYPE ||
  -                ret == strArray.getClass() || // XXX ???
  -                ret == ObjectName.class
  +                ret == strArray.getClass() || 
  +                ret == ObjectName.class  ||
  +                ret == objNameArray.getClass()
               ;
       }
   
  
  
  
  1.8       +0 -15     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MbeansSource.java	28 Feb 2003 04:56:32 -0000	1.7
  +++ MbeansSource.java	27 Mar 2003 06:18:47 -0000	1.8
  @@ -226,21 +226,6 @@
   
       }
   
  -    // XXX We should know the type from the mbean metadata
  -    private Object getValueObject( String valueS, String type )
  -            throws MalformedObjectNameException
  -    {
  -        if( type==null )
  -            return valueS;
  -        if( "int".equals( type ) || "java.lang.Integer".equals(type) ) {
  -            return new Integer( valueS);
  -        }
  -        if( "ObjectName".equals( type ) || "javax.management.ObjectName".equals(type) )
{
  -            return new ObjectName( valueS);
  -        }
  -        return valueS;
  -    }
  -
       private void processArg(Node mbeanN) {
           Node firstArgN=DomUtil.getChild(mbeanN, "arg" );
           // process all args
  
  
  
  1.3       +17 -0     jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/ModelerSource.java
  
  Index: ModelerSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/ModelerSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ModelerSource.java	26 Feb 2003 22:17:32 -0000	1.2
  +++ ModelerSource.java	27 Mar 2003 06:18:47 -0000	1.3
  @@ -2,6 +2,8 @@
   
   import org.apache.commons.modeler.Registry;
   import java.util.List;
  +import javax.management.MalformedObjectNameException;
  +import javax.management.ObjectName;
   
   /** Source for descriptor data. More sources can be added.
    *
  @@ -14,5 +16,20 @@
       {
           // TODO
           return null;
  +    }
  +    
  +    // XXX We should know the type from the mbean metadata
  +    protected Object getValueObject( String valueS, String type )
  +            throws MalformedObjectNameException
  +    {
  +        if( type==null )
  +            return valueS;
  +        if( "int".equals( type ) || "java.lang.Integer".equals(type) ) {
  +            return new Integer( valueS);
  +        }
  +        if( "ObjectName".equals( type ) || "javax.management.ObjectName".equals(type) )
{
  +            return new ObjectName( valueS);
  +        }
  +        return valueS;
       }
   }
  
  
  

---------------------------------------------------------------------
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