Package org.jboss.mx.server

Examples of org.jboss.mx.server.Invocation


               getSignatureString(signature))
         );
      }
     
      // create the invocation object
      Invocation invocation = new Invocation();        
     
      // copy the server's invocation context to the invocation
      invocation.addContext(ctx);

      // set the invocation's entry point
      invocation.setType(InvocationContext.OP_INVOKE);
     
      // set the args
      invocation.setArgs(args);
     
      try
      {
         // the default invocation implementation will invoke each interceptor
         // declared in the invocation context before invoking the target method
         return invocation.invoke();        
      }
     
      // Both interceptors and the invocation object propagate only one exception
      // type, InvocationException, which wraps the underlying JMX exception
      // (which in turn may wrap application exception, as per the JMX spec).
      // Unwrap the outermost InvocationException layer here.
      catch (InvocationException e)
      {
         if (e.getTargetException() instanceof MBeanException)
            throw (MBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof ReflectionException)
            throw (ReflectionException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeMBeanException)
            throw (RuntimeMBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeErrorException)
            throw (RuntimeErrorException)e.getTargetException();        
         else
            throw new RuntimeException(e.getTargetException().toString());
      }
     
      // any other throwable object that gets propagated back to the invoker
      // indicates an error in the server or in the interceptor implementation.
      catch (Throwable t)
      {
         throw new RuntimeOperationsException(new RuntimeException(
               "Unhandled throwable propagated to the invoker by " +
               invocation + ":" +t.toString())
         );
        
         // TODO:  mark interceptors so we can track which interceptor fails
      }
     
      // TODO: should be fixed by adding invocation return value object
      finally
      {
         ctx.setDescriptor(invocation.getDescriptor());
      }
     
   }
View Full Code Here


      // it does not exist as far as we are concerned
      if (ctx == null)
         throw new AttributeNotFoundException("not found: " + attribute);
     
      // create the invocation object
      Invocation invocation = new Invocation();
     
      // copy the server's invocation context to the invocation
      invocation.addContext(ctx);

      // indicate the invocation access point was getAttribute() method
      invocation.setType(InvocationContext.OP_GETATTRIBUTE);
     
      try
      {
         return invocation.invoke();
      }

      // Both interceptors and the invocation object propagate only one exception
      // type, InvocationException, which wraps the underlying JMX exception
      // (which in turn may wrap application exception, as per the JMX spec).
      // Unwrap the outermost InvocationException layer here.
      catch (InvocationException e)
      {
         if (e.getTargetException() instanceof AttributeNotFoundException)
            throw (AttributeNotFoundException)e.getTargetException();
         if (e.getTargetException() instanceof MBeanException)
            throw (MBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof ReflectionException)
            throw (ReflectionException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeMBeanException)
            throw (RuntimeMBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeErrorException)
            throw (RuntimeErrorException)e.getTargetException();        
         else
            throw new RuntimeException(e.getTargetException().toString());
      }

      // any other throwable object that gets propagated back to the invoker
      // indicates an error in the server or in the interceptor implementation.
      catch (Throwable t)
      {
         throw new RuntimeOperationsException(new RuntimeException(
               "Unhandled throwable propagated to the invoker by " +
               invocation + ":" +t.toString())
         );
        
         // TODO:  mark interceptors so we can track which interceptor fails           
      }
     
      // TODO: should be fixed by adding invocation return value object
      finally
      {
         ctx.setDescriptor(invocation.getDescriptor());
      }
   }
View Full Code Here

      // it does not exist as far as we are concerned
      if (ctx == null)
         throw new AttributeNotFoundException("not found: " + attribute.getName());

      // create the invocation object     
      Invocation invocation = new Invocation();

      // copy the server context to the invocation     
      invocation.addContext(ctx);

      // indicate the access point as setAttribute()
      invocation.setType(InvocationContext.OP_SETATTRIBUTE);
     
      // set the attribute value as the argument
      invocation.setArgs(new Object[] { attribute.getValue() });
     
      try
      {
         // the default invocation implementation will invoke each interceptor
         // declared in the invocation context before invoking the target method        
         invocation.invoke();     
      }

      // Both interceptors and the invocation object propagate only one exception
      // type, InvocationException, which wraps the underlying JMX exception
      // (which in turn may wrap application exception, as per the JMX spec).
      // Unwrap the outermost InvocationException layer here.     
      catch (InvocationException e)
      {
         if (e.getTargetException() instanceof InvalidAttributeValueException)
            throw (InvalidAttributeValueException)e.getTargetException();
         if (e.getTargetException() instanceof AttributeNotFoundException)
            throw (AttributeNotFoundException)e.getTargetException();
         if (e.getTargetException() instanceof MBeanException)
            throw (MBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof ReflectionException)
            throw (ReflectionException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeMBeanException)
            throw (RuntimeMBeanException)e.getTargetException();
         else if (e.getTargetException() instanceof RuntimeErrorException)
            throw (RuntimeErrorException)e.getTargetException();        
         else
            throw new RuntimeException(e.getTargetException().toString());
      }
     
      // any other throwable object that gets propagated back to the invoker
      // indicates an error in the server or in the interceptor implementation.     
      catch (Throwable t)
      {
         throw new RuntimeOperationsException(new RuntimeException(
               "Unhandled throwable propagated to the invoker by " +
               invocation + ":" +t.toString())
         );
      }
     
      // TODO: should be fixed by adding invocation return value object
      finally
      {
         ctx.setDescriptor(invocation.getDescriptor());
      }     
   }
View Full Code Here

   }

   public MBeanInfo getMBeanInfo()
   {
      // create the invocation object
      Invocation invocation = new Invocation(getMBeanInfoCtx);
  
      // set the invocation's access point as getMBeanInfo()
      invocation.setType(InvocationContext.OP_GETMBEANINFO);
     
      try
      {
         MBeanInfo info = (MBeanInfo)invocation.invoke();

         return info;
      }
      catch (InvocationException e)
      {
View Full Code Here

      assertTrue(server.isRegistered(new ObjectName(
            JBOSSMX_DOMAIN + ":" + "type=Interceptor,name=MySharedInterceptor,ID=0"
      )));
     
      InvocationContext ic = new InvocationContext();
      Invocation i = new Invocation();

      i.addContext(ic);
      i.setType("bloopah");
     
      server.invoke(oname, "invoke",
            new Object[] { i },
            new String[] { Invocation.class.getName() }
      );
     
      assertTrue(i.getType().equals("something"));
   }
View Full Code Here

TOP

Related Classes of org.jboss.mx.server.Invocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.