Package adams.flow.core
Class RestorableActorHelper
- java.lang.Object
-
- adams.flow.core.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 Summary
Constructors Constructor Description RestorableActorHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canRead(PlaceholderFile input)
Checks whether the restoration file can be read.static String
read(PlaceholderFile input, Properties props)
Loads the state as properties from the specified file.static String
read(PlaceholderFile input, RestorableActor actor, String[] properties)
Reads the specified state information from the specified input file.static String
write(Properties props, PlaceholderFile output)
Stores the state properties in the specified file.static String
write(RestorableActor actor, String[] properties, PlaceholderFile output)
Stores the specified state information in the specified output file.
-
-
-
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 fileprops
- 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 storeoutput
- 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 fromactor
- the actor to obtain the restore information fromproperties
- 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 fromproperties
- the bean properties to obtain and storeoutput
- the output file to store the information in- Returns:
- null if successful, otherwise error message
-
-