use of org.apache.openejb.core.cmp.CmpContainer in project tomee by apache.
the class EjbSelect method execute_long.
public static long execute_long(final Object obj, final String methodSignature, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "long", args);
return result.longValue();
}
use of org.apache.openejb.core.cmp.CmpContainer in project tomee by apache.
the class EjbSelect method execute_float.
public static float execute_float(final Object obj, final String methodSignature, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "float", args);
return result.floatValue();
}
use of org.apache.openejb.core.cmp.CmpContainer in project tomee by apache.
the class EjbSelect method execute_byte.
public static byte execute_byte(final Object obj, final String methodSignature, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
final Number result = (Number) cmpContainer.select(beanContext, methodSignature, "byte", args);
return result.byteValue();
}
use of org.apache.openejb.core.cmp.CmpContainer in project tomee by apache.
the class EjbSelect method execute_Object.
/**
* The single execution stub for all non-primitive
* select operations. This method has an additional
* returnType parameter used to instantiate the return
* value.
*
* @param obj The EJB object we're operating against.
* @param methodSignature The signature of the ejbSelectxxxx method.
* @param returnType The return type signature of the method.
* @param args The select arguments.
* @return An object of the specified type...which might be
* one of the collection types.
* @throws FinderException
*/
public static Object execute_Object(final Object obj, final String methodSignature, final String returnType, final Object... args) throws FinderException {
final BeanContext beanContext = (BeanContext) obj;
final Container container = beanContext.getContainer();
if (!(container instanceof CmpContainer)) {
throw new FinderException("Deployment is not connected to a CmpContainer " + beanContext.getDeploymentID());
}
final CmpContainer cmpContainer = (CmpContainer) container;
return cmpContainer.select(beanContext, methodSignature, returnType, args);
}
use of org.apache.openejb.core.cmp.CmpContainer in project tomee by apache.
the class Cmp2Util method getEntityBean.
public static <Bean extends EntityBean> Bean getEntityBean(final EJBLocalObject proxy) {
if (proxy == null) {
return null;
}
final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
if (handler.container == null) {
return null;
}
if (!(handler.container instanceof CmpContainer)) {
throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
}
final CmpContainer container = (CmpContainer) handler.container;
final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
return entity;
}
Aggregations