Mercurial > hg > eSciDocImport
comparison src/de/mpiwg/itgroup/eSciDoc/Tools/SendFileToeSciDoc.java @ 8:a844f6948dd8
?nderungen im Walker
tools f?r pubman
author | dwinter |
---|---|
date | Mon, 14 May 2012 09:58:45 +0200 |
parents | c6929e63b0b8 |
children | b6cf6462d709 |
comparison
equal
deleted
inserted
replaced
7:df8c62d84f8f | 8:a844f6948dd8 |
---|---|
5 import java.net.MalformedURLException; | 5 import java.net.MalformedURLException; |
6 import java.net.URL; | 6 import java.net.URL; |
7 | 7 |
8 import org.apache.http.HttpResponse; | 8 import org.apache.http.HttpResponse; |
9 import org.apache.http.client.ClientProtocolException; | 9 import org.apache.http.client.ClientProtocolException; |
10 import org.apache.log4j.BasicConfigurator; | |
10 | 11 |
11 | 12 |
12 public class SendFileToeSciDoc { | 13 public class SendFileToeSciDoc { |
13 | 14 |
14 | 15 |
15 //private static final String ESCIDOC_SERVER = "xserve07.mpiwg-berlin.mpg.de"; | 16 //private static final String ESCIDOC_SERVER = "xserve07.mpiwg-berlin.mpg.de"; |
16 private static final String ESCIDOC_SERVER = "escidoc-test.mpiwg-berlin.mpg.de"; | 17 private static final String ESCIDOC_SERVER = "escidoc.mpiwg-berlin.mpg.de"; |
18 //private static final String ESCIDOC_SERVER = "escidoc-test.mpiwg-berlin.mpg.de"; | |
17 | 19 |
18 /** | 20 /** |
19 * @param args | 21 * @param args |
20 * @throws IOException | 22 * @throws IOException |
21 * @throws IllegalStateException | 23 * @throws IllegalStateException |
25 if (args.length<4){ | 27 if (args.length<4){ |
26 System.out.println("Usage: sendfile command urlOfFile user password"); | 28 System.out.println("Usage: sendfile command urlOfFile user password"); |
27 return; | 29 return; |
28 } | 30 } |
29 | 31 |
32 BasicConfigurator.configure(); | |
30 EScidocBasicHandler handler = new EScidocBasicHandler(ESCIDOC_SERVER,8080,args[2],args[3]); | 33 EScidocBasicHandler handler = new EScidocBasicHandler(ESCIDOC_SERVER,8080,args[2],args[3]); |
31 URL url; | 34 URL url; |
32 HttpResponse ret; | 35 HttpResponse ret; |
33 try { | 36 try { |
34 url = new URL(args[1]); | 37 url = new URL(args[1]); |
36 | 39 |
37 e.printStackTrace(); | 40 e.printStackTrace(); |
38 return; | 41 return; |
39 } | 42 } |
40 try { | 43 try { |
41 ret = handler.eScidocPut(args[0], url); | 44 //ret = handler.eScidocDelete(args[0]); |
45 ret = handler.eScidocPost(args[0], url); | |
42 } catch (ClientProtocolException e) { | 46 } catch (ClientProtocolException e) { |
43 // TODO Auto-generated catch block | 47 // TODO Auto-generated catch block |
44 e.printStackTrace(); | 48 e.printStackTrace(); |
45 return; | 49 return; |
46 } catch (IOException e) { | 50 } catch (IOException e) { |