edu.ucsb.nceas.morpho.framework
Class DataStore
java.lang.Object
|
+--edu.ucsb.nceas.morpho.framework.DataStore
- Direct Known Subclasses:
- FileSystemDataStore, MetacatDataStore
- public abstract class DataStore
- extends java.lang.Object
- implements DataStoreInterface
creates an abstract class for getting files from any dataStore using the same
methods.
Field Summary |
protected java.lang.String |
cachedir
|
protected java.lang.String |
datadir
|
protected java.lang.String |
separator
|
protected java.lang.String |
tempdir
|
Method Summary |
void |
debug(int code,
java.lang.String message)
|
abstract boolean |
deleteFile(java.lang.String name)
Deletes the file with an id of name. |
protected java.lang.String |
insertIdInFile(java.io.File file,
java.lang.String id)
inserts a documents id into a specified path in the document. |
abstract java.io.File |
newFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
create a new file with an id of name in the datastore and return a File
object that represents it. |
abstract java.io.File |
openFile(java.lang.String name)
open a file from a datastore with the id of name and return a File
object that represents it. |
protected java.lang.String |
parseId(java.lang.String id)
Parses a dotted notation id into a file path. |
protected java.lang.String |
parseIdFromMessage(java.lang.String message)
parses the id of a file from the message that metacat returns |
abstract java.io.File |
saveFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
save a file to the datastore with the id of name. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
datadir
protected java.lang.String datadir
separator
protected java.lang.String separator
cachedir
protected java.lang.String cachedir
tempdir
protected java.lang.String tempdir
DataStore
public DataStore(ClientFramework cf)
- create a new FileSystemDataStore for a ClientFramework
debug
public void debug(int code,
java.lang.String message)
parseId
protected java.lang.String parseId(java.lang.String id)
- Parses a dotted notation id into a file path. johnson2343.13223 becomes
johnson2343/13223. Revision numbers are left on the end so
johnson2343.13223.2 becomes johnson2343/13223.2
parseIdFromMessage
protected java.lang.String parseIdFromMessage(java.lang.String message)
- parses the id of a file from the message that metacat returns
insertIdInFile
protected java.lang.String insertIdInFile(java.io.File file,
java.lang.String id)
- inserts a documents id into a specified path in the document. the document
is returned as a string
- Parameters:
file
- the file to insert the id intoid
- the id to insert into the file.
openFile
public abstract java.io.File openFile(java.lang.String name)
throws java.io.FileNotFoundException,
CacheAccessException
- Description copied from interface: DataStoreInterface
- open a file from a datastore with the id of name and return a File
object that represents it. Throws FileNotFoundException if a file
with the id name does not exist in the datastore. Throws IOException
if a there is a communications problem with the datastore.
- Specified by:
- openFile in interface DataStoreInterface
saveFile
public abstract java.io.File saveFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
throws java.lang.Exception
- Description copied from interface: DataStoreInterface
- save a file to the datastore with the id of name. a file object
representing the saved file is returned. If the publicAccess boolean
is true, then an unauthenticated user may read the document from the
data store.
- Specified by:
- saveFile in interface DataStoreInterface
newFile
public abstract java.io.File newFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
throws java.lang.Exception
- Description copied from interface: DataStoreInterface
- create a new file with an id of name in the datastore and return a File
object that represents it.
- Specified by:
- newFile in interface DataStoreInterface
deleteFile
public abstract boolean deleteFile(java.lang.String name)
throws java.lang.Exception
- Description copied from interface: DataStoreInterface
- Deletes the file with an id of name. returns true if the file was
succesfully deleted, false otherwise
- Specified by:
- deleteFile in interface DataStoreInterface
Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.