comparison artifacts-common/src/main/java/org/dive4elements/artifacts/common/ArtifactNamespaceContext.java @ 472:783cc1b6b615

Moved directories to org.dive4elements
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 10:53:15 +0200
parents artifacts-common/src/main/java/de/intevation/artifacts/common/ArtifactNamespaceContext.java@0344a20f8a93
children 415df0fc4fa1
comparison
equal deleted inserted replaced
471:1a87cb24a446 472:783cc1b6b615
1 /*
2 * Copyright (c) 2010 by Intevation GmbH
3 *
4 * This program is free software under the LGPL (>=v2.1)
5 * Read the file LGPL.txt coming with the software for details
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
7 */
8
9 package de.intevation.artifacts.common;
10
11 import java.util.Iterator;
12
13 import javax.xml.XMLConstants;
14
15 import javax.xml.namespace.NamespaceContext;
16
17 /**
18 * The namespace used in artifact documents.
19 * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a>
20 */
21 public class ArtifactNamespaceContext
22 implements NamespaceContext
23 {
24 /**
25 * The URI of the namespace of the artifacts.
26 */
27 public final static String NAMESPACE_URI =
28 "http://www.intevation.de/2009/artifacts";
29
30 /**
31 * The XML prefix for the artifacts namespace.
32 */
33 public final static String NAMESPACE_PREFIX = "art";
34
35 /**
36 * Final instance to be easily used to avoid creation
37 * of instances.
38 */
39 public static final ArtifactNamespaceContext INSTANCE =
40 new ArtifactNamespaceContext();
41
42 /**
43 * The default constructor.
44 */
45 public ArtifactNamespaceContext() {
46 }
47
48 /**
49 * @see javax.xml.namespace.NamespaceContext#getNamespaceURI(String)
50 * @param prefix The prefix
51 * @return The corresponing URI
52 */
53 public String getNamespaceURI(String prefix) {
54
55 if (prefix == null) {
56 throw new NullPointerException("Null prefix");
57 }
58
59 if (NAMESPACE_PREFIX.equals(prefix)) {
60 return NAMESPACE_URI;
61 }
62
63 if ("xml".equals(prefix)) {
64 return XMLConstants.XML_NS_URI;
65 }
66
67 return XMLConstants.NULL_NS_URI;
68 }
69
70 /**
71 * @see javax.xml.namespace.NamespaceContext#getPrefix(String)
72 * @param uri The URI
73 * @return nothing.
74 * @throws java.lang.UnsupportedOperationException
75 */
76 public String getPrefix(String uri) {
77 throw new UnsupportedOperationException();
78 }
79
80 /**
81 * @see javax.xml.namespace.NamespaceContext#getPrefixes(java.lang.String)
82 * @param uri The URI
83 * @return nothing
84 * @throws java.lang.UnsupportedOperationException
85 */
86 public Iterator getPrefixes(String uri) {
87 throw new UnsupportedOperationException();
88 }
89 }
90 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org