Non-XML Data Files |
Back | Home | Next |
Metacat has the capability of proxying a connection to a data file server. This capability is provided through an abstract class called DataFileUploadInterface. Currently, there is a data file server implemented for this interface that can store non-XML data files on the local UNIX file system. Theoretically, any file storage system could be proxied through this interface.
Reasoning
Since Metacat has been designed as a metadata storage system for ecological data, there was a concern that data and metadata files were being stored seperately and that users would find it impractical to have to use two different systems to get their data and metadata. This system also allows users to specify access control restraints on their data files the same way that they are specified on the xml metadata files.
Data Download (GET)Metacat Server can retrieve data files that are stored on Metacat
file system or in any other file system on Internet.
Metacat stores data files in a directory under the servlet context.
It writes information about these data files in xml_documents just like
about any XML file.
An example of HTTP request for download of data file on Metacat is shown below:
http://server.domain.com/metacat?action=read&docid=nceas.55
An example of HTTP request for download of data file on Internet is shown below:
http://server.domain.com/metacat?action=read&docid=http://otherserver.domain.com/filename
Note in docid=http://otherserver.domain.com/filename HTTP protocol is used, i.e. currently for file download HTTP protocol is only supported.
Data Upload (PUT)
Due to a Java limitation on the HTTP PUT comand, the data upload portion of Metacat deviates from the standard HTTP interface. A standard bidirectional TCP/IP socket is used for tranfering the data. The procedure for uploading a file is as follows.
<xml version="1.0"?><port>xxxx</port>where xxxx is an open port between 0 and 65000.
[filename]0[sessionID]0[filelength]0[DATA]The filename, sessionID and filelength must be converted into a byte string, terminated with a 0 (zero) byte and inserted into the stream in the order shown. The filelength is in bytes. The DATA stream does not need to be terminated with a 0 byte.
<?xml version="1.0"?><docid>yyyy</docid>where yyyy is the new docid.
The file DataStreamTest.java is a test class that shows how a client must operate to successfully upload a data file to Metacat.