Object readResolve() throws ObjectStreamException { try { return SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(jndiName); } catch (final NamingException e) { throw new InvalidObjectException(e.getMessage()); } } }
private String findPrefix() { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); for (final AppContext appContext : containerSystem.getAppContexts()) { if (appContext.getClassLoader().equals(loader)) { return appContext.getId(); } for (final WebContext web : appContext.getWebContexts()) { if (web.getClassLoader().equals(loader)) { return appContext.getId(); } } } if (1 == containerSystem.getAppContexts().size()) { return containerSystem.getAppContexts().iterator().next().getId(); } return null; }
private AppContext appContext(final String appName) { final ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class); final AppContext appContext = cs.getAppContext(appName); if (appContext == null) { throw new OpenEJBRuntimeException("can't find application " + appName); } return appContext; } }
private MdbContainer getMdbContainer(final String containerId) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); if (containerId == null || containerId.length() == 0) { final Container[] containers = containerSystem.containers(); for (final Container container : containers) { if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } } return null; } final Container container = containerSystem.getContainer(containerId); if (MdbContainer.class.isInstance(container)) { return MdbContainer.class.cast(container); } return null; }
private static BeanContext resolve(Class<?> clazz) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); while (clazz != null && clazz != Object.class) { { final BeanContext context = containerSystem.getBeanContext(clazz.getName()); if (context != null) { return context; } } for (final BeanContext context : containerSystem.deployments()) { if (clazz == context.getBeanClass()) { return context; } } clazz = clazz.getSuperclass(); } return null; }
public void exec(Arguments args, DataInputStream in, PrintStream out) throws IOException { ContainerSystem containerSystem1 = SystemInstance.get().getComponent(ContainerSystem.class); Container[] c = containerSystem1.containers(); out.println("Containers:"); for (int i = 0; i < c.length; i++) { out.print(" " + c[i].getContainerID()); out.println(""); } out.println(""); out.println("Deployments:"); ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); DeploymentInfo[] d = containerSystem.deployments(); for (int i = 0; i < d.length; i++) { out.print(" " + d[i].getDeploymentID()); out.println(""); } }
for (final AppContext appContext : containerSystem.getAppContexts()) { final ClassLoader appContextClassLoader = appContext.getClassLoader(); if (tccl.equals(appContextClassLoader) || appContextClassLoader.equals(tccl)) { value = containerSystem.getJNDIContext().lookup( (jndi.endsWith("Factory") ? Assembler.VALIDATOR_FACTORY_NAMING_CONTEXT
public void produce(@Observes final BeforeClass bs) { try { final Assembler a = SystemInstance.get().getComponent(Assembler.class); context.set(a.getContainerSystem().getJNDIContext()); beanManager.set(a.getContainerSystem().getAppContext(a.getDeployedApplications().iterator().next().appId).getBeanManager()); } catch (final Exception e) { // no-op } } }
final Context jndiContext = containerSystem.getJNDIContext(); final BeanContext context = containerSystem.getBeanContext(testClass.getName());
WebContext webContext = cs.getWebContextByHost(path, hostname); if (webContext == null) { // tomee-embedded deployment webContext = cs.getWebContextByHost(standardContext.getPath().replaceFirst("/", ""), hostname); if (webContext == null) { webContext = cs.getWebContextByHost(standardContext.getPath(), hostname); for (final WebAppInfo webAppInfo : contextInfo.appInfo.webApps) { if (webAppInfo.path != null && webAppInfo.path.replace(File.separatorChar, '/').equals(standardContext.getDocBase())) { webContext = cs.getWebContextByHost(webAppInfo.moduleId, hostname); if (webContext != null) { break; root.bind("global", SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup("global")); } catch (final NamingException e) { comp.rebind("BeanManager", new InjectableBeanManager(webContext.getWebbeansContext().getBeanManagerImpl())); } else if (contextInfo != null) { final WebBeansContext webBeansContext = cs.getAppContext(contextInfo.appInfo.appId).getWebBeansContext(); if (webBeansContext != null) { // can be null if cdi is inhibited comp.rebind("BeanManager", new InjectableBeanManager(webBeansContext.getBeanManagerImpl()));
protected BeanContext getDeployment(final EJBRequest req) throws RemoteException { final String deploymentId = req.getDeploymentId(); final BeanContext beanContext = containerSystem.getBeanContext(deploymentId); if (beanContext == null) { throw new RemoteException("No deployment: " + deploymentId); } return beanContext; }
private BeanContext beanContext() { final TestClass tc = testClass.get(); if (tc == null) { return null; } final String className = tc.getName(); final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); for (final AppContext app : containerSystem.getAppContexts()) { final BeanContext context = containerSystem.getBeanContext(app.getId() + "_" + className); if (context != null) { return context; } } return null; } }
/** * This may not be that performant, but it's certain to be faster than the * user having to track down which deployment is using a particular jndi name * @param name * @return . */ private DeploymentInfo findNameOwner(String name) { ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); for (DeploymentInfo deploymentInfo : containerSystem.deployments()) { Bindings bindings = deploymentInfo.get(Bindings.class); if (bindings != null && bindings.getBindings().contains(name)) return deploymentInfo; } return null; }
Container[] containers = this.containerSystem.containers(); for (Container container : containers)
for (final AppContext appContext : containerSystem.getAppContexts()) { final ClassLoader appContextClassLoader = appContext.getClassLoader(); if (tccl.equals(appContextClassLoader) || appContextClassLoader.equals(tccl)) { value = containerSystem.getJNDIContext().lookup( (jndi.endsWith("Factory") ? Assembler.VALIDATOR_FACTORY_NAMING_CONTEXT
public void produce(@Observes final BeforeClass bs) { try { final Assembler a = SystemInstance.get().getComponent(Assembler.class); context.set(a.getContainerSystem().getJNDIContext()); beanManager.set(a.getContainerSystem().getAppContext(a.getDeployedApplications().iterator().next().appId).getBeanManager()); } catch (final Exception e) { // no-op } } }
final Context jndiContext = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext(); for (final EnvEntry entry : testBean.getEnvEntry()) { // set it in global jndi context since that's "app" entries and otherwise when we are no more in test bean context lookup fails final String name = entry.getName(); final BeanContext context = SystemInstance.get().getComponent(ContainerSystem.class).getBeanContext(testClass.getName());
public BeanContext getDeploymentInfo(String deploymentId) { return getContainerSystem().getBeanContext(deploymentId); }
logger.debug("startup.debugContainers", containerSystem.containers().length); if (containerSystem.containers().length > 0) { Container[] c = containerSystem.containers(); logger.debug("startup.debugContainersType"); for (int i = 0; i < c.length; i++) { logger.debug("startup.debugDeployments", containerSystem.deployments().length); if (containerSystem.deployments().length > 0) { logger.debug("startup.debugDeploymentsType"); DeploymentInfo[] d = containerSystem.deployments(); for (int i = 0; i < d.length; i++) { String entry = " ";
final Container[] containers = containerSystem.containers(); for (Container container : containers) { if (MdbContainer.class.isInstance(container)) { final Container appContainer = containerSystem.getContainer(moduleId + "/" + containerId); if (appContainer != null && MdbContainer.class.isInstance(appContainer)) { return convert(MdbContainer.class.cast(appContainer)); final Container container = containerSystem.getContainer(containerId); if (MdbContainer.class.isInstance(container)) { return convert(MdbContainer.class.cast(container));