Examples of Invocation


Examples of org.jboss.invocation.Invocation

    * @return response of the invocation
    * @throws Throwable
    */
   public Object invoke(InvocationRequest invocationReq) throws Throwable
   {
      Invocation invocation = (Invocation) invocationReq.getParameter();
      Thread currentThread = Thread.currentThread();
      ClassLoader oldCl = currentThread.getContextClassLoader();
      ObjectName mbean = null;
      try
      {
         mbean = (ObjectName) Registry.lookup(invocation.getObjectName());

         /** Clustering **/
         long clientViewId = ((Long) invocation.getValue("CLUSTER_VIEW_ID")).longValue();
         HATarget target = (HATarget) beanMap.get(invocation.getObjectName());
         if(target == null)
         {
            // We could throw IllegalStateException but we have a race condition that could occur:
            // when we undeploy a bean, the cluster takes some time to converge
            // and to recalculate a new viewId and list of replicant for each HATarget.
View Full Code Here

Examples of org.jboss.invocation.Invocation

      if (log.isTraceEnabled())
      {
         log.trace("Using legacy invoker method for getEJBObject() invocation.");
      }
      SecurityActions sa = SecurityActions.UTIL.getSecurityActions();        
      Invocation invocation = new Invocation(
            null,
            GET_EJB_OBJECT,
            new Object[]{id},
            //No transaction set up in here? it will get picked up in the proxy
            null,
            // fix for bug 474134 from Luke Taylor
            sa.getPrincipal(),
            sa.getCredential());

      invocation.setObjectName(new Integer(objectName));
      invocation.setValue(InvocationKey.INVOKER_PROXY_BINDING,
         invokerProxyBinding, PayloadKey.AS_IS);

      // It is a home invocation
      invocation.setType(InvocationType.HOME);

      // Create an invocation context for the invocation
      InvocationContext ctx = new InvocationContext();
      invocation.setInvocationContext(ctx);
     
      // Get the invoker to the target server (cluster or node)

      // Ship it
      if (isLocal())
View Full Code Here

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

Examples of org.jboss.wsf.spi.invocation.Invocation

      {
         // not for us
         return this.getNext().invoke(jbossInvocation);
      }

      final Invocation wsInvocation = (Invocation) jbossInvocation.getValue(Invocation.class.getName());
      final HandlerCallback callback = (HandlerCallback) jbossInvocation.getValue(HandlerCallback.class.getName());

      if (callback == null || wsInvocation == null)
      {
         log.warn("Handler callback not available");
         return this.getNext().invoke(jbossInvocation);
      }

      // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
      try
      {
         // call the request handlers
         boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
         handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

         // Call the next interceptor in the chain
         if (handlersPass)
         {
            // The SOAPContentElements stored in the EndpointInvocation might have changed after
            // handler processing. Get the updated request payload. This should be a noop if request
            // handlers did not modify the incomming SOAP message.
            final Object[] reqParams = wsInvocation.getArgs();
            jbossInvocation.setArguments(reqParams);
            final Object resObj = this.getNext().invoke(jbossInvocation);

            // Setting the message to null should trigger binding of the response message
            msgContext.setMessage(null);
            wsInvocation.setReturnValue(resObj);
         }

         // call the response handlers
         handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
         handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

         // update the return value after response handler processing
         return wsInvocation.getReturnValue();
      }
      catch (Exception ex)
      {
         try
         {
View Full Code Here

Examples of org.jboss.wsf.spi.invocation.Invocation

        private JAXRPCHandlersInterceptor() {}

        @Override
        public Object processInvocation(final InterceptorContext context) throws Exception {
            final SOAPMessageContext msgContext = (SOAPMessageContext) context.getPrivateData(MessageContext.class);
            final Invocation wsInvocation = (Invocation) context.getPrivateData(Invocation.class);
            final HandlerCallback callback = (HandlerCallback) context.getPrivateData(HandlerCallback.class);
            if (msgContext == null || callback == null || wsInvocation == null) {
                // not for us
                return context.proceed();
            }

            // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
            try {
                // call the request handlers
                boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
                handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);

                // Call the next interceptor in the chain
                if (handlersPass) {
                    // The SOAPContentElements stored in the EndpointInvocation might have changed after
                    // handler processing. Get the updated request payload. This should be a noop if request
                    // handlers did not modify the incomming SOAP message.
                    final Object[] reqParams = wsInvocation.getArgs();
                    context.setParameters(reqParams);
                    final Object resObj = context.proceed();

                    // Setting the message to null should trigger binding of the response message
                    msgContext.setMessage(null);
                    wsInvocation.setReturnValue(resObj);
                }

                // call the response handlers
                handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
                handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);

                // update the return value after response handler processing
                return wsInvocation.getReturnValue();
            }
            catch (final Exception ex) {
                try {
                    // call the fault handlers
                    boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
View Full Code Here

Examples of org.jclouds.reflect.Invocation

   @Test
   public void testRequestFilterStripExpect() {
      // First, verify that by default, the StripExpectHeader filter is not applied
      Invokable<?, ?> method = method(TestRequestFilter.class, "post");
      Invocation invocation = Invocation.create(method,
         ImmutableList.<Object>of(HttpRequest.builder().method("POST").endpoint("http://localhost")
            .addHeader(HttpHeaders.EXPECT, "100-Continue").build()));
      GeneratedHttpRequest request = processor.apply(invocation);
      assertEquals(request.getFilters().size(), 1);
      assertEquals(request.getFilters().get(0).getClass(), TestRequestFilter1.class);
View Full Code Here

Examples of org.jmock.api.Invocation

        final ProxyObject proxyObject = (ProxyObject) objenesis.newInstance(proxyClass);
        proxyObject.setHandler(new MethodHandler() {
            @Override
            public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
                return mockObject.invoke(new Invocation(self, thisMethod, args));
            }
        });

        return proxyObject;
View Full Code Here

Examples of org.jmock.core.Invocation

    private class MyInterceptor implements MethodInterceptor {
        public Object intercept(Object obj, Method method, Object[] args,
                                MethodProxy superProxy) throws Throwable {

            Invocation invocation = new Invocation(proxy, method, args);
            try {
                return mockInvocation(invocation);
            } catch (DynamicMockError e) {
                if (!isProxyConstructed())
                    return superProxy.invokeSuper(obj, args);
View Full Code Here

Examples of org.mockito.internal.invocation.Invocation

    }
   
    public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        if (mockitoStubber.hasAnswersForStubbing()) {
            //stubbing voids with stubVoid() or doAnswer() style
            Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
            InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);
            mockitoStubber.setMethodForStubbing(invocationMatcher);
            return null;
        }
       
        VerificationMode verificationMode = mockingProgress.pullVerificationMode();
        mockingProgress.validateState();

        Invocation invocation = new Invocation(proxy, method, args, mockingProgress.nextSequenceNumber());
        InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(invocation);

        if (verificationMode != null) {
            VerificationDataImpl data = new VerificationDataImpl(registeredInvocations.getAll(), invocationMatcher);
            verificationMode.verify(data);
View Full Code Here

Examples of org.mockito.internal.invocation.Invocation

        }
       
        List<Invocation> actualInvocations = finder.findInvocations(invocations, wanted, mode);
       
        if (actualInvocations.isEmpty()) {
            Invocation similar = finder.findSimilarInvocation(invocations, wanted, mode);
            reportMissingInvocationError(wanted, similar);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.