edu.ucsb.nceas.morpho.framework
Class FileSystemDataStore
java.lang.Object
|
+--edu.ucsb.nceas.morpho.framework.DataStore
|
+--edu.ucsb.nceas.morpho.framework.FileSystemDataStore
- public class FileSystemDataStore
- extends DataStore
- implements DataStoreInterface
implements and the DataStoreInterface for accessing files on the local
file system.
Method Summary |
boolean |
deleteFile(java.lang.String name)
deletes a file from the local file system. |
static void |
main(java.lang.String[] args)
Test method |
java.io.File |
newFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
returns a File object in the local repository. |
java.io.File |
openFile(java.lang.String name)
opens a file with the given name. |
java.io.File |
saveFile(java.lang.String name,
java.io.Reader file)
|
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. |
java.io.File |
saveFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess,
java.lang.String rootDir)
Saves a file with the given name. |
java.io.File |
saveTempFile(java.lang.String name,
java.io.Reader file)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
FileSystemDataStore
public FileSystemDataStore(ClientFramework cf)
- create a new FileSystemDataStore for a ClientFramework
openFile
public java.io.File openFile(java.lang.String name)
throws java.io.FileNotFoundException
- opens a file with the given name. the name should be in the form
scope.accnum where the scope is unique to this machine. The file will
be opened from the <datadir>/<scope>/ directory
where the filename is the accnum.
Example:
name=johnson2343.13223
datadir=data
complete path=/usr/local/morpho/profiles/johnson/data/johnson2343/13223
Any characters after the first separator are assumed to be part of the
accession number. Hence the id johnson2343.13223.5 would produce
the file johnson2343/13223.5
- Specified by:
- openFile in interface DataStoreInterface
- Overrides:
- openFile in class DataStore
saveFile
public java.io.File saveFile(java.lang.String name,
java.io.Reader file)
saveFile
public java.io.File saveFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
- 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
- Overrides:
- saveFile in class DataStore
saveTempFile
public java.io.File saveTempFile(java.lang.String name,
java.io.Reader file)
saveFile
public java.io.File saveFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess,
java.lang.String rootDir)
- Saves a file with the given name. if the file does not exist it is created
The file is saved according to the name provided. The file will
be saved to the <datadir>/<scope>/ directory
where the filename is the accnum.
Example:
name=johnson2343.13223
datadir=data
complete path=/usr/local/morpho/profiles/johnson/data/johnson2343/13223
Any characters after the first separator are assumed to be part of the
accession number. Hence the id johnson2343.13223.5 would produce
the file johnson2343/13223.5
newFile
public java.io.File newFile(java.lang.String name,
java.io.Reader file,
boolean publicAccess)
- returns a File object in the local repository.
- Specified by:
- newFile in interface DataStoreInterface
- Overrides:
- newFile in class DataStore
- Parameters:
name:
- the id of the filefile:
- the stream to the filepublicAccess:
- flag for unauthenticated read access to the file.
true if anauthenticated users can read the file, false otherwise.
deleteFile
public boolean deleteFile(java.lang.String name)
- deletes a file from the local file system. returns true if the file is
successfully deleted, false otherwise.
- Specified by:
- deleteFile in interface DataStoreInterface
- Overrides:
- deleteFile in class DataStore
- Parameters:
name
- the name of the file to delete
main
public static void main(java.lang.String[] args)
- Test method
Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.