Package org.jboss.invocation

Examples of org.jboss.invocation.Interceptor


                    rolesAllowed.addAll(attr.getRolesAllowed());
                }
                ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(rolesAllowed);
            }

            final Interceptor authorizationInterceptor = new AuthorizationInterceptor(ejbMethodSecurityMetaData, viewClassName, viewMethod, contextID);
            viewConfiguration.addViewInterceptor(viewMethod, new ImmediateInterceptorFactory(authorizationInterceptor), InterceptorOrder.View.EJB_SECURITY_AUTHORIZATION_INTERCEPTOR);
            return true;
        }
        return false;
    }
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

        final Method ejbCreate = (Method) context.getContextData().get(EntityBeanHomeCreateInterceptorFactory.EJB_CREATE_METHOD_KEY);
        final Method ejbPostCreate = (Method) context.getContextData().get(EntityBeanHomeCreateInterceptorFactory.EJB_POST_CREATE_METHOD_KEY);
        final Object[] params = (Object[]) context.getContextData().get(EntityBeanHomeCreateInterceptorFactory.PARAMETERS_KEY);

        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {

                if (existing != null) {
                    primaryKeyReference.set(existing);
View Full Code Here

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

    private final Interceptor interceptor;

    public EntityGetHomeInterceptorFactory() {
        interceptor = 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 Interceptor create(final InterceptorFactoryContext context) {

        final EntityBeanComponent component = (EntityBeanComponent) context.getContextData().get(Component.class);

        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {

                //grab a bean from the pool to invoke the finder method on
                final EntityBeanComponentInstance instance = component.acquireUnAssociatedInstance();
View Full Code Here

        this.ejbPostCreate = ejbPostCreate;
    }

    @Override
    public Interceptor create(final InterceptorFactoryContext context) {
        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                final ComponentView view = viewToCreate.getValue();
                final HashMap<Object, Object> ctx = new HashMap<Object, Object>();
                ctx.put(EJB_CREATE_METHOD_KEY, ejbCreate);
View Full Code Here

    @Override
    public Interceptor create(final InterceptorFactoryContext context) {

        final EntityBeanComponent component = (EntityBeanComponent) context.getContextData().get(Component.class);

        return new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {

                //grab a bean from the pool to invoke the business method on
                final EntityBeanComponentInstance instance = component.acquireUnAssociatedInstance();
View Full Code Here

    public static final EntityBeanHomeRemoveByHandleInterceptorFactory INSTANCE = new EntityBeanHomeRemoveByHandleInterceptorFactory();

    private final Interceptor interceptor;

    private EntityBeanHomeRemoveByHandleInterceptorFactory() {
        interceptor = new Interceptor() {
            public Object processInvocation(final InterceptorContext interceptorContext) throws Exception {
                final Handle handle = (Handle) interceptorContext.getParameters()[0];
                handle.getEJBObject().remove();
                return null;
            }
View Full Code Here

    public void callTimeout(final TimerImpl timer, final Method timeoutMethod) throws Exception {
        if(!started) {
            //this can happen if an invocation has been triggered as the deployment is shutting down
            throw EjbMessages.MESSAGES.timerInvocationFailedDueToInvokerNotBeingStarted();
        }
        final Interceptor interceptor = timeoutInterceptors.get(timeoutMethod);
        if(interceptor == null) {
            throw EjbMessages.MESSAGES.failToInvokeTimeout(timeoutMethod);
        }
        final InterceptorContext context = new InterceptorContext();
        context.setContextData(new HashMap<String, Object>());
        context.setMethod(timeoutMethod);
        if(timeoutMethod.getParameterTypes().length == 0) {
            context.setParameters(new Object[0]);
        } else {
            final Object[] params = new Object[1];
            params[0] = timer;
            context.setParameters(params);
        }
        context.setTimer(timer);

        if(timer.getPrimaryKey() != null) {
            context.putPrivateData(EntityBeanComponent.PRIMARY_KEY_CONTEXT_KEY, timer.getPrimaryKey());
        }
        context.putPrivateData(Component.class, ejbComponent.getValue());
        context.putPrivateData(MethodIntf.class, MethodIntf.TIMER);
        context.putPrivateData(InvocationType.class, InvocationType.TIMER);
        interceptor.processInvocation(context);
    }
View Full Code Here

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

    private final Interceptor interceptor;

    public GetHomeInterceptorFactory() {
        interceptor = new Interceptor() {
            @Override
            public Object processInvocation(final InterceptorContext context) throws Exception {
                return viewToCreate.getValue().createInstance().getInstance();
            }
        };
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.