Search in sources :

Example 16 with Property

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

the class BpmPlatformParser method writeProperties.

private void writeProperties(final XMLExtendedStreamWriter writer, ModelNode entry) throws XMLStreamException {
    if (entry.hasDefined(Element.PROPERTIES.getLocalName())) {
        writer.writeStartElement(Element.PROPERTIES.getLocalName());
        List<Property> propertyList = entry.get(Element.PROPERTIES.getLocalName()).asPropertyList();
        if (!propertyList.isEmpty()) {
            for (Property property : propertyList) {
                writer.writeStartElement(Element.PROPERTY.getLocalName());
                writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
                writer.writeCharacters(property.getValue().asString());
                writer.writeEndElement();
            }
        }
        writer.writeEndElement();
    }
}
Also used : Property(org.jboss.dmr.Property)

Example 17 with Property

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

the class BpmPlatformParser method writeProcessEnginesContent.

private void writeProcessEnginesContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
    writer.writeStartElement(Element.PROCESS_ENGINES.getLocalName());
    ModelNode node = context.getModelNode();
    ModelNode processEngineConfigurations = node.get(Element.PROCESS_ENGINES.getLocalName());
    if (processEngineConfigurations.isDefined()) {
        for (Property property : processEngineConfigurations.asPropertyList()) {
            // write each child element to xml
            writer.writeStartElement(Element.PROCESS_ENGINE.getLocalName());
            writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
            ModelNode entry = property.getValue();
            writeAttribute(Attribute.DEFAULT, writer, entry);
            writeElement(Element.DATASOURCE, writer, entry);
            writeElement(Element.HISTORY_LEVEL, writer, entry);
            writeElement(Element.CONFIGURATION, writer, entry);
            writeProperties(writer, entry);
            writePlugins(writer, entry);
            writer.writeEndElement();
        }
    }
    // end process-engines
    writer.writeEndElement();
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 18 with Property

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

the class ProcessEngineAdd method getPropertiesMap.

protected Map<String, String> getPropertiesMap(ModelNode model) {
    Map<String, String> properties = new HashMap<String, String>();
    if (model.hasDefined(Element.PROPERTIES.getLocalName())) {
        ModelNode propertiesNode = model.get(Element.PROPERTIES.getLocalName());
        List<Property> propertyList = propertiesNode.asPropertyList();
        if (!propertyList.isEmpty()) {
            for (Property property : propertyList) {
                properties.put(property.getName(), property.getValue().asString());
            }
        }
    }
    return properties;
}
Also used : HashMap(java.util.HashMap) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 19 with Property

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

the class JGroupsSubsystemXMLWriter method writeRelay.

private static void writeRelay(XMLExtendedStreamWriter writer, ModelNode relay) throws XMLStreamException {
    writer.writeStartElement(XMLElement.RELAY.getLocalName());
    writeAttributes(writer, relay, RelayResourceDefinition.Attribute.class);
    if (relay.hasDefined(RemoteSiteResourceDefinition.WILDCARD_PATH.getKey())) {
        for (Property property : relay.get(RemoteSiteResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
            writer.writeStartElement(XMLElement.REMOTE_SITE.getLocalName());
            writer.writeAttribute(XMLAttribute.NAME.getLocalName(), property.getName());
            writeAttributes(writer, property.getValue(), EnumSet.allOf(RemoteSiteResourceDefinition.Attribute.class));
            writer.writeEndElement();
        }
    }
    writer.writeEndElement();
}
Also used : Attribute(org.jboss.as.clustering.controller.Attribute) Property(org.jboss.dmr.Property)

Example 20 with Property

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

the class RemoteCacheContainerConfigurationServiceConfigurator method configure.

@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.connectionTimeout = Attribute.CONNECTION_TIMEOUT.resolveModelAttribute(context, model).asInt();
    this.defaultRemoteCluster = Attribute.DEFAULT_REMOTE_CLUSTER.resolveModelAttribute(context, model).asString();
    this.maxRetries = Attribute.MAX_RETRIES.resolveModelAttribute(context, model).asInt();
    this.protocolVersion = Attribute.PROTOCOL_VERSION.resolveModelAttribute(context, model).asString();
    this.socketTimeout = Attribute.SOCKET_TIMEOUT.resolveModelAttribute(context, model).asInt();
    this.tcpNoDelay = Attribute.TCP_NO_DELAY.resolveModelAttribute(context, model).asBoolean();
    this.tcpKeepAlive = Attribute.TCP_KEEP_ALIVE.resolveModelAttribute(context, model).asBoolean();
    this.statisticsEnabled = Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
    this.transactionTimeout = Attribute.TRANSACTION_TIMEOUT.resolveModelAttribute(context, model).asLong();
    this.marshallerFactory = HotRodMarshallerFactory.valueOf(Attribute.MARSHALLER.resolveModelAttribute(context, model).asString());
    this.clusters.clear();
    Resource container = context.readResource(PathAddress.EMPTY_ADDRESS);
    for (Resource.ResourceEntry entry : container.getChildren(RemoteClusterResourceDefinition.WILDCARD_PATH.getKey())) {
        String clusterName = entry.getName();
        ModelNode cluster = entry.getModel();
        List<String> bindings = StringListAttributeDefinition.unwrapValue(context, RemoteClusterResourceDefinition.Attribute.SOCKET_BINDINGS.resolveModelAttribute(context, cluster));
        List<SupplierDependency<OutboundSocketBinding>> bindingDependencies = new ArrayList<>(bindings.size());
        for (String binding : bindings) {
            bindingDependencies.add(new ServiceSupplierDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding)));
        }
        this.clusters.put(clusterName, bindingDependencies);
    }
    this.server = context.hasOptionalCapability(CommonRequirement.MBEAN_SERVER.getName(), null, null) ? new ServiceSupplierDependency<>(CommonRequirement.MBEAN_SERVER.getServiceName(context)) : null;
    this.properties.clear();
    for (Property property : Attribute.PROPERTIES.resolveModelAttribute(context, model).asPropertyListOrEmpty()) {
        this.properties.setProperty(property.getName(), property.getValue().asString());
    }
    return this;
}
Also used : Resource(org.jboss.as.controller.registry.Resource) ArrayList(java.util.ArrayList) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) ModelNode(org.jboss.dmr.ModelNode) SupplierDependency(org.wildfly.clustering.service.SupplierDependency) ServiceSupplierDependency(org.wildfly.clustering.service.ServiceSupplierDependency) Property(org.jboss.dmr.Property)

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