[seek-dev] Re: metacat 'put' implementation

Jing Tao tao at nceas.ucsb.edu
Mon Aug 30 13:41:10 PDT 2004


Hi, Bing:

For some reason ( I couldn't remeber now), the get and query method didn't 
use metacat client library. They call the metacat code direcly from same 
JVM.

I think matt's suggestion that use metacat client is a better idea. It has 
a very clean api to do it (probably I will switch the get and query method 
to use metacat client sometime). If you use the method in metacat client, 
the 4 steps which you described will be done in metacat automatically 
rather than in ecogrid  implementation.(Actually there is some problem in 
the first step, why do you want to open a document with the object id in put method? If it is 
inserting a new one, the document should NOT be existed). 

The code you are talking about is to read a data file from metacat. Data 
file is stored in file system and file name itself is the object id. Data 
files are stored in a configurable directory. So the filepath which was 
getten from configure file combines the file name(obbject id) will locate 
the data file.  

Hope this is helpful.

Jing


On Mon, 30 Aug 2004, Bing Zhu wrote:

> Date: Mon, 30 Aug 2004 12:17:07 -0700
> From: Bing Zhu <bzhu at sdsc.edu>
> To: Jing Tao <tao at nceas.ucsb.edu>
> Cc: Seek-Dev <seek-dev at ecoinformatics.org>
> Subject: metacat 'put' implementation
> 
> Hi Jing,
> 
> Since you implemented 'get' for Metacat, I think it will be more appropriate
> to ask you the followings.
> 
> In 'get', it seems the service gets the filename from the document with the
> following code.
>     String filepath = MetaCatUtil.getOption("datafilepath");
>     if(!filepath.endsWith("/"))
>     {
>              filepath += "/";
>     }
>     String filename = filepath + docid;
> And then the 'get' service read data from the file for user.
> 
> As Matt mentioned in previous mail, the 'put' should be implemented in
> parallel. Therefore, the 'put'
> for a file will be implemented as of followings.
>      (The put function has syntax:  put(byte[] objData, String objectId, int
> objType, int sessionId)  )
> 
>     1. open the document with doc ID, 'objectId'. if the doc doesn't exist,
> return an error.
>     2. compose filename  ---> what's your algorithm to build this
> filename???
>     3. Create a new file with filename from (2) and write data into the
> file.
>     4. Save filename info into the metacat document for 'objectId'.
> 
> Let me know if my understanding is correct. Thanks.
> 
> Bing
> 

-- 
Jing Tao
National Center for Ecological
Analysis and Synthesis (NCEAS)
735 State St. Suite 204
Santa Barbara, CA 93101




More information about the Seek-dev mailing list