use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class AbstractXMLDataSourceRuntimeHandler method getDataSourceConfig.
private T getDataSourceConfig(final PathAddress operationAddress) throws OperationFailedException {
final List<PathElement> relativeAddress = new ArrayList<PathElement>();
for (int i = operationAddress.size() - 1; i >= 0; i--) {
PathElement pe = operationAddress.getElement(i);
relativeAddress.add(0, pe);
if (ModelDescriptionConstants.DEPLOYMENT.equals(pe.getKey())) {
break;
}
}
final PathAddress pa = PathAddress.pathAddress(relativeAddress);
final T config;
if (operationAddress.getLastElement().getKey().equals(CONNECTION_PROPERTIES) || operationAddress.getLastElement().getKey().equals(XA_DATASOURCE_PROPERTIES)) {
config = dataSourceConfigs.get(pa.subAddress(0, pa.size() - 1));
} else {
config = dataSourceConfigs.get(pa);
}
if (config == null) {
String exceptionMessage = ConnectorLogger.ROOT_LOGGER.noDataSourceRegisteredForAddress(operationAddress);
throw new OperationFailedException(exceptionMessage);
}
return config;
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class LogStoreProbeHandler method addTransactions.
private void addTransactions(final Resource parent, Set<ObjectInstance> transactions, MBeanServer mbs) throws IntrospectionException, InstanceNotFoundException, IOException, ReflectionException, MalformedObjectNameException {
for (ObjectInstance oi : transactions) {
String transactionId = oi.getObjectName().getCanonicalName();
if (!transactionId.contains("puid") && transactionId.contains("itype")) {
final Resource transaction = new LogStoreResource.LogStoreRuntimeResource(oi.getObjectName());
final ModelNode model = transaction.getModel();
Map<String, String> tAttributes = getMBeanValues(mbs, oi.getObjectName(), LogStoreConstants.TXN_JMX_NAMES);
String txnId = tAttributes.get("Id");
addAttributes(model, LogStoreConstants.MODEL_TO_JMX_TXN_NAMES, tAttributes);
// model.get(LogStoreConstants.JMX_ON_ATTRIBUTE).set(transactionId);
String participantQuery = transactionId + ",puid=*";
Set<ObjectInstance> participants = mbs.queryMBeans(new ObjectName(participantQuery), null);
addParticipants(transaction, participants, mbs);
final PathElement element = PathElement.pathElement(LogStoreConstants.TRANSACTIONS, txnId);
parent.registerChild(element, transaction);
}
}
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class BackupsResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
PathAddressTransformer addressTransformer = new PathAddressTransformer() {
@Override
public PathAddress transform(PathElement current, Builder builder) {
return builder.next();
}
};
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, addressTransformer) : parent.addChildResource(PATH);
BackupResourceDefinition.buildTransformation(version, builder);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class ManagedExecutorServiceResourceDefinition method registerTransformers_4_0.
void registerTransformers_4_0(final ResourceTransformationDescriptionBuilder builder) {
final PathElement pathElement = getPathElement();
final ResourceTransformationDescriptionBuilder resourceBuilder = builder.addChildResource(pathElement);
resourceBuilder.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.UNDEFINED, CORE_THREADS_AD).end();
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class JMSDestinationDefinitionInjectionSource method startTopic.
private void startTopic(String topicName, ServiceTarget serviceTarget, ServiceName serverServiceName, ServiceBuilder<?> serviceBuilder, DeploymentUnit deploymentUnit, Injector<ManagedReferenceFactory> injector) {
ModelNode destination = new ModelNode();
destination.get(NAME).set(topicName);
destination.get(ENTRIES).add(jndiName);
Service<Topic> topicService = JMSTopicService.installService(topicName, serverServiceName, serviceTarget, new String[0]);
inject(serviceBuilder, injector, topicService);
//create the management registration
String serverName = getActiveMQServerName(properties);
final PathElement serverElement = PathElement.pathElement(SERVER, serverName);
final PathElement dest = PathElement.pathElement(JMS_TOPIC, topicName);
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);
JMSTopicConfigurationRuntimeHandler.INSTANCE.registerResource(serverName, topicName, destination);
}
Aggregations