A newly created data store doesn't contain a single existing directory.
| Modifier and Type | Field and Description |
|---|---|
| private final String | databaseName
The name of the database this store serves, expected to be the absolute path of the service root (i.e. /tmp/myDB if the database myDB is created in /tmp). |
| private boolean | deleteMe
Tells if this store is scheduled for deletion. |
| private static final String[] | EMPTY_STR_ARR
Constant for the empty String array. |
| private final Map | files
The files exsiting in the store. |
| private final Object | LOCK
Lock object for the file map. |
| private static final char | SEP
The path separator used. |
| private final Object | TMP_COUNTER_LOCK
Lock object for the temporary file counter. |
| private long | tmpFileCounter
Counter used to generate unique temporary file names. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | Returns: true if all children of the root path were deleted,
false otherwise.the normalized root path to start deleting from prefixPath)Deletes every child of the root path specified. |
| public boolean | Returns: true if all parents either already existed as directories
or were created, false otherwiseCreates all the parents of the specified path. |
| public DataStoreEntry | Returns: ADataStoreEntry-instance if the entry was successfully
created, null otherwisethe path of the entry iPath, boolean tells if the new entry shall be directory or a file isDir)Creates a new entry in the data store. |
| public boolean | |
| public boolean | Returns: true if the entry was deleted, false otherwise.path of the entry to delete iPath)Deletes the specified entry. |
| public String | Returns: The database name.Returns the database name, which is expected to equal the path of the service root. |
| public DataStoreEntry | |
| private String[] | Returns: A list of parents.the normalized path to create a parent list for path)Returns the list of parents for the specified path. |
| public long | Returns: An integer uniquely identifying a temporary file.Returns an identifier for a temporary file. |
| public String[] | Returns: An array with the relative paths of the children.the directory to list the children of iPath)Lists the childen of the specified path. |
| public boolean | Returns: true if the file was moved, false if the new
file already existed or the existing file doesn't exist.the current file currentFile, StorageFile the new file newFile)Moves / renames a file. |
| public void | |
| public boolean | Returns: true if the store is awaiting deletion,
false otherwise.Tells if this data store is scheduled for deletion. |
| databaseName | back to summary |
|---|---|
| private final String databaseName The name of the database this store serves, expected to be the absolute path of the service root (i.e. /tmp/myDB if the database myDB is created in /tmp). | |
| deleteMe | back to summary |
|---|---|
| private boolean deleteMe Tells if this store is scheduled for deletion. | |
| EMPTY_STR_ARR | back to summary |
|---|---|
| private static final String[] EMPTY_STR_ARR Constant for the empty String array. | |
| files | back to summary |
|---|---|
| private final Map<String, DataStoreEntry> files The files exsiting in the store. The initial size is set to the number of initial files of a Derby database, pluss a few more. | |
| LOCK | back to summary |
|---|---|
| private final Object LOCK Lock object for the file map. | |
| SEP | back to summary |
|---|---|
| private static final char SEP The path separator used. | |
| TMP_COUNTER_LOCK | back to summary |
|---|---|
| private final Object TMP_COUNTER_LOCK Lock object for the temporary file counter. | |
| tmpFileCounter | back to summary |
|---|---|
| private long tmpFileCounter Counter used to generate unique temporary file names. | |
| DataStore | back to summary |
|---|---|
| public DataStore(String databaseName) Creates a new data store.
| |
| _deleteAll | back to summary |
|---|---|
| private boolean _deleteAll(String prefixPath) Deletes every child of the root path specified. Note that the root itself must be removed outside of this method.
| |
| createAllParents | back to summary |
|---|---|
| public boolean createAllParents(String path) Creates all the parents of the specified path.
| |
| createEntry | back to summary |
|---|---|
| public DataStoreEntry createEntry(String iPath, boolean isDir) Creates a new entry in the data store.
This method returns
| |
| deleteAll | back to summary |
|---|---|
| public boolean deleteAll(String iPath) Deletes the specified entry and all its children.
| |
| deleteEntry | back to summary |
|---|---|
| public boolean deleteEntry(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.
| |
| getDatabaseName | back to summary |
|---|---|
| public String getDatabaseName() Returns the database name, which is expected to equal the path of the service root.
| |
| getEntry | back to summary |
|---|---|
| public DataStoreEntry getEntry(String iPath) Returns the entry with the specified path.
| |
| getParentList | back to summary |
|---|---|
| private String[] getParentList(String path) Returns the list of parents for the specified path. The lowest level parent is listed first in the list, so all absolute paths will have the root listed as the last element. | |
| getTempFileCounter | back to summary |
|---|---|
| public long getTempFileCounter() Returns an identifier for a temporary file.
| |
| listChildren | back to summary |
|---|---|
| public String[] listChildren(String iPath) Lists the childen of the specified path. | |
| move | back to summary |
|---|---|
| public boolean move(StorageFile currentFile, StorageFile newFile) Moves / renames a file.
| |
| purge | back to summary |
|---|---|
| public void purge() Purges the database and releases all files associated with it. | |
| scheduledForDeletion | back to summary |
|---|---|
| public boolean scheduledForDeletion() Tells if this data store is scheduled for deletion.
| |