Search in sources :

Example 16 with ReloadRequiredWriteAttributeHandler

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

the class EJB3SubsystemRootResourceDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(DEFAULT_CLUSTERED_SFSB_CACHE, new SimpleAliasReadAttributeHandler(DEFAULT_SFSB_CACHE));
    resourceRegistration.registerReadWriteAttribute(DEFAULT_SFSB_CACHE, null, EJB3SubsystemDefaultCacheWriteHandler.SFSB_CACHE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE, null, EJB3SubsystemDefaultCacheWriteHandler.SFSB_PASSIVATION_DISABLED_CACHE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_SLSB_INSTANCE_POOL, null, EJB3SubsystemDefaultPoolWriteHandler.SLSB_POOL);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_MDB_INSTANCE_POOL, null, EJB3SubsystemDefaultPoolWriteHandler.MDB_POOL);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_ENTITY_BEAN_INSTANCE_POOL, null, EJB3SubsystemDefaultPoolWriteHandler.ENTITY_BEAN_POOL);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_ENTITY_BEAN_OPTIMISTIC_LOCKING, null, EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_RESOURCE_ADAPTER_NAME, null, DefaultResourceAdapterWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_SINGLETON_BEAN_ACCESS_TIMEOUT, null, DefaultSingletonBeanAccessTimeoutWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_STATEFUL_BEAN_ACCESS_TIMEOUT, null, DefaultStatefulBeanAccessTimeoutWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_STATEFUL_BEAN_SESSION_TIMEOUT, null, DefaultStatefulBeanSessionTimeoutWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(ENABLE_STATISTICS, (context, operation) -> {
        ModelNode aliasOp = operation.clone();
        aliasOp.get("name").set(EJB3SubsystemModel.STATISTICS_ENABLED);
        context.addStep(aliasOp, ReadAttributeHandler.INSTANCE, OperationContext.Stage.MODEL, true);
    }, (context, operation) -> {
        ModelNode aliasOp = operation.clone();
        aliasOp.get("name").set(EJB3SubsystemModel.STATISTICS_ENABLED);
        context.addStep(aliasOp, WriteAttributeHandler.INSTANCE, OperationContext.Stage.MODEL, true);
    });
    resourceRegistration.registerReadWriteAttribute(STATISTICS_ENABLED, null, StatisticsEnabledWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(PASS_BY_VALUE, null, EJBRemoteInvocationPassByValueWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_DISTINCT_NAME, null, EJBDefaultDistinctNameWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(LOG_EJB_EXCEPTIONS, null, ExceptionLoggingWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(ALLOW_EJB_NAME_REGEX, null, EJBNameRegexWriteHandler.INSTANCE);
    final EJBDefaultSecurityDomainWriteHandler defaultSecurityDomainWriteHandler = new EJBDefaultSecurityDomainWriteHandler(DEFAULT_SECURITY_DOMAIN, defaultSecurityDomainDeploymentProcessor);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_SECURITY_DOMAIN, null, defaultSecurityDomainWriteHandler);
    final EJBDefaultMissingMethodPermissionsWriteHandler defaultMissingMethodPermissionsWriteHandler = new EJBDefaultMissingMethodPermissionsWriteHandler(DEFAULT_MISSING_METHOD_PERMISSIONS_DENY_ACCESS, missingMethodPermissionsDenyAccessMergingProcessor);
    resourceRegistration.registerReadWriteAttribute(DEFAULT_MISSING_METHOD_PERMISSIONS_DENY_ACCESS, null, defaultMissingMethodPermissionsWriteHandler);
    resourceRegistration.registerReadWriteAttribute(DISABLE_DEFAULT_EJB_PERMISSIONS, null, new AbstractWriteAttributeHandler<Void>(DISABLE_DEFAULT_EJB_PERMISSIONS) {

        protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException {
            if (resolvedValue.asBoolean()) {
                throw EjbLogger.ROOT_LOGGER.disableDefaultEjbPermissionsCannotBeTrue();
            }
            return false;
        }

        protected void revertUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode valueToRestore, final ModelNode valueToRevert, final Void handback) throws OperationFailedException {
        }
    });
    resourceRegistration.registerReadWriteAttribute(ENABLE_GRACEFUL_TXN_SHUTDOWN, null, EnableGracefulTxnShutdownWriteHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(SERVER_INTERCEPTORS, null, new ReloadRequiredWriteAttributeHandler(SERVER_INTERCEPTORS));
    resourceRegistration.registerReadWriteAttribute(CLIENT_INTERCEPTORS, null, new ReloadRequiredWriteAttributeHandler(CLIENT_INTERCEPTORS));
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationFailedException(org.jboss.as.controller.OperationFailedException) ModelNode(org.jboss.dmr.ModelNode) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Example 17 with ReloadRequiredWriteAttributeHandler

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

the class IdentityResourceDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    outflowSecurityDomains.clear();
    ReloadRequiredWriteAttributeHandler handler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES);
    for (AttributeDefinition attribute : ATTRIBUTES) {
        resourceRegistration.registerReadWriteAttribute(attribute, null, handler);
    }
}
Also used : StringListAttributeDefinition(org.jboss.as.controller.StringListAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Example 18 with ReloadRequiredWriteAttributeHandler

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

the class ExternalJMSTopicDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration registry) {
    if (registerRuntimeOnly) {
        registry.registerReadOnlyAttribute(CommonAttributes.DESTINATION_ENTRIES, null);
        // Should this be read only as entries ?
        registry.registerReadOnlyAttribute(External.ENABLE_AMQ1_PREFIX, null);
    } else {
        registry.registerReadWriteAttribute(CommonAttributes.DESTINATION_ENTRIES, null, new ReloadRequiredWriteAttributeHandler(CommonAttributes.DESTINATION_ENTRIES));
        registry.registerReadWriteAttribute(External.ENABLE_AMQ1_PREFIX, null, new ReloadRequiredWriteAttributeHandler(External.ENABLE_AMQ1_PREFIX));
    }
}
Also used : ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Example 19 with ReloadRequiredWriteAttributeHandler

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

the class JMSBridgeDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration registry) {
    ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES);
    CredentialReferenceWriteAttributeHandler credentialReferenceWriteAttributeHandler = new CredentialReferenceWriteAttributeHandler(SOURCE_CREDENTIAL_REFERENCE, TARGET_CREDENTIAL_REFERENCE);
    for (AttributeDefinition attr : ATTRIBUTES) {
        if (attr.equals(SOURCE_CREDENTIAL_REFERENCE) || attr.equals(TARGET_CREDENTIAL_REFERENCE)) {
            registry.registerReadWriteAttribute(attr, null, credentialReferenceWriteAttributeHandler);
        } else {
            registry.registerReadWriteAttribute(attr, null, reloadRequiredWriteAttributeHandler);
        }
    }
    for (AttributeDefinition attr : READONLY_ATTRIBUTES) {
        registry.registerReadOnlyAttribute(attr, JMSBridgeHandler.INSTANCE);
    }
    for (AttributeDefinition attr : METRICS) {
        registry.registerMetric(attr, JMSBridgeHandler.READ_ONLY_INSTANCE);
    }
}
Also used : CredentialReferenceWriteAttributeHandler(org.jboss.as.controller.security.CredentialReferenceWriteAttributeHandler) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) PropertiesAttributeDefinition(org.jboss.as.controller.PropertiesAttributeDefinition) ObjectTypeAttributeDefinition(org.jboss.as.controller.ObjectTypeAttributeDefinition) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)

Example 20 with ReloadRequiredWriteAttributeHandler

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

the class PooledConnectionFactoryDefinition method registerAttributes.

@Override
public void registerAttributes(ManagementResourceRegistration registry) {
    Collection<AttributeDefinition> definitions = getAttributes();
    ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(definitions);
    CredentialReferenceWriteAttributeHandler credentialReferenceWriteAttributeHandler = new CredentialReferenceWriteAttributeHandler(CREDENTIAL_REFERENCE);
    for (AttributeDefinition attr : definitions) {
        if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) {
            if (deployed) {
                registry.registerReadOnlyAttribute(attr, PooledConnectionFactoryConfigurationRuntimeHandler.INSTANCE);
            } else {
                if (attr.equals(CREDENTIAL_REFERENCE)) {
                    registry.registerReadWriteAttribute(attr, null, credentialReferenceWriteAttributeHandler);
                } else {
                    registry.registerReadWriteAttribute(attr, null, reloadRequiredWriteAttributeHandler);
                }
            }
        }
    }
}
Also used : CredentialReferenceWriteAttributeHandler(org.jboss.as.controller.security.CredentialReferenceWriteAttributeHandler) StringListAttributeDefinition(org.jboss.as.controller.StringListAttributeDefinition) AttributeDefinition(org.jboss.as.controller.AttributeDefinition) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SimpleMapAttributeDefinition(org.jboss.as.controller.SimpleMapAttributeDefinition) PrimitiveListAttributeDefinition(org.jboss.as.controller.PrimitiveListAttributeDefinition) SimpleListAttributeDefinition(org.jboss.as.controller.SimpleListAttributeDefinition) 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