Examples of InterceptorStack


Examples of br.com.caelum.vraptor.core.InterceptorStack

    HttpServletRequest request = (HttpServletRequest) context.getProperties().get(DefaultJersey.REQUEST);
    request.setAttribute(METHOD_TO_EXECUTE, method);
    request.setAttribute(RESOURCE_TO_USE, resource);
    request.setAttribute(DISPATCHER, this);
    request.setAttribute(HTTP_CONTEXT, context);
    InterceptorStack stack = (InterceptorStack) request.getAttribute(DefaultJersey.INTERCEPTOR_STACK);
    stack.next(this, resource);
  }
View Full Code Here

Examples of com.intellij.struts2.dom.struts.strutspackage.InterceptorStack

    final String text = nameAttributeValue.getValue();
    final boolean hasDot = StringUtil.containsChar(text, '.');
    final int idx = hasDot ? text.indexOf('.') : text.length();
    final String refName = text.substring(0, idx);

    final InterceptorStack stack = (InterceptorStack) value;
    final InterceptorRef resolvedInterceptorRef =
        ContainerUtil.find(stack.getInterceptorRefs(), new Condition<InterceptorRef>() {
          @Override
          public boolean value(final InterceptorRef ref) {
            return Comparing.strEqual(refName, ref.getName().getStringValue());
          }
        });
View Full Code Here

Examples of mfinder.annotation.InterceptorStack

     *
     * @throws IllegalAccessException 如果调用的对象无法访问指定字段。
     */
    private InterceptorStackProxy createInterceptorStackProxy(Field field, Object obj) throws
            IllegalAccessException {
        InterceptorStack interceptorStack = field.getAnnotation(InterceptorStack.class);
        String name = interceptorStack.name().trim();

        //interceptorStack name
        //未指定拦截栈名称则取字符串的值为名称
        if (StringUtil.isNull(name)) {
            name = field.get(obj).toString();
            //空命名异常
            if (StringUtil.isNull(name))
                throw new IllegalArgumentException("Null name in InterceptorStack : "
                        + field.getName() + " at " + obj.getClass());
        }
        //interceptors name
        String[] names = interceptorStack.interceptors();

        List<InterceptorProxy> list = null;
        if (names != null) {
            list = new ArrayList<InterceptorProxy>(names.length);
            //add interceptorStack
View Full Code Here

Examples of org.apache.hivemind.InterceptorStack

                }

            });
        replay(rootService, realCreatedService);

        InterceptorStack stack = new InterceptorStackImpl(log, servicePoint, rootService);

        // create the interceptor
        factory.createInterceptor(stack, invokingModule, parameters);
        ServiceImplementationFactory intercepted = (ServiceImplementationFactory) stack.peek();

        assertNotNull(intercepted);

        SomeService result = (SomeService) intercepted.createCoreServiceImplementation(factoryParameters);
        MockSwitcher switcher = (MockSwitcher) Proxy.getInvocationHandler(result);
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

            interceptorInstances.put(beanClass.getName(), beanInstance);

            // Invoke post construct method
            callContext.setCurrentOperation(Operation.POST_CONSTRUCT);
            final List<InterceptorData> callbackInterceptors = this.getCallbackInterceptors();
            final InterceptorStack postConstruct = new InterceptorStack(beanInstance, null, Operation.POST_CONSTRUCT, callbackInterceptors, interceptorInstances);
           
            //Transaction Demarcation for Singleton PostConstruct method
            TransactionType transactionType;

            if (getComponentType() == BeanType.SINGLETON) {
                Set<Method> callbacks = callbackInterceptors.get(callbackInterceptors.size() -1).getPostConstruct();
                if (callbacks.isEmpty()) {
                    transactionType = TransactionType.RequiresNew;
                } else {
                    transactionType = getTransactionType(callbacks.iterator().next());
                    if (transactionType == TransactionType.Required) {
                        transactionType = TransactionType.RequiresNew;
                    }
                }
            } else {
                transactionType = isBeanManagedTransaction()? TransactionType.BeanManaged: TransactionType.NotSupported;
            }
            TransactionPolicy transactionPolicy = EjbTransactionUtil.createTransactionPolicy(transactionType, callContext);
            try{
                //Call the chain
                postConstruct.invoke();               
            } catch(Throwable e) {
                //RollBack Transaction
                EjbTransactionUtil.handleSystemException(transactionPolicy, e, callContext);
            }
            finally{
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

                final Operation originalOperation = callContext.getCurrentOperation();
                try {
                    callContext.setCurrentOperation(Operation.CREATE);
                    final Method create = beanContext.getCreateMethod();
                    final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap());
                    ejbCreate.invoke();
                } finally {
                    callContext.setCurrentOperation(originalOperation);
                }
            }
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

            BeanContext beanContext = callContext.getBeanContext();

            Method remove = instance.bean instanceof SessionBean? removeSessionBeanMethod : null;

            List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
            InterceptorStack interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);

            interceptorStack.invoke();

            if (instance.creationalContext != null) {
                instance.creationalContext.release();
            }
        } catch (Throwable re) {
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

                    // Setup for business invocation
                    Method createOrInit = beanContext.getMatchingBeanMethod(callMethod);
                    createContext.set(Method.class, createOrInit);

                    // Initialize interceptor stack
                    InterceptorStack interceptorStack = new InterceptorStack(instance.bean, createOrInit, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap<String, Object>());

                    // Invoke
                    if (args == null){
                        interceptorStack.invoke();
                    } else {
                        interceptorStack.invoke(args);
                    }
                }
            } catch (Throwable e) {
                handleException(createContext, txPolicy, e);
            } finally {
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

                        args = new Object[]{};
                    }

                    // Initialize interceptor stack
                    List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
                    InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, Operation.REMOVE, interceptors, instance.interceptors);

                    // Invoke
                    if (args == null){
                        returnValue = interceptorStack.invoke();
                    } else {
                        returnValue = interceptorStack.invoke(args);
                    }
                }
            } catch (InvalidateReferenceException e) {
                throw e;
            } catch (Throwable e) {
                if (interfaceType.isBusiness()) {
                    retain = beanContext.retainIfExeption(runMethod);
                    handleException(callContext, txPolicy, e);
                } else {
                    try {
                        handleException(callContext, txPolicy, e);
                    } catch (ApplicationException ae){
                        // Don't throw application exceptions for non-business interface removes
                    }
                }
            } finally {
                if (!retain) {
                    try {
                        callContext.setCurrentOperation(Operation.PRE_DESTROY);
                        List<InterceptorData> callbackInterceptors = beanContext.getCallbackInterceptors();
                        if (instance != null) {
                            InterceptorStack interceptorStack = new InterceptorStack(instance.bean, null, Operation.PRE_DESTROY, callbackInterceptors, instance.interceptors);
                            interceptorStack.invoke();
                        }
                    } catch (Throwable t) {
                        final String logMessage = "An unexpected exception occured while invoking the preDestroy method on the Stateful SessionBean instance: "
                                + (null != instance ? instance.bean.getClass().getName() : beanContext.getBeanClass().getName());
                        logger.error(logMessage, t);
View Full Code Here

Examples of org.apache.openejb.core.interceptor.InterceptorStack

                Method runMethod = beanContext.getMatchingBeanMethod(callMethod);
                callContext.set(Method.class, runMethod);

                // Initialize interceptor stack
                List<InterceptorData> interceptors = beanContext.getMethodInterceptors(runMethod);
                InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, Operation.BUSINESS, interceptors, instance.interceptors);

                // Invoke
                returnValue = interceptorStack.invoke(args);
            } catch (Throwable e) {
                handleException(callContext, txPolicy, e);
            } finally {
                // un register EntityManager
                unregisterEntityManagers(instance, callContext);
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.