Search in sources :

Example 61 with Property

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

the class EJB3SubsystemXMLPersister method writeChannelCreationOptions.

private void writeChannelCreationOptions(final XMLExtendedStreamWriter writer, final ModelNode node) throws XMLStreamException {
    writer.writeStartElement(EJB3SubsystemXMLElement.CHANNEL_CREATION_OPTIONS.getLocalName());
    for (final Property optionPropertyModelNode : node.asPropertyList()) {
        writer.writeStartElement(EJB3SubsystemXMLElement.OPTION.getLocalName());
        writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), optionPropertyModelNode.getName());
        final ModelNode propertyValueModelNode = optionPropertyModelNode.getValue();
        RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_VALUE.marshallAsAttribute(propertyValueModelNode, writer);
        RemoteConnectorChannelCreationOptionResource.CHANNEL_CREATION_OPTION_TYPE.marshallAsAttribute(propertyValueModelNode, writer);
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 62 with Property

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

the class EJB3SubsystemXMLPersister method writeCaches.

private void writeCaches(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
    List<Property> caches = model.get(EJB3SubsystemModel.CACHE).asPropertyList();
    for (Property property : caches) {
        writer.writeStartElement(EJB3SubsystemXMLElement.CACHE.getLocalName());
        ModelNode cache = property.getValue();
        writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), property.getName());
        CacheFactoryResourceDefinition.PASSIVATION_STORE.marshallAsAttribute(cache, writer);
        writeAttribute(writer, cache, CacheFactoryResourceDefinition.ALIASES);
        writer.writeEndElement();
    }
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 63 with Property

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

the class ConfigurationHelper method addGroupingHandlerConfiguration.

static void addGroupingHandlerConfiguration(final OperationContext context, final Configuration configuration, final ModelNode model) throws OperationFailedException {
    if (model.hasDefined(CommonAttributes.GROUPING_HANDLER)) {
        final Property prop = model.get(CommonAttributes.GROUPING_HANDLER).asProperty();
        final String name = prop.getName();
        final ModelNode node = prop.getValue();
        final GroupingHandlerConfiguration.TYPE type = GroupingHandlerConfiguration.TYPE.valueOf(GroupingHandlerDefinition.TYPE.resolveModelAttribute(context, node).asString());
        final String address = GROUPING_HANDLER_ADDRESS.resolveModelAttribute(context, node).asString();
        final int timeout = TIMEOUT.resolveModelAttribute(context, node).asInt();
        final long groupTimeout = GROUP_TIMEOUT.resolveModelAttribute(context, node).asLong();
        final long reaperPeriod = REAPER_PERIOD.resolveModelAttribute(context, node).asLong();
        final GroupingHandlerConfiguration conf = new GroupingHandlerConfiguration().setName(SimpleString.toSimpleString(name)).setType(type).setAddress(SimpleString.toSimpleString(address)).setTimeout(timeout).setGroupTimeout(groupTimeout).setReaperPeriod(reaperPeriod);
        configuration.setGroupingHandlerConfiguration(conf);
    }
}
Also used : GroupingHandlerConfiguration(org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 64 with Property

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

the class PartitionManagerResourceDefinition method configureIdentityStore.

private static void configureIdentityStore(OperationContext context, ModelNode modelNode) throws OperationFailedException {
    Property prop = modelNode.asProperty();
    String storeType = prop.getName();
    ModelNode identityStore = prop.getValue().asProperty().getValue();
    if (storeType.equals(LDAP_STORE.getName())) {
        if (!identityStore.hasDefined(LDAP_STORE_MAPPING.getName())) {
            throw ROOT_LOGGER.idmLdapNoMappingDefined();
        }
    }
    validateSupportedTypes(context, identityStore);
}
Also used : ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Example 65 with Property

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

the class PartitionManagerResourceDefinition method validateSupportedTypes.

private static void validateSupportedTypes(OperationContext context, ModelNode identityStore) throws OperationFailedException {
    boolean hasSupportedType = identityStore.hasDefined(SUPPORTED_TYPES.getName());
    if (hasSupportedType) {
        ModelNode featuresSetNode = identityStore.get(SUPPORTED_TYPES.getName()).asProperty().getValue();
        try {
            ModelNode supportsAllNode = SupportedTypesResourceDefinition.SUPPORTS_ALL.resolveModelAttribute(context, featuresSetNode);
            hasSupportedType = supportsAllNode.asBoolean();
        } catch (OperationFailedException ofe) {
            if (featuresSetNode.get(SupportedTypesResourceDefinition.SUPPORTS_ALL.getName()).getType() == ModelType.EXPRESSION) {
                // We just tried to resolve an expression is Stage.MODEL. That's not reliable.
                // Just assume it would resolve to true and don't fail validation.
                // If it's invalid it will be caught on a server
                hasSupportedType = true;
            } else {
                throw ofe;
            }
        }
        if (featuresSetNode.hasDefined(SUPPORTED_TYPE.getName())) {
            for (Property supportedTypeNode : featuresSetNode.get(SUPPORTED_TYPE.getName()).asPropertyList()) {
                ModelNode supportedType = supportedTypeNode.getValue();
                if (!supportedType.hasDefined(SupportedTypeResourceDefinition.CLASS_NAME.getName()) && !supportedType.hasDefined(SupportedTypeResourceDefinition.CODE.getName())) {
                    throw ROOT_LOGGER.typeNotProvided(SUPPORTED_TYPE.getName());
                }
                hasSupportedType = true;
            }
        }
    }
    if (!hasSupportedType) {
        throw ROOT_LOGGER.idmNoSupportedTypesDefined();
    }
}
Also used : OperationFailedException(org.jboss.as.controller.OperationFailedException) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property)

Aggregations

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