Package org.jboss.as.ee.component

Examples of org.jboss.as.ee.component.ComponentInstance


    @Override
    public Object processInvocation(InterceptorContext interceptorContext) throws Exception {
        SingletonComponent singletonComponent = this.getComponent(interceptorContext, SingletonComponent.class);
        // get the component instance
        ComponentInstance singletonComponentInstance = singletonComponent.getComponentInstance();
        if (singletonComponent == null) {
            throw new Exception("Component instance isn't available for invocation: " + interceptorContext);
        }
        interceptorContext.putPrivateData(ComponentInstance.class, singletonComponentInstance);
        return interceptorContext.proceed();
View Full Code Here


    /** {@inheritDoc} */
    @Override
    public Interceptor createClientInterceptor(final Class<?> viewClass) {
        // One instance per client lookup.
        final ComponentInstance instance = createInstance();
        return new Interceptor() {
            public Object processInvocation(final InterceptorContext context) throws Exception {
                context.putPrivateData(ComponentInstance.class, instance);
                return context.proceed();
            }
View Full Code Here

        final InterceptorContext context = CurrentInvocationContext.get();

        if (context == null) {
            return null;
        }
        final ComponentInstance instance = context.getPrivateData(ComponentInstance.class);
        if (instance instanceof EntityBeanComponentInstance) {
            return ((EntityBeanComponentInstance) instance).getPrimaryKey();
        }
        return null;
    }
View Full Code Here

    /** {@inheritDoc} */
    @Override
    public Interceptor createClientInterceptor(final Class<?> viewClass) {
        // One instance per client lookup.
        final ComponentInstance instance = createInstance();
        return new Interceptor() {
            public Object processInvocation(final InterceptorContext context) throws Exception {
                context.putPrivateData(ComponentInstance.class, instance);
                return context.proceed();
            }
View Full Code Here

        public InstanceMethodInvokingInterceptor(final Method componentMethod) {
            this.componentMethod = componentMethod;
        }

        public Object processInvocation(final InterceptorContext context) throws Exception {
            ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
            if (componentInstance == null) {
                throw new IllegalStateException("No component instance associated");
            }
            return componentMethod.invoke(componentInstance.getInstance(), context.getParameters());
        }
View Full Code Here

                    // only POJO endpoints have to be initialized. EJB3 endpoints are handled by the EJB3 susbystem.
                    final ServiceName endpointComponentName = getEndpointComponentServiceName();
                    final ServiceController<BasicComponent> endpointController = getComponentController(endpointComponentName);
                    if (endpointController != null) {
                        final BasicComponent endpointComponent = endpointController.getValue();
                        final ComponentInstance endpointComponentInstance = endpointComponent.createInstance(delegate.getInstance(className).getValue());
                        final Object endpointInstance = endpointComponentInstance.getInstance();
                        // mark reference as initialized because JBoss server initialized it
                        final Reference endpointReference = ReferenceFactory.newInitializedReference(endpointInstance);
                        return cacheAndGet(endpointReference);
                    }
                }
            } else {
                // handle JAXWS handler instantiation
                final ServiceName handlerComponentName = getHandlerComponentServiceName(className);
                final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName);
                if (handlerComponentController != null) {
                    // we support initialization only on non system JAXWS handlers
                    final BasicComponent handlerComponent = handlerComponentController.getValue();
                    final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue());
                    final Object handlerInstance = handlerComponentInstance.getInstance();
                    // mark reference as initialized because JBoss server initialized it
                    final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance);
                    return cacheAndGet(handlerReference);
                }
            }
View Full Code Here

    @Override
    public Object processInvocation(InterceptorContext context) throws Exception {
        final EJBComponent component = getComponent(context, EJBComponent.class);
        // create the instance
        final ComponentInstance componentInstance = component.createInstance();
        context.putPrivateData(ComponentInstance.class, componentInstance);
        try {
            return context.proceed();
        } finally {
            context.putPrivateData(ComponentInstance.class, null);
            // destroy the instance
            componentInstance.destroy();
        }
    }
View Full Code Here

    }

    @Override
    public Object processInvocation(InterceptorContext context) throws Exception {
        PooledComponent<ComponentInstance> component = getComponent(context, PooledComponent.class);
        ComponentInstance instance = component.getPool().get();
        context.putPrivateData(ComponentInstance.class, instance);
        try {
            return context.proceed();
        } finally {
            context.putPrivateData(ComponentInstance.class, null);
View Full Code Here

*/
public class SFSBInvocationInterceptor implements Interceptor {

    @Override
    public Object processInvocation(InterceptorContext context) throws Exception {
        ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
        if (componentInstance == null) {
            throw new IllegalStateException("componentInstance not set in InterceptorContext: " + context);
        }
        StatefulSessionComponentInstance sfsb = (StatefulSessionComponentInstance)componentInstance;
        SFSBContextHandleImpl sfsbContextHandle = new SFSBContextHandleImpl(sfsb);
View Full Code Here

        public InstanceMethodInvokingInterceptor(final Method componentMethod) {
            this.componentMethod = componentMethod;
        }

        public Object processInvocation(final InterceptorContext context) throws Exception {
            final ComponentInstance componentInstance = context.getPrivateData(ComponentInstance.class);
            if (componentInstance == null) {
                throw new IllegalStateException("No component instance associated");
            }
            //for CMP beans we invoke directly on the instance, bypassing the interceptor chain
            return componentMethod.invoke(componentInstance.getInstance(), context.getParameters());
        }
View Full Code Here

TOP

Related Classes of org.jboss.as.ee.component.ComponentInstance

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.