@Override public void start(StartContext context) throws StartException { final URL url = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getUrl(); deploymentName = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getDeploymentName(); final File root = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getRoot(); DEPLOYMENT_CONNECTOR_LOGGER.debugf("DEPLOYMENT name = %s", deploymentName); final AS7RaDeployer raDeployer = new AS7RaDeployer( context.getChildTarget(), url, deploymentName, root, classLoader, cmd, ijmd, deploymentServiceName); raDeployer.setConfiguration(config.getValue()); ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WritableServiceBasedNamingStore.pushOwner(duServiceName); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); raDeployment = raDeployer.doDeploy(); deploymentName = raDeployment.getDeploymentName(); } catch (Throwable t) { unregisterAll(deploymentName); throw MESSAGES.failedToStartRaDeployment(t, deploymentName); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old); WritableServiceBasedNamingStore.popOwner(); } if (raDeployer.checkActivation(cmd, ijmd)) { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Activating: %s", deploymentName); ServiceName raServiceName = ConnectorServices.getResourceAdapterServiceName(deploymentName); value = new ResourceAdapterDeployment(raDeployment, deploymentName, raServiceName); managementRepository.getValue().getConnectors().add(value.getDeployment().getConnector()); registry.getValue().registerResourceAdapterDeployment(value); context .getChildTarget() .addService( raServiceName, new ResourceAdapterService( deploymentName, raServiceName, value.getDeployment().getResourceAdapter())) .setInitialMode(Mode.ACTIVE) .install(); } else { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Not activating: %s", deploymentName); } }
@Override protected void setRecoveryForResourceAdapterInResourceAdapterRepository( String key, boolean isXA) { try { raRepository.getValue().setRecoveryForResourceAdapter(key, isXA); } catch (Throwable t) { DEPLOYMENT_CONNECTOR_LOGGER.unableToRegisterRecovery(key, isXA); } }
@Override public void unregisterAll(String deploymentName) { ConnectorServices.unregisterResourceAdapterIdentifier(deploymentName); super.unregisterAll(deploymentName); if (mdr != null && mdr.getValue() != null && deploymentName != null) { try { mdr.getValue().unregisterResourceAdapter(deploymentName); } catch (Throwable t) { DEPLOYMENT_CONNECTOR_LOGGER.debug("Exception during unregistering deployment", t); } } }
/** Stop */ @Override public void stop(StopContext context) { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Stopping sevice %s", deploymentServiceName); unregisterAll(deploymentName); }