private void createConnectorResource(ConnectorResource connectorResource, ResourceInfo resourceInfo, PoolInfo poolInfo) throws ConnectorRuntimeException { if (ResourcesUtil.createInstance().isEnabled(connectorResource, resourceInfo)){ if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Calling backend to add connector resource", resourceInfo); } runtime.createConnectorResource(resourceInfo, poolInfo, null); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Added connector resource in backend", resourceInfo); } } else { _logger.log(Level.INFO, "core.resource_disabled", new Object[]{connectorResource.getJndiName(), ConnectorConstants.RES_TYPE_CR}); } }
/** * Creates default connector resource * * @throws ConnectorRuntimeException when unable to create connector resources */ protected void createDefaultConnectorResources() throws ConnectorRuntimeException { for (ConnectionDefDescriptor descriptor : connectionDefs_) { String connectionDefName = descriptor.getConnectionFactoryIntf(); String resourceName = connectorRuntime_.getDefaultResourceName(moduleName_, connectionDefName); String poolName = connectorRuntime_.getDefaultPoolName(moduleName_, connectionDefName); PoolInfo poolInfo = new PoolInfo(poolName); ResourceInfo resourceInfo = new ResourceInfo(resourceName); connectorRuntime_.createConnectorResource(resourceInfo, poolInfo, null); desc_.addDefaultResourceName(resourceName); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Created default connector resource [ " + resourceName + " ] " ); } } }
/** * {@inheritDoc} */ public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception { //deployResource is not synchronized as there is only one caller //ResourceProxy which is synchronized com.sun.enterprise.config.serverbeans.JdbcResource jdbcRes = (com.sun.enterprise.config.serverbeans.JdbcResource) resource; String jndiName = jdbcRes.getJndiName(); String poolName = jdbcRes.getPoolName(); PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName); ResourceInfo resourceInfo = new ResourceInfo(jndiName, applicationName, moduleName); if (ResourcesUtil.createInstance().isEnabled(jdbcRes, resourceInfo)){ runtime.createConnectorResource(resourceInfo, poolInfo, null); //In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to create one if(ConnectorsUtil.getValidSuffix(jndiName) == null){ ResourceInfo pmResourceInfo = new ResourceInfo(ConnectorsUtil.getPMJndiName(jndiName), resourceInfo.getApplicationName(), resourceInfo.getModuleName()); runtime.createConnectorResource( pmResourceInfo, poolInfo, null); } if(_logger.isLoggable(Level.FINEST)) { _logger.finest("deployed resource " + jndiName); } } else { _logger.log(Level.INFO, "core.resource_disabled", new Object[]{jdbcRes.getJndiName(), ConnectorConstants.RES_TYPE_JDBC}); } } /**
/** * Creates connector connection pool pertaining to sun-ra.xml. This is * only for 1.0 complient rars. * * @throws ConnectorRuntimeException Thrown when pool creation fails. */ private void createSunRAConnectionPool() throws ConnectorRuntimeException { String defaultPoolName = connectorRuntime_.getDefaultPoolName( moduleName_, connectionDefs_[0].getConnectionFactoryIntf()); String sunRAPoolName = defaultPoolName + ConnectorConstants.SUN_RA_POOL; PoolInfo poolInfo = new PoolInfo(sunRAPoolName); ConnectorDescriptorInfo connectorDescriptorInfo = ConnectorDDTransformUtils.getConnectorDescriptorInfo(connectionDefs_[0]); connectorDescriptorInfo.setRarName(moduleName_); connectorDescriptorInfo.setResourceAdapterClassName(desc_.getResourceAdapterClass()); ConnectorConnectionPool connectorPoolObj = ConnectionPoolObjectsUtils.createSunRaConnectorPoolObject(poolInfo, desc_, moduleName_); connectorPoolObj.setConnectorDescriptorInfo(connectorDescriptorInfo); connectorRuntime_.createConnectorConnectionPool(connectorPoolObj); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Created SUN-RA connection pool:", poolInfo); } String jndiName = (String) desc_.getSunDescriptor(). getResourceAdapter().getValue(ResourceAdapter.JNDI_NAME); ResourceInfo resourceInfo = new ResourceInfo(jndiName); connectorRuntime_.createConnectorResource(resourceInfo, poolInfo, null); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Created SUN-RA connector resource : ", resourceInfo); } }