use of org.apache.openejb.Container 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.Container 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.Container in project tomee by apache.
the class Assembler method createContainer.
public void createContainer(final ContainerInfo serviceInfo) throws OpenEJBException {
final ObjectRecipe serviceRecipe = createRecipe(Collections.<ServiceInfo>emptyList(), serviceInfo);
serviceRecipe.setProperty("id", serviceInfo.id);
serviceRecipe.setProperty("transactionManager", props.get(TransactionManager.class.getName()));
serviceRecipe.setProperty("securityService", props.get(SecurityService.class.getName()));
serviceRecipe.setProperty("properties", new UnsetPropertiesRecipe());
// MDB container has a resource adapter string name that
// must be replaced with the real resource adapter instance
replaceResourceAdapterProperty(serviceRecipe);
final Object service = serviceRecipe.create();
// we forced it
serviceRecipe.getUnsetProperties().remove("id");
// we forced it
serviceRecipe.getUnsetProperties().remove("securityService");
logUnusedProperties(serviceRecipe, serviceInfo);
final Class interfce = serviceInterfaces.get(serviceInfo.service);
checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
bindService(serviceInfo, service);
setSystemInstanceComponent(interfce, service);
props.put(interfce.getName(), service);
props.put(serviceInfo.service, service);
props.put(serviceInfo.id, service);
containerSystem.addContainer(serviceInfo.id, (Container) service);
// Update the config tree
config.containerSystem.containers.add(serviceInfo);
logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
if (Container.class.isInstance(service) && LocalMBeanServer.isJMXActive()) {
final ObjectName objectName = ObjectNameBuilder.uniqueName("containers", serviceInfo.id, service);
try {
LocalMBeanServer.get().registerMBean(new DynamicMBeanWrapper(new JMXContainer(serviceInfo, (Container) service)), objectName);
containerObjectNames.add(objectName);
} catch (final Exception | NoClassDefFoundError e) {
// no-op
}
}
}
use of org.apache.openejb.Container in project tomee by apache.
the class BasicClusterableRequestHandler method updateServer.
@Override
public void updateServer(final BeanContext beanContext, final ClusterableRequest req, final ClusterableResponse res) {
final Container container = beanContext.getContainer();
if (container instanceof ClusteredRPCContainer) {
final ClusteredRPCContainer clusteredContainer = (ClusteredRPCContainer) container;
final URI[] locations = clusteredContainer.getLocations(beanContext);
if (null != locations) {
final ServerMetaData server = new ServerMetaData(locations);
if (req.getServerHash() != server.buildHash()) {
res.setServer(server);
}
}
}
}
use of org.apache.openejb.Container in project tomee by apache.
the class EjbSelect method execute_boolean.
public static boolean execute_boolean(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 Boolean result = (Boolean) cmpContainer.select(beanContext, methodSignature, "byte", args);
return result.booleanValue();
}
Aggregations