Search in sources :

Example 66 with PathElement

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;
}
Also used : PathElement(org.jboss.as.controller.PathElement) PathAddress(org.jboss.as.controller.PathAddress) ArrayList(java.util.ArrayList) OperationFailedException(org.jboss.as.controller.OperationFailedException)

Example 67 with PathElement

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);
        }
    }
}
Also used : PathElement(org.jboss.as.controller.PathElement) ObjectInstance(javax.management.ObjectInstance) Resource(org.jboss.as.controller.registry.Resource) ModelNode(org.jboss.dmr.ModelNode) ObjectName(javax.management.ObjectName)

Example 68 with PathElement

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);
}
Also used : PathElement(org.jboss.as.controller.PathElement) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) PathAddressTransformer(org.jboss.as.controller.transform.PathAddressTransformer)

Example 69 with PathElement

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();
}
Also used : PathElement(org.jboss.as.controller.PathElement) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)

Example 70 with PathElement

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);
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) PathElement(org.jboss.as.controller.PathElement) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode) Topic(javax.jms.Topic)

Aggregations

PathElement (org.jboss.as.controller.PathElement)70 PathAddress (org.jboss.as.controller.PathAddress)35 ModelNode (org.jboss.dmr.ModelNode)32 Resource (org.jboss.as.controller.registry.Resource)24 OperationFailedException (org.jboss.as.controller.OperationFailedException)10 ServiceName (org.jboss.msc.service.ServiceName)10 Map (java.util.Map)9 ServiceTarget (org.jboss.msc.service.ServiceTarget)9 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)8 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)7 ParseUtils.requireNoNamespaceAttribute (org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute)5 ParseUtils.unexpectedAttribute (org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute)5 AbstractSubsystemBaseTest (org.jboss.as.subsystem.test.AbstractSubsystemBaseTest)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 StatisticsResourceDefinition (org.jboss.as.connector.dynamicresource.StatisticsResourceDefinition)4 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)4 OperationContext (org.jboss.as.controller.OperationContext)4 StandardResourceDescriptionResolver (org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver)4 StatisticsPlugin (org.jboss.jca.core.spi.statistics.StatisticsPlugin)4