Class EncapsulateActors


  • public class EncapsulateActors
    extends Object
    Helper class for encapsulating actor(s).
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • EncapsulateActors

        public EncapsulateActors()
    • Method Detail

      • getVariables

        public static Variables getVariables​(Actor context,
                                             VariableName[] vars)
        Extracts the specified variables and their values and returns the subset.
        Parameters:
        context - the flow context to get the current variables from
        vars - the variables to extract
        Returns:
        the subset
      • getStorage

        public static Storage getStorage​(Actor context,
                                         StorageName[] items)
        Extracts the specified storage items and returns the subset.
        Parameters:
        context - the flow context to get the current storage items from
        items - the items to extract
        Returns:
        the subset
      • createStorageName

        protected static StorageName createStorageName​(StorageName[] items,
                                                       String prefix)
        Generates a storage name, ensuring that it doesn't interfere with storage items to keep.
        Parameters:
        items - the storage items to keep
        prefix - the prefix to use
        Returns:
        the name for the input token
      • createInputStorageName

        public static StorageName createInputStorageName​(StorageName[] items)
        Generates a storage name for the input token, ensuring that it doesn't interfere with storage items to keep.
        Parameters:
        items - the storage items to keep
        Returns:
        the name for the input token
      • createOutputStorageName

        public static StorageName createOutputStorageName​(StorageName[] items)
        Generates a storage name for the output token, ensuring that it doesn't interfere with storage items to keep.
        Parameters:
        items - the storage items to keep
        Returns:
        the name for the output token
      • encapsulate

        public static EncapsulatedActorsContainer encapsulate​(Actor actor,
                                                              VariableName[] vars,
                                                              StorageName[] items)
        Encapsulates the actor as is.
        Parameters:
        actor - the actor to encapsulate
        vars - the variables to migrate
        items - the storage items to migrate
        Returns:
        the generated container
      • encapsulate

        public static EncapsulatedActorsContainer encapsulate​(Actor actor,
                                                              VariableName[] vars,
                                                              StorageName[] items,
                                                              Object input)
        Encapsulates the actor as is.
        Parameters:
        actor - the actor to encapsulate
        vars - the variables to migrate
        items - the storage items to migrate
        input - the input token, can be null
        Returns:
        the generated container
      • wrap

        public static EncapsulatedActorsContainer wrap​(Actor actor,
                                                       VariableName[] vars,
                                                       StorageName[] items)
        Wraps the actor to obtain a fully self-container flow.
        Parameters:
        actor - the actors to wrap
        vars - the variables to migrate
        items - the storage items to migrate
        Returns:
        the generated container
      • wrap

        public static EncapsulatedActorsContainer wrap​(Actor actor,
                                                       VariableName[] vars,
                                                       StorageName[] items,
                                                       Object input)
        Wraps the actor to obtain a fully self-container flow.
        Parameters:
        actor - the actor to wrap
        vars - the variables to migrate
        items - the storage items to migrate
        input - the input token payload, can be null; gets ignored if actor is a Flow actor
        Returns:
        the generated container