use of org.jboss.jca.common.api.metadata.common.TransactionSupportEnum in project wildfly by wildfly.
the class RaOperationUtil method buildResourceAdaptersObject.
public static ModifiableResourceAdapter buildResourceAdaptersObject(final String id, final OperationContext context, ModelNode operation, String archiveOrModule) throws OperationFailedException {
Map<String, String> configProperties = new HashMap<>(0);
List<ConnectionDefinition> connectionDefinitions = new ArrayList<>(0);
List<AdminObject> adminObjects = new ArrayList<>(0);
String transactionSupportResolved = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, TRANSACTION_SUPPORT);
TransactionSupportEnum transactionSupport = operation.hasDefined(TRANSACTION_SUPPORT.getName()) ? TransactionSupportEnum.valueOf(ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, TRANSACTION_SUPPORT)) : null;
String bootstrapContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, BOOTSTRAP_CONTEXT);
List<String> beanValidationGroups = BEANVALIDATION_GROUPS.unwrap(context, operation);
boolean wmSecurity = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, operation, WM_SECURITY);
WorkManager workManager = null;
if (wmSecurity) {
final boolean mappingRequired = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, operation, WM_SECURITY_MAPPING_REQUIRED);
String domain;
final String elytronDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_ELYTRON_SECURITY_DOMAIN);
if (elytronDomain != null) {
domain = elytronDomain;
} else {
domain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_SECURITY_DOMAIN);
}
final String defaultPrincipal = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_SECURITY_DEFAULT_PRINCIPAL);
final List<String> defaultGroups = WM_SECURITY_DEFAULT_GROUPS.unwrap(context, operation);
final Map<String, String> groups = ModelNodeUtil.extractMap(operation, WM_SECURITY_MAPPING_GROUPS, WM_SECURITY_MAPPING_FROM, WM_SECURITY_MAPPING_TO);
final Map<String, String> users = ModelNodeUtil.extractMap(operation, WM_SECURITY_MAPPING_USERS, WM_SECURITY_MAPPING_FROM, WM_SECURITY_MAPPING_TO);
workManager = new WorkManagerImpl(new WorkManagerSecurityImpl(mappingRequired, domain, elytronDomain != null, defaultPrincipal, defaultGroups, users, groups));
}
ModifiableResourceAdapter ra;
ra = new ModifiableResourceAdapter(id, archiveOrModule, transactionSupport, connectionDefinitions, adminObjects, configProperties, beanValidationGroups, bootstrapContext, workManager);
return ra;
}
use of org.jboss.jca.common.api.metadata.common.TransactionSupportEnum in project wildfly by wildfly.
the class ResourceAdapterSubsystemParser method writeRaElement.
private void writeRaElement(XMLExtendedStreamWriter streamWriter, ModelNode ra, final String name) throws XMLStreamException {
streamWriter.writeStartElement(Activations.Tag.RESOURCE_ADAPTER.getLocalName());
streamWriter.writeAttribute(ResourceAdapterParser.Attribute.ID.getLocalName(), name);
STATISTICS_ENABLED.marshallAsAttribute(ra, streamWriter);
ARCHIVE.marshallAsElement(ra, streamWriter);
MODULE.marshallAsElement(ra, streamWriter);
BOOTSTRAP_CONTEXT.marshallAsElement(ra, streamWriter);
if (ra.hasDefined(BEANVALIDATION_GROUPS.getName())) {
streamWriter.writeStartElement(Activation.Tag.BEAN_VALIDATION_GROUPS.getLocalName());
for (ModelNode bvg : ra.get(BEANVALIDATION_GROUPS.getName()).asList()) {
streamWriter.writeStartElement(BEANVALIDATION_GROUPS.getXmlName());
streamWriter.writeCharacters(bvg.asString());
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
TRANSACTION_SUPPORT.marshallAsElement(ra, streamWriter);
writeNewConfigProperties(streamWriter, ra);
TransactionSupportEnum transactionSupport = ra.hasDefined(TRANSACTION_SUPPORT.getName()) ? TransactionSupportEnum.valueOf(ra.get(TRANSACTION_SUPPORT.getName()).resolve().asString()) : null;
boolean isXa = false;
if (transactionSupport == TransactionSupportEnum.XATransaction) {
isXa = true;
}
if (ra.hasDefined(WM_SECURITY.getName()) && ra.get(WM_SECURITY.getName()).asBoolean()) {
streamWriter.writeStartElement(Activation.Tag.WORKMANAGER.getLocalName());
streamWriter.writeStartElement(WorkManager.Tag.SECURITY.getLocalName());
WM_SECURITY_MAPPING_REQUIRED.marshallAsElement(ra, streamWriter);
WM_SECURITY_DOMAIN.marshallAsElement(ra, streamWriter);
WM_ELYTRON_SECURITY_DOMAIN.marshallAsElement(ra, streamWriter);
WM_SECURITY_DEFAULT_PRINCIPAL.marshallAsElement(ra, streamWriter);
if (ra.hasDefined(WM_SECURITY_DEFAULT_GROUPS.getName())) {
streamWriter.writeStartElement(WM_SECURITY_DEFAULT_GROUPS.getXmlName());
for (ModelNode group : ra.get(WM_SECURITY_DEFAULT_GROUPS.getName()).asList()) {
streamWriter.writeStartElement(WM_SECURITY_DEFAULT_GROUP.getXmlName());
streamWriter.writeCharacters(group.asString());
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
if (ra.hasDefined(WM_SECURITY_MAPPING_USERS.getName()) || ra.hasDefined(WM_SECURITY_MAPPING_GROUPS.getName())) {
streamWriter.writeStartElement(WorkManagerSecurity.Tag.MAPPINGS.getLocalName());
if (ra.hasDefined(WM_SECURITY_MAPPING_USERS.getName())) {
streamWriter.writeStartElement(WorkManagerSecurity.Tag.USERS.getLocalName());
for (ModelNode node : ra.get(WM_SECURITY_MAPPING_USERS.getName()).asList()) {
streamWriter.writeStartElement(WorkManagerSecurity.Tag.MAP.getLocalName());
WM_SECURITY_MAPPING_FROM.marshallAsAttribute(node, streamWriter);
WM_SECURITY_MAPPING_TO.marshallAsAttribute(node, streamWriter);
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
if (ra.hasDefined(WM_SECURITY_MAPPING_GROUPS.getName())) {
streamWriter.writeStartElement(WorkManagerSecurity.Tag.GROUPS.getLocalName());
for (ModelNode node : ra.get(WM_SECURITY_MAPPING_GROUPS.getName()).asList()) {
streamWriter.writeStartElement(WorkManagerSecurity.Tag.MAP.getLocalName());
WM_SECURITY_MAPPING_FROM.marshallAsAttribute(node, streamWriter);
WM_SECURITY_MAPPING_TO.marshallAsAttribute(node, streamWriter);
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
streamWriter.writeEndElement();
}
if (ra.hasDefined(CONNECTIONDEFINITIONS_NAME)) {
streamWriter.writeStartElement(Activation.Tag.CONNECTION_DEFINITIONS.getLocalName());
for (Property conDef : ra.get(CONNECTIONDEFINITIONS_NAME).asPropertyList()) {
writeConDef(streamWriter, conDef.getValue(), conDef.getName(), isXa);
}
streamWriter.writeEndElement();
}
if (ra.hasDefined(ADMIN_OBJECTS_NAME)) {
streamWriter.writeStartElement(Activation.Tag.ADMIN_OBJECTS.getLocalName());
for (Property adminObject : ra.get(ADMIN_OBJECTS_NAME).asPropertyList()) {
writeAdminObject(streamWriter, adminObject.getValue(), adminObject.getName());
}
streamWriter.writeEndElement();
}
streamWriter.writeEndElement();
}
use of org.jboss.jca.common.api.metadata.common.TransactionSupportEnum in project wildfly by wildfly.
the class ParsedRaDeploymentProcessor method process.
public static ServiceBuilder<ResourceAdapterDeployment> process(final ConnectorXmlDescriptor connectorXmlDescriptor, final IronJacamarXmlDescriptor ironJacamarXmlDescriptor, final ClassLoader classLoader, final ServiceTarget serviceTarget, final Map<ResourceRoot, Index> annotationIndexes, final ServiceName duServiceName, final ManagementResourceRegistration registration, Resource deploymentResource) throws DeploymentUnitProcessingException {
Connector cmd = connectorXmlDescriptor != null ? connectorXmlDescriptor.getConnector() : null;
final Activation activation = ironJacamarXmlDescriptor != null ? ironJacamarXmlDescriptor.getIronJacamar() : null;
try {
// Annotation merging
Annotations annotator = new Annotations();
if (annotationIndexes != null && annotationIndexes.size() > 0) {
DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found %d annotationIndexes", annotationIndexes.size());
for (Index index : annotationIndexes.values()) {
// Don't apply any empty indexes, as IronJacamar doesn't like that atm.
if (index.getKnownClasses() != null && index.getKnownClasses().size() > 0) {
AnnotationRepository repository = new JandexAnnotationRepositoryImpl(index, classLoader);
cmd = annotator.merge(cmd, repository, classLoader);
DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: CMD=%s", cmd);
}
}
}
if (annotationIndexes == null || annotationIndexes.size() == 0)
DEPLOYMENT_CONNECTOR_LOGGER.debugf("ParsedRaDeploymentProcessor: Found 0 annotationIndexes");
// FIXME: when the connector is null the Iron Jacamar data is ignored
if (cmd != null) {
// Validate metadata
cmd.validate();
// Merge metadata
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(activation, cmd);
}
TransactionSupportEnum transactionSupport = TransactionSupportEnum.NoTransaction;
if (cmd != null && cmd.getResourceadapter() != null && cmd.getResourceadapter().getOutboundResourceadapter() != null) {
transactionSupport = cmd.getResourceadapter().getOutboundResourceadapter().getTransactionSupport();
}
if (activation != null && activation.getTransactionSupport() != null) {
transactionSupport = activation.getTransactionSupport();
}
final ServiceName deployerServiceName = ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(connectorXmlDescriptor.getDeploymentName());
final ResourceAdapterDeploymentService raDeploymentService = new ResourceAdapterDeploymentService(connectorXmlDescriptor, cmd, activation, classLoader, deployerServiceName, duServiceName, registration, deploymentResource);
// Create the service
ServiceBuilder<ResourceAdapterDeployment> builder = Services.addServerExecutorDependency(serviceTarget.addService(deployerServiceName, raDeploymentService), raDeploymentService.getExecutorServiceInjector(), false).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, raDeploymentService.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, raDeploymentService.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, raDeploymentService.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, raDeploymentService.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, raDeploymentService.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, raDeploymentService.getConfigInjector()).addDependency(ConnectorServices.IDLE_REMOVER_SERVICE).addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE).addDependency(NamingService.SERVICE_NAME);
if (transactionSupport == null || transactionSupport.equals(TransactionSupportEnum.NoTransaction)) {
builder.addDependency(ConnectorServices.NON_TX_CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
} else {
builder.addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, raDeploymentService.getCcmInjector());
}
if (activation != null && ActivationSecurityUtil.isLegacySecurityRequired(activation)) {
builder.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class, raDeploymentService.getSubjectFactoryInjector()).addDependency(SimpleSecurityManagerService.SERVICE_NAME, ServerSecurityManager.class, raDeploymentService.getServerSecurityManager());
}
return builder;
} catch (Throwable t) {
throw new DeploymentUnitProcessingException(t);
}
}
use of org.jboss.jca.common.api.metadata.common.TransactionSupportEnum in project wildfly by wildfly.
the class ExternalPooledConnectionFactoryService method createService.
private void createService(ServiceTarget serviceTarget, ServiceContainer container) throws Exception {
InputStream is = null;
InputStream isIj = null;
// Properties for the resource adapter
List<ConfigProperty> properties = new ArrayList<ConfigProperty>();
try {
StringBuilder connectorClassname = new StringBuilder();
StringBuilder connectorParams = new StringBuilder();
TransportConfigOperationHandlers.processConnectorBindings(Arrays.asList(connectors), socketBindings, outboundSocketBindings);
for (TransportConfiguration tc : connectors) {
if (tc == null) {
throw MessagingLogger.ROOT_LOGGER.connectorNotDefined("null");
}
if (connectorClassname.length() > 0) {
connectorClassname.append(",");
connectorParams.append(",");
}
connectorClassname.append(tc.getFactoryClassName());
Map<String, Object> params = tc.getParams();
boolean multiple = false;
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (multiple) {
connectorParams.append(";");
}
connectorParams.append(entry.getKey()).append("=").append(entry.getValue());
multiple = true;
}
}
if (connectorClassname.length() > 0) {
properties.add(simpleProperty15(CONNECTOR_CLASSNAME, STRING_TYPE, connectorClassname.toString()));
}
if (connectorParams.length() > 0) {
properties.add(simpleProperty15(CONNECTION_PARAMETERS, STRING_TYPE, connectorParams.toString()));
}
if (discoveryGroupConfiguration != null) {
final String dgName = discoveryGroupConfiguration.getName();
final String key = "discovery" + dgName;
final DiscoveryGroupConfiguration config;
if (commandDispatcherFactories.containsKey(key)) {
BroadcastCommandDispatcherFactory commandDispatcherFactory = commandDispatcherFactories.get(key).get();
String clusterName = clusterNames.get(key);
config = JGroupsDiscoveryGroupAdd.createDiscoveryGroupConfiguration(name, discoveryGroupConfiguration, commandDispatcherFactory, clusterName);
} else {
final SocketBinding binding = groupBindings.get(key).get();
if (binding == null) {
throw MessagingLogger.ROOT_LOGGER.failedToFindDiscoverySocketBinding(dgName);
}
config = SocketDiscoveryGroupAdd.createDiscoveryGroupConfiguration(name, discoveryGroupConfiguration, binding);
binding.getSocketBindings().getNamedRegistry().registerBinding(ManagedBinding.Factory.createSimpleManagedBinding(binding));
}
BroadcastEndpointFactory bgCfg = config.getBroadcastEndpointFactory();
if (bgCfg instanceof UDPBroadcastEndpointFactory) {
UDPBroadcastEndpointFactory udpCfg = (UDPBroadcastEndpointFactory) bgCfg;
properties.add(simpleProperty15(GROUP_ADDRESS, STRING_TYPE, udpCfg.getGroupAddress()));
properties.add(simpleProperty15(GROUP_PORT, INTEGER_TYPE, "" + udpCfg.getGroupPort()));
properties.add(simpleProperty15(DISCOVERY_LOCAL_BIND_ADDRESS, STRING_TYPE, "" + udpCfg.getLocalBindAddress()));
} else if (bgCfg instanceof CommandDispatcherBroadcastEndpointFactory) {
String external = "/" + name + ":discovery" + dgName;
properties.add(simpleProperty15(JGROUPS_CHANNEL_NAME, STRING_TYPE, jgroupsClusterName));
properties.add(simpleProperty15(JGROUPS_CHANNEL_REF_NAME, STRING_TYPE, external));
}
properties.add(simpleProperty15(DISCOVERY_INITIAL_WAIT_TIMEOUT, LONG_TYPE, "" + config.getDiscoveryInitialWaitTimeout()));
properties.add(simpleProperty15(REFRESH_TIMEOUT, LONG_TYPE, "" + config.getRefreshTimeout()));
}
boolean hasReconnect = false;
final List<ConfigProperty> inboundProperties = new ArrayList<>();
final List<ConfigProperty> outboundProperties = new ArrayList<>();
final String reconnectName = ConnectionFactoryAttributes.Pooled.RECONNECT_ATTEMPTS_PROP_NAME;
for (PooledConnectionFactoryConfigProperties adapterParam : adapterParams) {
hasReconnect |= reconnectName.equals(adapterParam.getName());
ConfigProperty p = simpleProperty15(adapterParam.getName(), adapterParam.getType(), adapterParam.getValue());
if (adapterParam.getName().equals(REBALANCE_CONNECTIONS_PROP_NAME)) {
boolean rebalanceConnections = Boolean.parseBoolean(adapterParam.getValue());
if (rebalanceConnections) {
inboundProperties.add(p);
}
} else {
if (null == adapterParam.getConfigType()) {
properties.add(p);
} else {
switch(adapterParam.getConfigType()) {
case INBOUND:
inboundProperties.add(p);
break;
case OUTBOUND:
outboundProperties.add(p);
break;
default:
properties.add(p);
break;
}
}
}
}
// The default -1, which will hang forever until a server appears
if (!hasReconnect) {
properties.add(simpleProperty15(reconnectName, Integer.class.getName(), DEFAULT_MAX_RECONNECTS));
}
configureCredential(properties);
WildFlyRecoveryRegistry.container = container;
OutboundResourceAdapter outbound = createOutbound(outboundProperties);
InboundResourceAdapter inbound = createInbound(inboundProperties);
ResourceAdapter ra = createResourceAdapter15(properties, outbound, inbound);
Connector cmd = createConnector15(ra);
TransactionSupportEnum transactionSupport = getTransactionSupport(txSupport);
ConnectionDefinition common = createConnDef(transactionSupport, bindInfo.getBindName(), minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace);
Activation activation = createActivation(common, transactionSupport);
ResourceAdapterActivatorService activator = new ResourceAdapterActivatorService(cmd, activation, ExternalPooledConnectionFactoryService.class.getClassLoader(), name);
activator.setBindInfo(bindInfo);
activator.setCreateBinderService(createBinderService);
activator.addJndiAliases(jndiAliases);
final ServiceBuilder sb = Services.addServerExecutorDependency(serviceTarget.addService(getResourceAdapterActivatorsServiceName(name), activator), activator.getExecutorServiceInjector()).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, activator.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, activator.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, activator.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, activator.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, activator.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, activator.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, activator.getCcmInjector());
sb.requires(NamingService.SERVICE_NAME);
sb.requires(capabilityServiceSupport.getCapabilityServiceName(MessagingServices.LOCAL_TRANSACTION_PROVIDER_CAPABILITY));
sb.requires(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append("default"));
sb.setInitialMode(ServiceController.Mode.PASSIVE).install();
// Mock the deployment service to allow it to start
serviceTarget.addService(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(name), Service.NULL).install();
} finally {
if (is != null) {
is.close();
}
if (isIj != null) {
isIj.close();
}
}
}
use of org.jboss.jca.common.api.metadata.common.TransactionSupportEnum in project wildfly by wildfly.
the class PooledConnectionFactoryService method createService.
private void createService(ServiceTarget serviceTarget, ServiceContainer container) throws Exception {
InputStream is = null;
InputStream isIj = null;
// Properties for the resource adapter
List<ConfigProperty> properties = new ArrayList<ConfigProperty>();
try {
StringBuilder connectorClassname = new StringBuilder();
StringBuilder connectorParams = new StringBuilder();
// pick the first connector available if pickAnyConnectors is true
if (discoveryGroupName == null && connectors.isEmpty() && pickAnyConnectors) {
Set<String> connectorNames = activeMQServer.getValue().getConfiguration().getConnectorConfigurations().keySet();
if (!connectorNames.isEmpty()) {
String connectorName = connectorNames.iterator().next();
MessagingLogger.ROOT_LOGGER.connectorForPooledConnectionFactory(name, connectorName);
connectors.add(connectorName);
}
}
for (String connector : connectors) {
TransportConfiguration tc = activeMQServer.getValue().getConfiguration().getConnectorConfigurations().get(connector);
if (tc == null) {
throw MessagingLogger.ROOT_LOGGER.connectorNotDefined(connector);
}
if (connectorClassname.length() > 0) {
connectorClassname.append(",");
connectorParams.append(",");
}
connectorClassname.append(tc.getFactoryClassName());
Map<String, Object> params = tc.getParams();
boolean multiple = false;
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (multiple) {
connectorParams.append(";");
}
connectorParams.append(entry.getKey()).append("=").append(entry.getValue());
multiple = true;
}
}
if (connectorClassname.length() > 0) {
properties.add(simpleProperty15(CONNECTOR_CLASSNAME, STRING_TYPE, connectorClassname.toString()));
}
if (connectorParams.length() > 0) {
properties.add(simpleProperty15(CONNECTION_PARAMETERS, STRING_TYPE, connectorParams.toString()));
}
if (discoveryGroupName != null) {
DiscoveryGroupConfiguration discoveryGroupConfiguration = activeMQServer.getValue().getConfiguration().getDiscoveryGroupConfigurations().get(discoveryGroupName);
BroadcastEndpointFactory bgCfg = discoveryGroupConfiguration.getBroadcastEndpointFactory();
if (bgCfg instanceof UDPBroadcastEndpointFactory) {
UDPBroadcastEndpointFactory udpCfg = (UDPBroadcastEndpointFactory) bgCfg;
properties.add(simpleProperty15(GROUP_ADDRESS, STRING_TYPE, udpCfg.getGroupAddress()));
properties.add(simpleProperty15(GROUP_PORT, INTEGER_TYPE, "" + udpCfg.getGroupPort()));
properties.add(simpleProperty15(DISCOVERY_LOCAL_BIND_ADDRESS, STRING_TYPE, "" + udpCfg.getLocalBindAddress()));
} else if (bgCfg instanceof CommandDispatcherBroadcastEndpointFactory) {
properties.add(simpleProperty15(JGROUPS_CHANNEL_NAME, STRING_TYPE, jgroupsChannelName));
properties.add(simpleProperty15(JGROUPS_CHANNEL_REF_NAME, STRING_TYPE, serverName + "/discovery" + discoveryGroupConfiguration.getName()));
}
properties.add(simpleProperty15(DISCOVERY_INITIAL_WAIT_TIMEOUT, LONG_TYPE, "" + discoveryGroupConfiguration.getDiscoveryInitialWaitTimeout()));
properties.add(simpleProperty15(REFRESH_TIMEOUT, LONG_TYPE, "" + discoveryGroupConfiguration.getRefreshTimeout()));
}
boolean hasReconnect = false;
final List<ConfigProperty> inboundProperties = new ArrayList<>();
final List<ConfigProperty> outboundProperties = new ArrayList<>();
final String reconnectName = ConnectionFactoryAttributes.Pooled.RECONNECT_ATTEMPTS_PROP_NAME;
for (PooledConnectionFactoryConfigProperties adapterParam : adapterParams) {
hasReconnect |= reconnectName.equals(adapterParam.getName());
ConfigProperty p = simpleProperty15(adapterParam.getName(), adapterParam.getType(), adapterParam.getValue());
if (adapterParam.getName().equals(REBALANCE_CONNECTIONS_PROP_NAME)) {
boolean rebalanceConnections = Boolean.parseBoolean(adapterParam.getValue());
if (rebalanceConnections) {
inboundProperties.add(p);
}
} else {
if (null == adapterParam.getConfigType()) {
properties.add(p);
} else
switch(adapterParam.getConfigType()) {
case INBOUND:
inboundProperties.add(p);
break;
case OUTBOUND:
outboundProperties.add(p);
break;
default:
properties.add(p);
break;
}
}
}
// The default -1, which will hang forever until a server appears
if (!hasReconnect) {
properties.add(simpleProperty15(reconnectName, Integer.class.getName(), DEFAULT_MAX_RECONNECTS));
}
configureCredential(properties);
// for backwards compatibility, the RA inbound is configured to prefix the Jakarta Messaging resources if JNDI lookups fail
// and the destination are inferred from the JNDI name.
inboundProperties.add(simpleProperty15("queuePrefix", String.class.getName(), JMS_QUEUE_PREFIX));
inboundProperties.add(simpleProperty15("topicPrefix", String.class.getName(), JMS_TOPIC_PREFIX));
WildFlyRecoveryRegistry.container = container;
OutboundResourceAdapter outbound = createOutbound(outboundProperties);
InboundResourceAdapter inbound = createInbound(inboundProperties);
ResourceAdapter ra = createResourceAdapter15(properties, outbound, inbound);
Connector cmd = createConnector15(ra);
TransactionSupportEnum transactionSupport = getTransactionSupport(txSupport);
ConnectionDefinition common = createConnDef(transactionSupport, bindInfo.getBindName(), minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace);
Activation activation = createActivation(common, transactionSupport);
ResourceAdapterActivatorService activator = new ResourceAdapterActivatorService(cmd, activation, PooledConnectionFactoryService.class.getClassLoader(), name);
activator.setBindInfo(bindInfo);
activator.setCreateBinderService(createBinderService);
activator.addJndiAliases(jndiAliases);
final ServiceBuilder sb = Services.addServerExecutorDependency(serviceTarget.addService(getResourceAdapterActivatorsServiceName(name), activator), activator.getExecutorServiceInjector()).addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, activator.getMdrInjector()).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, activator.getRaRepositoryInjector()).addDependency(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, ManagementRepository.class, activator.getManagementRepositoryInjector()).addDependency(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, ResourceAdapterDeploymentRegistry.class, activator.getRegistryInjector()).addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, activator.getTxIntegrationInjector()).addDependency(ConnectorServices.CONNECTOR_CONFIG_SERVICE, JcaSubsystemConfiguration.class, activator.getConfigInjector()).addDependency(ConnectorServices.CCM_SERVICE, CachedConnectionManager.class, activator.getCcmInjector());
sb.requires(ActiveMQActivationService.getServiceName(getActiveMQServiceName(serverName)));
sb.requires(NamingService.SERVICE_NAME);
sb.requires(MessagingServices.getCapabilityServiceName(MessagingServices.LOCAL_TRANSACTION_PROVIDER_CAPABILITY));
sb.requires(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append("default"));
sb.setInitialMode(ServiceController.Mode.PASSIVE).install();
// Mock the deployment service to allow it to start
serviceTarget.addService(ConnectorServices.RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX.append(name), Service.NULL).install();
} finally {
if (is != null)
is.close();
if (isIj != null)
isIj.close();
}
}
Aggregations