edu.ucsb.nceas.morpho.framework
Class MetacatDataStore

java.lang.Object
  |
  +--edu.ucsb.nceas.morpho.framework.DataStore
        |
        +--edu.ucsb.nceas.morpho.framework.MetacatDataStore

public class MetacatDataStore
extends DataStore
implements DataStoreInterface

implements and the DataStoreInterface for accessing files on the Metacat


Fields inherited from class edu.ucsb.nceas.morpho.framework.DataStore
cachedir, datadir, separator, tempdir
 
Constructor Summary
MetacatDataStore(ClientFramework cf)
          Constructor to create this object in conjunction with a ceartain framework.
 
Method Summary
 boolean deleteFile(java.lang.String name)
          deletes a file from metacat.
static void main(java.lang.String[] args)
          Test method
 void newDataFile(java.lang.String id, java.io.File file)
          method to create a new data file on metacat.
 java.io.File newFile(java.lang.String name, java.io.Reader file, DataPackage dp)
          Create and save a new file to metacat using the "insert" action.
 java.io.File newFile(java.lang.String name, java.io.Reader file, DataPackage dp, boolean checkforaccessfile)
           
 java.io.File openFile(java.lang.String name)
          Opens a file from Metacat and returns a File object that represents the metacat file.
 java.io.File saveFile(java.lang.String name, java.io.Reader file, DataPackage dp)
          Save an xml metadata file (which already exists) to metacat using the "update" action.
 java.io.File saveFile(java.lang.String name, java.io.Reader file, DataPackage dp, boolean checkforaccessfile)
           
 
Methods inherited from class edu.ucsb.nceas.morpho.framework.DataStore
debug, insertIdInFile, parseId, parseIdFromMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetacatDataStore

public MetacatDataStore(ClientFramework cf)
Constructor to create this object in conjunction with a ceartain framework.
Method Detail

openFile

public java.io.File openFile(java.lang.String name)
                      throws java.io.FileNotFoundException,
                             CacheAccessException
Opens a file from Metacat and returns a File object that represents the metacat file. If the file does not exist in the local cache, or is outdated in the local cache, this method adds the new file to the cache for later access.
Specified by:
openFile in interface DataStoreInterface
Overrides:
openFile in class DataStore
Parameters:
name: - the docid of the metacat file in <scope>.<number> or <scope>.<number>.<revision> form.

saveFile

public java.io.File saveFile(java.lang.String name,
                             java.io.Reader file,
                             DataPackage dp)
                      throws MetacatUploadException
Save an xml metadata file (which already exists) to metacat using the "update" action. This method is for xml metadata documents only do not use this method to upload binary data files.
Specified by:
saveFile in interface DataStoreInterface
Overrides:
saveFile in class DataStore
Parameters:
name: - the docid
file: - the file to save
publicAccess: - true if the file can be read by unauthenticated users, false otherwise.

saveFile

public java.io.File saveFile(java.lang.String name,
                             java.io.Reader file,
                             DataPackage dp,
                             boolean checkforaccessfile)
                      throws MetacatUploadException

newFile

public java.io.File newFile(java.lang.String name,
                            java.io.Reader file,
                            DataPackage dp)
                     throws MetacatUploadException
Create and save a new file to metacat using the "insert" action.
Specified by:
newFile in interface DataStoreInterface
Overrides:
newFile in class DataStore
Parameters:
name: - the id of the new file
file: - the stream to the file to write to metacat
publicAccess: - flag for unauthenticated read access to the new file true if unauthenticated users should have read access, false otherwise

newFile

public java.io.File newFile(java.lang.String name,
                            java.io.Reader file,
                            DataPackage dp,
                            boolean checkforaccessfile)
                     throws MetacatUploadException

newDataFile

public void newDataFile(java.lang.String id,
                        java.io.File file)
                 throws MetacatUploadException
method to create a new data file on metacat. This method uploads the given file with the given id. It does nothing to control access or link the file into packages -- those items are handled by the metadata documents that are created on metacat.
Parameters:
id - the identifier to use for this file (e.g., knb.1.1). It should be revision '1' because data files cannot be updated on metacat
file - the file to upload to metacat

deleteFile

public boolean deleteFile(java.lang.String name)
deletes a file from metacat. returns true if the file was deleted succesfully, 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.