use of org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment in project wildfly by wildfly.
the class RaServicesFactory method createDeploymentService.
public static void createDeploymentService(final ManagementResourceRegistration registration, ConnectorXmlDescriptor connectorXmlDescriptor, Module module, ServiceTarget serviceTarget, final String deploymentUnitName, ServiceName deploymentUnitServiceName, String deployment, Activation raxml, final Resource deploymentResource, final ServiceRegistry serviceRegistry) {
// Create the service
ServiceName serviceName = ConnectorServices.getDeploymentServiceName(deploymentUnitName, raxml);
ResourceAdapterXmlDeploymentService service = new ResourceAdapterXmlDeploymentService(connectorXmlDescriptor, raxml, module, deployment, serviceName, deploymentUnitServiceName);
String bootStrapCtxName = DEFAULT_NAME;
if (raxml.getBootstrapContext() != null && !raxml.getBootstrapContext().equals("undefined")) {
bootStrapCtxName = raxml.getBootstrapContext();
}
ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(serviceName, service), service.getExecutorServiceInjector(), false).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, service.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, service.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, service.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, service.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, service.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, service.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, service.getCcmInjector()).addDependency(ConnectorServices.IDLE_REMOVER_SERVICE).addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE).addDependency(NamingService.SERVICE_NAME).addDependency(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append(bootStrapCtxName)).addDependency(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName()));
if (ActivationSecurityUtil.isLegacySecurityRequired(raxml)) {
builder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class, service.getSubjectFactoryInjector()).addDependency(SimpleSecurityManagerService.SERVICE_NAME, ServerSecurityManager.class, service.getServerSecurityManager());
}
String raName = deployment;
if (raxml.getId() != null) {
raName = raxml.getId();
}
ServiceName parentName = ServiceName.of(ConnectorServices.RA_SERVICE, raName);
for (ServiceName subServiceName : serviceRegistry.getServiceNames()) {
if (parentName.isParentOf(subServiceName) && !subServiceName.getSimpleName().equals(ConnectorServices.STATISTICS_SUFFIX)) {
builder.addDependency(subServiceName);
}
}
if (registration != null && deploymentResource != null) {
if (registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName) == null) {
registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
@Override
public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
return Collections.emptyMap();
}
@Override
public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
return Collections.emptyMap();
}
});
}
}
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
}
use of org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment in project wildfly by wildfly.
the class RaServicesFactory method createDeploymentService.
public static void createDeploymentService(final ManagementResourceRegistration registration, ConnectorXmlDescriptor connectorXmlDescriptor, Module module, ServiceTarget serviceTarget, final String deploymentUnitName, ServiceName deploymentUnitServiceName, String deployment, Activation raxml, final Resource deploymentResource, final ServiceRegistry serviceRegistry, final CapabilityServiceSupport support) {
// Create the service
ServiceName serviceName = ConnectorServices.getDeploymentServiceName(deploymentUnitName, raxml);
ResourceAdapterXmlDeploymentService service = new ResourceAdapterXmlDeploymentService(connectorXmlDescriptor, raxml, module, deployment, serviceName, deploymentUnitServiceName);
String bootStrapCtxName = DEFAULT_NAME;
if (raxml.getBootstrapContext() != null && !raxml.getBootstrapContext().equals("undefined")) {
bootStrapCtxName = raxml.getBootstrapContext();
}
ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(serviceName, service), service.getExecutorServiceInjector()).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, service.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, service.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, service.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, service.getRegistryInjector()).addDependency(support.getCapabilityServiceName(ConnectorServices.TRANSACTION_INTEGRATION_CAPABILITY_NAME), TransactionIntegration.class, service.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, service.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, service.getCcmInjector());
builder.requires(ConnectorServices.IDLE_REMOVER_SERVICE);
builder.requires(ConnectorServices.CONNECTION_VALIDATOR_SERVICE);
builder.requires(support.getCapabilityServiceName(NamingService.CAPABILITY_NAME));
builder.requires(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append(bootStrapCtxName));
builder.requires(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName()));
String raName = deployment;
if (raxml.getId() != null) {
raName = raxml.getId();
}
ServiceName parentName = ServiceName.of(ConnectorServices.RA_SERVICE, raName);
for (ServiceName subServiceName : serviceRegistry.getServiceNames()) {
if (parentName.isParentOf(subServiceName) && !subServiceName.getSimpleName().equals(ConnectorServices.STATISTICS_SUFFIX)) {
builder.requires(subServiceName);
}
}
if (registration != null && deploymentResource != null && registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName) == null) {
registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
@Override
public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
return Collections.emptyMap();
}
@Override
public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
return Collections.emptyMap();
}
});
}
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
}
use of org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment in project wildfly by wildfly.
the class ResourceAdapterActivatorService method start.
@Override
public void start(StartContext context) throws StartException {
String pathname = "file://RaActivator" + deploymentName;
try {
ResourceAdapterActivator activator = new ResourceAdapterActivator(context.getChildTarget(), new URL(pathname), deploymentName, new File(pathname), cl, cmd, activation);
activator.setConfiguration(getConfig().getValue());
// FIXME!!, this should probably be done by IJ and not the service
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(cl);
deploymentMD = activator.doDeploy();
} finally {
Thread.currentThread().setContextClassLoader(old);
}
String raName = deploymentMD.getDeploymentName();
ServiceName raServiceName = ConnectorServices.getResourceAdapterServiceName(raName);
value = new ResourceAdapterDeployment(deploymentMD, raName, raServiceName);
registry.getValue().registerResourceAdapterDeployment(value);
managementRepository.getValue().getConnectors().add(value.getDeployment().getConnector());
context.getChildTarget().addService(raServiceName, new ResourceAdapterService(raServiceName, value.getDeployment().getResourceAdapter())).setInitialMode(Mode.ACTIVE).install();
DEPLOYMENT_CONNECTOR_LOGGER.debugf("Started service %s", ConnectorServices.RESOURCE_ADAPTER_ACTIVATOR_SERVICE);
} catch (Throwable t) {
// To clean up we need to invoke blocking behavior, so do that in another thread
// and let this MSC thread return
String raName = deploymentName;
ServiceName raServiceName = ConnectorServices.getResourceAdapterServiceName(raName);
cleanupStartAsync(context, deploymentName, raServiceName, t);
}
}
use of org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment in project wildfly by wildfly.
the class ResourceAdapterXmlDeploymentService method start.
/**
* Start
*/
@Override
public void start(StartContext context) throws StartException {
try {
Connector cmd = mdr.getValue().getResourceAdapter(deployment);
File root = mdr.getValue().getRoot(deployment);
Activation localRaXml = getRaxml();
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(localRaXml, cmd);
String id = ((ModifiableResourceAdapter) raxml).getId();
final ServiceName raServiceName;
if (id == null || id.trim().isEmpty()) {
raServiceName = ConnectorServices.getResourceAdapterServiceName(raName);
this.connectorServicesRegistrationName = raName;
} else {
raServiceName = ConnectorServices.getResourceAdapterServiceName(id);
this.connectorServicesRegistrationName = id;
}
final WildFlyRaXmlDeployer raDeployer = new WildFlyRaXmlDeployer(context.getChildTarget(), connectorXmlDescriptor.getUrl(), raName, root, module.getClassLoader(), cmd, localRaXml, deploymentServiceName);
raDeployer.setConfiguration(config.getValue());
WritableServiceBasedNamingStore.pushOwner(duServiceName);
ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
raxmlDeployment = raDeployer.doDeploy();
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old);
WritableServiceBasedNamingStore.popOwner();
}
value = new ResourceAdapterDeployment(raxmlDeployment, raName, raServiceName);
managementRepository.getValue().getConnectors().add(value.getDeployment().getConnector());
registry.getValue().registerResourceAdapterDeployment(value);
final ServiceBuilder raServiceSB = context.getChildTarget().addService(raServiceName, new ResourceAdapterService(raServiceName, value.getDeployment().getResourceAdapter()));
raServiceSB.requires(deploymentServiceName);
raServiceSB.setInitialMode(ServiceController.Mode.ACTIVE).install();
} catch (Throwable t) {
cleanupStartAsync(context, raName, deploymentServiceName, t);
}
}
use of org.jboss.as.connector.metadata.deployment.ResourceAdapterDeployment in project wildfly by wildfly.
the class ResourceAdapterDeploymentService method start.
@Override
public void start(StartContext context) throws StartException {
final URL url = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getUrl();
deploymentName = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getDeploymentName();
connectorServicesRegistrationName = deploymentName;
final File root = connectorXmlDescriptor == null ? null : connectorXmlDescriptor.getRoot();
DEPLOYMENT_CONNECTOR_LOGGER.debugf("DEPLOYMENT name = %s", deploymentName);
final boolean fromModule = duServiceName.getParent().equals(RaOperationUtil.RAR_MODULE);
final WildFLyRaDeployer raDeployer = new WildFLyRaDeployer(context.getChildTarget(), url, deploymentName, root, classLoader, cmd, activation, deploymentServiceName, fromModule);
raDeployer.setConfiguration(config.getValue());
ClassLoader old = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
try {
WritableServiceBasedNamingStore.pushOwner(duServiceName);
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
raDeployment = raDeployer.doDeploy();
deploymentName = raDeployment.getDeploymentName();
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old);
WritableServiceBasedNamingStore.popOwner();
}
if (raDeployer.checkActivation(cmd, activation)) {
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);
ServiceTarget serviceTarget = context.getChildTarget();
serviceTarget.addService(raServiceName, new ResourceAdapterService(raServiceName, value.getDeployment().getResourceAdapter())).setInitialMode(Mode.ACTIVE).install();
final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(deploymentName);
IronJacamarActivationResourceService ijResourceService = new IronJacamarActivationResourceService(registration, deploymentResource, false);
serviceTarget.addService(deployerServiceName.append(ConnectorServices.IRONJACAMAR_RESOURCE), ijResourceService).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, ijResourceService.getMdrInjector()).addDependency(deployerServiceName, ResourceAdapterDeployment.class, ijResourceService.getResourceAdapterDeploymentInjector()).setInitialMode(Mode.PASSIVE).install();
} else {
DEPLOYMENT_CONNECTOR_LOGGER.debugf("Not activating: %s", deploymentName);
}
} catch (Throwable t) {
cleanupStartAsync(context, deploymentName, t, duServiceName, classLoader);
}
}
Aggregations