Package org.jboss.invocation

Examples of org.jboss.invocation.InterceptorContext


                    final SecurityContext sc = SecurityContextFactory.createSecurityContext("CORBA_REMOTE");
                    sc.getUtil().createSubjectInfo(principal, password, null);

                    //TODO: deal with the transaction
                    final InterceptorContext interceptorContext = new InterceptorContext();
                    interceptorContext.setContextData(new HashMap<String, Object>());
                    interceptorContext.setParameters(params);
                    interceptorContext.setMethod(op.getMethod());
                    interceptorContext.putPrivateData(ComponentView.class, componentView);
                    interceptorContext.putPrivateData(Component.class, componentView.getComponent());
                    retVal = componentView.invoke(interceptorContext);
                } finally {
                    if (tx != null) {
                        if (transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION) {
                            transactionManager.suspend();
View Full Code Here


        if (tx != null) {
            transactionManager.resume(tx);
        }
        try {
            final InterceptorContext interceptorContext = new InterceptorContext();
            interceptorContext.setContextData(new HashMap<String, Object>());
            interceptorContext.setParameters(arguments);
            interceptorContext.setMethod(op.getMethod());
            interceptorContext.putPrivateData(ComponentView.class, componentView);
            interceptorContext.putPrivateData(Component.class, componentView.getComponent());
            return componentView.invoke(interceptorContext);
        } finally {
            if (tx != null) {
                if (transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION) {
                    transactionManager.suspend();
View Full Code Here


                    final SecurityContext sc = SecurityContextFactory.createSecurityContext("CORBA_REMOTE");
                    sc.getUtil().createSubjectInfo(principal, password, null);

                    final InterceptorContext interceptorContext = new InterceptorContext();

                    //todo: could this be nicer
                    if (componentView.getComponent() instanceof StatefulSessionComponent) {
                        final SessionID sessionID = (SessionID) unmarshalIdentifier();
                        interceptorContext.putPrivateData(SessionID.SESSION_ID_KEY, sessionID);
                    } else if (componentView.getComponent() instanceof EntityBeanComponent) {
                        final Object pk = unmarshalIdentifier();
                        interceptorContext.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, pk);
                    }
                    interceptorContext.setContextData(new HashMap<String, Object>());
                    interceptorContext.setParameters(params);
                    interceptorContext.setMethod(op.getMethod());
                    interceptorContext.putPrivateData(ComponentView.class, componentView);
                    interceptorContext.putPrivateData(Component.class, componentView.getComponent());
                    retVal = componentView.invoke(interceptorContext);
                } finally {
                    if (tx != null) {
                        if (transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION) {
                            transactionManager.suspend();
View Full Code Here

        }
        if (tx != null) {
            transactionManager.resume(tx);
        }
        try {
            final InterceptorContext interceptorContext = new InterceptorContext();
            //todo: could this be nicer
            if (componentView.getComponent() instanceof StatefulSessionComponent) {
                final SessionID sessionID = (SessionID) unmarshalIdentifier();
                interceptorContext.putPrivateData(SessionID.SESSION_ID_KEY, sessionID);
            } else if (componentView.getComponent() instanceof EntityBeanComponent) {
                final Object pk = unmarshalIdentifier();
                interceptorContext.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, pk);
            }
            //TODO: deal with the transaction

            interceptorContext.setContextData(new HashMap<String, Object>());
            interceptorContext.setParameters(arguments);
            interceptorContext.setMethod(op.getMethod());
            interceptorContext.putPrivateData(ComponentView.class, componentView);
            interceptorContext.putPrivateData(Component.class, componentView.getComponent());
            return componentView.invoke(interceptorContext);
        } finally {
            if (tx != null) {
                if (transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION) {
                    transactionManager.suspend();
View Full Code Here

            for (int i = 0; i < parameters.length; ++i) {
                parameters[i] = clone(method.getParameterTypes()[i], parameterCloner, invocation.getParameters()[i], allowPassByReference);
            }
        }

        final InterceptorContext context = new InterceptorContext();
        context.setParameters(parameters);
        context.setMethod(method);
        context.setTarget(invocation.getInvokedProxy());
        context.setContextData(new HashMap<String, Object>());
        context.putPrivateData(Component.class, ejbComponent);
        context.putPrivateData(ComponentView.class, view);

        if (locator instanceof StatefulEJBLocator) {
            final SessionID sessionID = ((StatefulEJBLocator) locator).getSessionId();
            context.putPrivateData(SessionID.SESSION_ID_KEY, sessionID);
        } else if (locator instanceof EntityEJBLocator) {
            final Object primaryKey = ((EntityEJBLocator) locator).getPrimaryKey();
            context.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, primaryKey);
        }

        final ClonerConfiguration config = new ClonerConfiguration();
        config.setClassCloner(new ClassLoaderClassCloner(invocation.getInvokedProxy().getClass().getClassLoader()));
        final ObjectCloner resultCloner = ObjectCloners.getSerializingObjectClonerFactory().createCloner(config);
        if (async) {
            if (ejbComponent instanceof SessionBeanComponent) {
                final SessionBeanComponent component = (SessionBeanComponent) ejbComponent;
                final CancellationFlag flag = new CancellationFlag();
                final AsyncInvocationTask task = new AsyncInvocationTask(flag) {

                    @Override
                    protected Object runInvocation() throws Exception {
                        return view.invoke(context);
                    }
                };
                context.putPrivateData(CancellationFlag.class, flag);
                component.getAsynchronousExecutor().submit(task);
                //TODO: we do not clone the result of an async task
                //TODO: we do not clone the exception of an async task
                receiverContext.resultReady(new ImmediateResultProducer(task));
            } else {
View Full Code Here

    /**
     * @return The primary key of the current EJB, or null if not applicable
     */
    private Object currentPrimaryKey() {

        final InterceptorContext context = CurrentInvocationContext.get();

        if (context == null) {
            return null;
        }
        return context.getPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY);
    }
View Full Code Here

     * </p>
     *
     * @return
     */
    protected boolean isLifecycleCallbackInvocation() {
        final InterceptorContext currentInvocationContext = CurrentInvocationContext.get();
        if (currentInvocationContext == null) {
            return false;
        }
        // If the method in current invocation context is null,
        // then it represents a lifecycle callback invocation
        Method invokedMethod = currentInvocationContext.getMethod();
        if (invokedMethod == null) {
            // it's a lifecycle callback
            return true;
        }
        // not a lifecycle callback
View Full Code Here

        }
    }

    protected TransactionAttributeType getCurrentTransactionAttribute() {

        final InterceptorContext invocation = CurrentInvocationContext.get();
        final MethodIntf methodIntf = MethodIntfHelper.of(invocation);
        return getTransactionAttributeType(methodIntf, invocation.getMethod());
    }
View Full Code Here

        }

        @Override
        public Object getInstance() {
            // get the current invocation context and the EJBComponent out of it
            final InterceptorContext currentInvocationContext = CurrentInvocationContext.get();
            final EJBComponent ejbComponent = (EJBComponent) currentInvocationContext.getPrivateData(Component.class);
            if (ejbComponent == null) {
                throw EjbLogger.ROOT_LOGGER.failToGetEjbComponent(currentInvocationContext);
            }
            return ejbComponent.getTimerService();
        }
View Full Code Here

    private static class EJBContextHandle implements SetupContextHandle, ResetContextHandle {

        private final transient InterceptorContext interceptorContext;

        private EJBContextHandle() {
            final InterceptorContext interceptorContext = CurrentInvocationContext.get();
            if(interceptorContext != null) {
                this.interceptorContext = interceptorContext.clone();
                // overwrite invocation type so EE concurrency tasks have special access to resources such as the user tx
                this.interceptorContext.putPrivateData(InvocationType.class, InvocationType.CONCURRENT_CONTEXT);
            } else {
                this.interceptorContext = null;
            }
View Full Code Here

TOP

Related Classes of org.jboss.invocation.InterceptorContext

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.