Mercurial > dive4elements > http-client
annotate src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java @ 15:f3441dc6853f 0.2
Tagged RELEASE 0.2 of HTTP Client.
http-client/tags/0.2@1918 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 13 May 2011 10:40:53 +0000 |
parents | 5b62267a1c3c |
children | c4431f39926a |
rev | line source |
---|---|
1
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.artifacts.httpclient.http; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
12
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
10 import java.io.InputStream; |
1
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.io.OutputStream; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.Document; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifacts.httpclient.http.response.ResponseHandler; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.httpclient.objects.Artifact; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.httpclient.objects.ArtifactFactory; |
2
2fdfa20cfa63
Added an interface that is used to create instances of artifacts depending on the framework that includes this lib. The create() method of the HttpClient makes use of this interface.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
19 import de.intevation.artifacts.httpclient.utils.ArtifactCreator; |
1
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 */ |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public interface HttpClient { |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 ArtifactFactory[] getArtifactFactories() |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 throws ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
2
2fdfa20cfa63
Added an interface that is used to create instances of artifacts depending on the framework that includes this lib. The create() method of the HttpClient makes use of this interface.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1
diff
changeset
|
29 Object create(Document createDocument, ArtifactCreator creator) |
1
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 throws ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 Object describe( |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 Artifact artifact, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 Document describeDocument, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 ResponseHandler handler) |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 throws ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 Object feed(Artifact artifact, Document feedDocument, ResponseHandler handler) |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 throws ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 Object advance( |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 Artifact artifact, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 Document advanceDocument, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 ResponseHandler handler) |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 throws ConnectionException; |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 void out( |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 Artifact artifact, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 Document outDocument, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 String target, |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 OutputStream out) |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 throws ConnectionException; |
4
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
53 |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
54 |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
55 /******************************* |
5
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
56 * Service API |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
57 *******************************/ |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
58 |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
59 Document callService(String url, String service, Document input) |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
60 throws ConnectionException; |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
61 |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
62 |
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
63 /******************************* |
4
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
64 * Collections API |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
65 *******************************/ |
5
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
66 |
4
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
67 Object createCollection( |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
68 Document createDocument, |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
69 String ownerId, |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
70 ResponseHandler handler) |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
71 throws ConnectionException; |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
72 |
6
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
73 Object doCollectionAction( |
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
74 Document actionDocument, |
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
75 String uuid, |
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
76 ResponseHandler handler) |
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
77 throws ConnectionException; |
09a84c6e263a
Enhanced the HttpClient with a method sto trigger a collection specific action.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
5
diff
changeset
|
78 |
9
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
79 void collectionOut( |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
80 Document outDocument, |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
81 String uuid, |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
82 String type, |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
83 OutputStream out) |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
84 throws ConnectionException; |
072e8d488f83
Enhanced the HttpClient with a method to trigger the out() operation of Collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
7
diff
changeset
|
85 |
12
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
86 InputStream collectionOut( |
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
87 Document doc, |
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
88 String uuid, |
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
89 String type) |
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
90 throws ConnectionException; |
5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
9
diff
changeset
|
91 |
4
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
92 |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
93 /******************************* |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
94 * Users API |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
95 *******************************/ |
5
7917c21fad01
Enabled the HttpClient to call services that are registered at the artifact server.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4
diff
changeset
|
96 |
4
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
97 Document listUsers() |
19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3
diff
changeset
|
98 throws ConnectionException; |
7
06e9e25632cd
Added a method to the HttpClient to list the collection of a user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
6
diff
changeset
|
99 |
06e9e25632cd
Added a method to the HttpClient to list the collection of a user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
6
diff
changeset
|
100 Document listUserCollections(String userid) |
06e9e25632cd
Added a method to the HttpClient to list the collection of a user.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
6
diff
changeset
|
101 throws ConnectionException; |
1
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 } |
c9ac6642973c
Renamed GNVClient and GNVClientImpl to HttpClient and HttpClientImpl.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |