private void unbindConnectorDescriptor(String moduleName) throws ConnectorRuntimeException { if(ConnectorRuntime.getRuntime().isServer()){ try { String descriptorJNDIName = ConnectorAdminServiceUtils. getReservePrefixedJNDINameForDescriptor(moduleName); _runtime.getNamingManager().getInitialContext().unbind(descriptorJNDIName); if(_logger.isLoggable(Level.FINEST)){ _logger.finest("ResourceAdapterAdminServiceImpl :: destroyActiveRA " + moduleName + " removed descriptor " + descriptorJNDIName); } } catch (NamingException ne) { if(_logger.isLoggable(Level.FINEST)){ _logger.log(Level.FINEST, "rardeployment.connector_descriptor_jndi_removal_failure", moduleName); } } } }
/** * Returns a databaseName that is populated in pool's default DATABASENAME * @param poolInfo * @param mcf * @return * @throws javax.naming.NamingException if poolName lookup fails */ private String getDefaultDatabaseName(PoolInfo poolInfo, ManagedConnectionFactory mcf) throws NamingException { // All this to get the default user name and principal String databaseName = null; ConnectorConnectionPool connectorConnectionPool = null; try { String jndiNameForPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo); Context ic = _runtime.getNamingManager().getInitialContext(); connectorConnectionPool = (ConnectorConnectionPool) ic.lookup(jndiNameForPool); } catch (NamingException ne) { throw ne; } databaseName = ccPoolAdmService.getPropertyValue("DATABASENAME", connectorConnectionPool); // To avoid using "" as the default databasename, try to get // the databasename from MCF. if (databaseName == null || databaseName.trim().equals("")) { databaseName = ConnectionPoolObjectsUtils.getValueFromMCF("DatabaseName", poolInfo, mcf); } return databaseName; }
try { String jndiNameForPool = getReservePrefixedJNDINameForPool(poolInfo); Context ic = ConnectorRuntime.getRuntime().getNamingManager().getInitialContext(); connectorConnectionPool = (ConnectorConnectionPool) ic.lookup(jndiNameForPool);
+ " publishing descriptor " + descriptorJNDIName); _runtime.getNamingManager().publishObject(descriptorJNDIName, connectorDescriptor, true);