Package org.jboss.invocation

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 EjbLogger.ROOT_LOGGER.noEjbContextAvailable();
        }
        final ComponentInstance component = context.getPrivateData(ComponentInstance.class);
        if(!(component instanceof EjbComponentInstance)) {
            throw EjbLogger.ROOT_LOGGER.currentComponentNotAEjb(component);
        }
        return ((EjbComponentInstance)component).getEjbContext();
    }
View Full Code Here


        // per invocation
        return instance.getComponent().getCallerPrincipal();
    }

    public Map<String, Object> getContextData() {
        final InterceptorContext invocation = CurrentInvocationContext.get();
        return invocation.getContextData();
    }
View Full Code Here

        return instance.getComponent();
    }

    public boolean getRollbackOnly() throws IllegalStateException {
        // to allow override per invocation
        final InterceptorContext context = CurrentInvocationContext.get();
        if (context.getMethod() == null) {
            throw EjbLogger.ROOT_LOGGER.lifecycleMethodNotAllowed("getRollbackOnly");
        }
        return instance.getComponent().getRollbackOnly();
    }
View Full Code Here

        return getComponent().lookup(name);
    }

    public void setRollbackOnly() throws IllegalStateException {
        // to allow override per invocation
        final InterceptorContext context = CurrentInvocationContext.get();
        if (context.getMethod() == null) {
            throw EjbLogger.ROOT_LOGGER.lifecycleMethodNotAllowed("getRollbackOnly");
        }
        instance.getComponent().setRollbackOnly();
    }
View Full Code Here

        stateful = instance.getComponent() instanceof StatefulSessionComponent;
    }

    public <T> T getBusinessObject(Class<T> businessInterface) throws IllegalStateException {
        // to allow override per invocation
        final InterceptorContext invocation = CurrentInvocationContext.get();
        return getComponent().getBusinessObject(businessInterface, invocation);
    }
View Full Code Here

    }

    public EJBLocalObject getEJBLocalObject() throws IllegalStateException {
        AllowedMethodsInformation.checkAllowed(MethodType.GET_EJB_LOCAL_OBJECT);
        // to allow override per invocation
        final InterceptorContext invocation = CurrentInvocationContext.get();
        return getComponent().getEJBLocalObject(invocation);
    }
View Full Code Here

    }

    public EJBObject getEJBObject() throws IllegalStateException {
        AllowedMethodsInformation.checkAllowed(MethodType.GET_EJB_OBJECT);
        // to allow override per invocation
        final InterceptorContext invocation = CurrentInvocationContext.get();
        return getComponent().getEJBObject(invocation);
    }
View Full Code Here

        final InterceptorContext invocation = CurrentInvocationContext.get();
        return getComponent().getEJBObject(invocation);
    }

    public Class<?> getInvokedBusinessInterface() throws IllegalStateException {
        final InterceptorContext invocation = CurrentInvocationContext.get();
        final ComponentView view = invocation.getPrivateData(ComponentView.class);
        if (view.getViewClass().equals(getComponent().getEjbObjectType()) || view.getViewClass().equals(getComponent().getEjbLocalObjectType())) {
            throw EjbLogger.ROOT_LOGGER.cannotCall("getInvokedBusinessInterface", "EjbObject", "EJBLocalObject");
        }
        return view.getViewClass();
    }
View Full Code Here

    public SessionBeanComponent getComponent() {
        return (SessionBeanComponent) super.getComponent();
    }

    public MessageContext getMessageContext() throws IllegalStateException {
        final InterceptorContext invocation = CurrentInvocationContext.get();
        final MessageContext context = invocation.getPrivateData(MessageContext.class);
        if (context == null) {
            throw EjbLogger.ROOT_LOGGER.cannotCall("getMessageContext()", "MessageContext");

        }
        return context;
View Full Code Here

        }
        return context;
    }

    public boolean wasCancelCalled() throws IllegalStateException {
        final InterceptorContext invocation = CurrentInvocationContext.get();
        final CancellationFlag flag = invocation.getPrivateData(CancellationFlag.class);
        if (flag == null) {
            throw EjbLogger.ROOT_LOGGER.noAsynchronousInvocationInProgress();
        }
        return flag.get();
    }
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.