User: schaefera
  Date: 01/06/15 22:53:38

  Modified:    src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Added the support for classes with a single string as only argument for
  the constructor to the ConfigurationService. Some fixes and additional
  methods for the JBoss management.
  
  Revision  Changes    Path
  1.30      +31 -1     jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ConfigurationService.java 2001/06/10 07:49:09     1.29
  +++ ConfigurationService.java 2001/06/16 05:53:38     1.30
  @@ -9,6 +9,7 @@
   
   import java.io.*;
   import java.beans.*;
  +import java.lang.reflect.Constructor;
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  @@ -45,7 +46,7 @@
    * @author  Rickard Öberg ([EMAIL PROTECTED])
    * @author  [EMAIL PROTECTED]
    * @author  Jason Dillon <a 
href="mailto:[EMAIL PROTECTED]";>&lt;[EMAIL PROTECTED]&gt;</a>
  - * @version $Revision: 1.29 $
  + * @version $Revision: 1.30 $
    */
   public class ConfigurationService
       extends ServiceMBeanSupport
  @@ -405,6 +406,9 @@
       /**
        * Provides a wrapper around the information about which constructor
        * that MBeanServer should use to construct a MBean.
  +     * Please note that only basic datatypes (type is then the same as
  +     * you use to declare it "short", "int", "float" etc.) and any class
  +     * having a constructor taking a single "String" as only parameter.
        *
        * <p>XML syntax for contructor:
        *   <pre>
  @@ -467,6 +471,10 @@
                       String value = arg.getAttribute("value");
                       Object realValue = value;
                       if( signature != null ) {
  +                       if( signature.equals( "short" ) ) {
  +                          signature = Short.TYPE.getName();
  +                          realValue = new Short( value );
  +                       } else
                          if( signature.equals( "int" ) ) {
                             signature = Integer.TYPE.getName();
                             realValue = new Integer( value );
  @@ -495,6 +503,22 @@
                             signature = Boolean.TYPE.getName();
                             realValue = new Boolean( value );
                          }
  +                       else
  +                       {
  +                          try {
  +                             // Check if there is a constructor with a single 
String as
  +                             // only parameter
  +                             Class signatureClass =
  +                                
Thread.currentThread().getContextClassLoader().loadClass( signature );
  +                             Constructor signatureConstructor =
  +                                signatureClass.getConstructor( new Class[] { 
String.class } );
  +                             realValue = signatureConstructor.newInstance(
  +                                new Object[] { value }
  +                             );
  +                          }
  +                          catch( Exception e ) {
  +                          }
  +                       }
                       }
                       info.signature[j] = signature;
                       info.params[j] = realValue;
  @@ -817,3 +841,9 @@
           }
       }
   }
  +
  +/* Log
  +6/13/2001 Andreas Schaefer Added type "short" for constructor argument and
  +                           any class having a constructor taking a "String"
  +                           as only parameter
  +*/
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to