Mercurial > dive4elements > framework
annotate artifacts-common/src/main/java/de/intevation/artifacts/common/ArtifactNamespaceContext.java @ 379:95ff5a25a339
Avoid adding duplicated facets in DefaultOutput.addFacet().
artifacts/trunk@4185 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 30 Mar 2012 07:21:29 +0000 |
parents | 0344a20f8a93 |
children |
rev | line source |
---|---|
113
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 /* |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 * |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 package de.intevation.artifacts.common; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import java.util.Iterator; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import javax.xml.XMLConstants; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import javax.xml.namespace.NamespaceContext; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * The namespace used in artifact documents. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a> |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 public class ArtifactNamespaceContext |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 implements NamespaceContext |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 * The URI of the namespace of the artifacts. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 public final static String NAMESPACE_URI = |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 "http://www.intevation.de/2009/artifacts"; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * The XML prefix for the artifacts namespace. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public final static String NAMESPACE_PREFIX = "art"; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 * Final instance to be easily used to avoid creation |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 * of instances. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 public static final ArtifactNamespaceContext INSTANCE = |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 new ArtifactNamespaceContext(); |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 * The default constructor. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 public ArtifactNamespaceContext() { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(String) |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 * @param prefix The prefix |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 * @return The corresponing URI |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 public String getNamespaceURI(String prefix) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 if (prefix == null) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 throw new NullPointerException("Null prefix"); |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 if (NAMESPACE_PREFIX.equals(prefix)) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 return NAMESPACE_URI; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 if ("xml".equals(prefix)) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 return XMLConstants.XML_NS_URI; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 return XMLConstants.NULL_NS_URI; |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 * @see javax.xml.namespace.NamespaceContext#getPrefix(String) |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 * @param uri The URI |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 * @return nothing. |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 * @throws java.lang.UnsupportedOperationException |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 public String getPrefix(String uri) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 throw new UnsupportedOperationException(); |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 /** |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 * @see javax.xml.namespace.NamespaceContext#getPrefixes(java.lang.String) |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 * @param uri The URI |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 * @return nothing |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 * @throws java.lang.UnsupportedOperationException |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 */ |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 public Iterator getPrefixes(String uri) { |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 throw new UnsupportedOperationException(); |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 } |
0344a20f8a93
Added the ArtifactNamespaceContext and a ClientProtocolUtils that helps working with the artifact protocol.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |