Package javax.interceptor

Examples of javax.interceptor.InvocationContext


        }
    }

    public Object invoke(final javax.xml.rpc.handler.MessageContext messageContext, final Object... parameters) throws Exception {
        try {
            final InvocationContext invocationContext = new JaxRpcInvocationContext(operation, interceptors, beanInstance, targetMethod, messageContext, parameters);
            ThreadContext.getThreadContext().set(InvocationContext.class, invocationContext);
            return invocationContext.proceed();
        } finally {
            ThreadContext.getThreadContext().remove(InvocationContext.class);
        }
    }
View Full Code Here


    }

    @Override
    protected Object invoke(final Exchange exchange, final Object serviceObject,
                            final Method m, final List<Object> params) {
        final InvocationContext invContext = exchange.get(InvocationContext.class);
        if (invContext == null) {
            return preEjbInvoke(exchange, m, params);
        }
        return super.invoke(exchange, serviceObject, m, params);
    }
View Full Code Here

    }

    @Override
    protected Object performInvocation(final Exchange exchange, final Object serviceObject,
                                       final Method m, final Object[] paramArray) throws Exception {
        InvocationContext invContext = exchange.get(InvocationContext.class);
        invContext.setParameters(paramArray);
        Object res = invContext.proceed();

        EjbMessageContext ctx = (EjbMessageContext) invContext.getContextData();

        Map<String, Object> handlerProperties = (Map<String, Object>) exchange
            .get(HANDLER_PROPERTIES);
        addHandlerProperties(ctx, handlerProperties);
View Full Code Here

      this.interceptors = interceptors;
   }
  
   public Object invoke(final InvocationContext context) throws Exception
   {
      InvocationContext current = new InvocationContext() {
         private int currentInterceptor = 0;
        
         public Map<String, Object> getContextData()
         {
            return context.getContextData();
         }
        
         public Method getMethod()
         {
            return context.getMethod();
         }
        
         public Object[] getParameters()
         {
            return context.getParameters();
         }
        
         public Object getTarget()
         {
            return context.getTarget();
         }
        
         public Object proceed() throws Exception
         {
            if(currentInterceptor < interceptors.length)
            {
               try
               {
                  return interceptors[currentInterceptor++].invoke(this);
               }
               finally
               {
                  // so that interceptors like clustering can reinvoke down the chain
                  currentInterceptor--;
               }
            }
            return context.proceed();
         }
        
         public void setParameters(Object[] params)
         {
            context.setParameters(params);
         }
      };
      return current.proceed();
   }
View Full Code Here

    * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
    */
   public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable
   {
      final Map<String, Object> contextData = new HashMap<String, Object>();
      InvocationContext context = new InvocationContext() {
         private Object[] parameters = args;
        
         public Map<String, Object> getContextData()
         {
            return contextData;
View Full Code Here

        else if (postConstructMethods == null || postConstructMethods.size() == 0)
        {
            return;
        }

        InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(internalInstance, InterceptionType.POST_CONSTRUCT, postConstructInterceptors,
                                                                            interceptorInstances, postConstructMethods);
        try
        {
            ic.proceed();
        }
        catch (Exception e)
        {
            throw ExceptionUtil.throwAsRuntimeException(e);
        }
View Full Code Here

        else if (preDestroyMethods == null || preDestroyMethods.size() == 0)
        {
            return;
        }

        InvocationContext ic = new LifecycleInterceptorInvocationContext<T>(internalInstance, InterceptionType.PRE_DESTROY, preDestroyInterceptors,
                                                                            interceptorInstances, preDestroyMethods);
        try
        {
            ic.proceed();
        }
        catch (Exception e)
        {
            ExceptionUtil.throwAsRuntimeException(e);
        }
View Full Code Here

        return new ReflectionInvocationContext(operation, interceptors, beanInstance, targetMethod, parameters);
    }

    public Object invoke(Object... parameters) throws Exception {
        try {
            InvocationContext invocationContext = createInvocationContext(parameters);
            if (ThreadContext.getThreadContext() != null) {
                ThreadContext.getThreadContext().set(InvocationContext.class, invocationContext);
            }
            return invocationContext.proceed();
        } finally {
            if (ThreadContext.getThreadContext() != null) {
                ThreadContext.getThreadContext().remove(InvocationContext.class);
            }
        }
View Full Code Here

        }
    }

    public Object invoke(javax.xml.ws.handler.MessageContext messageContext, Object... parameters) throws Exception {
        try {
            InvocationContext invocationContext = new JaxWsInvocationContext(operation, interceptors, beanInstance, targetMethod, messageContext, parameters);
            ThreadContext.getThreadContext().set(InvocationContext.class, invocationContext);
            return invocationContext.proceed();
        } finally {
            ThreadContext.getThreadContext().remove(InvocationContext.class);
        }
    }
View Full Code Here

        }
    }

    public Object invoke(javax.xml.rpc.handler.MessageContext messageContext, Object... parameters) throws Exception {
        try {
            InvocationContext invocationContext = new JaxRpcInvocationContext(operation, interceptors, beanInstance, targetMethod, messageContext, parameters);
            ThreadContext.getThreadContext().set(InvocationContext.class, invocationContext);
            return invocationContext.proceed();
        } finally {
            ThreadContext.getThreadContext().remove(InvocationContext.class);
        }
    }
View Full Code Here

TOP

Related Classes of javax.interceptor.InvocationContext

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.