edu.ucsb.nceas.morpho.datastore
Class MetacatDataStore

java.lang.Object
  extended byedu.ucsb.nceas.morpho.datastore.DataStore
      extended byedu.ucsb.nceas.morpho.datastore.MetacatDataStore
All Implemented Interfaces:
DataStoreInterface

public class MetacatDataStore
extends DataStore
implements DataStoreInterface

implements and the DataStoreInterface for accessing files on the Metacat


Field Summary
 
Fields inherited from class edu.ucsb.nceas.morpho.datastore.DataStore
cachedir, datadir, separator, tempdir
 
Constructor Summary
MetacatDataStore(Morpho morpho)
          Constructor to create this object in conjunction with a ceartain morpho.
 
Method Summary
 boolean deleteFile(java.lang.String name)
          deletes a file from metacat.
 boolean exists(java.lang.String name)
          Checks to see if a document with the id exists on 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)
          Create and save a new file to metacat using the "insert" action.
 java.io.File newFile(java.lang.String name, java.io.Reader file, boolean checkforaccessfile)
           
 java.io.File openDataFile(java.lang.String name)
          Opens a file from Metacat and returns a File object that represents the metacat file.
 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)
          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, boolean checkforaccessfile)
           
 java.lang.String saveFilesTransaction(java.util.Vector namesVec, java.util.Vector readersVec)
           
 
Methods inherited from class edu.ucsb.nceas.morpho.datastore.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(Morpho morpho)
Constructor to create this object in conjunction with a ceartain morpho.

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
Specified by:
openFile in class DataStore
Throws:
java.io.FileNotFoundException
CacheAccessException

openDataFile

public java.io.File openDataFile(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. differs from 'openFile' in that no filtering is done on special characters This is needed for binary data files.

Throws:
java.io.FileNotFoundException
CacheAccessException

exists

public boolean exists(java.lang.String name)
Checks to see if a document with the id exists on Metacat


saveFile

public java.io.File saveFile(java.lang.String name,
                             java.io.Reader file)
                      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
Specified by:
saveFile in class DataStore
Throws:
MetacatUploadException

saveFile

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

newFile

public java.io.File newFile(java.lang.String name,
                            java.io.Reader file)
                     throws MetacatUploadException
Create and save a new file to metacat using the "insert" action.

Specified by:
newFile in interface DataStoreInterface
Specified by:
newFile in class DataStore
Throws:
MetacatUploadException

newFile

public java.io.File newFile(java.lang.String name,
                            java.io.Reader file,
                            boolean checkforaccessfile)
                     throws MetacatUploadException
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
Throws:
MetacatUploadException

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
Specified by:
deleteFile in class DataStore
Parameters:
name - the name of the file to delete

main

public static void main(java.lang.String[] args)
Test method


saveFilesTransaction

public java.lang.String saveFilesTransaction(java.util.Vector namesVec,
                                             java.util.Vector readersVec)


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.