use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class CmpKeyGeneratorSubsystem11TestCase method assertOperation.
private void assertOperation(final ModelNode operation, final String operationName, final PathElement lastElement) {
assertEquals(operationName, operation.get(OP).asString());
final PathAddress addr = PathAddress.pathAddress(operation.get(OP_ADDR));
final PathElement element = addr.getLastElement();
assertEquals(lastElement.getKey(), element.getKey());
assertEquals(lastElement.getValue(), element.getValue());
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class JMSConnectionFactoryDefinitionInjectionSource method startedPooledConnectionFactory.
private void startedPooledConnectionFactory(ResolutionContext context, String name, ServiceBuilder<?> serviceBuilder, ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException, OperationFailedException {
Map<String, String> props = new HashMap<>(properties);
List<String> connectors = getConnectors(props);
clearUnknownProperties(properties);
ModelNode model = new ModelNode();
for (String connector : connectors) {
model.get(CONNECTORS).add(connector);
}
for (Map.Entry<String, String> entry : properties.entrySet()) {
model.get(entry.getKey()).set(entry.getValue());
}
model.get(MIN_POOL_SIZE.getName()).set(minPoolSize);
model.get(MAX_POOL_SIZE.getName()).set(maxPoolSize);
if (user != null && !user.isEmpty()) {
model.get(ConnectionFactoryAttributes.Pooled.USER.getName()).set(user);
}
if (password != null && !password.isEmpty()) {
model.get(ConnectionFactoryAttributes.Pooled.PASSWORD.getName()).set(password);
}
if (clientId != null && !clientId.isEmpty()) {
model.get(CommonAttributes.CLIENT_ID.getName()).set(clientId);
}
final String discoveryGroupName = properties.containsKey(DISCOVERY_GROUP.getName()) ? properties.get(DISCOVERY_GROUP.getName()) : null;
if (discoveryGroupName != null) {
model.get(DISCOVERY_GROUP.getName()).set(discoveryGroupName);
}
final String jgroupsChannelName = properties.containsKey(JGROUPS_CHANNEL.getName()) ? properties.get(JGROUPS_CHANNEL.getName()) : null;
if (jgroupsChannelName != null) {
model.get(JGROUPS_CHANNEL.getName()).set(jgroupsChannelName);
}
final String managedConnectionPoolClassName = properties.containsKey(MANAGED_CONNECTION_POOL.getName()) ? properties.get(MANAGED_CONNECTION_POOL.getName()) : null;
if (managedConnectionPoolClassName != null) {
model.get(MANAGED_CONNECTION_POOL.getName()).set(managedConnectionPoolClassName);
}
final Boolean enlistmentTrace = properties.containsKey(ENLISTMENT_TRACE.getName()) ? Boolean.valueOf(properties.get(ENLISTMENT_TRACE.getName())) : null;
List<PooledConnectionFactoryConfigProperties> adapterParams = getAdapterParams(model);
String txSupport = transactional ? XA_TX : NO_TX;
final String serverName = getActiveMQServerName(properties);
final String pcfName = uniqueName(context, name);
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(context.getApplicationName(), context.getModuleName(), context.getComponentName(), !context.isCompUsesModule(), name);
PooledConnectionFactoryService.installService(serviceTarget, pcfName, serverName, connectors, discoveryGroupName, jgroupsChannelName, adapterParams, bindInfo, txSupport, minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace, true);
final ServiceName referenceFactoryServiceName = ConnectionFactoryReferenceFactoryService.SERVICE_NAME_BASE.append(bindInfo.getBinderServiceName());
serviceBuilder.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, injector);
//create the management registration
String managementName = managementName(context, name);
final PathElement serverElement = PathElement.pathElement(SERVER, serverName);
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
deploymentResourceSupport.getDeploymentSubModel(MessagingExtension.SUBSYSTEM_NAME, serverElement);
final PathElement pcfPath = PathElement.pathElement(POOLED_CONNECTION_FACTORY, managementName);
PathAddress registration = PathAddress.pathAddress(serverElement, pcfPath);
MessagingXmlInstallDeploymentUnitProcessor.createDeploymentSubModel(registration, deploymentUnit);
PooledConnectionFactoryConfigurationRuntimeHandler.INSTANCE.registerResource(serverName, managementName, model);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class JMSDestinationDefinitionInjectionSource method startQueue.
/**
* To workaround ActiveMQ's BindingRegistry limitation in {@link WildFlyBindingRegistry}
* that does not allow to build a BindingInfo with the ResolutionContext info, the JMS queue is created *without* any
* JNDI bindings and handle the JNDI bindings directly by getting the service's JMS queue.
*/
private void startQueue(final String queueName, final ServiceTarget serviceTarget, final ServiceName serverServiceName, final ServiceBuilder<?> serviceBuilder, final DeploymentUnit deploymentUnit, final Injector<ManagedReferenceFactory> injector) {
final String selector = properties.containsKey(SELECTOR.getName()) ? properties.get(SELECTOR.getName()) : null;
final boolean durable = properties.containsKey(DURABLE.getName()) ? Boolean.valueOf(properties.get(DURABLE.getName())) : DURABLE.getDefaultValue().asBoolean();
ModelNode destination = new ModelNode();
destination.get(NAME).set(queueName);
destination.get(DURABLE.getName()).set(durable);
if (selector != null) {
destination.get(SELECTOR.getName()).set(selector);
}
destination.get(ENTRIES).add(jndiName);
Service<Queue> queueService = JMSQueueService.installService(queueName, serviceTarget, serverServiceName, selector, durable, new String[0]);
inject(serviceBuilder, injector, queueService);
//create the management registration
String serverName = getActiveMQServerName(properties);
final PathElement serverElement = PathElement.pathElement(SERVER, serverName);
final PathElement dest = PathElement.pathElement(JMS_QUEUE, queueName);
final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
deploymentResourceSupport.getDeploymentSubModel(MessagingExtension.SUBSYSTEM_NAME, serverElement);
PathAddress registration = PathAddress.pathAddress(serverElement, dest);
MessagingXmlInstallDeploymentUnitProcessor.createDeploymentSubModel(registration, deploymentUnit);
JMSQueueConfigurationRuntimeHandler.INSTANCE.registerResource(serverName, queueName, destination);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class SecuritySubsystemParser_3_0 method parseElytronRealm.
protected void parseElytronRealm(final XMLExtendedStreamReader reader, final List<ModelNode> operations, final PathAddress subsystemPath) throws XMLStreamException {
final ModelNode elytronRealmAddOperation = Util.createAddOperation();
PathElement elytronRealmPath = null;
final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.LEGACY_JAAS_CONFIG);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch(attribute) {
case NAME:
{
if (value == null || value.length() == 0) {
throw invalidAttributeValue(reader, i);
}
elytronRealmPath = PathElement.pathElement(ELYTRON_REALM, value);
break;
}
case LEGACY_JAAS_CONFIG:
{
LEGACY_JAAS_CONFIG.parseAndSetParameter(value, elytronRealmAddOperation, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
elytronRealmAddOperation.get(OP_ADDR).set(subsystemPath.append(elytronRealmPath).toModelNode());
operations.add(elytronRealmAddOperation);
requireNoContent(reader);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class SecuritySubsystemParser_3_0 method parseTLSEntity.
protected void parseTLSEntity(final XMLExtendedStreamReader reader, final List<ModelNode> operations, final PathAddress subsystemPath, final String tlsEntityName) throws XMLStreamException {
final ModelNode elytronTLSEntityAddOperation = Util.createAddOperation();
PathElement elytronTLSEntityPath = null;
final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.LEGACY_JSSE_CONFIG);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch(attribute) {
case NAME:
{
if (value == null || value.length() == 0) {
throw invalidAttributeValue(reader, i);
}
elytronTLSEntityPath = PathElement.pathElement(tlsEntityName, value);
break;
}
case LEGACY_JSSE_CONFIG:
{
LEGACY_JSSE_CONFIG.parseAndSetParameter(value, elytronTLSEntityAddOperation, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
elytronTLSEntityAddOperation.get(OP_ADDR).set(subsystemPath.append(elytronTLSEntityPath).toModelNode());
operations.add(elytronTLSEntityAddOperation);
requireNoContent(reader);
}
Aggregations