Search in sources :

Example 1 with OptionalLocalInterfaceProvider

use of com.sun.ejb.spi.container.OptionalLocalInterfaceProvider in project Payara by payara.

the class JavaEEInterceptorBuilderImpl method createInvoker.

public InterceptorInvoker createInvoker(Object instance) throws Exception {
    interceptorInfo.setTargetObjectInstance(instance);
    // Proxy invocation handler. Also implements InterceptorInvoker.
    InterceptorInvocationHandler invoker = new InterceptorInvocationHandler();
    Proxy proxy = (Proxy) Proxy.newProxyInstance(subClass.getClassLoader(), new Class[] { subClassIntf }, invoker);
    // Object passed back to the caller.
    OptionalLocalInterfaceProvider provider = (OptionalLocalInterfaceProvider) subClass.newInstance();
    provider.setOptionalLocalIntfProxy(proxy);
    invoker.init(instance, interceptorManager.createInterceptorInstances(), provider, interceptorManager);
    return invoker;
}
Also used : Proxy(java.lang.reflect.Proxy) OptionalLocalInterfaceProvider(com.sun.ejb.spi.container.OptionalLocalInterfaceProvider)

Example 2 with OptionalLocalInterfaceProvider

use of com.sun.ejb.spi.container.OptionalLocalInterfaceProvider in project Payara by payara.

the class MessageBeanContainer method createMessageBeanProxy.

/**
 * Generates the appropriate Proxy based on the message listener type.
 *
 * @param handler InvocationHandler responsible for calls on the proxy
 * @return an object implementing MessageEndpoint and the appropriate MDB view
 * @throws Exception
 */
@Override
public Object createMessageBeanProxy(InvocationHandler handler) throws Exception {
    if (isNoMethodsListenerInterface(messageListenerType_)) {
        // EJB 3.2 No-interface MDB View
        Proxy proxy = (Proxy) Proxy.newProxyInstance(loader, new Class[] { messageBeanInterface_ }, handler);
        OptionalLocalInterfaceProvider provider = (OptionalLocalInterfaceProvider) messageBeanSubClass_.newInstance();
        provider.setOptionalLocalIntfProxy(proxy);
        return provider;
    } else {
        // EJB 3.1 - 2.0 Interface View
        return Proxy.newProxyInstance(loader, new Class[] { messageListenerType_, MessageEndpoint.class }, handler);
    }
}
Also used : Proxy(java.lang.reflect.Proxy) OptionalLocalInterfaceProvider(com.sun.ejb.spi.container.OptionalLocalInterfaceProvider)

Example 3 with OptionalLocalInterfaceProvider

use of com.sun.ejb.spi.container.OptionalLocalInterfaceProvider in project Payara by payara.

the class SafeProperties method instantiateOptionalEJBLocalBusinessObjectImpl.

protected EJBLocalObjectImpl instantiateOptionalEJBLocalBusinessObjectImpl() throws Exception {
    EJBLocalObjectInvocationHandler handler = new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap, true);
    EJBLocalObjectImpl localBusinessObjImpl = handler;
    ejbOptionalLocalBusinessObjectProxyCtor.newInstance(new Object[] { handler });
    localBusinessObjImpl.setContainer(this);
    Class businessIntfClass = ejbGeneratedOptionalLocalBusinessIntfClass;
    EJBLocalObjectInvocationHandlerDelegate delegate = new EJBLocalObjectInvocationHandlerDelegate(businessIntfClass, getContainerId(), handler);
    Proxy proxy = (Proxy) Proxy.newProxyInstance(loader, new Class[] { IndirectlySerializable.class, businessIntfClass }, delegate);
    String beanSubClassName = ejbGeneratedOptionalLocalBusinessIntfClass.getName() + "__Bean__";
    ((EjbOptionalIntfGenerator) optIntfClassLoader).generateOptionalLocalInterfaceSubClass(ejbClass, beanSubClassName, ejbGeneratedOptionalLocalBusinessIntfClass);
    optIntfClassLoader.loadClass(ejbGeneratedOptionalLocalBusinessIntfClass.getName());
    Class subClass = optIntfClassLoader.loadClass(beanSubClassName);
    OptionalLocalInterfaceProvider provider = (OptionalLocalInterfaceProvider) subClass.newInstance();
    provider.setOptionalLocalIntfProxy(proxy);
    localBusinessObjImpl.mapClientObject(ejbClass.getName(), provider);
    return localBusinessObjImpl;
}
Also used : Proxy(java.lang.reflect.Proxy) SystemInterceptorProxy(com.sun.ejb.containers.interceptors.SystemInterceptorProxy) EjbOptionalIntfGenerator(com.sun.ejb.codegen.EjbOptionalIntfGenerator) IndirectlySerializable(com.sun.enterprise.container.common.spi.util.IndirectlySerializable) OptionalLocalInterfaceProvider(com.sun.ejb.spi.container.OptionalLocalInterfaceProvider)

Aggregations

OptionalLocalInterfaceProvider (com.sun.ejb.spi.container.OptionalLocalInterfaceProvider)3 Proxy (java.lang.reflect.Proxy)3 EjbOptionalIntfGenerator (com.sun.ejb.codegen.EjbOptionalIntfGenerator)1 SystemInterceptorProxy (com.sun.ejb.containers.interceptors.SystemInterceptorProxy)1 IndirectlySerializable (com.sun.enterprise.container.common.spi.util.IndirectlySerializable)1