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 Classes Modifier and Type Class Description static interfaceAbstractControllerService.ControllerInstabilityListenerListener for notifications that theModelControlleris unstable and a process restart is necessary.protected static classAbstractControllerService.ModelControllerServiceInitializationParamsParameters for initializingModelControllerServiceInitializationinstancesprotected static interfaceAbstractControllerService.PartialModelIndicatorTracks whether the controller is working with a complete model or just a partial one.
-
Field Summary
Fields Modifier and Type Field Description protected DelegatingConfigurableAuthorizerauthorizerstatic StringBOOT_STACK_SIZE_PROPERTYName of the system property to set to control the stack size for the thread used to process boot operations.protected static RuntimeCapability<Void>CLIENT_FACTORY_CAPABILITYCapability in-vm users of the controller use to create clientsstatic intDEFAULT_BOOT_STACK_SIZEThe default stack size for the thread used to process boot operations.static RuntimeCapability<Void>EXECUTOR_CAPABILITYCapability users of the controller use to perform asynchronous management tasks.protected static RuntimeCapability<Void>NOTIFICATION_REGISTRY_CAPABILITYCapability in-vm users of the controller use to register notification handlersstatic RuntimeCapability<Void>PATH_MANAGER_CAPABILITYCapability users of the controller use to coordinate changes to paths.protected static RuntimeCapability<Void>PROCESS_STATE_NOTIFIER_CAPABILITYCapability users of the controller use to read process state and get notification of state changes.protected ProcessTypeprocessTypeprotected ManagementSecurityIdentitySuppliersecurityIdentitySupplier
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidacquireReadLock(int operationId)protected booleanboot(List<org.jboss.dmr.ModelNode> bootOperations, boolean rollbackOnRuntimeFailure)Boot 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 voidbootThreadDone()protected voidclearBootingReadOnlyFlag()protected OperationStepHandlercreateExtraValidationStepHandler()protected voidexecuteAdditionalCliBootScript()protected org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, OperationMessageHandler handler, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep, int lockPermit)protected org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep)protected org.jboss.dmr.ModelNodeexecuteReadOnlyOperation(org.jboss.dmr.ModelNode operation, Resource model, ModelController.OperationTransactionControl control, OperationStepHandler prepareStep)protected voidfinishBoot()protected voidfinishBoot(boolean readOnly)protected ManagedAuditLoggergetAuditLogger()protected BootErrorCollectorgetBootErrorCollector()protected ExecutorServicegetExecutorService()protected ModelControllerClientFactorygetModelControllerClientFactory()protected AbstractControllerService.ModelControllerServiceInitializationParamsgetModelControllerServiceInitializationParams()Override to return aAbstractControllerService.ModelControllerServiceInitializationParams.protected MutableRootResourceRegistrationProvidergetMutableRootResourceRegistrationProvider()protected NotificationSupportgetNotificationSupport()protected AbstractControllerService.PartialModelIndicatorgetPartialModelIndicator()ModelControllergetValue()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 booleanisExposingClientServicesAllowed()Gets whether this controller service should install aModelControllerClientFactoryand aNotificationHandlerRegistryas a service.protected voidpostBoot()protected org.jboss.dmr.ModelNoderegisterModelControllerServiceInitializationBootStep(BootContext context)Used 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 Detail
-
BOOT_STACK_SIZE_PROPERTY
public static final String 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, Constant Field Values
-
DEFAULT_BOOT_STACK_SIZE
public static final int DEFAULT_BOOT_STACK_SIZE
The default stack size for the thread used to process boot operations.- See Also:
BOOT_STACK_SIZE_PROPERTY, Constant Field Values
-
CLIENT_FACTORY_CAPABILITY
protected static final RuntimeCapability<Void> CLIENT_FACTORY_CAPABILITY
Capability in-vm users of the controller use to create clients
-
NOTIFICATION_REGISTRY_CAPABILITY
protected static final RuntimeCapability<Void> NOTIFICATION_REGISTRY_CAPABILITY
Capability in-vm users of the controller use to register notification handlers
-
PATH_MANAGER_CAPABILITY
public static final RuntimeCapability<Void> 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
public static final RuntimeCapability<Void> 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
protected static final RuntimeCapability<Void> 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
protected final ProcessType processType
-
authorizer
protected final DelegatingConfigurableAuthorizer authorizer
-
securityIdentitySupplier
protected final ManagementSecurityIdentitySupplier securityIdentitySupplier
-
-
Constructor Detail
-
AbstractControllerService
@Deprecated 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.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
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)
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
-
-
Method Detail
-
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
protected void boot(BootContext context) throws ConfigurationPersistenceException
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
protected void finishBoot() throws ConfigurationPersistenceException
-
finishBoot
protected void finishBoot(boolean readOnly) throws ConfigurationPersistenceException
-
clearBootingReadOnlyFlag
protected void clearBootingReadOnlyFlag()
-
bootThreadDone
protected void bootThreadDone()
-
postBoot
protected void postBoot()
-
getNotificationSupport
protected NotificationSupport getNotificationSupport()
-
getMutableRootResourceRegistrationProvider
protected final MutableRootResourceRegistrationProvider getMutableRootResourceRegistrationProvider()
-
getPartialModelIndicator
protected AbstractControllerService.PartialModelIndicator 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
public ModelController getValue() throws IllegalStateException, IllegalArgumentException
- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<ModelController>- Throws:
SecurityException- if the caller does not haveModelController.ACCESS_PERMISSIONIllegalStateExceptionIllegalArgumentException
-
getExecutorService
protected ExecutorService getExecutorService()
-
setConfigurationPersister
protected void setConfigurationPersister(ConfigurationPersister persister)
-
initModel
protected abstract void initModel(ManagementModel managementModel, Resource modelControllerResource)
-
getAuditLogger
protected ManagedAuditLogger getAuditLogger()
-
getBootErrorCollector
protected BootErrorCollector getBootErrorCollector()
-
createExtraValidationStepHandler
protected OperationStepHandler createExtraValidationStepHandler()
-
acquireReadLock
protected void acquireReadLock(int operationId) throws InterruptedException- 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
protected ModelControllerClientFactory getModelControllerClientFactory()
-
executeAdditionalCliBootScript
protected void executeAdditionalCliBootScript()
-
-