|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xnode.providers.AbstractXNodeStoreProvider
org.ceryle.xnode.providers.FileSystemProvider
public class FileSystemProvider
Implements the XNodeStoreProvider API for an XNodeStore, using the local file system as the storage. This can actually coexist with the BerkeleyDBProvider as it uses a 'db' directory within the default 'storage' directory as the root of the directory tree.
The XNode Implementation (the package org.ceryle.xnode.*, both its source code and documentation), are released under the Apache 2.0 License. For more details, check the LICENSE file contained with the distribution, or see The Ceryle Project for more information. It is distributed with no warranty.
| Field Summary | |
|---|---|
static String |
FILE_EXT
The file extension for stored files. |
| Fields inherited from class org.ceryle.xnode.providers.AbstractXNodeStoreProvider |
|---|
Filesep, m_homepath, m_storage, m_storagepath, m_xns, mh |
| Constructor Summary | |
|---|---|
FileSystemProvider()
|
|
| Method Summary | |
|---|---|
void |
closeDatabase(String did)
Close the Database backing the XNodeCollection having ID did. |
void |
deleteContent(String did,
String rid)
Permanently deletes the key/data pair (database record) matching the key String rid from the Database with ID did. |
void |
deleteDatabase(String did)
Remove the Database backing the XNodeCollection having ID did. |
String |
getContent(String did,
String rid)
The method that does the actual work of retrieving the contents in the record with key String rid (record ID) from the Database with ID did. |
int |
getContentSize(String did,
String rid)
Returns the record storage size of the document in the Database with ID did for the data matching the key String rid (record ID). |
Object |
getDatabase(String did)
Return the Database backing the XNodeCollection having ID did. |
List |
getDatabaseIndex()
Returns the List of existing Database IDs. |
List |
getDocumentIndex(String did)
Returns the document index for the Database with key did, sorted, created from the Database. |
boolean |
hasContent(String did,
String rid)
Returns true if the Database with ID did contains data matching the key String rid (record ID). |
boolean |
hasDatabase(String did)
Returns true if there is an existing Database with key did. |
void |
initialize(XNodeStore xnodestore)
Initializes the XNodeStoreProvider provided its parent XNodeStore. |
void |
putContent(String did,
String rid,
String content,
boolean overwrite)
The method that does the actual work of storing the String content in the Database db using the key String rid (record ID). |
void |
start()
Start the database service. |
void |
stop()
Shuts down the database service. |
| Methods inherited from class org.ceryle.xnode.providers.AbstractXNodeStoreProvider |
|---|
error, isLoadedDatabase, message, optimize, setPaths, storageExists, warning, writeXNodeToDatabase |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.purl.xnode.XNodeStoreProvider |
|---|
isLoadedDatabase, optimize, storageExists, writeXNodeToDatabase |
| Field Detail |
|---|
public static final String FILE_EXT
| Constructor Detail |
|---|
public FileSystemProvider()
| Method Detail |
|---|
public void initialize(XNodeStore xnodestore)
throws XNodeStoreProviderException
initialize in interface XNodeStoreProviderinitialize in class AbstractXNodeStoreProviderxnodestore - the parent XNodeStore.
XNodeStoreProviderException - if any error occurs while initializing the provider.
public void start()
throws XNodeStoreProviderException
Does nothing in this class.
(This is an XNodeStoreProvider API method)
start in interface XNodeStoreProviderstart in class AbstractXNodeStoreProviderXNodeStoreProviderException - if unable to start the database.
public void stop()
throws XNodeStoreProviderException
Does nothing in this class.
(This is an XNodeStoreProvider API method)
stop in interface XNodeStoreProviderstop in class AbstractXNodeStoreProviderXNodeStoreProviderException - if an error occurs while stopping the database.
public Object getDatabase(String did)
throws XNodeStoreProviderException
If did equals the root ID ("db"), use that as the base name, otherwise the root should be added as part of the path , e.g., "db/did".
(This is an XNodeStoreProvider API method)
getDatabase in interface XNodeStoreProvidergetDatabase in class AbstractXNodeStoreProviderdid - the ID of the Database
XNodeStoreProviderException - if any error occurs while getting or creating the Database.
public boolean hasDatabase(String did)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
hasDatabase in interface XNodeStoreProviderhasDatabase in class AbstractXNodeStoreProviderdid - the ID of the Database to query.
XNodeStoreProviderException - if any error occurs while querying.
public List getDatabaseIndex()
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getDatabaseIndex in interface XNodeStoreProvidergetDatabaseIndex in class AbstractXNodeStoreProviderXNodeStoreProviderException - if any error occurs while building the index.
public void closeDatabase(String did)
throws XNodeStoreProviderException
In this class this method does nothing.
closeDatabase in interface XNodeStoreProvidercloseDatabase in class AbstractXNodeStoreProviderdid - the ID of the Database to close.
XNodeStoreProviderException - if any error occurs while closing the Database.
public void deleteDatabase(String did)
throws XNodeStoreProviderException
This will ignore requests to delete the root directory ("db").
(This is an XNodeStoreProvider API method)
deleteDatabase in interface XNodeStoreProviderdeleteDatabase in class AbstractXNodeStoreProviderdid - the ID of the Database to delete.
XNodeStoreProviderException - if any error occurs while removing the Database.
public void putContent(String did,
String rid,
String content,
boolean overwrite)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
putContent in interface XNodeStoreProviderputContent in class AbstractXNodeStoreProviderdid - the ID of the Databaserid - the ID of the recordcontent - the content String.overwrite - when true permit the overwrite of previous content.
XNodeStoreProviderException - if any error occurs while putting the content into the Database.
public boolean hasContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
hasContent in interface XNodeStoreProviderhasContent in class AbstractXNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs retrieving the content.
public int getContentSize(String did,
String rid)
hasContent(String,String)
since it does basically the same function but returns a more useful value.
This returns -1 if the document doesn't exist, and returns a -2 if either
of the parameters is null or an error occurs, rather than throwing an
exception.
(This is an XNodeStoreProvider API method)
getContentSize in interface XNodeStoreProvidergetContentSize in class AbstractXNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
public String getContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getContent in interface XNodeStoreProvidergetContent in class AbstractXNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs retrieving the content.
public void deleteContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
deleteContent in interface XNodeStoreProviderdeleteContent in class AbstractXNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs deleting the key/data pair.
public List getDocumentIndex(String did)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getDocumentIndex in interface XNodeStoreProvidergetDocumentIndex in class AbstractXNodeStoreProviderdid - the ID of the Database.
XNodeStoreProviderException - if an error occurs obtaining the document index.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||