Object readResolve() throws ObjectStreamException { try { return SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(jndiName); } catch (final NamingException e) { throw new InvalidObjectException(e.getMessage()); } } }
Object readResolve() throws ObjectStreamException { try { return SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext().lookup(jndiName); } catch (final NamingException e) { throw new InvalidObjectException(e.getMessage()); } } }
private DataSource findDelegate() { try { return DataSource.class.cast(SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext() .lookup(Assembler.OPENEJB_RESOURCE_JNDI_PREFIX + delegate)); } catch (final NamingException e) { throw new IllegalArgumentException("'" + delegate + "' not found", e); } }
protected Context getContext() throws NamingException { if (context == null) { if (contextJndiName != null) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); } else { context = new InitialContext(envProperties); } } return context; } }
protected Context getContext() throws NamingException { if (context == null) { if (contextJndiName != null) { ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); } else { context = new InitialContext(envProperties); } } return context; } }
protected Context getContext() throws NamingException { if (context == null) { if (contextJndiName != null) { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); } else { context = new InitialContext(envProperties); } } return context; } }
protected Object readResolve() throws ObjectStreamException { try { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); if (containerSystem != null) { return containerSystem.getJNDIContext().lookup(jndi); } } catch (final Exception e) { throw new InvalidObjectException("name not found: " + jndi); } return null; } }
public static Context getContext() throws NamingException { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); final Context context = (Context) containerSystem.getJNDIContext().lookup("openejb"); return context; }
protected Context getContext(final String jndiProviderId) throws NamingException { if (jndiProviderId != null) { final String contextJndiName = "java:openejb/remote_jndi_contexts/" + jndiProviderId; final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); final Context context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); return context; } else { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); final Context context = containerSystem.getJNDIContext(); return context; } }
protected Context getContext(String jndiProviderId) throws NamingException { if (jndiProviderId != null) { String contextJndiName = "java:openejb/remote_jndi_contexts/" + jndiProviderId; ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); Context context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); return context; } else { ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); Context context = containerSystem.getJNDIContext(); return context; } }
protected Context getContext(String jndiProviderId) throws NamingException { if (jndiProviderId != null) { String contextJndiName = "java:openejb/remote_jndi_contexts/" + jndiProviderId; ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); Context context = (Context) containerSystem.getJNDIContext().lookup(contextJndiName); return context; } else { ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); Context context = containerSystem.getJNDIContext(); return context; } }
public Object getObject() throws NamingException { final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); try { return containerSystem.getJNDIContext().lookup(jndiName); } catch (final NameNotFoundException e) { // EE.5.18: try using java:module/<shortName> prefix return containerSystem.getJNDIContext().lookup("java:module/" + Strings.lastPart(getClassName(), '.')); } catch (final NamingException e) { throw (NamingException) new NamingException("could not look up " + jndiName).initCause(e); } }
public <T> T resource(final Class<T> type, final String name) { try { return type.cast( SystemInstance.get().getComponent(ContainerSystem.class) .getJNDIContext().lookup("java:" + Assembler.OPENEJB_RESOURCE_JNDI_PREFIX + name) ); } catch (final NamingException e) { throw new OpenEJBRuntimeException(e); } }
private void removePersistenceUnitGBean(PersistenceUnitGBean persistenceUnitGBean) { String unit = persistenceUnitGBean.getPersistenceUnitName(); String rootUrl = persistenceUnitGBean.getPersistenceUnitRoot(); String id = unit + " " + rootUrl.hashCode(); Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext(); try { context.unbind("java:openejb/PersistenceUnit/" + id); } catch (Exception e) { throw new IllegalStateException(e); } }
@Override public UserTransaction getUserTransaction() { UserTransaction ut; try { ut = (UserTransaction) containerSystem.getJNDIContext().lookup("comp/UserTransaction"); } catch (final NamingException e) { logger.debug("User transaction is not bound to context, lets create it"); ut = new CoreUserTransaction(getTransactionManager()); } return ut; }
@Override public UserTransaction getUserTransaction() { UserTransaction ut; try { ut = (UserTransaction) containerSystem.getJNDIContext().lookup("comp/UserTransaction"); } catch (final NamingException e) { logger.debug("User transaction is not bound to context, lets create it"); ut = new CoreUserTransaction(getTransactionManager()); } return ut; }
private void addPersistenceUnitGBean(PersistenceUnitGBean persistenceUnitGBean) { String unit = persistenceUnitGBean.getPersistenceUnitName(); String rootUrl = persistenceUnitGBean.getPersistenceUnitRoot(); String id = unit + " " + rootUrl.hashCode(); Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext(); try { context.bind("java:openejb/PersistenceUnit/" + id, persistenceUnitGBean.getEntityManagerFactory()); } catch (Exception e) { throw new IllegalStateException(e); } }
@Override public Context getInitialContext(final Hashtable env) throws NamingException { // don't validate there env content, it is commonly built from System properties and therefore can inherit a bunch of things return new LocalFallbackContextWrapper(SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext()); }
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 } } }
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 } } }