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, 13 Nov 2003 02:49:26 GMT
dain        2003/11/12 18:49:26

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/service
                        GeronimoMBeanInfo.java
  Log:
  Added the ability to precreate the targets
  
  Revision  Changes    Path
  1.6       +24 -14    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GeronimoMBeanInfo.java	11 Nov 2003 16:00:59 -0000	1.5
  +++ GeronimoMBeanInfo.java	13 Nov 2003 02:49:26 -0000	1.6
  @@ -139,23 +139,26 @@
           //
           // Derived
           //
  +        targets.putAll(source.targets);
           String className = null;
           try {
               for (Iterator i = targetClasses.entrySet().iterator(); i.hasNext();) {
                   Map.Entry entry = (Map.Entry) i.next();
  -                className = (String) entry.getValue();
  -                Class clazz = ParserUtil.loadClass(className);
  -
  -                if(Modifier.isFinal(clazz.getModifiers())) {
  -                    throw new IllegalArgumentException("Target class cannot be final: "
+ className);
  +                Object key = entry.getKey();
  +                if (!targets.containsKey(key)) {
  +                    className = (String) entry.getValue();
  +                    Class clazz = ParserUtil.loadClass(className);
  +
  +                    if (Modifier.isFinal(clazz.getModifiers())) {
  +                        throw new IllegalArgumentException("Target class cannot be final:
" + className);
  +                    }
  +
  +                    // Insert Magic Here
  +                    GeronimoMBeanTarget target = createTarget(clazz);
  +                    targets.put(key, target);
  +                    FastClass fastClass = FastClass.create(clazz);
  +                    targetFastClasses.put(key, fastClass);
                   }
  -
  -                // Insert Magic Here
  -                GeronimoMBeanTarget target = createTarget(clazz);
  -                //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);
  @@ -224,6 +227,13 @@
           return targets.get(name);
       }
   
  +    public void setTarget(String name, Object target) {
  +        if (immutable) {
  +            throw new IllegalStateException("Data is no longer mutable");
  +        }
  +        targets.put(name, target);
  +    }
  +
       FastClass getTargetFastClass() {
           return (FastClass) targetFastClasses.get(DEFAULT_TARGET_NAME);
       }
  @@ -387,7 +397,7 @@
       private static final MethodInterceptor NO_OP_METHOD_INTERCEPTOR = new MethodInterceptor()
{
           public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
throws Throwable {
               if (Modifier.isAbstract(method.getModifiers())) {
  -                if(method.getReturnType() == Boolean.TYPE) {
  +                if (method.getReturnType() == Boolean.TYPE) {
                       return Boolean.TRUE;
                   } else {
                       return null;
  
  
  

Mime
View raw message