Search in sources :

Example 96 with AttributeDefinition

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

the class ElytronIntegrationResourceDefinitions method getElytronKeyStoreResourceDefinition.

/**
 * Defines a resource that represents an Elytron-compatible key store that can be exported by a JSSE-enabled domain
 * in the legacy security subsystem.
 *
 * To export the key store the resource uses a {@code BasicAddHandler} implementation that registers the elytron key-store
 * capability and implements a {@code org.jboss.as.security.elytron.BasicService.ValueSupplier} that uses the injected
 * {@code SecurityDomainContext} to obtain a {@code JSSESecurityDomain}. If such domain is found, its configured key
 * store is obtained and returned.
 *
 * The {@code ValueSupplier} implementation throws an exception if the referenced legacy domain is not a JSSE-enabled
 * domain or if the domain doesn't contain a key store configuration.
 */
public static ResourceDefinition getElytronKeyStoreResourceDefinition() {
    final AttributeDefinition[] attributes = new AttributeDefinition[] { LEGACY_JSSE_CONFIG };
    final AbstractAddStepHandler addHandler = createAddHandler(attributes, KEY_STORE_RUNTIME_CAPABILITY);
    return new BasicResourceDefinition(Constants.ELYTRON_KEY_STORE, addHandler, attributes, KEY_STORE_RUNTIME_CAPABILITY);
}
Also used : AbstractAddStepHandler(org.jboss.as.controller.AbstractAddStepHandler) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition)

Example 97 with AttributeDefinition

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

the class LoginModuleResourceDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);
    OperationStepHandler writeHandler = new ModelOnlyWriteAttributeHandler(ATTRIBUTES);
    for (AttributeDefinition attribute : ATTRIBUTES) {
        resourceRegistration.registerReadWriteAttribute(attribute, null, writeHandler);
    }
}
Also used : ModelOnlyWriteAttributeHandler(org.jboss.as.controller.ModelOnlyWriteAttributeHandler) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) PropertiesAttributeDefinition(org.jboss.as.controller.PropertiesAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition)

Example 98 with AttributeDefinition

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

the class MappingModuleDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);
    OperationStepHandler writeHandler = new ModelOnlyWriteAttributeHandler(getAttributes());
    for (AttributeDefinition attr : getAttributes()) {
        resourceRegistration.registerReadWriteAttribute(attr, null, writeHandler);
    }
}
Also used : ModelOnlyWriteAttributeHandler(org.jboss.as.controller.ModelOnlyWriteAttributeHandler) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) PropertiesAttributeDefinition(org.jboss.as.controller.PropertiesAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition)

Example 99 with AttributeDefinition

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

the class ResteasyAttributeTestCase method testBadSyntax.

/**
 * Verify that syntactically incorrect values get kicked out.
 */
@Test
public void testBadSyntax() throws Exception {
    for (AttributeDefinition attribute : JaxrsAttribute.ATTRIBUTES) {
        // RESTEasy accepts any string for "resteasy-media-type-param-mapping".
        if (JaxrsAttribute.RESTEASY_MEDIA_TYPE_PARAM_MAPPING.equals(attribute)) {
            continue;
        }
        ModelNode op = Operations.createWriteAttributeOperation(ADDRESS, attribute.getName(), mangleAttribute(attribute));
        ModelNode result = client.getControllerClient().execute(op);
        Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
    }
}
Also used : AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Example 100 with AttributeDefinition

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

the class ListenerResourceDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    // DO NOT call super, as we need non-standard handling for enabled
    Collection<AttributeDefinition> ads = getAttributes();
    // we include ENABLED in this set, but it doesn't matter we don't register rrh for it
    OperationStepHandler rrh = new ReloadRequiredWriteAttributeHandler(ads);
    OperationStepHandler enh = new EnabledAttributeHandler();
    for (AttributeDefinition ad : ads) {
        OperationStepHandler osh = ad == ENABLED ? enh : rrh;
        resourceRegistration.registerReadWriteAttribute(ad, null, osh);
    }
    for (ConnectorStat attr : ConnectorStat.values()) {
        resourceRegistration.registerMetric(attr.definition, ReadStatisticHandler.INSTANCE);
    }
}
Also used : OperationStepHandler(org.jboss.as.controller.OperationStepHandler) OptionAttributeDefinition(org.wildfly.extension.io.OptionAttributeDefinition) StringListAttributeDefinition(org.jboss.as.controller.StringListAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Aggregations

AttributeDefinition (org.jboss.as.controller.AttributeDefinition)102 ModelNode (org.jboss.dmr.ModelNode)48 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)40 PathAddress (org.jboss.as.controller.PathAddress)17 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)16 ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)14 OperationContext (org.jboss.as.controller.OperationContext)13 Resource (org.jboss.as.controller.registry.Resource)12 Property (org.jboss.dmr.Property)12 ObjectTypeAttributeDefinition (org.jboss.as.controller.ObjectTypeAttributeDefinition)9 PropertiesAttributeDefinition (org.jboss.as.controller.PropertiesAttributeDefinition)9 StringListAttributeDefinition (org.jboss.as.controller.StringListAttributeDefinition)9 OperationFailedException (org.jboss.as.controller.OperationFailedException)8 ArrayList (java.util.ArrayList)7 PrimitiveListAttributeDefinition (org.jboss.as.controller.PrimitiveListAttributeDefinition)6 Map (java.util.Map)5 AbstractAddStepHandler (org.jboss.as.controller.AbstractAddStepHandler)5 SimpleListAttributeDefinition (org.jboss.as.controller.SimpleListAttributeDefinition)5 SimpleOperationDefinitionBuilder (org.jboss.as.controller.SimpleOperationDefinitionBuilder)5 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)5