Class AbstractFileStorageEngine<SC extends AbstractFileStorageConfiguration>
- java.lang.Object
-
- com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine<SC>
-
- com.datumbox.framework.common.storage.abstracts.AbstractFileStorageEngine<SC>
-
- Type Parameters:
SC-
- All Implemented Interfaces:
StorageEngine,AutoCloseable
public abstract class AbstractFileStorageEngine<SC extends AbstractFileStorageConfiguration> extends AbstractStorageEngine<SC>
Parent class of all File-based Storage Engines.- Author:
- Vasilis Vryniotis
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.datumbox.framework.common.storage.interfaces.StorageEngine
StorageEngine.MapType, StorageEngine.StorageHint
-
-
Field Summary
-
Fields inherited from class com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine
logger, storageConfiguration, storageName
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFileStorageEngine(String storageName, SC storageConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancreateDirectoryIfNotExists(Path path)Creates the directory in the target location if it does not exist.protected booleandeleteDirectory(Path path, boolean cleanParent)Deletes a directory and optionally removes the parent directory if it becomes empty.protected booleandeleteIfExistsRecursively(Path path)Deletes the file or directory recursively if it exists.protected StringgetDirectory()Returns the location of the directory from the configuration or the temporary directory if not defined.protected PathgetRootPath(String storageName)Returns the root path of the storage.protected booleanmoveDirectory(Path src, Path target)Moves a directory in the target location.-
Methods inherited from class com.datumbox.framework.common.storage.abstracts.AbstractStorageEngine
assertConnectionOpen, close, getStorageName, isClosed, nonSerializableBigMaps, postDeserializer, postSerializer, preSerializer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.datumbox.framework.common.storage.interfaces.StorageEngine
clear, dropBigMap, existsObject, getBigMap, loadObject, rename, saveObject
-
-
-
-
Constructor Detail
-
AbstractFileStorageEngine
protected AbstractFileStorageEngine(String storageName, SC storageConfiguration)
- Parameters:
storageName-storageConfiguration-- See Also:
AbstractStorageEngine(String, StorageConfiguration)
-
-
Method Detail
-
getDirectory
protected String getDirectory()
Returns the location of the directory from the configuration or the temporary directory if not defined.- Returns:
-
getRootPath
protected Path getRootPath(String storageName)
Returns the root path of the storage.- Parameters:
storageName-- Returns:
-
deleteIfExistsRecursively
protected boolean deleteIfExistsRecursively(Path path) throws IOException
Deletes the file or directory recursively if it exists.- Parameters:
path-- Returns:
- Throws:
IOException
-
deleteDirectory
protected boolean deleteDirectory(Path path, boolean cleanParent) throws IOException
Deletes a directory and optionally removes the parent directory if it becomes empty.- Parameters:
path-cleanParent-- Returns:
- Throws:
IOException
-
moveDirectory
protected boolean moveDirectory(Path src, Path target) throws IOException
Moves a directory in the target location.- Parameters:
src-target-- Returns:
- Throws:
IOException
-
createDirectoryIfNotExists
protected boolean createDirectoryIfNotExists(Path path) throws IOException
Creates the directory in the target location if it does not exist.- Parameters:
path-- Returns:
- Throws:
IOException
-
-