Interface OperationContext
- All Superinterfaces:
CapabilityServiceDescriptorResolver,ExpressionResolver,FeatureFilter,FeatureRegistry
- Author:
- David M. Lloyd
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classAn attachment key instance.static enumThe current activity of an operation.static enumThe result action.static interfaceHandler for a callback to anOperationStepHandlerindicating that the result of the overall operation is known and the handler can take any necessary actions to deal with that result.static interfaceHandler for a callback to anOperationStepHandlerindicating that the overall operation is being rolled back and the handler should revert any change it has made.static enumThe stage at which a step should apply.Nested classes/interfaces inherited from interface org.jboss.as.controller.ExpressionResolver
ExpressionResolver.ExpressionResolutionServerException, ExpressionResolver.ExpressionResolutionUserException -
Field Summary
Fields inherited from interface org.jboss.as.controller.ExpressionResolver
EXPRESSION_PATTERN, EXTENSION_REJECTING, REJECTING, SIMPLE, SIMPLE_LENIENT, TEST_RESOLVER -
Method Summary
Modifier and TypeMethodDescriptionvoidAcquire the controllingModelController's exclusive lock.voidaddModelStep(OperationDefinition stepDefinition, OperationStepHandler stepHandler, boolean addFirst) Add aOperationContext.Stage.MODELexecution step to this operation process, including descriptive information for the operation.voidaddModelStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationDefinition stepDefinition, OperationStepHandler stepHandler, boolean addFirst) Add aOperationContext.Stage.MODELexecution step to this operation process, including descriptive information for the operation.voidaddResource(PathAddress address, int index, Resource toAdd) Add a new resource, at to the executed operation address.voidaddResource(PathAddress address, Resource toAdd) Add a new resource, at the executed operation address.voidaddResponseWarning(Level level, String warning) Add a warning to response.voidaddResponseWarning(Level level, org.jboss.dmr.ModelNode warning) voidaddStep(OperationStepHandler step, OperationContext.Stage stage) Add an execution step to this operation process.voidaddStep(OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) Add an execution step to this operation process.voidaddStep(org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage) Add an execution step to this operation process, writing any output to the response object associated with the current step.voidaddStep(org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) Add an execution step to this operation process, writing any output to the response object associated with the current step.voidaddStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage) Add an execution step to this operation process.voidaddStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) Add an execution step to this operation process.<T> Tattach(OperationContext.AttachmentKey<T> key, T value) Attaches an arbitrary object to this context.<T> TattachIfAbsent(OperationContext.AttachmentKey<T> key, T value) Attaches an arbitrary object to this context only if the object was not already attached.attachResultStream(String mimeType, InputStream stream) Attach a stream to be included as part of the response.voidattachResultStream(String uuid, String mimeType, InputStream stream) Attach a stream to be included as part of the response, with a predetermined UUID.authorize(org.jboss.dmr.ModelNode operation) Check for authorization of the given operation.authorize(org.jboss.dmr.ModelNode operation, String attribute, org.jboss.dmr.ModelNode currentValue) Check for authorization to read or modify an attribute, checking all effects of the given operationauthorize(org.jboss.dmr.ModelNode operation, String attribute, org.jboss.dmr.ModelNode currentValue, Set<Action.ActionEffect> effects) Check for authorization to read or modify an attribute, limiting the check to the given effects of the operationauthorize(org.jboss.dmr.ModelNode operation, Set<Action.ActionEffect> effects) Check for authorization of the given effects for the given operation.authorizeOperation(org.jboss.dmr.ModelNode operation) Check for authorization to execute an operation.authorizeResource(boolean attributes, boolean isDefaultResource) Check for authorization for the resource associated with the currently executing operation step and, optionally, its individual attributesvoidcompleteStep(OperationContext.ResultHandler resultHandler) Complete a step, while registering fora notificationwhen the overall result of the operation is known.voidcompleteStep(OperationContext.RollbackHandler rollbackHandler) Complete a step, while registering fora notificationif the work done by the caller needs to be rolled back}.createResource(PathAddress address) Create a new resource, relative to the executed operation address.voidderegisterCapability(String capabilityName) Record that a previously registered capability will no longer be available.voidderegisterCapabilityRequirement(String required, String dependent) Record that a previously registered requirement for a capability will no longer exist.voidderegisterCapabilityRequirement(String required, String dependent, String attribute) Record that a previously registered requirement for a capability will no longer exist.<T> Tdetach(OperationContext.AttachmentKey<T> key) Detaches or removes the value from this context.voidemit(Notification notification) Emit aNotification.<T> TRetrieves an object that has been attached to this context.getAttachmentStream(int index) Get a stream which is attached to the request.intGets the number of streams attached to the request.Gets the caller environment for the current request.<T> TgetCapabilityRuntimeAPI(String capabilityName, Class<T> apiType) Gets the runtime API associated with a given capability, if there is one.<T> TgetCapabilityRuntimeAPI(String capabilityBaseName, String dynamicPart, Class<T> apiType) Gets the runtime API associated with a givendynamically namedcapability, if there is one.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(String capabilityName, Class<?> serviceType) Gets the name of a service associated with a given capability, if there is one.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(String capabilityBaseName, Class<?> serviceType, String... dynamicParts) Gets the name of a service associated with a givendynamically namedcapability, if there is one.org.jboss.msc.service.ServiceNamegetCapabilityServiceName(String capabilityBaseName, String dynamicPart, Class<?> serviceType) Gets the name of a service associated with a givendynamically namedcapability, if there is one.default <T> org.jboss.msc.service.ServiceNamegetCapabilityServiceName(BinaryServiceDescriptor<T> descriptor, String parent, String child) Resolves theServiceNameof the capability described by the specified descriptor using the specified reference names.default <T> org.jboss.msc.service.ServiceNamegetCapabilityServiceName(NullaryServiceDescriptor<T> descriptor) Resolves theServiceNameof the capability described by the specified descriptor.default <T> org.jboss.msc.service.ServiceNamegetCapabilityServiceName(QuaternaryServiceDescriptor<T> descriptor, String greatGrandparent, String grandparent, String parent, String child) Resolves theServiceNameof the capability described by the specified descriptor using the specified reference names.default <T> org.jboss.msc.service.ServiceNamegetCapabilityServiceName(TernaryServiceDescriptor<T> descriptor, String grandparent, String parent, String child) Resolves theServiceNameof the capability described by the specified descriptor using the specified reference names.default <T> org.jboss.msc.service.ServiceNamegetCapabilityServiceName(UnaryServiceDescriptor<T> descriptor, String name) Resolves theServiceNameof the capability described by the specified descriptor using the specified reference name.Gets a support object that allows service implementations installed from this context to integrate with capabilities.Get the service target.Gets the address associated with the currently executing step.Get the node with current operation nameorg.jboss.dmr.ModelNodeGet parameter node by its nameorg.jboss.dmr.ModelNodegetCurrentOperationParameter(String name, boolean nullable) Get parameter node by its nameGet the current stage of execution.org.jboss.dmr.ModelNodeGet the failure description response node, creating it if necessary.Get a read-only reference of the entire management model BEFORE any changes were made by this context.Get the type of process in which this operation is executing.Get a read only view of the managed resource registration.Get a mutable view of the managed resource registration.org.jboss.dmr.ModelNodeGet the response-headers response node, creating it if necessary.org.jboss.dmr.ModelNodeGet the node into which the operation result should be written.Get a read only view of the root managed resource registration.Gets the running mode of the process.org.wildfly.security.auth.server.SecurityIdentityObtain theSecurityIdentityfor the current request.org.jboss.dmr.ModelNodeGet the node into which the details of server results in a multi-server managed domain operation should be written.org.jboss.msc.service.ServiceRegistrygetServiceRegistry(boolean modify) Get the service registry.default org.jboss.msc.service.ServiceTargetDeprecated, for removal: This API element is subject to removal in a future version.default StabilityReturns the feature stability supported by this feature registry.booleanReturns whethergetFailureDescription()has been invoked.default booleanhasOptionalCapability(String requested, String[] requestedSegments, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.booleanhasOptionalCapability(String requested, String dependent, String attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(String requested, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(BinaryServiceDescriptor<?> requested, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(NullaryServiceDescriptor<?> requested, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(QuaternaryServiceDescriptor<?> requested, String greatGrandparent, String grandparent, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(TernaryServiceDescriptor<?> requested, String grandparent, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.default booleanhasOptionalCapability(UnaryServiceDescriptor<?> requested, String name, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present.booleanReturns whethergetResult()has been invoked.booleanDetermine whether the controller is currently performing boot tasks.booleanWhether normally this operation would require a runtime step.booleanDetermine whether the model has thus far been affected by this operation.booleanConvenience method to check if theprocess typeisa server typeand therunning modeisRunningMode.NORMAL.booleanDetermine whether themanagement resource registryhas thus far been affected by this operation.booleanGets whetherOperationContext.Stage.RUNTIMEhandlers can restart (or remove) runtime services in order to make the operation take effect.booleanDetermine whether the current operation is bound to be rolled back.booleanGets whether any changes made by the operation should be rolled back if an error is introduced by aOperationContext.Stage.RUNTIMEorOperationContext.Stage.VERIFYhandler.booleanDetermine whether the runtime container has thus far been affected by this operation.booleanmarkResourceRestarted(PathAddress resource, Object owner) Marks a resource to indicate that it's backing service(s) will be restarted.readResource(PathAddress relativeAddress) Get the resource for read only operations, relative to the executed operation address.readResource(PathAddress relativeAddress, boolean recursive) Get the resource for read only operations, relative to the executed operation address.readResourceForUpdate(PathAddress relativeAddress) Get an addressable resource for update operations.readResourceFromRoot(PathAddress address) Read an addressable resource from the root of the model.readResourceFromRoot(PathAddress address, boolean recursive) Read an addressable resource from the root of the model.voidregisterAdditionalCapabilityRequirement(String required, String dependent, String attribute) Registers an additional hard requirement a capability has beyond what it was aware of whencapabilitywas passed toregisterCapability(org.jboss.as.controller.capability.RuntimeCapability).voidregisterCapability(RuntimeCapability<?> capability) Registers a capability with the system.voidNotify the context that the process requires a stop and re-start of its root service (but not a full process restart) in order to ensure stable operation and/or to bring its running state in line with its persistent configuration.removeResource(PathAddress relativeAddress) Remove a resource relative to the executed operation address.voidremoveService(org.jboss.msc.service.ServiceController<?> controller) Initiate a service removal.org.jboss.msc.service.ServiceController<?>removeService(org.jboss.msc.service.ServiceName name) Initiate a service removal.voidreport(MessageSeverity severity, String message) Send a message to the client.voidrequireOptionalCapability(String required, String dependent, String attribute) Requests that one of a capability's optional requirements hereafter be treated as required, until the process is stopped or reloaded.org.jboss.dmr.ModelNoderesolveExpressions(org.jboss.dmr.ModelNode node) Resolves any expressions passed in the ModelNode.voidNotify the context that the process must be terminated and replaced with a new process in order to ensure stable operation and/or to bring the running state in line with the persistent configuration.voidNotify the context that a previous call toreloadRequired()can be ignored (typically because the change that led to the need for reload has been rolled back.)booleanrevertResourceRestarted(PathAddress resource, Object owner) Removes the restarted marking on the specified resource, provided the passed owner is the one originally used to obtain the mark.voidNotify the context that a previous call torestartRequired()can be ignored (typically because the change that led to the need for restart has been rolled back.)voidNotify the context that an update to the runtime that would normally have been made could not be made due to the current state of the process.voidIndicate that the operation should be rolled back, regardless of outcome.Methods inherited from interface org.jboss.as.controller.ExpressionResolver
resolveExpressionsMethods inherited from interface org.jboss.as.controller.FeatureRegistry
enables
-
Method Details
-
addStep
void addStep(OperationStepHandler step, OperationContext.Stage stage) throws IllegalArgumentException Add an execution step to this operation process. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
step- the step to addstage- the stage at which the operation applies- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addStep
void addStep(OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) throws IllegalArgumentException Add an execution step to this operation process. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
step- the step to addstage- the stage at which the operation appliesaddFirst- add the handler before the others- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addStep
void addStep(org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage) throws IllegalArgumentException Add an execution step to this operation process, writing any output to the response object associated with the current step. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
operation- the operation body to pass into the added stepstep- the step to addstage- the stage at which the operation applies- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addStep
void addStep(org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) throws IllegalArgumentException Add an execution step to this operation process, writing any output to the response object associated with the current step. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
operation- the operation body to pass into the added stepstep- the step to addstage- the stage at which the operation appliesaddFirst- add the handler before the others- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addStep
void addStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage) throws IllegalArgumentException Add an execution step to this operation process. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
response- the response which the nested step should populateoperation- the operation body to pass into the added stepstep- the step to addstage- the stage at which the operation applies- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addStep
void addStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationStepHandler step, OperationContext.Stage stage, boolean addFirst) throws IllegalArgumentException Add an execution step to this operation process. Runtime operation steps are automatically added after configuration operation steps. Since only one operation may perform runtime work at a time, this method may block until other runtime operations have completed.- Parameters:
response- the response which the nested step should populateoperation- the operation body to pass into the added stepstep- the step to addstage- the stage at which the operation appliesaddFirst- add the handler before the others- Throws:
IllegalArgumentException- if the step handler is not valid for this controller type
-
addModelStep
void addModelStep(OperationDefinition stepDefinition, OperationStepHandler stepHandler, boolean addFirst) throws IllegalArgumentException Add aOperationContext.Stage.MODELexecution step to this operation process, including descriptive information for the operation.This method is primarily intended for internal use.
- Parameters:
stepDefinition- the definition of the step to addstepHandler- the handler for the stepaddFirst- add the handler before the others @throws IllegalArgumentException if the step handler is not valid for this controller type- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODELIllegalArgumentException
-
addModelStep
void addModelStep(org.jboss.dmr.ModelNode response, org.jboss.dmr.ModelNode operation, OperationDefinition stepDefinition, OperationStepHandler stepHandler, boolean addFirst) throws IllegalArgumentException Add aOperationContext.Stage.MODELexecution step to this operation process, including descriptive information for the operation.This method is primarily intended for use by a handler for the
compositeoperation.- Parameters:
response- the response which the nested step should populateoperation- the operation body to pass into the added stepstepDefinition- the definition of the step to addstepHandler- the handler for the stepaddFirst- add the handler before the others @throws IllegalArgumentException if the step handler is not valid for this controller type- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODELIllegalArgumentException
-
addResponseWarning
Add a warning to response. This method appends warning message in response headers. Warning should be issued to inform managing end of non catastrophic occurrence, which require administrative action- Parameters:
level- - level of warning. Used to filter warning based on level value, just likewarning- - i18n formatter message, it should contain ID, just like jboss.Logger output does.
-
addResponseWarning
- Parameters:
warning- - pre-formatted warning messsage.
-
getAttachmentStream
Get a stream which is attached to the request.- Parameters:
index- the index- Returns:
- the input stream
-
getAttachmentStreamCount
int getAttachmentStreamCount()Gets the number of streams attached to the request.- Returns:
- the number of streams
-
getResult
org.jboss.dmr.ModelNode getResult()Get the node into which the operation result should be written.- Returns:
- the result node
-
hasResult
boolean hasResult()Returns whethergetResult()has been invoked.- Returns:
trueifgetResult()has been invoked
-
attachResultStream
Attach a stream to be included as part of the response. The return value of this method should be used as the value of theresultfor the step that invokes this method. Callers can then use that value to find the stream in theresponseto this operation.- Parameters:
mimeType- the mime type of the stream. Cannot benullstream- the stream. Cannot benull- Returns:
- a uuid for the stream. Will not be
null - Throws:
IllegalStateException- ifisBooting()returnstrue.
-
attachResultStream
Attach a stream to be included as part of the response, with a predetermined UUID.This method is intended for use by core handlers related to managed domain operation as they propagate a stream throughout a domain. Ordinary handlers should use
attachResultStream(String, java.io.InputStream).- Parameters:
mimeType- the mime type of the stream. Cannot benullstream- the stream. Cannot benull- Throws:
IllegalStateException- ifisBooting()returnstrue.
-
getFailureDescription
org.jboss.dmr.ModelNode getFailureDescription()Get the failure description response node, creating it if necessary.- Returns:
- the failure description
-
hasFailureDescription
boolean hasFailureDescription()Returns whethergetFailureDescription()has been invoked.- Returns:
trueifgetFailureDescription()has been invoked
-
getServerResults
org.jboss.dmr.ModelNode getServerResults()Get the node into which the details of server results in a multi-server managed domain operation should be written.- Returns:
- the server results node
- Throws:
IllegalStateException- if this process is not aProcessType.HOST_CONTROLLER
-
getResponseHeaders
org.jboss.dmr.ModelNode getResponseHeaders()Get the response-headers response node, creating it if necessary. Ordinary operation step handlers should not use this API for manipulating theoperation-requires-restartorprocess-stateheaders. UsereloadRequired()andrestartRequired()for that. (Some core operation step handlers used for coordinating execution of operations across different processes in a managed domain may use this method to manipulate theoperation-requires-restartorprocess-stateheaders, but that is an exception.)- Returns:
- the response-headers node
-
completeStep
Complete a step, while registering fora notificationif the work done by the caller needs to be rolled back}.- Parameters:
rollbackHandler- the handler for any rollback notification. Cannot benull.
-
completeStep
Complete a step, while registering fora notificationwhen the overall result of the operation is known. Handlers that register for notifications will receive the notifications in the reverse of the order in which their steps execute.- Parameters:
resultHandler- the handler for the result notification. Cannot benull.
-
getProcessType
ProcessType getProcessType()Get the type of process in which this operation is executing.- Returns:
- the process type. Will not be
null
-
getRunningMode
RunningMode getRunningMode()Gets the running mode of the process.- Returns:
- the running mode. Will not be
null
-
isBooting
boolean isBooting()Determine whether the controller is currently performing boot tasks.- Returns:
- whether the controller is currently booting
-
isNormalServer
boolean isNormalServer()Convenience method to check if theprocess typeisa server typeand therunning modeisRunningMode.NORMAL. The typical usage would be for handlers that are only meant to execute on a normally running server, not on a host controller or on aRunningMode.ADMIN_ONLYserver.- Returns:
trueif theprocess typeisa server typeand therunning modeisRunningMode.NORMAL.
-
isRollbackOnly
boolean isRollbackOnly()Determine whether the current operation is bound to be rolled back.- Returns:
trueif the operation will be rolled back
-
setRollbackOnly
void setRollbackOnly()Indicate that the operation should be rolled back, regardless of outcome. -
isRollbackOnRuntimeFailure
boolean isRollbackOnRuntimeFailure()Gets whether any changes made by the operation should be rolled back if an error is introduced by aOperationContext.Stage.RUNTIMEorOperationContext.Stage.VERIFYhandler.- Returns:
trueif the operation should rollback if there is a runtime stage failure
-
isResourceServiceRestartAllowed
boolean isResourceServiceRestartAllowed()Gets whetherOperationContext.Stage.RUNTIMEhandlers can restart (or remove) runtime services in order to make the operation take effect. Iffalseand the operation cannot be effected without restarting or removing services, the handler should invokereloadRequired()orrestartRequired().- Returns:
trueif a service restart or removal is allowed
-
reloadRequired
void reloadRequired()Notify the context that the process requires a stop and re-start of its root service (but not a full process restart) in order to ensure stable operation and/or to bring its running state in line with its persistent configuration. -
restartRequired
void restartRequired()Notify the context that the process must be terminated and replaced with a new process in order to ensure stable operation and/or to bring the running state in line with the persistent configuration. -
revertReloadRequired
void revertReloadRequired()Notify the context that a previous call toreloadRequired()can be ignored (typically because the change that led to the need for reload has been rolled back.) -
revertRestartRequired
void revertRestartRequired()Notify the context that a previous call torestartRequired()can be ignored (typically because the change that led to the need for restart has been rolled back.) -
runtimeUpdateSkipped
void runtimeUpdateSkipped()Notify the context that an update to the runtime that would normally have been made could not be made due to the current state of the process. As an example, a step handler that can only update the runtime whenisBooting()istruemust invoke this method if it is executed whenisBooting()isfalse. -
getCurrentAddress
PathAddress getCurrentAddress()Gets the address associated with the currently executing step.- Returns:
- the address. Will not be
null
-
getCurrentAddressValue
String getCurrentAddressValue()- Returns:
- the last element value
- Throws:
IllegalStateException- ifgetCurrentAddress()is the empty address
-
getCurrentOperationName
String getCurrentOperationName()Get the node with current operation name- Returns:
- operation name node
-
getCurrentOperationParameter
Get parameter node by its name- Parameters:
name- of desired parameter- Returns:
- node for parameter of given name or
nullif the operation has no such parameter
-
getCurrentOperationParameter
Get parameter node by its name- Parameters:
name- of desired parameternullable- whether the return value can be null if the operation has no parameter with the given name- Returns:
- node for the parameter of the given name, or
nullifnullableistrueand the operation has no parameter with the given name
-
getResourceRegistration
ImmutableManagementResourceRegistration getResourceRegistration()Get a read only view of the managed resource registration. The registration is relative to the operation address.This method validates that the caller has the necessary permissions to read the resource registration associated with the currently executing step.
- Returns:
- the model node registration
-
getResourceRegistrationForUpdate
ManagementResourceRegistration getResourceRegistrationForUpdate()Get a mutable view of the managed resource registration. The registration is relative to the operation address.This method validates that the caller has the necessary permissions to read and modify the resource registration associated with the currently executing step.
- Returns:
- the model node registration
-
getRootResourceRegistration
ImmutableManagementResourceRegistration getRootResourceRegistration()Get a read only view of the root managed resource registration.- Returns:
- the root resource registration
-
getServiceRegistry
org.jboss.msc.service.ServiceRegistry getServiceRegistry(boolean modify) throws UnsupportedOperationException Get the service registry. If the step is not a runtime operation handler step, an exception will be thrown. The returned registry must not be used to remove services, if an attempt is made to callServiceController.setMode(REMOVE)on aServiceControllerreturned from this registry anIllegalStateExceptionwill be thrown. To remove a service callremoveService(org.jboss.msc.service.ServiceName).Note: It is very important that the
modifyparameter accurately reflect whether the caller intends to make any modifications to any object reachable, directly or indirectly, from the returnedServiceRegistry. This includes modifying anyServiceController,Service,Service,Valueor any object reachable from a value.This method validates that the caller has the necessary permissions to read or modify the runtime state.
- Parameters:
modify-trueif the operation may be modifying any object reachable directly or indirectly from the returnedServiceRegistry,falseotherwise- Returns:
- the service registry
- Throws:
UnsupportedOperationException- if the calling step is not a runtime operation step
-
removeService
org.jboss.msc.service.ServiceController<?> removeService(org.jboss.msc.service.ServiceName name) throws UnsupportedOperationException Initiate a service removal. If the step is not a runtime operation handler step, an exception will be thrown. Any subsequent step which attempts to add a service with the same name will block until the service removal completes. The returned controller may be used to attempt to cancel a removal in progress.This method performs an authorization check to ensure that the caller has the necessary permissions to modify the runtime state.
- Parameters:
name- the service to remove- Returns:
- the controller of the service to be removed if service of given name exists; null otherwise
- Throws:
UnsupportedOperationException- if the calling step is not a runtime operation step
-
removeService
void removeService(org.jboss.msc.service.ServiceController<?> controller) throws UnsupportedOperationException Initiate a service removal. If the step is not a runtime operation handler step, an exception will be thrown. Any subsequent step which attempts to add a service with the same name will block until the service removal completes.This method performs an authorization check to ensure that the caller has the necessary permissions to modify the runtime state.
- Parameters:
controller- the service controller to remove- Throws:
UnsupportedOperationException- if the calling step is not a runtime operation step
-
getServiceTarget
@Deprecated(forRemoval=true) default org.jboss.msc.service.ServiceTarget getServiceTarget() throws UnsupportedOperationExceptionDeprecated, for removal: This API element is subject to removal in a future version.UsegetCapabilityServiceTarget()instead.Get the service target. If the step is not a runtime operation handler step, an exception will be thrown. The returned service target is limited such that only the service add methods are supported. If a service added to this target was removed by a prior operation step, the install will wait until the removal completes.- Returns:
- the service target
- Throws:
UnsupportedOperationException- if the calling step is not a runtime operation step
-
getCapabilityServiceTarget
Get the service target. If the step is not a runtime operation handler step, an exception will be thrown. The returned service target is limited such that only the service add methods are supported. If a service added to this target was removed by a prior operation step, the install will wait until the removal completes.- Returns:
- the service target
- Throws:
UnsupportedOperationException- if the calling step is not a runtime operation step
-
acquireControllerLock
void acquireControllerLock()Acquire the controllingModelController's exclusive lock. Holding this lock prevent other operations from mutating the model, themanagement resource registryor the runtime service registry until the lock is released. The lock is automatically released when theexecute methodof the handler that invoked this method returns.This method should be little used. The model controller's exclusive lock is acquired automatically when any of the operations in this interface that imply mutating the model, management resource registry or service registry are invoked. The only use for this method are special situations where an exclusive lock is needed but none of those methods will be invoked.
-
createResource
Create a new resource, relative to the executed operation address. Since only one operation may write at a time, this operation may block until other writing operations have completed.This method performs an authorization check to ensure that the caller has the necessary permissions to create the resource.
- Parameters:
address- the (possibly empty) address where the resource should be created. Address is relative to the address of the operation being executed- Returns:
- the created resource
- Throws:
OperationFailedRuntimeException- if a resource already exists at the given addressUnsupportedOperationException- if the calling operation is not a model operation
-
addResource
Add a new resource, at the executed operation address. Since only one operation may write at a time, this operation may block until other writing operations have completed.This method performs an authorization check to ensure that the caller has the necessary permissions to add the resource.
- Parameters:
address- the (possibly empty) address where the resource should be added. Address is relative to the address of the operation being executedtoAdd- the new resource- Throws:
OperationFailedRuntimeException- if a resource already exists at the given address, or if the resource does not support ordered childredUnsupportedOperationException- if the calling operation is not a model operation
-
addResource
Add a new resource, at to the executed operation address. Since only one operation may write at a time, this operation may block until other writing operations have completed.This method performs an authorization check to ensure that the caller has the necessary permissions to add the resource.
- Parameters:
address- the (possibly empty) address where the resource should be added. Address is relative to the address of the operation being executedindex- the index of the resource to be created in the parent resources children of this typetoAdd- the new resource- Throws:
OperationFailedRuntimeException- if a resource already exists at the given addressUnsupportedOperationException- if the calling operation is not a model operation
-
readResource
Get the resource for read only operations, relative to the executed operation address. Reads never block. If a write action was previously performed, the value read will be from an uncommitted copy of the management model.This method performs an authorization check to ensure that the caller has the necessary permissions to add the resource.
Note: By default the returned resource is read-only copy of the entire sub-model. In case this is not required use
readResource(PathAddress, boolean)instead.- Parameters:
relativeAddress- the (possibly empty) address where the resource should be added. The address is relative to the address of the operation being executed- Returns:
- the resource
-
readResource
Get the resource for read only operations, relative to the executed operation address. Reads never block. If a write action was previously performed, the value read will be from an uncommitted copy of the the management model.This method performs an authorization check to ensure that the caller has the necessary permissions to add the resource.
- Parameters:
relativeAddress- the (possibly empty) address where the resource should be added. The address is relative to the address of the operation being executedrecursive- whether the model should be read recursively or not- Returns:
- the resource
-
readResourceFromRoot
Read an addressable resource from the root of the model. Reads never block. If a write action was previously performed, the value read will be from an uncommitted copy of the management model.This method performs an authorization check to ensure that the caller has the necessary permissions to read the resource. Note: By default the returned resource is read-only copy of the entire sub-model. In case the entire sub-model is not required use
readResourceFromRoot(PathAddress, boolean)instead.- Parameters:
address- the (possibly empty) address- Returns:
- a read-only reference from the model
-
readResourceFromRoot
Read an addressable resource from the root of the model. Reads never block. If a write action was previously performed, the value read will be from an uncommitted copy of the management model.Use the
recursiveparameter to avoid the expense of making read-only copies of large portions of the resource tree. Ifrecursiveisfalse, the returned resource will only have placeholder resources for immediate children. Those placeholder resources will return an emptymodeland will not themselves have any children. Their presence, however, allows the caller to see what immediate children exist under the target resource.This method performs an authorization check to ensure that the caller has the necessary permissions to read the resource.
- Parameters:
address- the (possibly empty) addressrecursive- whether the model should be read recursively or not- Returns:
- a read-only reference from the model
-
readResourceForUpdate
Get an addressable resource for update operations. Since only one operation may write at a time, this operation may block until other writing operations have completed.This method performs an authorization check to ensure that the caller has the necessary permissions to read and modify the resource.
- Parameters:
relativeAddress- the (possibly empty) address where the resource should be added. The address is relative to the address of the operation being executed- Returns:
- the resource
-
removeResource
Remove a resource relative to the executed operation address. Since only one operation may write at a time, this operation may block until other writing operations have completed.This method performs an authorization check to ensure that the caller has the necessary permissions to remove the resource.
- Parameters:
relativeAddress- the (possibly empty) address where the resource should be removed. The address is relative to the address of the operation being executed- Returns:
- the old value of the node
- Throws:
UnsupportedOperationException- if the calling operation is not a model operation
-
getOriginalRootResource
Resource getOriginalRootResource()Get a read-only reference of the entire management model BEFORE any changes were made by this context. The structure of the returned model may depend on the context type (domain vs. server).- Returns:
- the read-only original resource
-
isModelAffected
boolean isModelAffected()Determine whether the model has thus far been affected by this operation.- Returns:
trueif the model was affected,falseotherwise
-
isResourceRegistryAffected
boolean isResourceRegistryAffected()Determine whether themanagement resource registryhas thus far been affected by this operation.- Returns:
trueif the management resource registry was affected,falseotherwise
-
isRuntimeAffected
boolean isRuntimeAffected()Determine whether the runtime container has thus far been affected by this operation.- Returns:
trueif the container was affected,falseotherwise
-
getCurrentStage
OperationContext.Stage getCurrentStage()Get the current stage of execution.- Returns:
- the current stage
-
report
Send a message to the client. Valid only during this operation.- Parameters:
severity- the message severitymessage- the message
-
markResourceRestarted
Marks a resource to indicate that it's backing service(s) will be restarted. This is to ensure that a restart only occurs once, even if there are multiple updates. When true is returned the caller has "acquired" the mark and should proceed with the restart, when false, the caller should take no additional action. The passed owner is compared by instance when a call torevertReloadRequired(). This is to ensure that only the "owner" will be successful in reverting the mark.- Parameters:
resource- the resource that will be restartedowner- the instance representing ownership of the mark- Returns:
- true if the mark was required and the service should be restarted, false if no action should be taken.
-
revertResourceRestarted
Removes the restarted marking on the specified resource, provided the passed owner is the one originally used to obtain the mark. The purpose of this method is to facilitate rollback processing. Only the "owner" of the mark should be the one to revert the service to a previous state (once again restarting it).When true is returned, the caller must take the required corrective action by restarting the resource, when false is returned the caller should take no additional action. The passed owner is compared by instance to the one provided inmarkResourceRestarted(PathAddress, Object)- Parameters:
resource- the resource being revertedowner- the owner of the mark for the resource- Returns:
- true if the caller owns the mark and the service should be restored by restarting false if no action should be taken.
-
resolveExpressions
org.jboss.dmr.ModelNode resolveExpressions(org.jboss.dmr.ModelNode node) throws OperationFailedException Resolves any expressions passed in the ModelNode.- Specified by:
resolveExpressionsin interfaceExpressionResolver- Parameters:
node- the ModelNode containing expressions.- Returns:
- a copy of the node with expressions resolved
- Throws:
OperationFailedException- if there is a value of typeModelType.EXPRESSIONin the node tree and there is no system property or environment variable that matches the expression, or if a security manager exists and itscheckPermissionmethod doesn't allow access to the relevant system property or environment variable
-
getAttachment
Retrieves an object that has been attached to this context.- Type Parameters:
T- the value type of the attachment.- Parameters:
key- the key to the attachment.- Returns:
- the attachment if found otherwise
null.
-
attach
Attaches an arbitrary object to this context.- Type Parameters:
T- the value type of the attachment.- Parameters:
key- they attachment key used to ensure uniqueness and used for retrieval of the value.value- the value to store.- Returns:
- the previous value associated with the key or
nullif there was no previous value.
-
attachIfAbsent
Attaches an arbitrary object to this context only if the object was not already attached. If a value has already been attached with the key provided, the current value associated with the key is returned.- Type Parameters:
T- the value type of the attachment.- Parameters:
key- they attachment key used to ensure uniqueness and used for retrieval of the value.value- the value to store.- Returns:
- the previous value associated with the key or
nullif there was no previous value.
-
detach
Detaches or removes the value from this context.- Type Parameters:
T- the value type of the attachment.- Parameters:
key- the key to the attachment.- Returns:
- the attachment if found otherwise
null.
-
authorize
Check for authorization of the given operation.- Parameters:
operation- the operation. Cannot benull- Returns:
- the authorization result
-
authorize
Check for authorization of the given effects for the given operation.- Parameters:
operation- the operation. Cannot benulleffects- the relevant effects. If empty, all effects associated with the operation are tested.- Returns:
- the authorization result
-
authorizeResource
Check for authorization for the resource associated with the currently executing operation step and, optionally, its individual attributes- Parameters:
attributes-trueif the result should include attribute authorizationsisDefaultResource-trueif- Returns:
- the resource authorization
-
authorize
AuthorizationResult authorize(org.jboss.dmr.ModelNode operation, String attribute, org.jboss.dmr.ModelNode currentValue) Check for authorization to read or modify an attribute, checking all effects of the given operation- Parameters:
operation- the operation that will read or modifyattribute- the attribute namecurrentValue- the current value of the attribute- Returns:
- the authorization result
-
authorize
AuthorizationResult authorize(org.jboss.dmr.ModelNode operation, String attribute, org.jboss.dmr.ModelNode currentValue, Set<Action.ActionEffect> effects) Check for authorization to read or modify an attribute, limiting the check to the given effects of the operation- Parameters:
operation- the operation that will read or modifyattribute- the attribute namecurrentValue- the current value of the attributeeffects- the effects to check, or, if empty, all effects- Returns:
- the authorization result
-
authorizeOperation
Check for authorization to execute an operation.- Parameters:
operation- the operation. Cannot benull- Returns:
- the authorization result
-
getSecurityIdentity
org.wildfly.security.auth.server.SecurityIdentity getSecurityIdentity()Obtain theSecurityIdentityfor the current request.- Returns:
- The current
SecurityIdentity.
-
emit
Emit aNotification.- Parameters:
notification- the notification to emit
-
getCallEnvironment
Environment getCallEnvironment()Gets the caller environment for the current request.- Returns:
- the call environment
-
registerCapability
Registers a capability with the system. Anyrequirementsassociated with the capability will be recorded as requirements.- Parameters:
capability- the capability. Cannot benull- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODEL
-
registerAdditionalCapabilityRequirement
Registers an additional hard requirement a capability has beyond what it was aware of whencapabilitywas passed toregisterCapability(org.jboss.as.controller.capability.RuntimeCapability). Used for cases where a capability optionally depends on another capability, and whether or not that requirement is needed is not known when the capability is first registered.This method should be used in preference to
requireOptionalCapability(String, String, String)when, based on its own configuration, the caller knows inOperationContext.Stage.MODELthat the optional capability is actually required in the current process.- Parameters:
required- the name of the required capability. Cannot benulldependent- the name of the capability that requires the other capability. Cannot benullattribute- the name of the attribute that triggered this requirement, ornullif no single attribute was responsible- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODELor ifcapabilityis not registered
-
hasOptionalCapability
Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the name of the requested capability. Cannot benulldependent- the name of the capability that requires the other capability. Cannot benullattribute- the name of the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(String requested, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the base name of the requested capability. Cannot benulldependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(String requested, String[] requestedSegments, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the base name of the requested capability. Cannot benullrequestedSegments- the dynamic segments of the requested capability. Cannot benulldependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(NullaryServiceDescriptor<?> requested, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the base name of the requested capability. Cannot benulldependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(UnaryServiceDescriptor<?> requested, String name, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the service descriptor of the requested capability. Cannot benullname- the dynamic name segment of the requested capability.dependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(BinaryServiceDescriptor<?> requested, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the service descriptor of the requested capability. Cannot benullparent- the first dynamic name segment of the requested capability.child- the second dynamic name segment of the requested capability.dependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(TernaryServiceDescriptor<?> requested, String grandparent, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the service descriptor of the requested capability. Cannot benullgrandparent- the first dynamic name segment of the requested capability.parent- the second dynamic name segment of the requested capability.child- the third dynamic name segment of the requested capability.dependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
hasOptionalCapability
default boolean hasOptionalCapability(QuaternaryServiceDescriptor<?> requested, String greatGrandparent, String grandparent, String parent, String child, RuntimeCapability<?> dependent, AttributeDefinition attribute) Checks whether one of a capability's optional and runtime-only requirements is present. Only for use in cases where thedependentcapability's persistent configuration does not mandate the presence of therequestedcapability, but the capability will use it at runtime if it is present.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)when the caller's own configuration doesn't impose a hard requirement for therequestedcapability, but, if it is present it will be used. Once the caller declares an intent to use the capability by invoking this method and getting atrueresponse, thereafter the system is aware thatdependentis actually usingrequested, but will not prevent configuration changes that makerequestedunavailable.- Parameters:
requested- the service descriptor of the requested capability. Cannot benullgreatGrandparent- the first dynamic name segment of the requested capability.grandparent- the second dynamic name segment of the requested capability.parent- the third dynamic name segment of the requested capability.child- the fourth dynamic name segment of the requested capability.dependent- the runtime capability that requires the other capability. Cannot benullattribute- the attribute that triggered this requirement, ornullif no single attribute was responsible- Returns:
trueif the requested capability is present;falseif not. Iftrue, hereafterdependent's requirement forrequestedwill not be treated as optional.- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.
-
requireOptionalCapability
void requireOptionalCapability(String required, String dependent, String attribute) throws OperationFailedException Requests that one of a capability's optional requirements hereafter be treated as required, until the process is stopped or reloaded. This request will only be granted if the required capability is already present; otherwise anOperationFailedExceptionwill be thrown.This method should be used in preference to
registerAdditionalCapabilityRequirement(String, String, String)only if the caller is not sure whether the capability is required untilOperationContext.Stage.RUNTIME. Not knowing whether a capability is required until stage RUNTIME is an anti-pattern, so use of this method is strongly discouraged. It only exists to avoid the need to break backward compatibility by removing support for expressions from certain attributes.- Parameters:
required- the name of the required capability. Cannot benulldependent- the name of the capability that requires the other capability. Cannot benullattribute- the name of the attribute that triggered this requirement, ornullif no single attribute was responsible- Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.OperationFailedException- if the requested capability is not available
-
deregisterCapabilityRequirement
Record that a previously registered requirement for a capability will no longer exist.Semantics with "reload-required" and "restart-required": Deregistering a capability requirement does not obligate the caller to cease using a
previously obtainedreference to that capability'sruntime API. But, if the caller will not cease using the capability, it must put the process inreload-requiredorrestart-requiredstate. This will reflect the fact that the model says the capability is not required, but in the runtime it still is.- Parameters:
required- the name of the no longer required capabilitydependent- the name of the capability that no longer has the requirement- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODEL
-
deregisterCapabilityRequirement
Record that a previously registered requirement for a capability will no longer exist.Semantics with "reload-required" and "restart-required": Deregistering a capability requirement does not obligate the caller to cease using a
previously obtainedreference to that capability'sruntime API. But, if the caller will not cease using the capability, it must put the process inreload-requiredorrestart-requiredstate. This will reflect the fact that the model says the capability is not required, but in the runtime it still is.- Parameters:
required- the name of the no longer required capabilitydependent- the name of the capability that no longer has the requirementattribute- the name of the attribute that references to the no longer required capability, ornullif there is if no single attribute referring to the required capability.- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODEL
-
deregisterCapability
Record that a previously registered capability will no longer be available. Invoking this operation will also automaticallyderegister any requirementsthat are associated with this capability, including optional ones.Semantics with "reload-required" and "restart-required": Deregistering a capability does not eliminate the obligation to other capabilities that have previously depended upon it to support them by providing expected runtime services. It does require that those other capabilities also
deregister their requirementsas part of the same operation. Requiring that they do so ensures that the management model is consistent. However, those other capabilities may simply put the process inreload-requiredorrestart-requiredstate and then continue to use the existing services. So, an operation that invokes this method should also always put the process intoreload-requiredorrestart-requiredstate. This will reflect the fact that the model says the capability is not present, but in the runtime it still is.- Parameters:
capabilityName- the name of the capability- Throws:
IllegalStateException- ifthe current stageis notOperationContext.Stage.MODEL
-
getCapabilityRuntimeAPI
Gets the runtime API associated with a given capability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityName- the name of the capability. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- the runtime API. Will not return
null - Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.IllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getCapabilityRuntimeAPI
Gets the runtime API associated with a givendynamically namedcapability, if there is one.- Type Parameters:
T- the java type that exposes the API- Parameters:
capabilityBaseName- the base name of the capability. Cannot benulldynamicPart- the dynamic part of the capability name. Cannot benullapiType- class of the java type that exposes the API. Cannot benull- Returns:
- the runtime API. Will not return
null - Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.IllegalArgumentException- if the capability does not provide a runtime APIClassCastException- if the runtime API exposed by the capability cannot be cast to type {code T}
-
getCapabilityServiceName
org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityName, Class<?> serviceType) Gets the name of a service associated with a given capability, if there is one.- Parameters:
capabilityName- the name of the capability. Cannot benullserviceType- class of the java type that exposes by the service. Can be null.- Returns:
- the name of the service. Will not return
null - Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.IllegalArgumentException- ifserviceTypeisnullor the capability does not provide a service of typeserviceType
-
getCapabilityServiceName
org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityBaseName, String dynamicPart, Class<?> serviceType) Gets the name of a service associated with a givendynamically namedcapability, if there is one.- Parameters:
capabilityBaseName- the base name of the capability. Cannot benulldynamicPart- the dynamic part of the capability name. Cannot benullserviceType- class of the java type that exposes by the service. Can be null.- Returns:
- the name of the service. Will not return
null - Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.IllegalArgumentException- ifserviceTypeisnullor the capability does not provide a service of typeserviceType
-
getCapabilityServiceName
org.jboss.msc.service.ServiceName getCapabilityServiceName(String capabilityBaseName, Class<?> serviceType, String... dynamicParts) Gets the name of a service associated with a givendynamically namedcapability, if there is one.- Parameters:
capabilityBaseName- the base name of the capability. Cannot benullserviceType- class of the java type that exposes by the service. Can be null.dynamicParts- the dynamic parts of the capability name. Cannot benull- Returns:
- the name of the service. Will not return
null - Throws:
IllegalStateException- ifthe current stageisOperationContext.Stage.MODEL. The complete set of capabilities is not known until the end of the model stage.IllegalArgumentException- ifserviceTypeisnullor the capability does not provide a service of typeserviceType
-
getCapabilityServiceSupport
CapabilityServiceSupport getCapabilityServiceSupport()Gets a support object that allows service implementations installed from this context to integrate with capabilities.- Returns:
- the support object. Will not return
null* @throws java.lang.IllegalStateException ifthe current stageisOperationContext.Stage.MODEL. Service integration is not supported in the model stage.
-
isDefaultRequiresRuntime
boolean isDefaultRequiresRuntime()Whether normally this operation would require a runtime step. It returnstrue in the following cases- The process is a server, and it is running in NORMAL (i.e. not admin-only) mode.
- The process is a HC, and the address of the operation is a subsystem in the host model or a child thereof
-
getStability
Description copied from interface:FeatureRegistryReturns the feature stability supported by this feature registry.- Specified by:
getStabilityin interfaceFeatureRegistry- Returns:
- a stability level
-
getCapabilityServiceName
default <T> org.jboss.msc.service.ServiceName getCapabilityServiceName(NullaryServiceDescriptor<T> descriptor) Description copied from interface:CapabilityServiceDescriptorResolverResolves theServiceNameof the capability described by the specified descriptor.- Specified by:
getCapabilityServiceNamein interfaceCapabilityServiceDescriptorResolver- Type Parameters:
T- the service value type- Parameters:
descriptor- the capability service descriptor- Returns:
- the service name
-
getCapabilityServiceName
default <T> org.jboss.msc.service.ServiceName getCapabilityServiceName(UnaryServiceDescriptor<T> descriptor, String name) Description copied from interface:CapabilityServiceDescriptorResolverResolves theServiceNameof the capability described by the specified descriptor using the specified reference name.- Specified by:
getCapabilityServiceNamein interfaceCapabilityServiceDescriptorResolver- Type Parameters:
T- the service value type- Parameters:
descriptor- the capability service descriptorname- the dynamic name component- Returns:
- the service name
-
getCapabilityServiceName
default <T> org.jboss.msc.service.ServiceName getCapabilityServiceName(BinaryServiceDescriptor<T> descriptor, String parent, String child) Description copied from interface:CapabilityServiceDescriptorResolverResolves theServiceNameof the capability described by the specified descriptor using the specified reference names.- Specified by:
getCapabilityServiceNamein interfaceCapabilityServiceDescriptorResolver- Type Parameters:
T- the service value type- Parameters:
descriptor- the capability service descriptorparent- the first dynamic name componentchild- the second dynamic name component- Returns:
- the service name
-
getCapabilityServiceName
default <T> org.jboss.msc.service.ServiceName getCapabilityServiceName(TernaryServiceDescriptor<T> descriptor, String grandparent, String parent, String child) Description copied from interface:CapabilityServiceDescriptorResolverResolves theServiceNameof the capability described by the specified descriptor using the specified reference names.- Specified by:
getCapabilityServiceNamein interfaceCapabilityServiceDescriptorResolver- Type Parameters:
T- the service value type- Parameters:
descriptor- the capability service descriptorgrandparent- the first dynamic name componentparent- the second dynamic name componentchild- the third dynamic name component- Returns:
- the service name
-
getCapabilityServiceName
default <T> org.jboss.msc.service.ServiceName getCapabilityServiceName(QuaternaryServiceDescriptor<T> descriptor, String greatGrandparent, String grandparent, String parent, String child) Description copied from interface:CapabilityServiceDescriptorResolverResolves theServiceNameof the capability described by the specified descriptor using the specified reference names.- Specified by:
getCapabilityServiceNamein interfaceCapabilityServiceDescriptorResolver- Type Parameters:
T- the service value type- Parameters:
descriptor- the capability service descriptorgreatGrandparent- the first dynamic name componentgrandparent- the second dynamic name componentparent- the third dynamic name componentchild- the fourth dynamic name component- Returns:
- the service name
-
getCapabilityServiceTarget()instead.