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

Jing Tao tao at nceas.ucsb.edu
Fri Sep 3 09:24:26 PDT 2004


Hi, Bing:

Here is a comment about you can upload a file even after user logout. Did 
you put httpclient.jar in your class path? As I know, httpclient.jar has 
its own cookie system and our logout code doesn't work there.

Hope this is helpful.

Jing

On Thu, 2 Sep 2004, Bing Zhu wrote:

> Date: Thu, 2 Sep 2004 17:52:33 -0700
> From: Bing Zhu <bzhu at sdsc.edu>
> To: Saurabh Garg <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>
> Subject: RE: need a new upload() method in MetacatClient.java
> 
> 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
> >
> 

-- 
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