View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.om.registry;
18  
19  import java.util.Enumeration;
20  import java.util.Iterator;
21  
22  /***
23   * Represents all items within Jetspeed that hold configuration information.
24   *
25   * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
26   * @author <a href="raphael@apache.org">RaphaŽl Luta</a>
27   * @version $Id: Registry.java,v 1.7 2004/02/23 03:11:39 jford Exp $
28   */
29  public interface Registry
30  {
31  
32      /***
33       * Get the number of entries within the Registry.
34       *
35       * @return the number of elements in this Registry instance
36       */
37      public int getEntryCount();
38  
39      /***
40       * Creates a new RegistryEntry instance compatible with the current
41       * Registry instance implementation
42       *
43       * @return the newly created RegistryEntry
44       */
45      public RegistryEntry createEntry();
46  
47      /***
48       * Get the entry in the registry with the specified name
49       *
50       * @throws RegistryException if the given 'name' does not exist within the
51       *                         Registry
52       */
53      public RegistryEntry getEntry( String name ) throws RegistryException;
54  
55      /***
56       * Set the entry in the registry with the specified name and Entry
57       *
58       * @throws RegistryException if the given 'name' does not exist within the
59       *                          Registry
60       */
61      public void setEntry( RegistryEntry entry ) throws RegistryException;
62  
63      /***
64       * Add the given entry to the registry with the given name.
65       *
66       * @throws RegistryException if the given 'name' already exists within the
67       *                         Registry
68       */
69      public void addEntry( RegistryEntry entry ) throws RegistryException;
70  
71      /***
72       * Tests if an entry with the specified name exists within the Registry
73       *
74       * @param name the name of the entry that we are looking for
75       * @return true if an entry with this name exists in the Registry
76       */
77      public boolean hasEntry( String name );
78  
79      /***
80       * Removes the given entry from the Registry
81       *
82       * @param entry the RegistryEntry to remove
83       */
84      public void removeEntry( RegistryEntry entry );
85  
86      /***
87       * Removes the given entry from the Registry
88       *
89       * @param name the name of the entry to remove from the Registry
90       */
91      public void removeEntry( String name );
92  
93      /***
94       * Get all entries within this Registry
95       *
96       * @return an Enumeration of all unordered current entries
97       */
98      public Enumeration getEntries();
99  
100     /***
101      * List all the entry names within this Registry
102      *
103      * @return an Iterator over an unordered list of current entry names
104      */
105     public Iterator listEntryNames();
106 
107     /***
108      * Get all entries within this Registry as an array
109      *
110      * @return an unordered array of current registry entries
111      */
112     public RegistryEntry[] toArray();
113 
114 }
115 
116