Search in sources :

Example 26 with ReloadRequiredWriteAttributeHandler

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

the class VaultResourceDefinition method registerAttributes.

public void registerAttributes(final ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadWriteAttribute(OPTIONS, null, new ReloadRequiredWriteAttributeHandler(OPTIONS));
    resourceRegistration.registerReadWriteAttribute(CODE, null, new ReloadRequiredWriteAttributeHandler(CODE));
}
Also used : ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Example 27 with ReloadRequiredWriteAttributeHandler

use of org.jboss.as.controller.ReloadRequiredWriteAttributeHandler 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)

Example 28 with ReloadRequiredWriteAttributeHandler

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

the class WSExtension method initialize.

@Override
public void initialize(final ExtensionContext context) {
    final boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystem.registerXMLElementWriter(new WSSubsystemWriter());
    // ws subsystem
    ResourceBuilder propertyResource = ResourceBuilder.Factory.create(PROPERTY_PATH, getResourceDescriptionResolver(Constants.PROPERTY)).setAddOperation(PropertyAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.VALUE, null, new ReloadRequiredWriteAttributeHandler(Attributes.VALUE));
    ResourceBuilder handlerBuilder = ResourceBuilder.Factory.create(HANDLER_PATH, getResourceDescriptionResolver(HANDLER)).setAddOperation(HandlerAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.CLASS, null, new ReloadRequiredWriteAttributeHandler(Attributes.CLASS));
    ResourceBuilder preHandler = ResourceBuilder.Factory.create(PRE_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.PRE_HANDLER_CHAIN)).setAddOperation(HandlerChainAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS)).pushChild(handlerBuilder).pop();
    ResourceBuilder postHandler = ResourceBuilder.Factory.create(POST_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.POST_HANDLER_CHAIN)).setAddOperation(HandlerChainAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS)).pushChild(handlerBuilder).pop();
    ResourceDefinition epConfigsDef = ResourceBuilder.Factory.create(ENDPOINT_CONFIG_PATH, getResourceDescriptionResolver(ENDPOINT_CONFIG)).setAddOperation(EndpointConfigAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).pushChild(propertyResource).pop().pushChild(preHandler).pop().pushChild(postHandler).pop().build();
    ResourceDefinition clConfigsDef = ResourceBuilder.Factory.create(CLIENT_CONFIG_PATH, getResourceDescriptionResolver(CLIENT_CONFIG)).setAddOperation(ClientConfigAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).pushChild(propertyResource).pop().pushChild(preHandler).pop().pushChild(postHandler).pop().build();
    ResourceDefinition subsystemResource = ResourceBuilder.Factory.createSubsystemRoot(SUBSYSTEM_PATH, getResourceDescriptionResolver(), WSSubsystemAdd.INSTANCE, WSSubsystemRemove.INSTANCE).addReadWriteAttribute(Attributes.WSDL_HOST, null, new WSServerConfigAttributeHandler(Attributes.WSDL_HOST)).addReadWriteAttribute(Attributes.WSDL_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PORT)).addReadWriteAttribute(Attributes.WSDL_SECURE_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_SECURE_PORT)).addReadWriteAttribute(Attributes.WSDL_URI_SCHEME, null, new WSServerConfigAttributeHandler(Attributes.WSDL_URI_SCHEME)).addReadWriteAttribute(Attributes.WSDL_PATH_REWRITE_RULE, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PATH_REWRITE_RULE)).addReadWriteAttribute(Attributes.MODIFY_WSDL_ADDRESS, null, new WSServerConfigAttributeHandler(Attributes.MODIFY_WSDL_ADDRESS)).addReadWriteAttribute(Attributes.STATISTICS_ENABLED, null, new WSServerConfigAttributeHandler(Attributes.STATISTICS_ENABLED)).build();
    ManagementResourceRegistration subsystemRegistration = subsystem.registerSubsystemModel(subsystemResource);
    subsystemRegistration.registerSubModel(epConfigsDef);
    subsystemRegistration.registerSubModel(clConfigsDef);
    if (registerRuntimeOnly) {
        subsystem.registerDeploymentModel(ResourceBuilder.Factory.create(SUBSYSTEM_PATH, getResourceDescriptionResolver("deployment")).noFeature().pushChild(ENDPOINT_PATH).addMetrics(WSEndpointMetrics.INSTANCE, WSEndpointMetrics.ATTRIBUTES).addReadOnlyAttribute(ENDPOINT_CLASS).addReadOnlyAttribute(ENDPOINT_CONTEXT).addReadOnlyAttribute(ENDPOINT_NAME).addReadOnlyAttribute(ENDPOINT_TYPE).addReadOnlyAttribute(ENDPOINT_WSDL).build());
    }
}
Also used : ResourceBuilder(org.jboss.as.controller.ResourceBuilder) ResourceDefinition(org.jboss.as.controller.ResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 29 with ReloadRequiredWriteAttributeHandler

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

the class TransactionSubsystemRootResourceDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    // Register all attributes except of the mutual ones
    Set<AttributeDefinition> attributesWithoutMutuals = new HashSet<>(Arrays.asList(add_attributes));
    attributesWithoutMutuals.remove(USE_HORNETQ_STORE_PARAM);
    attributesWithoutMutuals.remove(USE_JOURNAL_STORE_PARAM);
    attributesWithoutMutuals.remove(USE_JDBC_STORE);
    attributesWithoutMutuals.remove(STATISTICS_ENABLED);
    attributesWithoutMutuals.remove(DEFAULT_TIMEOUT);
    attributesWithoutMutuals.remove(MAXIMUM_TIMEOUT);
    // Remove these as it also needs special write handler
    attributesWithoutMutuals.remove(JDBC_STORE_DATASOURCE);
    attributesWithoutMutuals.remove(PROCESS_ID_UUID);
    attributesWithoutMutuals.remove(PROCESS_ID_SOCKET_BINDING);
    attributesWithoutMutuals.remove(PROCESS_ID_SOCKET_MAX_PORTS);
    attributesWithoutMutuals.remove(ENABLE_STATISTICS);
    attributesWithoutMutuals.remove(HORNETQ_STORE_ENABLE_ASYNC_IO);
    OperationStepHandler writeHandler = new ReloadRequiredWriteAttributeHandler(attributesWithoutMutuals);
    for (final AttributeDefinition def : attributesWithoutMutuals) {
        resourceRegistration.registerReadWriteAttribute(def, null, writeHandler);
    }
    // Register mutual object store attributes
    OperationStepHandler mutualWriteHandler = new ObjectStoreMutualWriteHandler(USE_JOURNAL_STORE, USE_JDBC_STORE);
    resourceRegistration.registerReadWriteAttribute(USE_JOURNAL_STORE, null, mutualWriteHandler);
    resourceRegistration.registerReadWriteAttribute(USE_JDBC_STORE, null, mutualWriteHandler);
    // Register default-timeout attribute
    resourceRegistration.registerReadWriteAttribute(DEFAULT_TIMEOUT, null, new DefaultTimeoutHandler(DEFAULT_TIMEOUT));
    resourceRegistration.registerReadWriteAttribute(MAXIMUM_TIMEOUT, null, new MaximumTimeoutHandler(MAXIMUM_TIMEOUT));
    // Register jdbc-store-datasource attribute
    resourceRegistration.registerReadWriteAttribute(JDBC_STORE_DATASOURCE, null, new JdbcStoreDatasourceWriteHandler(JDBC_STORE_DATASOURCE));
    // Register mutual object store attributes
    OperationStepHandler mutualProcessIdWriteHandler = new ProcessIdWriteHandler(PROCESS_ID_UUID, PROCESS_ID_SOCKET_BINDING, PROCESS_ID_SOCKET_MAX_PORTS);
    resourceRegistration.registerReadWriteAttribute(PROCESS_ID_UUID, null, mutualProcessIdWriteHandler);
    resourceRegistration.registerReadWriteAttribute(PROCESS_ID_SOCKET_BINDING, null, mutualProcessIdWriteHandler);
    resourceRegistration.registerReadWriteAttribute(PROCESS_ID_SOCKET_MAX_PORTS, null, mutualProcessIdWriteHandler);
    // Register statistics-enabled attribute
    resourceRegistration.registerReadWriteAttribute(STATISTICS_ENABLED, null, new StatisticsEnabledHandler(STATISTICS_ENABLED));
    AliasedHandler esh = new AliasedHandler(STATISTICS_ENABLED.getName());
    resourceRegistration.registerReadWriteAttribute(ENABLE_STATISTICS, esh, esh);
    AliasedHandler hsh = new AliasedHandler(USE_JOURNAL_STORE.getName());
    resourceRegistration.registerReadWriteAttribute(USE_HORNETQ_STORE, hsh, hsh);
    AliasedHandler hseh = new AliasedHandler(JOURNAL_STORE_ENABLE_ASYNC_IO.getName());
    resourceRegistration.registerReadWriteAttribute(HORNETQ_STORE_ENABLE_ASYNC_IO, hseh, hseh);
    if (registerRuntimeOnly) {
        TxStatsHandler.INSTANCE.registerMetrics(resourceRegistration);
    }
}
Also used : OperationStepHandler(org.jboss.as.controller.OperationStepHandler) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) HashSet(java.util.HashSet)

Example 30 with ReloadRequiredWriteAttributeHandler

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

the class XTSSubsystemDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadWriteAttribute(HOST_NAME, null, new ReloadRequiredWriteAttributeHandler(HOST_NAME));
    resourceRegistration.registerReadWriteAttribute(ENVIRONMENT_URL, null, new ReloadRequiredWriteAttributeHandler(ENVIRONMENT_URL));
    resourceRegistration.registerReadWriteAttribute(DEFAULT_CONTEXT_PROPAGATION, null, new ReloadRequiredWriteAttributeHandler(DEFAULT_CONTEXT_PROPAGATION));
    resourceRegistration.registerReadWriteAttribute(ASYNC_REGISTRATION, null, new ReloadRequiredWriteAttributeHandler(ASYNC_REGISTRATION));
    // this here just for legacy support!
    resourceRegistration.registerReadOnlyAttribute(ENVIRONMENT, new OperationStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            ModelNode url = context.readResource(PathAddress.EMPTY_ADDRESS).getModel().get(ModelDescriptionConstants.URL);
            context.getResult().get(ModelDescriptionConstants.URL).set(url);
        }
    });
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) OperationFailedException(org.jboss.as.controller.OperationFailedException) ModelNode(org.jboss.dmr.ModelNode) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Aggregations

ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)30 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)14 SimpleAttributeDefinition (org.jboss.as.controller.SimpleAttributeDefinition)14 OperationContext (org.jboss.as.controller.OperationContext)8 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)8 ModelNode (org.jboss.dmr.ModelNode)8 OperationFailedException (org.jboss.as.controller.OperationFailedException)7 StringListAttributeDefinition (org.jboss.as.controller.StringListAttributeDefinition)6 PropertiesAttributeDefinition (org.jboss.as.controller.PropertiesAttributeDefinition)5 CredentialReferenceWriteAttributeHandler (org.jboss.as.controller.security.CredentialReferenceWriteAttributeHandler)4 ObjectTypeAttributeDefinition (org.jboss.as.controller.ObjectTypeAttributeDefinition)3 PrimitiveListAttributeDefinition (org.jboss.as.controller.PrimitiveListAttributeDefinition)3 ReloadRequiredResourceRegistration (org.jboss.as.clustering.controller.ReloadRequiredResourceRegistration)2 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)2 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)2 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)2 Resource (org.jboss.as.controller.registry.Resource)2 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1