Package javax.interceptor

Examples of javax.interceptor.InvocationContext


   public void prePassivate(BeanContext ctx)
   {
      try
      {
         InvocationContext ic = LifecycleInvocationContextImpl.getLifecycleInvocationContext(
               PrePassivate.class,
               ctx,
               prePassivates,
               beanPrePassivates);
         ic.proceed();
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here


    private Instance<DelegateQueryHandler> delegates;

    @Override
    public Object execute(CdiQueryInvocationContext context) {
        try {
            InvocationContext invocation = context.getInvocation();
            DelegateQueryHandler delegate = selectDelegate(context.getMethod());
            if (delegate != null) {
                return invoke(delegate, context);
            }
            return invocation.proceed();
        } catch (Exception e) {
            throw new QueryInvocationException(e, context);
        }
    }
View Full Code Here

            return null;
        }
    }
   
    private Object invoke(DelegateQueryHandler delegate, CdiQueryInvocationContext context) {
        InvocationContext invocation = context.getInvocation();
        try {
            return invoke(delegate, invocation.getMethod(), invocation.getParameters());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

@QueryInvocation(MethodType.DELEGATE)
public class DelegateQueryBuilder extends QueryBuilder {

    @Override
    public Object execute(QueryInvocationContext context) throws Exception {
        InvocationContext invocation = context.getInvocation();
        if (EntityDaoHandler.contains(invocation.getMethod())) {
            return callEntityHandler(invocation, context.getEntityClass(), context.getEntityManager());
        }
        return invocation.proceed();
    }
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

                            Object serviceObject,
                            Method m,
                            List<Object> params) {      
        Object result = null;
       
        InvocationContext invContext = exchange.get(InvocationContext.class);
        if (invContext == null) {
            LOG.debug("PreEJBInvoke");
            result = preEjbInvoke(exchange, serviceObject, m, params);
        } else {
            LOG.debug("EJBInvoke"); // calls performInvocation()
View Full Code Here

    @Override
    protected Object performInvocation(Exchange exchange,
                                       Object serviceObject,
                                       Method m,
                                       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);
       
        updateWebServiceContext(exchange, ctx);
View Full Code Here

            default: {
                // not reachable
                throw new IllegalStateException();
            }
        }
        final InvocationContext newContext = new SimpleInvocationContext(targetInstance, targetMethod, newParameters, context.getContextData(), null);
        final Object result = targetInterceptor.processInvocation(newContext);
        switch (passMode) {
            case REFERENCE_ONLY: {
                return result;
            }
View Full Code Here

        this.interceptors = interceptors;
    }

    /** {@inheritDoc} */
    public Object processInvocation(final InvocationContext context) throws Exception {
        final InvocationContext childContext = new DelegatingInvocationContext(context) {
            private int index = 0;

            public Object proceed() throws Exception {
                if (index < interceptors.length) {
                    try {
                        return interceptors[index++].processInvocation(this);
                    } finally {
                        index--;
                    }
                } else {
                    return super.proceed();
                }
            }
        };
        return childContext.proceed();
    }
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.