Search in sources :

Example 11 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class ServerAdd method processAddressSettings.

/**
     * Process the address settings.
     *
     * @param configuration the ActiveMQ configuration
     * @param params        the detyped operation parameters
     */
/**
     * Process the address settings.
     *
     * @param configuration the ActiveMQ configuration
     * @param params        the detyped operation parameters
     * @throws org.jboss.as.controller.OperationFailedException
     */
static void processAddressSettings(final OperationContext context, final Configuration configuration, final ModelNode params) throws OperationFailedException {
    if (params.hasDefined(ADDRESS_SETTING)) {
        for (final Property property : params.get(ADDRESS_SETTING).asPropertyList()) {
            final String match = property.getName();
            final ModelNode config = property.getValue();
            final AddressSettings settings = AddressSettingAdd.createSettings(context, config);
            configuration.getAddressesSettings().put(match, settings);
        }
    }
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 12 with Property

use of org.jboss.dmr.Property in project wildfly by wildfly.

the class PartitionManagerRemoveHandler method removeIdentityStoreServices.

void removeIdentityStoreServices(OperationContext context, ModelNode model, String partitionManagerName, String... configurationNames) throws OperationFailedException {
    ModelNode identityConfigurationNode = model.get(IDENTITY_CONFIGURATION.getName());
    List<String> expectedConfigNames = Arrays.asList(configurationNames);
    if (identityConfigurationNode.isDefined()) {
        for (Property identityConfiguration : identityConfigurationNode.asPropertyList()) {
            String configurationName = identityConfiguration.getName();
            if (!expectedConfigNames.isEmpty() && !expectedConfigNames.contains(configurationName)) {
                continue;
            }
            ModelNode value = identityConfiguration.getValue();
            if (value.isDefined()) {
                for (Property store : value.asPropertyList()) {
                    context.removeService(PartitionManagerService.createIdentityStoreServiceName(partitionManagerName, configurationName, store.getName()));
                }
            }
        }
    }
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 13 with Property

use of org.jboss.dmr.Property in project smscgateway by RestComm.

the class SmscSubsystemParser method writeContent.

/**
 * {@inheritDoc}
 */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
    final ModelNode node = context.getModelNode();
    final ModelNode mbean = node.get(SmscMbeanDefinition.MBEAN);
    for (Property mbeanProp : mbean.asPropertyList()) {
        writer.writeStartElement(SmscMbeanDefinition.MBEAN);
        final ModelNode mbeanEntry = mbeanProp.getValue();
        SmscMbeanDefinition.NAME_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
        SmscMbeanDefinition.TYPE_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
        final ModelNode property = mbeanEntry.get(SmscMbeanPropertyDefinition.PROPERTY);
        if (property != null && property.isDefined()) {
            for (Property propertyProp : property.asPropertyList()) {
                writer.writeStartElement(SmscMbeanPropertyDefinition.PROPERTY);
                final ModelNode propertyEntry = propertyProp.getValue();
                SmscMbeanPropertyDefinition.NAME_ATTR.marshallAsAttribute(propertyEntry, true, writer);
                SmscMbeanPropertyDefinition.TYPE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
                SmscMbeanPropertyDefinition.VALUE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
                writer.writeEndElement();
            }
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 14 with Property

use of org.jboss.dmr.Property in project wildfly-swarm by wildfly-swarm.

the class InterfaceMarshaller method hasInterface.

private boolean hasInterface(Interface iface, List<ModelNode> list) {
    return list.stream().anyMatch(e -> {
        if (!e.get(OP).asString().equals(ADD)) {
            return false;
        }
        ModelNode addr = e.get(OP_ADDR);
        if (addr.getType() != ModelType.LIST) {
            return false;
        }
        List<ModelNode> addrList = addr.asList();
        if (addrList.size() != 1) {
            return false;
        }
        Property addrProp = addrList.get(0).asProperty();
        String propName = addrProp.getName();
        String propValue = addrProp.getValue().asString();
        return (propName.equals(INTERFACE_NAME) && propValue.equals(iface.getName()));
    });
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 15 with Property

use of org.jboss.dmr.Property in project camunda-bpm-platform by camunda.

the class JobAcquisitionAdd method performRuntime.

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException {
    String acquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue();
    MscRuntimeContainerJobExecutor mscRuntimeContainerJobExecutor = new MscRuntimeContainerJobExecutor();
    if (model.hasDefined(SubsystemAttributeDefinitons.PROPERTIES.getName())) {
        List<Property> properties = SubsystemAttributeDefinitons.PROPERTIES.resolveModelAttribute(context, model).asPropertyList();
        for (Property property : properties) {
            PropertyHelper.applyProperty(mscRuntimeContainerJobExecutor, property.getName(), property.getValue().asString());
        }
    }
    // start new service for job executor
    ServiceController<RuntimeContainerJobExecutor> serviceController = context.getServiceTarget().addService(ServiceNames.forMscRuntimeContainerJobExecutorService(acquisitionName), mscRuntimeContainerJobExecutor).addDependency(ServiceNames.forMscRuntimeContainerDelegate()).addDependency(ServiceNames.forMscExecutorService()).addListener(verificationHandler).setInitialMode(Mode.ACTIVE).install();
    newControllers.add(serviceController);
}
Also used : MscRuntimeContainerJobExecutor(org.camunda.bpm.container.impl.jboss.service.MscRuntimeContainerJobExecutor) Property(org.jboss.dmr.Property) MscRuntimeContainerJobExecutor(org.camunda.bpm.container.impl.jboss.service.MscRuntimeContainerJobExecutor) RuntimeContainerJobExecutor(org.camunda.bpm.engine.impl.jobexecutor.RuntimeContainerJobExecutor)

Aggregations

Property (org.jboss.dmr.Property)203 ModelNode (org.jboss.dmr.ModelNode)163 HashMap (java.util.HashMap)22 Test (org.junit.Test)19 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)16 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)16 PathAddress (org.jboss.as.controller.PathAddress)12 ArrayList (java.util.ArrayList)11 Map (java.util.Map)11 ValueExpression (org.jboss.dmr.ValueExpression)10 ModelType (org.jboss.dmr.ModelType)9 OperationFailedException (org.jboss.as.controller.OperationFailedException)8 HashSet (java.util.HashSet)7 ArrayDeque (java.util.ArrayDeque)6 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)6 Properties (java.util.Properties)5 LinkedHashMap (java.util.LinkedHashMap)4 LoginModuleControlFlag (javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 HttpResponse (org.apache.http.HttpResponse)3