Class Database
java.lang.Object
de.turnertech.frederick.services.PersistanceProvider
de.turnertech.frederick.persistance.file.Database
-
Field Summary
Fields inherited from class de.turnertech.frederick.services.PersistanceProvider
CURRENT_DEPLOYMENT_FILE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseDeployment(String name) voiddeleteDeployment(String name) Always returns a deployment! If no deployment is loaded, then it will load or create one.getDeployment(String name) Return the sorted set of files stored in the deployments folder of the data store.getPathToDeployment(String name) Returns the path to a deployment with the specified name.booleanisDeploymentExists(String name) Simple check for if a deployment with the given name exists on disk.voidvoidManages a save timer which triggers in 5 seconds.Methods inherited from class de.turnertech.frederick.services.PersistanceProvider
getInstance
-
Constructor Details
-
Database
public Database()The constructor initialises the data storage folder.
-
-
Method Details
-
getDeploymentFiles
Return the sorted set of files stored in the deployments folder of the data store. This will not cause the files to be loaded into memory.- Specified by:
getDeploymentFilesin classPersistanceProvider- Returns:
- Never null, empty list on exception.
-
getCurrentDeployment
Always returns a deployment! If no deployment is loaded, then it will load or create one.- Specified by:
getCurrentDeploymentin classPersistanceProvider- Returns:
- The active deployment.
-
saveCurrentDeployment
public void saveCurrentDeployment()- Specified by:
saveCurrentDeploymentin classPersistanceProvider
-
saveCurrentDeploymentInFiveSeconds
public void saveCurrentDeploymentInFiveSeconds()Manages a save timer which triggers in 5 seconds. Every call to this function resets the timer. This is usefull for enabling autosave functionality for example when saving after text bodies are entered.- Specified by:
saveCurrentDeploymentInFiveSecondsin classPersistanceProvider
-
getPathToDeployment
Returns the path to a deployment with the specified name. Note, that the deployment does not need to exist! This function is rather a helper function for concatenating the desired deployment name to the store root folder path.- Specified by:
getPathToDeploymentin classPersistanceProvider- Parameters:
name- The name of the deployment to get a path for.- Returns:
Optional.empty()on failure, or a valid theoreticalPath.
-
getDeployment
-
isDeploymentExists
Simple check for if a deployment with the given name exists on disk.- Specified by:
isDeploymentExistsin classPersistanceProvider- Parameters:
name- The name of a deployment to check for.- Returns:
- Whether the deployment exists or not.
-
closeDeployment
- Specified by:
closeDeploymentin classPersistanceProvider
-
deleteDeployment
- Specified by:
deleteDeploymentin classPersistanceProvider
-