geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service GeronimoMBeanInfo.java
Date Thu, 06 Nov 2003 19:58:46 GMT
dain        2003/11/06 11:58:45

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBeanInfo.java
  Log:
  Added Endpoint support.
  Changed java.lang.reflect.Method to cglib FastMethod.
  
  Revision  Changes    Path
  1.3       +48 -4     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfo.java
  
  Index: GeronimoMBeanInfo.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/service/GeronimoMBeanInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoMBeanInfo.java	24 Oct 2003 22:45:01 -0000	1.2
  +++ GeronimoMBeanInfo.java	6 Nov 2003 19:58:45 -0000	1.3
  @@ -70,6 +70,8 @@
   import org.apache.geronimo.kernel.service.ParserUtil;
   import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
   
  +import net.sf.cglib.reflect.FastClass;
  +
   /**
    * Describes a GeronimoMBean.  This extension allows the properties to be mutable during
setup,
    * and once the MBean is deployed an imutable copy of will be made.  This class also adds
support for multi target
  @@ -79,9 +81,14 @@
    */
   public final class GeronimoMBeanInfo extends MBeanInfo {
       /**
  -     * The key for the default target.
  +     * The key for the default target
  +     */
  +    final static String DEFAULT_TARGET_NAME = "default";
  +
  +    /**
  +     * The key for the geronimo mbean
        */
  -    private final static String DEFAULT_TARGET_NAME = "default";
  +    final static String GERONIMO_MBEAN_TARGET_NAME = "___Geronimo___MBean___";
   
       private static final MBeanConstructorInfo[] NO_CONSTRUCTORS = new MBeanConstructorInfo[0];
       private final boolean immutable;
  @@ -92,7 +99,9 @@
       private final Set attributes = new HashSet();
       private final Set operations = new HashSet();
       private final Set notifications = new HashSet();
  +    private final Set endpoints = new HashSet();
       final Map targets = new HashMap();
  +    final Map targetFastClasses = new HashMap();
       public static final String ALWAYS = "always";
       public static final String NEVER = "never";
   
  @@ -129,8 +138,11 @@
               for (Iterator i = targetClasses.entrySet().iterator(); i.hasNext();) {
                   Map.Entry entry = (Map.Entry) i.next();
                   className = (String) entry.getValue();
  -                Object target = ParserUtil.loadClass(className).newInstance();
  +                Class clazz = ParserUtil.loadClass(className);
  +                Object target = clazz.newInstance();
                   targets.put(entry.getKey(), target);
  +                FastClass fastClass = FastClass.create(clazz);
  +                targetFastClasses.put(entry.getKey(), fastClass);
               }
           } catch (ClassNotFoundException e) {
               throw new IllegalArgumentException("Target class could not be loaded: className="
+ className);
  @@ -161,6 +173,12 @@
               GeronimoNotificationInfo notificationInfo = (GeronimoNotificationInfo) iterator.next();
               notifications.add(new GeronimoNotificationInfo(notificationInfo, this));
           }
  +
  +
  +        for (Iterator iterator = source.endpoints.iterator(); iterator.hasNext();) {
  +            GeronimoMBeanEndpoint endpoint = (GeronimoMBeanEndpoint) iterator.next();
  +            endpoints.add(new GeronimoMBeanEndpoint(endpoint, this));
  +        }
       }
   
       public String getClassName() {
  @@ -201,6 +219,17 @@
           return targets.get(name);
       }
   
  +    FastClass getTargetFastClass() {
  +        return (FastClass)targetFastClasses.get(DEFAULT_TARGET_NAME);
  +    }
  +
  +    FastClass getTargetFastClass(String name) {
  +        if(GERONIMO_MBEAN_TARGET_NAME.equals(name)) {
  +            return GeronimoMBean.fastClass;
  +        }
  +        return (FastClass)targetFastClasses.get(name);
  +    }
  +
       public String getName() {
           return name;
       }
  @@ -271,6 +300,21 @@
               throw new IllegalStateException("Data is no longer mutable");
           }
           notifications.add(notificationInfo);
  +    }
  +
  +    public Set getEndpointsSet() {
  +        return Collections.unmodifiableSet(endpoints);
  +    }
  +
  +    public GeronimoMBeanEndpoint[] getEndpoints() {
  +        return (GeronimoMBeanEndpoint[]) endpoints.toArray(new GeronimoMBeanEndpoint[endpoints.size()]);
  +    }
  +
  +    public void addEndpoint(GeronimoMBeanEndpoint endpoint) {
  +        if (immutable) {
  +            throw new IllegalStateException("Data is no longer mutable");
  +        }
  +        endpoints.add(endpoint);
       }
   
       public int hashCode() {
  
  
  

Mime
View raw message