geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/task CreateMBeanInstance.java
Date Sat, 15 Nov 2003 19:16:42 GMT
djencks     2003/11/15 11:16:42

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service
                        MBeanMetadataXMLLoader.java
               modules/kernel/src/java/org/apache/geronimo/kernel/deployment/task
                        CreateMBeanInstance.java
  Log:
  Fix compilation problems... I thought maven handled dependencies better
  
  Revision  Changes    Path
  1.4       +5 -6      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/MBeanMetadataXMLLoader.java
  
  Index: MBeanMetadataXMLLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/MBeanMetadataXMLLoader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MBeanMetadataXMLLoader.java	11 Nov 2003 04:37:48 -0000	1.3
  +++ MBeanMetadataXMLLoader.java	15 Nov 2003 19:16:42 -0000	1.4
  @@ -56,7 +56,6 @@
   package org.apache.geronimo.kernel.deployment.service;
   
   import java.net.URI;
  -import java.util.List;
   import java.util.Map;
   import java.util.Set;
   import javax.management.MalformedObjectNameException;
  @@ -96,14 +95,14 @@
           NodeList nl = element.getElementsByTagName("constructor");
           Element consElement = (Element) nl.item(0);
           if (consElement != null) {
  -            List types = md.getConstructorTypes();
  -            List args = md.getConstructorArgs();
               nl = consElement.getElementsByTagName("arg");
  +            Object[] args = new Object[nl.getLength()];
  +            String[] types = new String[nl.getLength()];
               for (int i = 0; i < nl.getLength(); i++) {
                   Element argElement = (Element) nl.item(i);
                   String type = argElement.getAttribute("type");
  -                types.add(type);
  -                args.add(XMLUtil.getContent(argElement));
  +                types[i] = type;
  +                args[i] = XMLUtil.getContent(argElement);
               }
           }
   
  
  
  
  1.4       +13 -14    incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/task/CreateMBeanInstance.java
  
  Index: CreateMBeanInstance.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/task/CreateMBeanInstance.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CreateMBeanInstance.java	11 Nov 2003 04:39:37 -0000	1.3
  +++ CreateMBeanInstance.java	15 Nov 2003 19:16:42 -0000	1.4
  @@ -55,9 +55,7 @@
    */
   package org.apache.geronimo.kernel.deployment.task;
   
  -import java.lang.reflect.Constructor;
   import java.net.URI;
  -import java.util.ArrayList;
   import java.util.HashSet;
   import java.util.Iterator;
   import java.util.List;
  @@ -148,22 +146,20 @@
               // Create and register the MBean
               try {
                   // Get the constructor arguments
  -                List constructorTypeStrings = metadata.getConstructorTypes();
  -                List constructorTypes = new ArrayList(constructorTypeStrings.size());
  -                List constructorValues = metadata.getConstructorArgs();
  -                for (int i = 0; i < constructorTypeStrings.size(); i++) {
  +                String[] constructorTypeStrings = metadata.getConstructorTypes();
  +                Object[] constructorValues = metadata.getConstructorArgs();
  +                for (int i = 0; i < constructorTypeStrings.length; i++) {
                       Class type = null;
                       try {
  -                        type = ParserUtil.loadClass((String) constructorTypeStrings.get(i),
newCL);
  +                        type = ParserUtil.loadClass(constructorTypeStrings[i], newCL);
                       } catch (ClassNotFoundException e) {
                           throw new DeploymentException(e, metadata);
                       }
  -                    constructorTypes.add(type);
   
  -                    Object value = constructorValues.get(i);
  +                    Object value = constructorValues[i];
                       if (value instanceof String) {
                           value = ParserUtil.getValue(type, (String) value, baseURI);
  -                        constructorValues.set(i, value);
  +                        constructorValues[i] = value;
                       }
                   }
   
  @@ -172,9 +168,12 @@
                       log.trace("Creating MBean name=" + metadata.getName() + " class=" +
metadata.getCode());
                   }
   
  -                Class mbeanClass = newCL.loadClass(metadata.getCode());
  -                Constructor mbeanConstructor = mbeanClass.getConstructor((Class[]) constructorTypes.toArray(new
Class[constructorTypes.size()]));
  -                Object mbean = mbeanConstructor.newInstance(constructorValues.toArray());
  +                //Class mbeanClass = newCL.loadClass(metadata.getCode());
  +                //Constructor mbeanConstructor = mbeanClass.getConstructor(constructorTypes);
  +                Object mbean = server.instantiate(metadata.getCode(),
  +                        metadata.getLoaderName(),
  +                        metadata.getConstructorArgs(),
  +                        metadata.getConstructorTypes());
                   actualName = server.registerMBean(mbean, metadata.getName()).getObjectName();
                   if (log.isTraceEnabled() && !actualName.equals(metadata.getName()))
{
                       log.trace("Actual MBean name is " + actualName);
  
  
  

Mime
View raw message