Package org.jboss.invocation

Examples of org.jboss.invocation.SimpleInterceptorFactoryContext


    }

    protected Interceptor createInterceptor(final InterceptorFactory factory) {
        if (factory == null)
            return null;
        final SimpleInterceptorFactoryContext context = new SimpleInterceptorFactoryContext();
        context.getContextData().put(Component.class, this);
        return factory.create(context);
    }
View Full Code Here


        public ComponentViewInstance createInstance() {
            return createInstance(Collections.<Object, Object>emptyMap());
        }

        public ComponentViewInstance createInstance(Map<Object, Object> contextData) {
            final SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
            final Map<Method, InterceptorFactory> viewInterceptorFactories = ViewService.this.viewInterceptorFactories;
            final Map<Method, Interceptor> viewEntryPoints = new IdentityHashMap<Method, Interceptor>(viewInterceptorFactories.size());
            factoryContext.getContextData().put(Component.class, component);
            factoryContext.getContextData().put(ComponentView.class, this);
            factoryContext.getContextData().putAll(contextData);
            final Interceptor postConstructInterceptor = viewPostConstruct.create(factoryContext);

            for (Method method : viewInterceptorFactories.keySet()) {
                viewEntryPoints.put(method, viewInterceptorFactories.get(method).create(factoryContext));
            }
View Full Code Here

            public Class<?> getViewClass() {
                return viewClass;
            }

            public Object createProxy() {
                final SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
                factoryContext.getContextData().put(Component.class, component);
                factoryContext.getContextData().put(ComponentView.class, View.this);
                factoryContext.getContextData().put(ComponentViewInstance.class, this);

                final Map<Method, InterceptorFactory> clientInterceptorFactories = ViewService.this.clientInterceptorFactories;
                final Map<Method, Interceptor> clientEntryPoints = new IdentityHashMap<Method, Interceptor>(clientInterceptorFactories.size());
                for (Method method : clientInterceptorFactories.keySet()) {
                    clientEntryPoints.put(method, clientInterceptorFactories.get(method).create(factoryContext));
View Full Code Here

     * @param instance An instance to be wrapped, or null if a new instance should be created
     * @return the component instance
     */
    protected final BasicComponentInstance constructComponentInstance(ManagedReference instance) {
        // 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);

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

        instanceReference.set(instance);

        final Map<Method, InterceptorFactory> interceptorFactoryMap = this.getInterceptorFactoryMap();
        // This is an identity map.  This means that only <b>certain</b> {@code Method} objects will
View Full Code Here

        return module.getClassLoader();
    }

    @Override
    public synchronized void start(final StartContext context) throws StartException {
        SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
        factoryContext.getContextData().put(Component.class, ejbComponent.getValue());
        Map<Method, Interceptor> interceptors = new HashMap<Method, Interceptor>();
        for(Map.Entry<Method, InterceptorFactory> entry : ejbComponent.getValue().getTimeoutInterceptors().entrySet()) {
            interceptors.put(entry.getKey(), entry.getValue().create(factoryContext));
        }
        this.timeoutInterceptors = interceptors;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public synchronized void start() {
        final InterceptorFactoryContext context = new SimpleInterceptorFactoryContext();
        context.getContextData().put(Component.class, this);
        createInterceptors(context);


        this.stopping.set(false);
        gate = true;
View Full Code Here

            this.viewInterceptors = new IdentityHashMap<Method, Interceptor>();
            this.methods = new HashMap<MethodDescription, Method>();
        }

        void initializeInterceptors() {
            final SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
            final Map<Method, InterceptorFactory> viewInterceptorFactories = ViewService.this.viewInterceptorFactories;
            final Map<Method, Interceptor> viewEntryPoints = viewInterceptors;
            factoryContext.getContextData().put(Component.class, component);
            //we don't have this code in the constructor so we avoid passing around
            //a half constructed instance
            factoryContext.getContextData().put(ComponentView.class, this);

            for (Method method : viewInterceptorFactories.keySet()) {
                viewEntryPoints.put(method, viewInterceptorFactories.get(method).create(factoryContext));
                methods.put(new MethodDescription(method.getName(), DescriptorUtils.methodDescriptor(method)), method);
            }
View Full Code Here

        // Construct the view
        View view = new View(privateData);
        view.initializeInterceptors();
        this.view = view;

        final SimpleInterceptorFactoryContext factoryContext = new SimpleInterceptorFactoryContext();
        final Component component = view.getComponent();
        factoryContext.getContextData().put(Component.class, component);
        factoryContext.getContextData().put(ComponentView.class, view);

        clientPostConstructInterceptor = clientPostConstruct.create(factoryContext);
        clientPreDestroyInterceptor = clientPreDestroy.create(factoryContext);

        final Map<Method, InterceptorFactory> clientInterceptorFactories = ViewService.this.clientInterceptorFactories;
View Full Code Here

     * @param instance An instance to be wrapped, or null if a new instance should be created
     * @return the component instance
     */
    protected final BasicComponentInstance constructComponentInstance(ManagedReference instance, boolean invokePostConstruct) {
        // 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);

        final Map<Method, InterceptorFactory> interceptorFactoryMap = this.getInterceptorFactoryMap();
        // This is an identity map.  This means that only <b>certain</b> {@code Method} objects will
View Full Code Here

    }

    protected Interceptor createInterceptor(final InterceptorFactory factory) {
        if (factory == null)
            return null;
        final InterceptorFactoryContext context = new SimpleInterceptorFactoryContext();
        context.getContextData().put(Component.class, this);
        return factory.create(context);
    }
View Full Code Here

TOP

Related Classes of org.jboss.invocation.SimpleInterceptorFactoryContext

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.