Search in sources :

Example 36 with PathAddress

use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.

the class LockingMetricExecutor method execute.

@Override
public ModelNode execute(OperationContext context, Metric<DefaultLockManager> metric) throws OperationFailedException {
    PathAddress cacheAddress = context.getCurrentAddress().getParent();
    String containerName = cacheAddress.getParent().getLastElement().getValue();
    String cacheName = cacheAddress.getLastElement().getValue();
    Cache<?, ?> cache = ServiceContainerHelper.findValue(context.getServiceRegistry(false), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName));
    return (cache != null) ? metric.execute((DefaultLockManager) cache.getAdvancedCache().getLockManager()) : null;
}
Also used : PathAddress(org.jboss.as.controller.PathAddress) DefaultLockManager(org.infinispan.util.concurrent.locks.impl.DefaultLockManager)

Example 37 with PathAddress

use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.

the class PartitionHandlingMetricExecutor method execute.

@Override
public ModelNode execute(OperationContext context, Metric<AdvancedCache<?, ?>> metric) throws OperationFailedException {
    PathAddress cacheAddress = context.getCurrentAddress().getParent();
    String containerName = cacheAddress.getParent().getLastElement().getValue();
    String cacheName = cacheAddress.getLastElement().getValue();
    Cache<?, ?> cache = ServiceContainerHelper.findValue(context.getServiceRegistry(false), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName));
    return (cache != null) ? metric.execute(cache.getAdvancedCache()) : null;
}
Also used : PathAddress(org.jboss.as.controller.PathAddress)

Example 38 with PathAddress

use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.

the class ClusteredCacheMetricExecutor method execute.

@Override
public ModelNode execute(OperationContext context, Metric<RpcManagerImpl> metric) throws OperationFailedException {
    PathAddress address = context.getCurrentAddress();
    String containerName = address.getParent().getLastElement().getValue();
    String cacheName = address.getLastElement().getValue();
    Cache<?, ?> cache = ServiceContainerHelper.findValue(context.getServiceRegistry(false), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName));
    return (cache != null) ? metric.execute((RpcManagerImpl) cache.getAdvancedCache().getRpcManager()) : null;
}
Also used : RpcManagerImpl(org.infinispan.remoting.rpc.RpcManagerImpl) PathAddress(org.jboss.as.controller.PathAddress)

Example 39 with PathAddress

use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.

the class InfinispanSubsystemXMLReader method parseThreadPool.

private void parseThreadPool(ThreadPoolResourceDefinition pool, XMLExtendedStreamReader reader, PathAddress parentAddress, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
    PathAddress address = parentAddress.append(pool.getPathElement());
    ModelNode operation = Util.createAddOperation(address);
    operations.put(address, operation);
    for (int i = 0; i < reader.getAttributeCount(); i++) {
        XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i));
        switch(attribute) {
            case MIN_THREADS:
                {
                    readAttribute(reader, i, operation, pool.getMinThreads());
                    break;
                }
            case MAX_THREADS:
                {
                    readAttribute(reader, i, operation, pool.getMaxThreads());
                    break;
                }
            case QUEUE_LENGTH:
                {
                    readAttribute(reader, i, operation, pool.getQueueLength());
                    break;
                }
            case KEEPALIVE_TIME:
                {
                    readAttribute(reader, i, operation, pool.getKeepAliveTime());
                    break;
                }
            default:
                {
                    throw ParseUtils.unexpectedAttribute(reader, i);
                }
        }
    }
    ParseUtils.requireNoContent(reader);
}
Also used : PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode)

Example 40 with PathAddress

use of org.jboss.as.controller.PathAddress 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());
}
Also used : PathElement(org.jboss.as.controller.PathElement) PathAddress(org.jboss.as.controller.PathAddress)

Aggregations

PathAddress (org.jboss.as.controller.PathAddress)644 ModelNode (org.jboss.dmr.ModelNode)492 Resource (org.jboss.as.controller.registry.Resource)70 Test (org.junit.Test)66 PathElement (org.jboss.as.controller.PathElement)63 KernelServices (org.jboss.as.subsystem.test.KernelServices)51 ServiceName (org.jboss.msc.service.ServiceName)51 OperationFailedException (org.jboss.as.controller.OperationFailedException)43 ParseUtils.requireNoNamespaceAttribute (org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute)35 ParseUtils.unexpectedAttribute (org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute)35 FailedOperationTransformationConfig (org.jboss.as.model.test.FailedOperationTransformationConfig)34 KernelServicesBuilder (org.jboss.as.subsystem.test.KernelServicesBuilder)33 ServiceTarget (org.jboss.msc.service.ServiceTarget)32 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)31 Map (java.util.Map)30 ParseUtils.unexpectedElement (org.jboss.as.controller.parsing.ParseUtils.unexpectedElement)29 IOException (java.io.IOException)28 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)26 ArrayList (java.util.ArrayList)25 OperationContext (org.jboss.as.controller.OperationContext)23