Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/features/FeaturesNamespaceContext.java @ 4326:87362ba26c72
Extract the gauge name from the riverservice response
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Tue, 30 Oct 2012 13:03:20 +0100 |
parents | 4a6321dd5186 |
children |
rev | line source |
---|---|
3476
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server.features; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
3 import java.util.Iterator; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
4 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 import javax.xml.XMLConstants; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
6 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
7 import javax.xml.namespace.NamespaceContext; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
8 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 public class FeaturesNamespaceContext |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 implements NamespaceContext { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 * The URI of the namespace of the features. |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 public final static String NAMESPACE_URI = |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 "http://www.intevation.de/2012/flys/features"; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 * The XML prefix for the features namespace. |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 public final static String NAMESPACE_PREFIX = "ftr"; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 * Final instance to be easily used to avoid creation |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 * of instances. |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
26 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 public static final FeaturesNamespaceContext INSTANCE = |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 new FeaturesNamespaceContext(); |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
29 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 * The default constructor. |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
32 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 public FeaturesNamespaceContext() { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
34 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
35 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
37 * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(String) |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
38 * @param prefix The prefix |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 * @return The corresponing URI |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
40 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 @Override |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 public String getNamespaceURI(String prefix) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
43 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 if (prefix == null) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 throw new NullPointerException("Null prefix"); |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
46 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
48 if (NAMESPACE_PREFIX.equals(prefix)) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 return NAMESPACE_URI; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
51 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 if ("xml".equals(prefix)) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
53 return XMLConstants.XML_NS_URI; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
54 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
56 return XMLConstants.NULL_NS_URI; |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
57 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
59 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 * @see javax.xml.namespace.NamespaceContext#getPrefix(String) |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 * @param uri The URI |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 * @return nothing. |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
63 * @throws java.lang.UnsupportedOperationException |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
64 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
65 @Override |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
66 public String getPrefix(String uri) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
67 throw new UnsupportedOperationException(); |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
69 |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 /** |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
71 * @see javax.xml.namespace.NamespaceContext#getPrefixes(java.lang.String) |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 * @param uri The URI |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 * @return nothing |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 * @throws java.lang.UnsupportedOperationException |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 */ |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 @Override |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 public Iterator getPrefixes(String uri) { |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 throw new UnsupportedOperationException(); |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 } |
4a6321dd5186
Implement a class representation of features corresponding to roles
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 } |