Package org.jboss.invocation

Examples of org.jboss.invocation.Interceptor


    }


    @Override
    public Interceptor create(final InterceptorFactoryContext context) {
        final Interceptor aroundInvoke = this.aroundInvoke.create(context);
        final Interceptor aroundTimeout;
        if(this.aroundTimeout != null) {
            aroundTimeout = this.aroundTimeout.create(context);
        } else {
            aroundTimeout = null;
        }
        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                final InvocationType marker = context.getPrivateData(InvocationType.class);
                if (marker == InvocationType.TIMER) {
                    return aroundTimeout.processInvocation(context);
                } else {
                    return aroundInvoke.processInvocation(context);
                }
            }
        };
View Full Code Here


    }


    @Override
    public Interceptor create(final InterceptorFactoryContext context) {
        final Interceptor aroundConstruct = aroundConstrctChain.create(context);
        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                aroundConstruct.processInvocation(context);
                context.setParameters(null);
                return context.proceed();
            }
        };
    }
View Full Code Here

        }

        @Override
        public Object invoke(InterceptorContext interceptorContext) throws Exception {
            final Method method = interceptorContext.getMethod();
            final Interceptor interceptor = viewInterceptors.get(method);
            return interceptor.processInvocation(interceptorContext);
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Interceptor getInterceptor(final Method method) throws IllegalStateException {
        Interceptor interceptor = methodMap.get(method);
        if (interceptor == null) {
            throw EeLogger.ROOT_LOGGER.methodNotFound(method);
        }
        return interceptor;
    }
View Full Code Here

        this.componentView = componentView;
    }

    /** {@inheritDoc} */
    public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
        final Interceptor interceptor = interceptors.get(method);
        if (interceptor == null) {
            throw new NoSuchMethodError(method.toString());
        }
        final InterceptorContext context = new InterceptorContext();
        // special location for original proxy
        context.putPrivateData(Object.class, proxy);
        context.putPrivateData(Component.class, componentView.getComponent());
        context.putPrivateData(ComponentView.class, componentView);
        instance.prepareInterceptorContext(context);
        context.setParameters(args);
        context.setMethod(method);
        // setup the public context data
        context.setContextData(new HashMap<String, Object>());
        return interceptor.processInvocation(context);
    }
View Full Code Here

    }


    @Override
    public Interceptor create(final InterceptorFactoryContext context) {
        final Interceptor aroundInvoke = this.aroundInvoke.create(context);
        final Interceptor aroundTimeout = this.aroundTimeout.create(context);
        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                final

                TimerInvocationMarker marker = context.getPrivateData(TimerInvocationMarker.class);
                if (marker == null) {
                    return aroundInvoke.processInvocation(context);
                } else {
                    return aroundTimeout.processInvocation(context);
                }
            }
        };

    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Interceptor getInterceptor(final Method method) throws IllegalStateException {
        Interceptor interceptor = methodMap.get(method);
        if (interceptor == null) {
            throw MESSAGES.methodNotFound(method);
        }
        return interceptor;
    }
View Full Code Here

        // Interceptor factory context
        final SimpleInterceptorFactoryContext context = new SimpleInterceptorFactoryContext();
        context.getContextData().put(Component.class, this);

        // Create the post-construct interceptors for the ComponentInstance
        final Interceptor componentInstancePostConstructInterceptor = this.getPostConstruct().create(context);
        // create the pre-destroy interceptors
        final Interceptor componentInstancePreDestroyInterceptor = this.getPreDestroy().create(context);

        @SuppressWarnings("unchecked")
        final AtomicReference<ManagedReference> instanceReference = (AtomicReference<ManagedReference>) context.getContextData().get(BasicComponentInstance.INSTANCE_KEY);

        instanceReference.set(instance);
View Full Code Here

    private final InjectedValue<ComponentView> viewToCreate = new InjectedValue<ComponentView>();

    @Override
    public Interceptor create(final InterceptorFactoryContext context) {

        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                final EntityBeanComponentInstance instance = (EntityBeanComponentInstance) context.getPrivateData(ComponentInstance.class);
                try {
                    return viewToCreate.getValue().createInstance().getInstance();
View Full Code Here

            @Override
            public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException {

                //add the invocation type to the start of the chain
                //TODO: is there a cleaner way to do this?
                configuration.addViewInterceptor(new ImmediateInterceptorFactory(new Interceptor() {
                    @Override
                    public Object processInvocation(final InterceptorContext context) throws Exception {
                        context.putPrivateData(InvocationType.class, InvocationType.MESSAGE_DELIVERY);
                        return context.proceed();
                    }
View Full Code Here

TOP

Related Classes of org.jboss.invocation.Interceptor

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.