use of javax.ejb.EJBLocalObject in project Payara by payara.
the class SafeProperties method instantiateEJBLocalObjectImpl.
protected EJBLocalObjectImpl instantiateEJBLocalObjectImpl(Object key) throws Exception {
EJBLocalObjectImpl localObjImpl = null;
EJBLocalObjectInvocationHandler handler = new EJBLocalObjectInvocationHandler(proxyInvocationInfoMap, localIntf);
localObjImpl = handler;
try {
EJBLocalObject localObjectProxy = (EJBLocalObject) ejbLocalObjectProxyCtor.newInstance(new Object[] { handler });
handler.setProxy(localObjectProxy);
} catch (ClassCastException e) {
String msg = localStrings.getLocalString("ejb.basecontainer_invalid_local_interface", "Local component interface [{0}] is invalid since it does not extend javax.ejb.EJBLocalObject.", localIntf);
throw new IllegalArgumentException(msg, e);
}
localObjImpl.setContainer(this);
if (key != null) {
// associate the EJBObject with the key
localObjImpl.setKey(key);
}
return localObjImpl;
}
use of javax.ejb.EJBLocalObject in project tomee by apache.
the class BaseSessionContext method getEJBLocalObject.
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());
}
use of javax.ejb.EJBLocalObject in project tomee by apache.
the class Cmp2Util method getEjbProxy.
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;
}
use of javax.ejb.EJBLocalObject in project tomee by apache.
the class EntityContext method getEJBLocalObject.
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<>(), 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);
}
}
use of javax.ejb.EJBLocalObject in project Payara by payara.
the class EJBHashSet method contains.
/**
* Returns <tt>true</tt> if this set contains the specified element.
*
* @param o element whose presence in this set is to be tested.
* @return <tt>true</tt> if this set contains the specified element.
*/
public boolean contains(Object o) {
// NOI18N
logger.finest("---EJBHashSet.contains---");
assertIsValid();
assertInTransaction();
helper.assertInstanceOfLocalInterfaceImpl(o);
EJBLocalObject lo = (EJBLocalObject) o;
return pcSet.contains(helper.convertEJBLocalObjectToPC(lo, pm, true));
}
Aggregations