Class MultistepUtil


  • public final class MultistepUtil
    extends Object
    Utility code related to multistep operations.
    Author:
    Brian Stansberry
    • Method Detail

      • recordOperationSteps

        public static <T> void recordOperationSteps​(OperationContext context,
                                                    Map<T,​org.jboss.dmr.ModelNode> operations,
                                                    Map<T,​org.jboss.dmr.ModelNode> responses)
                                             throws OperationFailedException
        Adds a step to the given OperationContext for each operation included in the given map, either using for each step a response node provided in the responses map, or if the responses map is empty, creating them and storing them in the responses map. The response objects are not tied into the overall response to the operation associated with context. It is the responsibility of the caller to do that.

        NOTE: The given operations map must provide an iterator over its entry set that provides the entries in the order in which the operations should execute. A LinkedHashMap is the typical choice.

        Type Parameters:
        T - the type of the keys in the maps
        Parameters:
        context - the OperationContext. Cannot be null
        operations - the operations, each value of which must be a proper OBJECT type model node with a structure describing an operation.
        responses - a map of the response nodes, the keys for which match the keys in the operations param. Cannot be null but may be empty in which case this method will create the response nodes and store them in this map.
        Throws:
        OperationFailedException - if there is a problem registering a step for any of the operations
      • recordOperationSteps

        public static <T> void recordOperationSteps​(OperationContext context,
                                                    Map<T,​org.jboss.dmr.ModelNode> operations,
                                                    Map<T,​org.jboss.dmr.ModelNode> responses,
                                                    MultistepUtil.OperationHandlerResolver handlerResolver,
                                                    boolean adjustAddresses,
                                                    boolean rejectPrivateOperations)
                                             throws OperationFailedException
        This is a specialized version of the other variant of this method that allows a pluggable strategy for resolving the OperationStepHandler to use for the added steps. It is not expected to be needed by users outside the WildFly Core kernel.
        Type Parameters:
        T - the type of the keys in the maps
        Parameters:
        context - the OperationContext. Cannot be null
        operations - the operations, each value of which must be a proper OBJECT type model node with a structure describing an operation.
        responses - a map of the response nodes, the keys for which match the keys in the operations param. Cannot be null but may be empty in which case this method will create the response nodes and store them in this map.
        handlerResolver - an object that can provide the OperationStepHandler to use for the operation
        adjustAddresses - true if the address of each operation should be adjusted to become a child of the context's current address
        rejectPrivateOperations - true if an OperationFailedException should be thrown if the OperationEntry for any of the operations is OperationEntry.EntryType.PRIVATE
        Throws:
        OperationFailedException - if there is a problem registering a step for any of the operations