Search in sources :

Example 6 with SimpleAttributeDefinition

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

the class AbstractFederationResourceDefinition method createAttributeWriterHandler.

@Override
protected OperationStepHandler createAttributeWriterHandler() {
    List<SimpleAttributeDefinition> attributes = getAttributes();
    final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
    return new ReloadRequiredWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {

        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            if (!alternativeAttributes.isEmpty()) {
                context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
            }
            doRegisterModelWriteAttributeHandler(context, operation);
            super.execute(context, operation);
        }
    };
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ModelNode(org.jboss.dmr.ModelNode) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) AlternativeAttributeValidationStepHandler(org.wildfly.extension.picketlink.common.model.validator.AlternativeAttributeValidationStepHandler)

Example 7 with SimpleAttributeDefinition

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

the class AbstractIDMResourceDefinition method createAttributeWriterHandler.

@Override
protected OperationStepHandler createAttributeWriterHandler() {
    List<SimpleAttributeDefinition> attributes = getAttributes();
    final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
    return new IDMConfigWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {

        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            if (!alternativeAttributes.isEmpty()) {
                context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
            }
            doRegisterModelWriteAttributeHandler(context, operation);
            super.execute(context, operation);
        }
    };
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ModelNode(org.jboss.dmr.ModelNode) AlternativeAttributeValidationStepHandler(org.wildfly.extension.picketlink.common.model.validator.AlternativeAttributeValidationStepHandler)

Example 8 with SimpleAttributeDefinition

use of org.jboss.as.controller.SimpleAttributeDefinition in project teiid by teiid.

the class VDBMetadataMapper method getAttributeDefinitions.

public AttributeDefinition[] getAttributeDefinitions() {
    ObjectListAttributeDefinition properties = ObjectListAttributeDefinition.Builder.of(PROPERTIES, PropertyMetaDataMapper.INSTANCE.getAttributeDefinition()).build();
    ObjectListAttributeDefinition vdbimports = ObjectListAttributeDefinition.Builder.of(IMPORT_VDBS, VDBImportMapper.INSTANCE.getAttributeDefinition()).build();
    ObjectListAttributeDefinition models = ObjectListAttributeDefinition.Builder.of(MODELS, ModelMetadataMapper.INSTANCE.getAttributeDefinition()).build();
    ObjectListAttributeDefinition translators = ObjectListAttributeDefinition.Builder.of(OVERRIDE_TRANSLATORS, VDBTranslatorMetaDataMapper.INSTANCE.getAttributeDefinition()).build();
    ObjectListAttributeDefinition policies = ObjectListAttributeDefinition.Builder.of(DATA_POLICIES, DataPolicyMetadataMapper.INSTANCE.getAttributeDefinition()).build();
    return new AttributeDefinition[] { new SimpleAttributeDefinition(VDBNAME, ModelType.STRING, false), new SimpleAttributeDefinition(CONNECTIONTYPE, ModelType.INT, false), new SimpleAttributeDefinition(STATUS, ModelType.BOOLEAN, false), new SimpleAttributeDefinition(VERSION, ModelType.STRING, false), new SimpleAttributeDefinition(VDB_DESCRIPTION, ModelType.BOOLEAN, true), new SimpleAttributeDefinition(XML_DEPLOYMENT, ModelType.BOOLEAN, true), properties, vdbimports, models, translators, policies };
}
Also used : ObjectListAttributeDefinition(org.jboss.as.controller.ObjectListAttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) StringListAttributeDefinition(org.jboss.as.controller.StringListAttributeDefinition) ObjectListAttributeDefinition(org.jboss.as.controller.ObjectListAttributeDefinition) ObjectTypeAttributeDefinition(org.jboss.as.controller.ObjectTypeAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition)

Example 9 with SimpleAttributeDefinition

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

the class EESubsystemXmlPersister method writeManagedExecutorServices.

private void writeManagedExecutorServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
    writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICES.getLocalName());
    for (Property property : subModel.asPropertyList()) {
        writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICE.getLocalName());
        writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
        for (SimpleAttributeDefinition ad : ManagedExecutorServiceResourceDefinition.ATTRIBUTES) {
            ad.marshallAsAttribute(property.getValue(), writer);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) Property(org.jboss.dmr.Property)

Example 10 with SimpleAttributeDefinition

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

the class EESubsystemXmlPersister method writeManagedThreadFactories.

private void writeManagedThreadFactories(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException {
    writer.writeStartElement(Element.MANAGED_THREAD_FACTORIES.getLocalName());
    for (Property property : subModel.asPropertyList()) {
        writer.writeStartElement(Element.MANAGED_THREAD_FACTORY.getLocalName());
        writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
        for (SimpleAttributeDefinition ad : ManagedThreadFactoryResourceDefinition.ATTRIBUTES) {
            ad.marshallAsAttribute(property.getValue(), writer);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
Also used : SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) Property(org.jboss.dmr.Property)

Aggregations

SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)45 ModelNode (org.jboss.dmr.ModelNode)15 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)11 ParseUtils.requireNoNamespaceAttribute (org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute)9 ParseUtils.unexpectedAttribute (org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute)9 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)8 Property (org.jboss.dmr.Property)6 OperationContext (org.jboss.as.controller.OperationContext)4 AbstractAttributeDefinitionBuilder (org.jboss.as.controller.AbstractAttributeDefinitionBuilder)3 PathAddress (org.jboss.as.controller.PathAddress)3 PrimitiveListAttributeDefinition (org.jboss.as.controller.PrimitiveListAttributeDefinition)3 ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)3 SimpleListAttributeDefinition (org.jboss.as.controller.SimpleListAttributeDefinition)3 SimpleMapAttributeDefinition (org.jboss.as.controller.SimpleMapAttributeDefinition)3 ParseUtils.unexpectedElement (org.jboss.as.controller.parsing.ParseUtils.unexpectedElement)3 ClearWorkManagerStatisticsHandler (org.jboss.as.connector.dynamicresource.ClearWorkManagerStatisticsHandler)2 WorkManagerRuntimeAttributeReadHandler (org.jboss.as.connector.subsystems.resourceadapters.WorkManagerRuntimeAttributeReadHandler)2 WorkManagerRuntimeAttributeWriteHandler (org.jboss.as.connector.subsystems.resourceadapters.WorkManagerRuntimeAttributeWriteHandler)2 AbstractWriteAttributeHandler (org.jboss.as.controller.AbstractWriteAttributeHandler)2 ListAttributeDefinition (org.jboss.as.controller.ListAttributeDefinition)2