static void rebindInitialDataSources(ServletContext servletContext) throws Throwable { try { final InitialContext initialContext = new InitialContext(); for (final Map.Entry<String, DataSource> entry : JNDI_DATASOURCES_BACKUP.entrySet()) { final String jndiName = entry.getKey(); final DataSource dataSource = entry.getValue(); final Object lock = changeContextWritable(servletContext, null); initialContext.rebind(jndiName, dataSource); changeContextWritable(servletContext, lock); } initialContext.close(); } finally { JNDI_DATASOURCES_BACKUP.clear(); } }
static void rebindDataSource(ServletContext servletContext, String jndiName, DataSource dataSource, DataSource dataSourceProxy) throws Throwable { final Object lock = changeContextWritable(servletContext, null); final InitialContext initialContext = new InitialContext(); initialContext.rebind(jndiName, dataSourceProxy); JNDI_DATASOURCES_BACKUP.put(jndiName, dataSource); changeContextWritable(servletContext, lock); initialContext.close(); }
InitialContext initContext = new InitialContext(); initContext.rebind(uniqueName, managedDataSource); initContext.rebind("java:comp/UserTransaction", com.arjuna.ats.jta.UserTransaction.userTransaction()); initContext.rebind("java:comp/TransactionManager", tm); initContext.rebind("java:comp/TransactionSynchronizationRegistry", tsr); } catch (NamingException e) { logger.warning("No InitialContext available, resource won't be accessible via lookup");
private void startHornetQServer() throws Exception { jmsServer = new EmbeddedJMS(); jmsServer.start(); logger.debug("Started Embedded JMS Server"); XAConnectionFactory connectionFactory = (XAConnectionFactory) jmsServer.lookup("ConnectionFactory"); new InitialContext().rebind("java:comp/UserTransaction", com.arjuna.ats.jta.UserTransaction.userTransaction()); new InitialContext().rebind("java:comp/TransactionManager", com.arjuna.ats.jta.TransactionManager.transactionManager()); new InitialContext().rebind("java:comp/TransactionSynchronizationRegistry", new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple()); factory = new ConnectionFactoryProxy(connectionFactory, new TransactionHelperImpl(com.arjuna.ats.jta.TransactionManager.transactionManager())); queue = (Queue) jmsServer.lookup("/queue/exampleQueue"); }
public void bind(InitialContext initialContext) throws NamingException { Reference ref = new Reference(className, factory, factoryLocation); initialContext.rebind(bindName, ref); }
@Override public void rebind(Name name, Object obj) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.rebind(name, obj); } else { this.initialContext.rebind(name, obj); } }
@Override public void rebind(String name, Object obj) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.rebind(name, obj); } else { this.initialContext.rebind(name, obj); } }
@Override public void rebind(Name name, Object obj) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.rebind(name, obj); } else { this.initialContext.rebind(name, obj); } }
public void bind(InitialContext initialContext) throws NamingException { Reference ref = new Reference(className, factory, factoryLocation); initialContext.rebind(bindName, ref); }
public void bind(InitialContext initialContext) throws NamingException { Reference ref = new Reference(className, factory, factoryLocation); initialContext.rebind(bindName, ref); }
@Override public void rebind(String name, Object obj) throws NamingException { if (this.initialContext == null) { this.defaultInitCtx.rebind(name, obj); } else { this.initialContext.rebind(name, obj); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; try { InitialContext ctx = new InitialContext (); ctx.rebind (cfg.get ("name"), stub); } catch (NamingException e) { throw new ConfigurationException (e); } } public Set getKeySet () {
static void rebindDataSource(ServletContext servletContext, String jndiName, DataSource dataSource, DataSource dataSourceProxy) throws Throwable { final Object lock = changeContextWritable(servletContext, null); final InitialContext initialContext = new InitialContext(); initialContext.rebind(jndiName, dataSourceProxy); JNDI_DATASOURCES_BACKUP.put(jndiName, dataSource); changeContextWritable(servletContext, lock); initialContext.close(); }
protected void startService () throws RemoteException, NamingException, NotFoundException { qmux = (QMUX) NameRegistrar.get(qmuxName); qmuxproxy = new QMUXProxy(qmux); InitialContext ctx = new InitialContext (); ctx.rebind (getName (), qmuxproxy); }
protected void startService () throws RemoteException, NamingException { if (spaceName == null) sp = new SpaceProxy (); else sp = new SpaceProxy (spaceName); InitialContext ctx = new InitialContext (); ctx.rebind (getName (), sp); }
private InitialContextInitializer(String name, Reference reference) throws NamingException, FileNotFoundException, XMLStreamException { PrivilegedSystemHelper.setProperty(Context.INITIAL_CONTEXT_FACTORY, DEFAULT_INITIAL_CONTEXT_FACTORY); InitialContext initialContext = getInitialContext(); initialContext.rebind(name, reference); // binder binder = new InitialContextBinder(this, DEFAULT_BINDING_STORE_PATH); }
/** * {@inheritDoc} */ public void rebind(String name, Object value) throws NamingException { if (isInitialContextInitializerCall()) { super.rebind(name, value); return; } getContext().rebind(name, value); }
/** * {@inheritDoc} */ public void rebind(Name name, Object value) throws NamingException { if (isInitialContextInitializerCall()) { super.rebind(nameToString(name), value); return; } getContext().rebind(name, value); }
private void startHornetQServer() throws Exception { jmsServer = new EmbeddedJMS(); jmsServer.start(); logger.debug("Started Embedded JMS Server"); XAConnectionFactory connectionFactory = (XAConnectionFactory) jmsServer.lookup("ConnectionFactory"); new InitialContext().rebind("java:comp/UserTransaction", com.arjuna.ats.jta.UserTransaction.userTransaction()); new InitialContext().rebind("java:comp/TransactionManager", com.arjuna.ats.jta.TransactionManager.transactionManager()); new InitialContext().rebind("java:comp/TransactionSynchronizationRegistry", new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple()); factory = new ConnectionFactoryProxy(connectionFactory, new TransactionHelperImpl(com.arjuna.ats.jta.TransactionManager.transactionManager())); queue = (Queue) jmsServer.lookup("/queue/exampleQueue"); }
private void startHornetQServer() throws Exception { jmsServer = new EmbeddedJMS(); jmsServer.start(); logger.debug("Started Embedded JMS Server"); XAConnectionFactory connectionFactory = (XAConnectionFactory) jmsServer.lookup("ConnectionFactory"); new InitialContext().rebind("java:comp/UserTransaction", com.arjuna.ats.jta.UserTransaction.userTransaction()); new InitialContext().rebind("java:comp/TransactionManager", com.arjuna.ats.jta.TransactionManager.transactionManager()); new InitialContext().rebind("java:comp/TransactionSynchronizationRegistry", new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple()); factory = new ConnectionFactoryProxy(connectionFactory, new TransactionHelperImpl(com.arjuna.ats.jta.TransactionManager.transactionManager())); queue = (Queue) jmsServer.lookup("/queue/exampleQueue"); }