Examples of InterceptorContext


Examples of net.sourceforge.javautil.groovy.builder.GroovyBuilderInterceptor.InterceptorContext

   * It does NOT invoke any methods, even if a meta method was found for the call.
   */
  public Object invokeMethod(String name, Object args) {
    if (!this.isStackInitialized()) this.initializeStack();
    Object[] arguments = InvokerHelper.asArray(args);
    return interceptor.handleInvokedMethod(new InterceptorContext( this, this.getStack(), name, arguments ));
  }
View Full Code Here

Examples of org.apache.ldap.server.interceptor.InterceptorContext

            // If custom interceptor is not specified, use defaule one.

            interceptor = InterceptorChain.newDefaultChain();
        }

        interceptor.init( new InterceptorContext( initialEnv, system, globalRegistries, nexus,
                InterceptorConfigBuilder.build( initialEnv, EnvKeys.INTERCEPTORS ) ) );

        provider.setInterceptor( interceptor );

        // fire up the app partitions now!
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

    public final void destroy() {
        if (doneUpdater.compareAndSet(this, 0, 1)) try {
            preDestroy();
            final ManagedReference reference = instanceReference.get();
            if (reference != null) {
                final InterceptorContext interceptorContext = prepareInterceptorContext();
                interceptorContext.setTarget(reference.getInstance());
                interceptorContext.putPrivateData(InvocationType.class, InvocationType.PRE_DESTROY);
                preDestroy.processInvocation(interceptorContext);
            }
        } catch (Exception e) {
            ROOT_LOGGER.componentDestroyFailure(e, this);
        } finally {
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

    protected void preDestroy() {

    }

    protected InterceptorContext prepareInterceptorContext() {
        final InterceptorContext interceptorContext = new InterceptorContext();
        interceptorContext.putPrivateData(Component.class, component);
        interceptorContext.putPrivateData(ComponentInstance.class, this);
        interceptorContext.setContextData(new HashMap<String, Object>());
        return interceptorContext;
    }
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

        // create the component instance
        final BasicComponentInstance basicComponentInstance = this.instantiateComponentInstance(instanceReference, componentInstancePreDestroyInterceptor, interceptorMap, context);

        if (invokePostConstruct) {
            // now invoke the postconstruct interceptors
            final InterceptorContext interceptorContext = new InterceptorContext();
            interceptorContext.putPrivateData(Component.class, this);
            interceptorContext.putPrivateData(ComponentInstance.class, basicComponentInstance);
            interceptorContext.putPrivateData(InvocationType.class, InvocationType.POST_CONSTRUCT);
            interceptorContext.setContextData(new HashMap<String, Object>());

            try {
                componentInstancePostConstructInterceptor.processInvocation(interceptorContext);
            } catch (Exception e) {
                throw MESSAGES.componentConstructionFailure(e);
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

    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, component);
        context.putPrivateData(ComponentView.class, componentView);
        context.setParameters(args);
        context.setMethod(method);
        // setup the public context data
        context.setContextData(new HashMap());
        return interceptor.processInvocation(context);
    }
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

                Throwable cause = e.getCause();
                if (cause != null) error.initCause(cause);
                throw error;
            }

            InterceptorContext context = new InterceptorContext();
            context.putPrivateData(ComponentView.class, componentView);
            context.putPrivateData(Component.class, component);
            context.setContextData(new HashMap<String, Object>());
            clientPostConstructInterceptor.processInvocation(context);

            return new ManagedReference() {

                @Override
                public void release() {
                    try {
                        InterceptorContext interceptorContext = new InterceptorContext();
                        interceptorContext.putPrivateData(ComponentView.class, componentView);
                        interceptorContext.putPrivateData(Component.class, component);
                        clientPreDestroyInterceptor.processInvocation(interceptorContext);
                    } catch (Exception e) {
                        ROOT_LOGGER.preDestroyInterceptorFailure(e, component.getComponentClass());
                    }
                }
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

     * association should be gone (and thus it is ready for another tx).
     */
    @Test
    public void testDifferentTx() throws Exception {
        final Interceptor interceptor = new StatefulSessionSynchronizationInterceptor(true);
        final InterceptorContext context = new InterceptorContext();
        context.setInterceptors(Arrays.asList(noop()));
        final StatefulSessionComponent component = mock(StatefulSessionComponent.class);
        context.putPrivateData(Component.class, component);
        when(component.getAccessTimeout(null)).thenReturn(defaultAccessTimeout());
        Cache<SessionID, StatefulSessionComponentInstance> cache = mock(Cache.class);
        when(component.getCache()).thenReturn(cache);
        final TransactionSynchronizationRegistry transactionSynchronizationRegistry = mock(TransactionSynchronizationRegistry.class);
        when(component.getTransactionSynchronizationRegistry()).thenReturn(transactionSynchronizationRegistry);
        when(transactionSynchronizationRegistry.getTransactionKey()).thenReturn("TX1");
        final List<Synchronization> synchronizations = new LinkedList<Synchronization>();
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                Synchronization synchronization = (Synchronization) invocation.getArguments()[0];
                synchronizations.add(synchronization);
                return null;
            }
        }).when(transactionSynchronizationRegistry).registerInterposedSynchronization((Synchronization) any());
        final StatefulSessionComponentInstance instance = mock(StatefulSessionComponentInstance.class);
        when(instance.getComponent()).thenReturn(component);
        context.putPrivateData(ComponentInstance.class, instance);

        interceptor.processInvocation(context);

        // commit
        for (Synchronization synchronization : synchronizations) {
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

*/
public class CurrentInvocationContext {
    private static final ThreadLocalStack<InterceptorContext> stack = new ThreadLocalStack<InterceptorContext>();

    public static InterceptorContext get() {
        InterceptorContext current = stack.get();
        return current;
    }
View Full Code Here

Examples of org.jboss.invocation.InterceptorContext

    public static <T extends InterceptorContext> T get(Class<T> expectedType) {
        return expectedType.cast(get());
    }

    public static EJBContextImpl getEjbContext() {
        final InterceptorContext context = get();
        if(context == null) {
            throw MESSAGES.noEjbContextAvailable();
        }
        final ComponentInstance component = context.getPrivateData(ComponentInstance.class);
        if(!(component instanceof EjbComponentInstance)) {
            throw MESSAGES.currentComponentNotAEjb(component);
        }
        return ((EjbComponentInstance)component).getEjbContext();
    }
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.