Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/MetaDataServiceImpl.java @ 521:fc60822e9c89
Added a new package 'chart' that should be the place where chart relevant classes should be stored. Moved ChartOutputTab into that package.
flys-client/trunk@2000 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 25 May 2011 08:03:02 +0000 |
parents | 0fa8bf8a2295 |
children | 2e02db03e576 |
rev | line source |
---|---|
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
4 import java.util.ArrayList; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
5 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
6 import org.w3c.dom.Document; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
7 import org.w3c.dom.Element; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
8 import org.w3c.dom.Node; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
9 import org.w3c.dom.NodeList; |
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
13 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
14 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
15 import de.intevation.artifacts.common.utils.XMLUtils; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
16 |
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.flys.client.shared.exceptions.ServerException; |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.flys.client.client.services.MetaDataService; |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
21 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
22 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
23 import de.intevation.artifacts.httpclient.http.HttpClient; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
24 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
25 |
278
f33af25b7490
Datacage: transport rpc result to ui.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
276
diff
changeset
|
26 import de.intevation.flys.client.shared.model.DataCageTree; |
f33af25b7490
Datacage: transport rpc result to ui.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
276
diff
changeset
|
27 import de.intevation.flys.client.shared.model.DataCageNode; |
f33af25b7490
Datacage: transport rpc result to ui.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
276
diff
changeset
|
28 |
286
0fa8bf8a2295
Datacage: Better converter for incoming XML tree
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
278
diff
changeset
|
29 import de.intevation.flys.client.server.meta.Converter; |
0fa8bf8a2295
Datacage: Better converter for incoming XML tree
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
278
diff
changeset
|
30 |
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 public class MetaDataServiceImpl |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 extends RemoteServiceServlet |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 implements MetaDataService |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 { |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
35 public static final String ERROR_NO_META_DATA_FOUND = |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
36 "error_no_meta_data_found"; |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
37 |
278
f33af25b7490
Datacage: transport rpc result to ui.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
276
diff
changeset
|
38 public DataCageTree getMetaData(String url, String locale, String river) |
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 throws ServerException |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 { |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
41 System.out.println("MetaDataService.getDistanceInfo"); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
42 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
43 Document doc = XMLUtils.newDocument(); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
44 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
45 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
46 doc, |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
47 ArtifactNamespaceContext.NAMESPACE_URI, |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
48 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
49 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
50 Element riverEl = ec.create("river"); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
51 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
52 riverEl.setTextContent(river); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
53 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
54 doc.appendChild(riverEl); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
55 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
56 HttpClient client = new HttpClientImpl(url, locale); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
57 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
58 try { |
286
0fa8bf8a2295
Datacage: Better converter for incoming XML tree
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
278
diff
changeset
|
59 Converter converter = new Converter(); |
0fa8bf8a2295
Datacage: Better converter for incoming XML tree
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
278
diff
changeset
|
60 return converter.convert(client.callService(url, "metadata", doc)); |
276
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
61 } |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
62 catch (ConnectionException ce) { |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
63 System.err.println(ce.getLocalizedMessage()); |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
64 } |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
65 |
f4c8ce11df33
UI stub for data cage
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
262
diff
changeset
|
66 throw new ServerException(ERROR_NO_META_DATA_FOUND); |
262
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 } |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
44a340c9becc
Added stub for meta data service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |