org.apache.derby.impl.io.vfmem
Class DataStore
- java.lang.Object
-
- org.apache.derby.impl.io.vfmem.DataStore
-
public final class DataStore extends java.lang.ObjectA virtual data store, keeping track of all the virtual files existing and offering a set of high-level operations on virtual files.A newly created data store doesn't contain a single existing directory.
-
-
Constructor Summary
Constructors Constructor and Description DataStore(java.lang.String databaseName)Creates a new data store.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleancreateAllParents(java.lang.String path)Creates all the parents of the specified path.DataStoreEntrycreateEntry(java.lang.String iPath, boolean isDir)Creates a new entry in the data store.booleandeleteAll(java.lang.String iPath)Deletes the specified entry and all its children.booleandeleteEntry(java.lang.String iPath)Deletes the specified entry.java.lang.StringgetDatabaseName()Returns the database name, which is expected to equal the path of the service root.DataStoreEntrygetEntry(java.lang.String iPath)Returns the entry with the specified path.longgetTempFileCounter()Returns an identifier for a temporary file.java.lang.String[]listChildren(java.lang.String iPath)Lists the childen of the specified path.booleanmove(StorageFile currentFile, StorageFile newFile)Moves / renames a file.voidpurge()Purges the database and releases all files associated with it.booleanscheduledForDeletion()Tells if this data store is scheduled for deletion.
-
-
-
Constructor Detail
-
DataStore
public DataStore(java.lang.String databaseName)
Creates a new data store.- Parameters:
databaseName- the name of the assoicated database, expected to be the absolute path of the service root.
-
-
Method Detail
-
getDatabaseName
public java.lang.String getDatabaseName()
Returns the database name, which is expected to equal the path of the service root.- Returns:
- The database name.
-
scheduledForDeletion
public boolean scheduledForDeletion()
Tells if this data store is scheduled for deletion.- Returns:
trueif the store is awaiting deletion,falseotherwise.
-
createEntry
public DataStoreEntry createEntry(java.lang.String iPath, boolean isDir)
Creates a new entry in the data store.This method returns
nullif the path already exists, if one of the parent directories doesn't exist, or if one of the parents is a file instead of a directory.- Parameters:
iPath- the path of the entryisDir- tells if the new entry shall be directory or a file- Returns:
- A
DataStoreEntry-instance if the entry was successfully created,nullotherwise
-
createAllParents
public boolean createAllParents(java.lang.String path)
Creates all the parents of the specified path.- Returns:
trueif all parents either already existed as directories or were created,falseotherwise
-
deleteEntry
public boolean deleteEntry(java.lang.String iPath)
Deletes the specified entry.If the specified entry is a directory, it is only deleted if it is empty. Read-only entries are deleted.
- Parameters:
iPath- path of the entry to delete- Returns:
trueif the entry was deleted,falseotherwise.
-
getEntry
public DataStoreEntry getEntry(java.lang.String iPath)
Returns the entry with the specified path.- Parameters:
iPath- path of the entry to fetch- Returns:
nullif the entry doesn't exist, theDataStoreEntry-object otherwise.
-
deleteAll
public boolean deleteAll(java.lang.String iPath)
Deletes the specified entry and all its children.- Parameters:
iPath- the root entry- Returns:
trueif the entry and all its children were deleted,falseif the root doesn't exist.
-
listChildren
public java.lang.String[] listChildren(java.lang.String iPath)
Lists the childen of the specified path.- Parameters:
iPath- the directory to list the children of- Returns:
- An array with the relative paths of the children.
-
move
public boolean move(StorageFile currentFile, StorageFile newFile)
Moves / renames a file.- Parameters:
currentFile- the current filenewFile- the new file- Returns:
trueif the file was moved,falseif the new file already existed or the existing file doesn't exist.
-
purge
public void purge()
Purges the database and releases all files associated with it.
-
getTempFileCounter
public long getTempFileCounter()
Returns an identifier for a temporary file.- Returns:
- An integer uniquely identifying a temporary file.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG