Package org.jboss.as.controller
Class AbstractControllerService
java.lang.Object
org.jboss.as.controller.AbstractControllerService
- All Implemented Interfaces:
org.jboss.msc.Service,org.jboss.msc.service.Service<ModelController>,org.jboss.msc.value.Value<ModelController>
public abstract class AbstractControllerService
extends Object
implements org.jboss.msc.service.Service<ModelController>
A base class for controller services.
- Author:
- David M. Lloyd, Richard Opalka
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceListener for notifications that theModelControlleris unstable and a process restart is necessary.protected static classParameters for initializingModelControllerServiceInitializationinstancesprotected static interfaceTracks whether the controller is working with a complete model or just a partial one. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DelegatingConfigurableAuthorizerstatic final StringName of the system property to set to control the stack size for the thread used to process boot operations.protected static final RuntimeCapability<Void>Capability in-vm users of the controller use to create clientsstatic final intThe default stack size for the thread used to process boot operations.static final RuntimeCapability<Void>Capability users of the controller use to perform asynchronous management tasks.protected static final RuntimeCapability<Void>Capability in-vm users of the controller use to register notification handlersstatic final RuntimeCapability<Void>Capability users of the controller use to coordinate changes to paths.protected static final RuntimeCapability<Void>Capability users of the controller use to read process state and get notification of state changes.protected final ProcessTypeprotected final ManagementSecurityIdentitySupplierprotected final StabilityFields inherited from interface org.jboss.msc.service.Service
NULL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractControllerService(Supplier<ExecutorService> executorService, Supplier<AbstractControllerService.ControllerInstabilityListener> instabilityListener, ProcessType processType, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry, ConfigurationExtension configExtension) Deprecated, for removal: This API element is subject to removal in a future version.For use by legacy versionsprotectedAbstractControllerService(Supplier<ExecutorService> executorService, Supplier<AbstractControllerService.ControllerInstabilityListener> instabilityListener, ProcessType processType, Stability stability, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry, ConfigurationExtension configExtension) Construct a new instance.protectedAbstractControllerService(ProcessType processType, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidacquireReadLock(int operationId) protected booleanBoot with the given operations, performing full model and capability registry validation.protected booleanboot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure, boolean skipModelValidation) Boot with the given operations, optionally disabling model and capability registry validation.protected booleanboot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure, boolean skipModelValidation, MutableRootResourceRegistrationProvider parallelBootRootResourceRegistrationProvider) Boot, optionally disabling model and capability registry validation, using the given provider for the rootManagementResourceRegistration.protected voidboot(BootContext context) Boot the controller.protected voidprotected voidprotected OperationStepHandlerprotected voidprotected final org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, int lockPermit) protected final org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) protected final org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, Resource model, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) protected voidprotected voidfinishBoot(boolean readOnly) protected ManagedAuditLoggerprotected BootErrorCollectorprotected final org.jboss.dmr.ModelNodeprotected ExecutorServiceprotected ModelControllerClientFactoryOverride to return aAbstractControllerService.ModelControllerServiceInitializationParams.protected final MutableRootResourceRegistrationProviderprotected NotificationSupportgetValue()protected abstract voidinitModel(ManagementModel managementModel, Resource modelControllerResource) protected OperationResponseinternalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) protected OperationResponseinternalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, boolean attemptLock) protected OperationResponseinternalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, boolean attemptLock, boolean partialModel) protected booleanGets whether this controller service should install aModelControllerClientFactoryand aNotificationHandlerRegistryas a service.protected voidpostBoot()protected final org.jboss.dmr.ModelNodeUsed to add the operation used to initialise the ModelControllerServiceInitialization instances.protected voidreleaseReadLock(int operationId) protected voidsetConfigurationPersister(ConfigurationPersister persister) voidstart(org.jboss.msc.service.StartContext context) voidstop(org.jboss.msc.service.StopContext context) protected voidstopAsynchronous(org.jboss.msc.service.StopContext context) Hook for subclasses to perform work during the asynchronous task started bystop(org.jboss.msc.service.StopContext).
-
Field Details
-
BOOT_STACK_SIZE_PROPERTY
Name of the system property to set to control the stack size for the thread used to process boot operations. The boot sequence can have a very deep stack, so if needed setting this property can be used to create a larger memory area for storing data on the stack.- See Also:
-
DEFAULT_BOOT_STACK_SIZE
public static final int DEFAULT_BOOT_STACK_SIZEThe default stack size for the thread used to process boot operations. -
CLIENT_FACTORY_CAPABILITY
Capability in-vm users of the controller use to create clients -
NOTIFICATION_REGISTRY_CAPABILITY
Capability in-vm users of the controller use to register notification handlers -
PATH_MANAGER_CAPABILITY
Capability users of the controller use to coordinate changes to paths. This capability isn't necessarily directly related to this class but we declare it here as it's as good a place as any at this time. -
EXECUTOR_CAPABILITY
Capability users of the controller use to perform asynchronous management tasks. This capability isn't necessarily directly related to this class but we declare it here as it's as good a place as any at this time. -
PROCESS_STATE_NOTIFIER_CAPABILITY
Capability users of the controller use to read process state and get notification of state changes. This capability isn't necessarily directly related to this class but we declare it here as it's as good a place as any at this time. -
processType
-
stability
-
authorizer
-
securityIdentitySupplier
-
-
Constructor Details
-
AbstractControllerService
@Deprecated(forRemoval=true) protected AbstractControllerService(ProcessType processType, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry) Deprecated, for removal: This API element is subject to removal in a future version.Construct a new instance.- Parameters:
processType- the type of process being controlledrunningModeControl- the controller of the process' running modeconfigurationPersister- the configuration persisterprocessState- the controlled process staterootResourceDefinition- the root resource definitionprepareStep- the prepare step to prepend to operation executionexpressionResolver- the expression resolverauditLogger- the audit loggerauthorizer- handles authorizationcapabilityRegistry- the capability registry
-
AbstractControllerService
@Deprecated(forRemoval=true) protected AbstractControllerService(Supplier<ExecutorService> executorService, Supplier<AbstractControllerService.ControllerInstabilityListener> instabilityListener, ProcessType processType, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry, ConfigurationExtension configExtension) Deprecated, for removal: This API element is subject to removal in a future version.For use by legacy versionsConstruct a new instance.- Parameters:
processType- the type of process being controlledrunningModeControl- the controller of the process' running modeconfigurationPersister- the configuration persisterprocessState- the controlled process staterootResourceDefinition- the root resource definitionprepareStep- the prepare step to prepend to operation executionexpressionResolver- the expression resolverauditLogger- the audit loggerauthorizer- handles authorizationcapabilityRegistry- the capability registry
-
AbstractControllerService
protected AbstractControllerService(Supplier<ExecutorService> executorService, Supplier<AbstractControllerService.ControllerInstabilityListener> instabilityListener, ProcessType processType, Stability stability, RunningModeControl runningModeControl, ConfigurationPersister configurationPersister, ControlledProcessState processState, ResourceDefinition rootResourceDefinition, OperationStepHandler prepareStep, ExpressionResolver expressionResolver, ManagedAuditLogger auditLogger, DelegatingConfigurableAuthorizer authorizer, ManagementSecurityIdentitySupplier securityIdentitySupplier, CapabilityRegistry capabilityRegistry, ConfigurationExtension configExtension) Construct a new instance.- Parameters:
processType- the type of process being controlledstability- the stability level of the controlled processrunningModeControl- the controller of the process' running modeconfigurationPersister- the configuration persisterprocessState- the controlled process staterootResourceDefinition- the root resource definitionprepareStep- the prepare step to prepend to operation executionexpressionResolver- the expression resolverauditLogger- the audit loggerauthorizer- handles authorizationcapabilityRegistry- the capability registry
-
-
Method Details
-
start
public void start(org.jboss.msc.service.StartContext context) throws org.jboss.msc.service.StartException - Specified by:
startin interfaceorg.jboss.msc.Service- Throws:
org.jboss.msc.service.StartException
-
isExposingClientServicesAllowed
protected boolean isExposingClientServicesAllowed()Gets whether this controller service should install aModelControllerClientFactoryand aNotificationHandlerRegistryas a service. Default istrue; this method allows test infrastructure subclasses to turn this off.- Returns:
trueif a service should be installed
-
boot
Boot the controller. Called during service start.- Parameters:
context- the boot context- Throws:
ConfigurationPersistenceException- if the configuration failed to be loaded
-
boot
protected boolean boot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException Boot with the given operations, performing full model and capability registry validation.- Parameters:
bootOperations- the operations. Cannot benullrollbackOnRuntimeFailure-trueif the boot should fail if operations fail in the runtime stage- Returns:
trueif boot was successful- Throws:
ConfigurationPersistenceException
-
boot
protected boolean boot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure, boolean skipModelValidation) throws ConfigurationPersistenceException Boot with the given operations, optionally disabling model and capability registry validation.- Parameters:
bootOperations- the operations. Cannot benullrollbackOnRuntimeFailure-trueif the boot should fail if operations fail in the runtime stageskipModelValidation-trueif model and capability validation should be skipped.- Returns:
trueif boot was successful- Throws:
ConfigurationPersistenceException
-
boot
protected boolean boot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure, boolean skipModelValidation, MutableRootResourceRegistrationProvider parallelBootRootResourceRegistrationProvider) throws ConfigurationPersistenceException Boot, optionally disabling model and capability registry validation, using the given provider for the rootManagementResourceRegistration.- Parameters:
bootOperations- the operations. Cannot benullrollbackOnRuntimeFailure-trueif the boot should fail if operations fail in the runtime stageskipModelValidation-trueif model and capability validation should be skipped.parallelBootRootResourceRegistrationProvider- provider of the root resource registration- Returns:
trueif boot was successful- Throws:
ConfigurationPersistenceException
-
internalExecute
protected OperationResponse internalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) -
internalExecute
protected OperationResponse internalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, boolean attemptLock) -
internalExecute
protected OperationResponse internalExecute(Operation operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, boolean attemptLock, boolean partialModel) -
executeReadOnlyOperation
protected final org.jboss.dmr.ModelNode executeReadOnlyOperation(org.jboss.dmr.ModelNode operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, int lockPermit) -
executeReadOnlyOperation
protected final org.jboss.dmr.ModelNode executeReadOnlyOperation(org.jboss.dmr.ModelNode operation, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) -
executeReadOnlyOperation
protected final org.jboss.dmr.ModelNode executeReadOnlyOperation(org.jboss.dmr.ModelNode operation, Resource model, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep) -
finishBoot
-
finishBoot
-
clearBootingReadOnlyFlag
protected void clearBootingReadOnlyFlag() -
bootThreadDone
protected void bootThreadDone() -
postBoot
protected void postBoot() -
getNotificationSupport
-
getMutableRootResourceRegistrationProvider
protected final MutableRootResourceRegistrationProvider getMutableRootResourceRegistrationProvider() -
getPartialModelIndicator
-
stop
public void stop(org.jboss.msc.service.StopContext context) - Specified by:
stopin interfaceorg.jboss.msc.Service
-
stopAsynchronous
protected void stopAsynchronous(org.jboss.msc.service.StopContext context) Hook for subclasses to perform work during the asynchronous task started bystop(org.jboss.msc.service.StopContext). This base method does nothing.Subclasses must not invoke
LifecycleContext.complete()- Parameters:
context- the stop context
-
getValue
- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<ModelController>- Throws:
SecurityException- if the caller does not haveModelController.ACCESS_PERMISSIONIllegalStateExceptionIllegalArgumentException
-
getExecutorService
-
setConfigurationPersister
-
initModel
protected abstract void initModel(ManagementModel managementModel, Resource modelControllerResource) -
getAuditLogger
-
getBootErrorCollector
-
getBootErrors
protected final org.jboss.dmr.ModelNode getBootErrors() -
createExtraValidationStepHandler
-
acquireReadLock
- Throws:
InterruptedException
-
releaseReadLock
protected void releaseReadLock(int operationId) -
registerModelControllerServiceInitializationBootStep
protected final org.jboss.dmr.ModelNode registerModelControllerServiceInitializationBootStep(BootContext context) Used to add the operation used to initialise the ModelControllerServiceInitialization instances. The operation will only be registered, and called if the implementing class overrides and returns a nonnullvalue fromgetModelControllerServiceInitializationParams()- Parameters:
context- the boot context
-
getModelControllerServiceInitializationParams
protected AbstractControllerService.ModelControllerServiceInitializationParams getModelControllerServiceInitializationParams()Override to return aAbstractControllerService.ModelControllerServiceInitializationParams. Ifnullis returned,registerModelControllerServiceInitializationBootStep(BootContext)will not perform any initialization ofModelControllerServiceInitializationinstances.- Returns:
- the context to use for registering
ModelControllerServiceInitializationinstances
-
getModelControllerClientFactory
-
executeAdditionalCliBootScript
protected void executeAdditionalCliBootScript()
-