[JBoss-dev] CVS update: jmx/src/main/org/jboss/mx/interceptor StandardMBeanInterceptor.java InvocationException.java

2002-01-24 Thread Juha Lindfors

  User: juhalindfors
  Date: 02/01/24 14:13:33

  Modified:src/main/org/jboss/mx/interceptor
StandardMBeanInterceptor.java
InvocationException.java
  Log:
  fixed exception handling
  
  Revision  ChangesPath
  1.5   +73 -17
jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java
  
  Index: StandardMBeanInterceptor.java
  ===
  RCS file: 
/cvsroot/jboss/jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardMBeanInterceptor.java 2001/12/13 00:04:15 1.4
  +++ StandardMBeanInterceptor.java 2002/01/24 22:13:33 1.5
  @@ -18,7 +18,9 @@
   import javax.management.MBeanOperationInfo;
   import javax.management.ReflectionException;
   import javax.management.RuntimeErrorException;
  +import javax.management.RuntimeMBeanException;
   import javax.management.MBeanException;
  +import javax.management.AttributeNotFoundException;
   import javax.management.loading.DefaultLoaderRepository;
   
   import org.jboss.mx.server.StandardMBeanInvoker;
  @@ -32,7 +34,7 @@
* @see org.jboss.mx.server.StandardMBean
*
* @author  mailto:[EMAIL PROTECTED]";>Juha Lindfors.
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*   
*/
   public class StandardMBeanInterceptor 
  @@ -40,19 +42,20 @@
   {
   
  // Attributes    
  -   private Map methodMap = new HashMap();
  -   private Class invocationInterface;
  -   private MBeanInfo info;
  -   private Object resource;
  +   private Map methodMap   = new HashMap();
  +   private Class invocationInterface   = null;
  +   private MBeanInfo info  = null;
  +   private Object resource = null;
  
  // Constructors --
  public StandardMBeanInterceptor(Object resource, MBeanInfo info) throws 
ReflectionException
  {
 super("Standard MBean Interceptor");
 
  +  this.info = info;
 this.resource = resource;
 this.invocationInterface = StandardMBeanInvoker.getMBeanInterface(resource);
  -
  +  
 MBeanOperationInfo[] operations = info.getOperations();
   
 for (int i = 0; i < operations.length; ++i)
  @@ -68,6 +71,8 @@
  strBuf.append(params[j].getType());
   }
   
  +// FIXME: separate operation and attribute maps!
  +
   methodMap.put(name + strBuf.toString(), invocationInterface.getMethod(
 name, getSignatureAsClassArray(params, 
resource.getClass().getClassLoader(;
}
  @@ -184,35 +189,86 @@
  // Interceptor overrides --
  public Object invoke(Invocation invocation) throws InvocationException 
  {
  +  Method method = null;
  +  
 try
 {
  - Method m = (Method)methodMap.get(invocation.getOperationWithSignature());
  - return m.invoke(resource, invocation.getArgs());
  + method = (Method)methodMap.get(invocation.getOperationWithSignature());
  + return method.invoke(resource, invocation.getArgs());
 }
  +  
 catch (IllegalAccessException e)
 {
  - throw new InvocationException(e, "Illegal access to method " + 
invocation.getName());
  + throw new InvocationException(new ReflectionException(e,"Illegal access to 
method " + method.getName()));
 }
  +  
 catch (IllegalArgumentException e)
 {
  - throw new InvocationException(e, "Illegal operation arguments in " + 
invocation.getName() + ": " + e.getMessage());
  + throw new InvocationException(new ReflectionException(e, 
  +   "Illegal arguments for " + ((invocation.getInvocationType() == 
Invocation.ATTRIBUTE)
  +? "attribute "
  +: "operation ")
  ++ invocation.getName()
  ++ ": " + e.getMessage())
  + );
 }
  +  
 catch (InvocationTargetException e)
 {
  - if (e.getTargetException() instanceof Exception)
  - {
  -Exception e2 = (Exception)e.getTargetException();
  -throw new InvocationException(e2, "Operation " + invocation.getName() + 
" on MBean " + info.getClassName() + " has thrown an exception: " + e2.toString());
  + // exception or error from the MBean implementation ('business exception')
  + 
  + if (e.getTargetException() instanceof RuntimeException)
  + {
  +// runtime exceptions from mbean wrapped in RuntimeMBeanException
  +throw new Inv

[JBoss-dev] CVS update: jmx/src/main/org/jboss/mx/interceptor StandardMBeanInterceptor.java

2001-12-12 Thread Juha Lindfors

  User: juhalindfors
  Date: 01/12/12 16:04:15

  Modified:src/main/org/jboss/mx/interceptor
StandardMBeanInterceptor.java
  Log:
  
  
  Revision  ChangesPath
  1.4   +3 -3  
jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java
  
  Index: StandardMBeanInterceptor.java
  ===
  RCS file: 
/cvsroot/jboss/jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardMBeanInterceptor.java 2001/12/09 00:24:27 1.3
  +++ StandardMBeanInterceptor.java 2001/12/13 00:04:15 1.4
  @@ -21,7 +21,7 @@
   import javax.management.MBeanException;
   import javax.management.loading.DefaultLoaderRepository;
   
  -import org.jboss.mx.server.StandardMBean;
  +import org.jboss.mx.server.StandardMBeanInvoker;
   
   
   /**
  @@ -32,7 +32,7 @@
* @see org.jboss.mx.server.StandardMBean
*
* @author  mailto:[EMAIL PROTECTED]";>Juha Lindfors.
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
*   
*/
   public class StandardMBeanInterceptor 
  @@ -51,7 +51,7 @@
 super("Standard MBean Interceptor");
 
 this.resource = resource;
  -  this.invocationInterface = StandardMBean.getMBeanInterface(resource);
  +  this.invocationInterface = StandardMBeanInvoker.getMBeanInterface(resource);
   
 MBeanOperationInfo[] operations = info.getOperations();
   
  
  
  

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



[JBoss-dev] CVS update: jmx/src/main/org/jboss/mx/interceptor StandardMBeanInterceptor.java

2001-12-08 Thread Juha Lindfors

  User: juhalindfors
  Date: 01/12/08 16:24:28

  Modified:src/main/org/jboss/mx/interceptor
StandardMBeanInterceptor.java
  Log:
  remove debug statement
  
  Revision  ChangesPath
  1.3   +1 -3  
jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java
  
  Index: StandardMBeanInterceptor.java
  ===
  RCS file: 
/cvsroot/jboss/jmx/src/main/org/jboss/mx/interceptor/StandardMBeanInterceptor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardMBeanInterceptor.java 2001/12/08 16:06:50 1.2
  +++ StandardMBeanInterceptor.java 2001/12/09 00:24:27 1.3
  @@ -32,7 +32,7 @@
* @see org.jboss.mx.server.StandardMBean
*
* @author  mailto:[EMAIL PROTECTED]";>Juha Lindfors.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*   
*/
   public class StandardMBeanInterceptor 
  @@ -160,8 +160,6 @@
   
  public static Class getClassForType(String type, ClassLoader cl) throws 
ClassNotFoundException
  {
  -System.out.println("TYPE: " + type);
  -
 if (int.class.getName().equals(type))
return Integer.TYPE;
 else if (float.class.getName().equals(type))
  
  
  

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