Class RestorableActorHelper


  • public class RestorableActorHelper
    extends Object
    Helper class for writing/reading restoration information (= actor state). Uses .props files for storing the data (Properties).
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Properties
    • Constructor Detail

      • RestorableActorHelper

        public RestorableActorHelper()
    • Method Detail

      • canRead

        public static boolean canRead​(PlaceholderFile input)
        Checks whether the restoration file can be read.
        Parameters:
        input - the file to check
        Returns:
        true if should be readable
      • read

        public static String read​(PlaceholderFile input,
                                  Properties props)
        Loads the state as properties from the specified file.
        Parameters:
        input - the state file
        props - for storing the properties
        Returns:
        null if successful, otherwise error message
      • write

        public static String write​(Properties props,
                                   PlaceholderFile output)
        Stores the state properties in the specified file.
        Parameters:
        props - the properties to store
        output - the output file
        Returns:
        null if successful, otherwise error message
      • read

        public static String read​(PlaceholderFile input,
                                  RestorableActor actor,
                                  String[] properties)
        Reads the specified state information from the specified input file.
        Parameters:
        input - the file to read the information from
        actor - the actor to obtain the restore information from
        properties - the bean properties to obtain and store
        Returns:
        null if successful, otherwise error message
      • write

        public static String write​(RestorableActor actor,
                                   String[] properties,
                                   PlaceholderFile output)
        Stores the specified state information in the specified output file.
        Parameters:
        actor - the actor to obtain the restore information from
        properties - the bean properties to obtain and store
        output - the output file to store the information in
        Returns:
        null if successful, otherwise error message