[seek-dev] Re: need a new upload() method in MetacatClient.java

Saurabh Garg sgarg at nceas.ucsb.edu
Thu Sep 2 22:20:32 PDT 2004


Bing,

I am not sure about the Ecogrid's put method. You will have to check 
that with Jing or Matt.
Can you mail  me the code that  is able to upload the  document  even  
after you have logged out. I  want to  see the  exact  sequence of events.
You can use the read() function in metacat client to view the file which 
you have just uploaded. Check the source of 
edu.ucsb.nceas.metacattest.client.MetacatClientTest to find out how to 
do that..

Sid




Bing Zhu wrote:

>Sid,
>
>Thank you very much for the quick update. I will update my metacat files
>against CVS.
>
>And I have following questions.
>
>1. Metacat URL in Ecogrid's put
>
>    We have the following syntax for Ecogrid's put.
>            put(object, objectId, type, sessionId)
>    My understanding is that this is used to upload file or XML metadata
>    with a given 'sessionID'. i.e. Someone logs into Metacta and gets a
>    valid sessionID. Then using this valid session ID, he can upload
>    data/metadata into metacat using our 'put' service.
>
>    I played with Metacat code by creating separate java files based on
>    Jing's code for
>          (1) login and get a sessionID back
>          (2) upload a file with a given session ID
>          (3) logout
>
>     Notice (2) is equivalent to Ecogrid's put. But (2) needs Metacat URL
>which
>     is not mentioned in our 'put' syntax and not in Ecogrid's design
>document
>     either. So I guess the 'objectID' will a combination of  URL and
>metacat doc id.
>     e.g.   if I want to upload a file with Metacat ID, test108.1.1, via
>Ecogrid's put,
>     The object ID in this call will be:
>               http://indus.nceas.ucsb.edu/knb-oracle/metacat/test108.1.1
>
>     BTW, after I called logout for a valid sessionID with the following
>code
>                 MetacatClient mc =
>(MetacatClient)MetacatFactory.createMetacatConnection(metacatUrl);
>                 mc.setSessionId(sessionId);
>                 mc.logout();
>     Somehow I still can upload files using the same 'sessionID'. i.e. The
>'sessionId' does not expire imeediately
>     after 'mc.logout()'.
>
>2. Is there a quick way to view the Metacat docs I created?
>
>Sincerely,
>Bing
>
>
>
>
>
>-----Original Message-----
>From: Saurabh Garg [mailto:sgarg at nceas.ucsb.edu]
>Sent: Thursday, September 02, 2004 2:56 PM
>To: bzhu at sdsc.edu
>Cc: Matt Jones; Jing Tao; Bertram Ludaescher; Arcot Rajasekar; Seek-Dev
>Subject: Re: need a new upload() method in MetacatClient.java
>
>
>Bing,
>
>I have checked in a new method into metacat cvs. It is
>
>    public String upload(String docid, String filename, InputStream
>fileData, int fileSize)
>
>instead of
>
>    public String upload(String docid, byte[] bytes)
>
>The reason is that we dont want to store the file in metacat client code. If
>a user passes bytes array which is more than the memory size, it will crash
>the metacat client. So instead of that, we take an InputStream object.
>
>You will have to update both utilities and metacat cvs modules for this to
>work. For sample code, look in
>edu.ucsb.nceas.metacattest.client.MetacatClientTest (upload_stream()
>function)
>
>Any questions, let me know
>
>-Sid
>
>
>
>----- Original Message -----
>From: "Bing Zhu" <bzhu at sdsc.edu>
>To: "Sid" <sgarg at nceas.ucsb.edu>
>Cc: "Matt Jones" <jones at nceas.ucsb.edu>; "Jing Tao" <tao at nceas.ucsb.edu>;
>"Bertram Ludaescher" <ludaesch at sdsc.edu>; "Arcot Rajasekar"
><sekar at sdsc.edu>; "Seek-Dev" <seek-dev at ecoinformatics.org>
>Sent: Tuesday, August 31, 2004 10:53 AM
>Subject: need a new upload() method in MetacatClient.java
>
>
>  
>
>>Sid,
>>
>>In implemeting Ecogrid's 'put' for Metacat, it will be more
>>efficient to have a new upload method for the Ecogrid's
>>put service.
>>   public String upload(String docid, byte[] bytes)
>>
>>Currently I can only find the existing one,
>>   public String upload(String docid, File file),
>>with which the Ecogrid's put service has to save the input byte array
>>into a file and then call this method. I am going to implement
>>it for now. Once the new method is available, I can just directly
>>call the new one. Thanks.
>>
>>Bing
>>
>>    
>>




More information about the Seek-dev mailing list