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 BaseModelMBean.java
Date Wed, 16 Apr 2003 06:00:52 GMT
costin      2003/04/15 23:00:51

  Modified:    modeler/src/java/org/apache/commons/modeler
                        BaseModelMBean.java
  Log:
  Fix for the case of classes that extend BaseModelMBean and are also
  wrapped as BaseModelMbean. ( few tomcat objects )
  
  Revision  Changes    Path
  1.21      +14 -11    jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java
  
  Index: BaseModelMBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- BaseModelMBean.java	14 Apr 2003 14:49:22 -0000	1.20
  +++ BaseModelMBean.java	16 Apr 2003 06:00:51 -0000	1.21
  @@ -67,7 +67,6 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -import org.apache.commons.modeler.modules.MbeansSource;
   import org.apache.commons.modeler.modules.ModelerSource;
   
   import java.lang.reflect.InvocationTargetException;
  @@ -272,7 +271,8 @@
                   (new IllegalArgumentException("Attribute name is null"),
                    "Attribute name is null");
   
  -        if( resource instanceof DynamicMBean ) {
  +        if( (resource instanceof DynamicMBean) && 
  +             ! ( resource instanceof BaseModelMBean )) {
               return ((DynamicMBean)resource).getAttribute(name);
           }
           
  @@ -409,7 +409,8 @@
       public Object invoke(String name, Object params[], String signature[])
           throws MBeanException, ReflectionException 
       {
  -        if( resource instanceof DynamicMBean ) {
  +        if( (resource instanceof DynamicMBean) && 
  +             ! ( resource instanceof BaseModelMBean )) {
               return ((DynamicMBean)resource).invoke(name, params, signature);
           }
       
  @@ -556,7 +557,8 @@
           if( log.isDebugEnabled() )
               log.debug("Setting attribute " + this + " " + attribute );
   
  -        if( resource instanceof DynamicMBean ) {
  +        if( (resource instanceof DynamicMBean) && 
  +             ! ( resource instanceof BaseModelMBean )) {
               try {
                   ((DynamicMBean)resource).setAttribute(attribute);
               } catch (InvalidAttributeValueException e) {
  @@ -671,7 +673,8 @@
       }
   
       public String toString() {
  -        if( resource==null ) return "BaseModelMbean[" + resourceType + "]";
  +        if( resource==null ) 
  +            return "BaseModelMbean[" + resourceType + "]";
           return resource.toString();
       }
   
  @@ -775,7 +778,7 @@
   
           this.resource = resource;
           this.resourceType = resource.getClass().getName();
  -
  +        
           // Make the resource aware of the model mbean.
           try {
               Method m=resource.getClass().getMethod("setModelMBean",
  @@ -1367,7 +1370,7 @@
               log.debug("preRegister " + resource + " " + name );
           oname=name;
           if( resource instanceof MBeanRegistration ) {
  -            oname= ((MBeanRegistration)resource).preRegister(server, name );
  +            oname = ((MBeanRegistration)resource).preRegister(server, name );
           }
           return oname;
       }
  
  
  

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