public Class getLocalInterface() { return getDeploymentInfo().getLocalInterface(); }
public List<Class> getObjectInterface(final Class homeInterface) { if (BusinessLocalHome.class.isAssignableFrom(homeInterface)) { return getBusinessLocalInterfaces(); } else if (BusinessRemoteHome.class.isAssignableFrom(homeInterface)) { return getBusinessRemoteInterfaces(); } else if (EJBLocalHome.class.isAssignableFrom(homeInterface)) { final List<Class> classes = new ArrayList<Class>(); classes.add(getLocalInterface()); return classes; } else if (EJBHome.class.isAssignableFrom(homeInterface)) { final List<Class> classes = new ArrayList<Class>(); classes.add(getRemoteInterface()); return classes; } else { throw new IllegalArgumentException("Cannot determine object interface for " + homeInterface); } }
public List<Class> getObjectInterface(final Class homeInterface) { if (BusinessLocalHome.class.isAssignableFrom(homeInterface)) { return getBusinessLocalInterfaces(); } else if (BusinessRemoteHome.class.isAssignableFrom(homeInterface)) { return getBusinessRemoteInterfaces(); } else if (EJBLocalHome.class.isAssignableFrom(homeInterface)) { final List<Class> classes = new ArrayList<Class>(); classes.add(getLocalInterface()); return classes; } else if (EJBHome.class.isAssignableFrom(homeInterface)) { final List<Class> classes = new ArrayList<Class>(); classes.add(getRemoteInterface()); return classes; } else { throw new IllegalArgumentException("Cannot determine object interface for " + homeInterface); } }
public Object createLocalProxy(final EntityBean bean, final RpcContainer container) { // The KeyGenerator creates a new primary key and populates its fields with the // primary key fields of the bean instance. Each deployment has its own KeyGenerator. final Object primaryKey = keyGenerator.getPrimaryKey(bean); // create the proxy final Object proxy = localHandler.createProxy(primaryKey, beanContext.getLocalInterface()); return proxy; } }
public Object createLocalProxy(final EntityBean bean, final RpcContainer container) { // The KeyGenerator creates a new primary key and populates its fields with the // primary key fields of the bean instance. Each deployment has its own KeyGenerator. final Object primaryKey = keyGenerator.getPrimaryKey(bean); // create the proxy final Object proxy = localHandler.createProxy(primaryKey, beanContext.getLocalInterface()); return proxy; } }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { check(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface()); try { final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae); } }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { doCheck(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalInterface() == null) { throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface()); try { final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler); } catch (final IllegalAccessException iae) { throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae); } }
public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(final BeanContext beanContext, final EntityBean entity) { if (entity == null) { return null; } // build the primary key final Object primaryKey = getPrimaryKey(beanContext, entity); // get the cmp container if (!(beanContext.getContainer() instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + beanContext.getContainer().getClass().getName()); } final Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface()); return proxy; }
public static <Proxy extends EJBLocalObject> Proxy getEjbProxy(final BeanContext beanContext, final EntityBean entity) { if (entity == null) { return null; } // build the primary key final Object primaryKey = getPrimaryKey(beanContext, entity); // get the cmp container if (!(beanContext.getContainer() instanceof CmpContainer)) { throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + beanContext.getContainer().getClass().getName()); } final Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface()); return proxy; }
/** * This ManagedBean is added to all EjbModules to effectively * create a sharable "comp" namespace which can be used in * for components with undefined namespace such as CDI */ public static class Comp { public static String openejbCompName(final String module) { return module + "." + Comp.class.getSimpleName(); } }
/** * This ManagedBean is added to all EjbModules to effectively * create a sharable "comp" namespace which can be used in * for components with undefined namespace such as CDI */ public static class Comp { public static String openejbCompName(final String module) { return module + "." + Comp.class.getSimpleName(); } }
public static Object createHomeProxy(final BeanContext beanContext, final InterfaceType interfaceType) { return createHomeProxy(beanContext, interfaceType, null, interfaceType.isRemote() ? beanContext.getRemoteInterface() : beanContext.getLocalInterface()); }
public static Object createHomeProxy(final BeanContext beanContext, final InterfaceType interfaceType) { return createHomeProxy(beanContext, interfaceType, null, interfaceType.isRemote() ? beanContext.getRemoteInterface() : beanContext.getLocalInterface()); }
public CmrSet(final EntityBean source, final String sourceProperty, final BeanContext relatedInfo, final String relatedProperty, final Collection<Bean> relatedBeans) { this.source = source; this.sourceProperty = sourceProperty; this.relatedInfo = relatedInfo; this.relatedProperty = relatedProperty; this.relatedBeans = relatedBeans; relatedLocal = relatedInfo.getLocalInterface(); final TransactionSynchronizationRegistry transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class); try { transactionRegistry.registerInterposedSynchronization(new Synchronization() { public void beforeCompletion() { } public void afterCompletion(final int i) { mutable = false; } }); } catch (final IllegalStateException ignored) { // no tx so not mutable mutable = false; } }
public CmrSet(final EntityBean source, final String sourceProperty, final BeanContext relatedInfo, final String relatedProperty, final Collection<Bean> relatedBeans) { this.source = source; this.sourceProperty = sourceProperty; this.relatedInfo = relatedInfo; this.relatedProperty = relatedProperty; this.relatedBeans = relatedBeans; relatedLocal = relatedInfo.getLocalInterface(); final TransactionSynchronizationRegistry transactionRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class); try { transactionRegistry.registerInterposedSynchronization(new Synchronization() { public void beforeCompletion() { } public void afterCompletion(final int i) { mutable = false; } }); } catch (final IllegalStateException ignored) { // no tx so not mutable mutable = false; } }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { check(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalHomeInterface() == null) { throw new IllegalStateException("Bean does not have an EJBLocalObject interface: " + di.getDeploymentID()); } return (EJBLocalObject) EjbObjectProxyHandler.createProxy(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, di.getLocalInterface()); }
public EJBLocalObject getEJBLocalObject() throws IllegalStateException { doCheck(Call.getEJBLocalObject); final ThreadContext threadContext = ThreadContext.getThreadContext(); final BeanContext di = threadContext.getBeanContext(); if (di.getLocalHomeInterface() == null) { throw new IllegalStateException("Bean does not have an EJBLocalObject interface: " + di.getDeploymentID()); } return (EJBLocalObject) EjbObjectProxyHandler.createProxy(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, di.getLocalInterface()); }
public Class getInterface(final InterfaceType interfaceType) { switch (interfaceType) { case EJB_HOME: return getHomeInterface(); case EJB_OBJECT: return getRemoteInterface(); case EJB_LOCAL_HOME: return getLocalHomeInterface(); case EJB_LOCAL: return getLocalInterface(); case BUSINESS_LOCAL: return getBusinessLocalInterface(); case BUSINESS_REMOTE: return getBusinessRemoteInterface(); case TIMEOUT: return BeanContext.Timeout.class; case BUSINESS_REMOTE_HOME: return BeanContext.BusinessRemoteHome.class; case BUSINESS_LOCAL_HOME: return BeanContext.BusinessLocalHome.class; case SERVICE_ENDPOINT: return getServiceEndpointInterface(); case LOCALBEAN: return getBeanClass(); case BUSINESS_LOCALBEAN_HOME: return BeanContext.BusinessLocalBeanHome.class; default: throw new IllegalStateException("Unexpected enum constant: " + interfaceType); } }
public ProxyFactory(final BeanContext beanContext) { this.beanContext = beanContext; keyGenerator = beanContext.getKeyGenerator(); remoteInterface = beanContext.getRemoteInterface(); if (remoteInterface != null) { final EJBHome homeProxy = beanContext.getEJBHome(); remoteHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy); } else { remoteHandler = null; } localInterface = beanContext.getLocalInterface(); if (localInterface != null) { final EJBLocalHome localHomeProxy = beanContext.getEJBLocalHome(); localHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(localHomeProxy); } else { localHandler = null; } }
public ProxyFactory(final BeanContext beanContext) { this.beanContext = beanContext; keyGenerator = beanContext.getKeyGenerator(); remoteInterface = beanContext.getRemoteInterface(); if (remoteInterface != null) { final EJBHome homeProxy = beanContext.getEJBHome(); remoteHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(homeProxy); } else { remoteHandler = null; } localInterface = beanContext.getLocalInterface(); if (localInterface != null) { final EJBLocalHome localHomeProxy = beanContext.getEJBLocalHome(); localHandler = (EntityEjbHomeHandler) ProxyManager.getInvocationHandler(localHomeProxy); } else { localHandler = null; } }