Package net.sodacan.core.persist
Class AbstractPersister
java.lang.Object
net.sodacan.core.persist.AbstractPersister
- All Implemented Interfaces:
Persister
- Direct Known Subclasses:
FilePersister
,MemoryPersister
,RocksPersister
This abstract class provides two services to concrete subclasses:
First, it stores the configuration and actorId of the Actor instance for which it applies.
Second, it provides a consistent file naming service in the case of a persister that uses
disk file(s). A Subclass is not required to use the naming service(s).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected File
Files are organized by ActorGroup, type of actor, and actor id.protected File
This method return a file handle to folder assigned to the specific actorId.protected File
This method return a file handle to the ActorType directory within the specified ActorGroup directory within the specified Host directory within the specified root folder creating directories that do not exist.
-
Constructor Details
-
AbstractPersister
-
-
Method Details
-
getConfig
-
getActorId
-
makeFile
Files are organized by ActorGroup, type of actor, and actor id. The root folder is assumes to exist. This method creates the entire hierarchy of folders as needed and returns a file handle to the file.- Returns:
- A File handle
-
makeFolder
This method return a file handle to folder assigned to the specific actorId. This method is used when the persister requires a folder into which possibly multiple files will be placed. This method creates the entire hierarchy of folders as needed and returns a file handle to the target folder.- Returns:
- A File handle to the folder created
-
makeTypeFolder
This method return a file handle to the ActorType directory within the specified ActorGroup directory within the specified Host directory within the specified root folder creating directories that do not exist. This method is already called by the makeFolder and makeFile methods. Therefore, it should normally not be called directly by a persister but might be overriden to provide a custom directory structure.- Returns:
- A File handle to the ActorType directory
-