KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > NamespaceRegistry


1 /*
2  * $Id: NamespaceRegistry.java,v 1.2 2004/07/24 00:16:21 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr;
25
26 /**
27  * The <code>Item</code> is the base interface of <code>{@link Node}</code>
28  * and <code>{@link Property}</code>.
29  *
30  * @author Peeter Piegaze
31  */

32 public interface NamespaceRegistry {
33
34   /**
35    * Set a mapping from prefix to URI. To remove an existing mapping, set its
36    * prefix to null. Mappings are one-to-one: remapping an existing URI to a
37    * new prefix will erase the old prefix. Similarly, remapping an existing
38    * prefix to a new URI will erase the old URI. An attempt to change a
39    * built-in mapping (jcr, nt, mix, pt, sv) or to remove such a mapping will
40    * throw an NamespaceException. An implementation may similarly prevent
41    * the removal or alteration of additional implementation-specific,
42    * built-in namespaces.
43    *
44    * @param prefix The prefix to be mapped
45    * @param uri The URI to be mapped
46    * @throws NamespaceException if an attempt is madeto change or delete a
47    * built-in mapping
48    * @throws RepositoryException if another error occurs
49    */

50   public void setMapping(String JavaDoc prefix, String JavaDoc uri) throws NamespaceException, RepositoryException;
51
52   /**
53    * Returns an array holding all currently registered prefixes.
54    *
55    * @return a string array
56    */

57   public String JavaDoc[] getPrefixes();
58
59   /**
60    * Returns an array holding all currently registered URIs.
61    *
62    * @return a string array
63    */

64   public String JavaDoc[] getURIs();
65
66   /**
67    * Returns the URI to which the given prefix is mapped.
68    *
69    * @param prefix a string
70    * @return a string
71    */

72   public String JavaDoc getURI(String JavaDoc prefix) throws NamespaceException, RepositoryException;
73
74   /**
75    * Returns the prefix to which the given uri is mapped
76    *
77    * @param uri a string
78    * @return a string
79    */

80   public String JavaDoc getPrefix(String JavaDoc uri) throws NamespaceException, RepositoryException;
81 }
82
Popular Tags