|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xnode.providers.AbstractXNodeStoreProvider
public abstract class AbstractXNodeStoreProvider
An implementation of the XNodeStoreProvider API as the basis for implementing
common behaviours of an XNodeStoreProvider, in particular the use of the
Apache serialization features. initialize(XNodeStore) must be called
following instantiation of the class to initialize the provider.
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 |
Filesep
|
protected String |
m_homepath
|
protected File |
m_storage
|
protected String |
m_storagepath
|
protected XNodeStore |
m_xns
|
protected MessageHandler |
mh
|
| Constructor Summary | |
|---|---|
AbstractXNodeStoreProvider()
Default constructor. |
|
| Method Summary | |
|---|---|
abstract void |
closeDatabase(String did)
Close the Database backing the XNodeCollection having ID did. |
abstract 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. |
abstract void |
deleteDatabase(String did)
Remove the Database backing the XNodeCollection having ID did. |
void |
error(String message)
Write message to console or message output as an error message. |
abstract 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. |
abstract 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). |
abstract Object |
getDatabase(String did)
Return the Database backing the XNodeCollection having ID did. |
abstract List |
getDatabaseIndex()
Returns the List of existing Database IDs. |
abstract List |
getDocumentIndex(String did)
Returns the document index, sorted, created from the Database, not the XNode metadata. |
abstract boolean |
hasContent(String did,
String rid)
Returns true if the Database with ID did contains data matching the key String rid (record ID). |
abstract 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. |
boolean |
isLoadedDatabase(String did)
Returns true if the Database with key did has already been loaded. |
void |
message(String message)
Write message to console or message output as an informational message. |
void |
optimize(ActionListener listener)
Using any native processes, optimizes the Database. |
abstract 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). |
protected void |
setPaths()
|
abstract void |
start()
Start the database service. |
abstract void |
stop()
Shuts down the database service. |
boolean |
storageExists()
Returns true if the storage directory exists. |
void |
warning(String message)
Write message to console or message output as a warning message. |
void |
writeXNodeToDatabase(XNode xnode,
XNodeCollection collection,
boolean overwrite)
Writes the provided XNode to the XNodeCollection's Database using the XNode's ID as the key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String m_homepath
protected String m_storagepath
protected File m_storage
protected MessageHandler mh
protected XNodeStore m_xns
public static final String Filesep
| Constructor Detail |
|---|
public AbstractXNodeStoreProvider()
| Method Detail |
|---|
public void initialize(XNodeStore xnodestore)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
initialize in interface XNodeStoreProviderxnodestore - the parent XNodeStore.
XNodeStoreProviderException - if any error occurs while initializing the provider.
protected void setPaths()
throws XNodeStoreProviderException
XNodeStoreProviderExceptionpublic boolean storageExists()
storageExists in interface XNodeStoreProvider
public abstract void start()
throws XNodeStoreProviderException
start in interface XNodeStoreProviderXNodeStoreProviderException - if unable to start the database.
public abstract void stop()
throws XNodeStoreProviderException
stop in interface XNodeStoreProviderXNodeStoreProviderException - if an error occurs while stopping the database.public boolean isLoadedDatabase(String did)
isLoadedDatabase in interface XNodeStoreProvider
public abstract 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 XNodeStoreProviderdid - the ID of the Database
XNodeStoreProviderException - if any error occurs while getting or creating the Database.
public abstract boolean hasDatabase(String did)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
hasDatabase in interface XNodeStoreProviderdid - the ID of the Database to query.
XNodeStoreProviderException - if any error occurs while querying.
public abstract List getDatabaseIndex()
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getDatabaseIndex in interface XNodeStoreProviderXNodeStoreProviderException - if any error occurs while building the index.
public abstract void closeDatabase(String did)
throws XNodeStoreProviderException
closeDatabase in interface XNodeStoreProviderdid - the ID of the Database to close.
XNodeStoreProviderException - if any error occurs while closing the Database.
public abstract 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 XNodeStoreProviderdid - the ID of the Database to delete.
XNodeStoreProviderException - if any error occurs while removing the Database.
public abstract void putContent(String did,
String rid,
String content,
boolean overwrite)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
putContent in interface XNodeStoreProviderdid - 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 abstract boolean hasContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
hasContent in interface XNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs retrieving the content.
public abstract 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 either of the parameters is null, if the collection or
document doesn't exist, and returns a -2 if any error occurs, rather than
throwing an exception.
(This is an XNodeStoreProvider API method)
getContentSize in interface XNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
public abstract String getContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getContent in interface XNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs retrieving the content.
public abstract void deleteContent(String did,
String rid)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
deleteContent in interface XNodeStoreProviderdid - the ID of the Databaserid - the ID of the record
XNodeStoreProviderException - if an error occurs deleting the key/data pair.
public abstract List getDocumentIndex(String did)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
getDocumentIndex in interface XNodeStoreProviderdid - the ID of the Database.
XNodeStoreProviderException - if an error occurs obtaining the document index.
public void writeXNodeToDatabase(XNode xnode,
XNodeCollection collection,
boolean overwrite)
throws XNodeStoreProviderException
(This is an XNodeStoreProvider API method)
writeXNodeToDatabase in interface XNodeStoreProviderxnode - the XNode to write.collection - the XNodeCollection.overwrite - when true permit the overwrite of previous content.
XNodeStoreProviderException - if an error occurs deleting writing the XNode.public void optimize(ActionListener listener)
If the optional ActionListener is provided its
ActionListener.actionPerformed(ActionEvent)
method will be called upon completion of the optimization.
In this abstract class this is a stub method and does nothing.
optimize in interface XNodeStoreProviderlistener - an optional listener to receive
notification upon completion.public void message(String message)
public void warning(String message)
public void error(String message)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||