1 /* NamingContext.java --
2    Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 
38 
39 package org.omg.CosNaming;
40 
41 import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
42 import org.omg.CosNaming.NamingContextPackage.CannotProceed;
43 import org.omg.CosNaming.NamingContextPackage.InvalidName;
44 import org.omg.CosNaming.NamingContextPackage.NotEmpty;
45 import org.omg.CosNaming.NamingContextPackage.NotFound;
46 
47 /**
48  * The naming context operations. The naming context can
49  * store (bound) and retrieve (resolve) the named objects or
50  * named child contexts.
51  *
52  * @see NamingContextExtOperations
53  *
54  * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
55  */
56 public interface NamingContextOperations
57 {
58   /**
59    * Gives the object a name, valid in this context.
60    *
61    * @param a_name the name, being given to the object.
62    * @param an_object the object, being named.
63    *
64    * @throws AlreadyBound if the object is already named in this context.
65    * @throws InvalidName if the name has zero length or otherwise invalid.
66    */
bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)67   void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
68      throws NotFound, CannotProceed, InvalidName, AlreadyBound;
69 
70   /**
71    * Gives a child context name, valid in this context.
72    *
73    * @param a_name the name, being given to the child context.
74    * @param a_context the child context being named.
75    *
76    * @throws AlreadyBound if the child context is already named in
77    * the current context.
78    */
bind_context(NameComponent[] a_name, NamingContext a_context)79   void bind_context(NameComponent[] a_name, NamingContext a_context)
80              throws NotFound, CannotProceed, InvalidName, AlreadyBound;
81 
82   /**
83    * Create a new context and give it a given name (bound it)
84    * in the current context.
85    *
86    * @param a_name the name being given to the new context.
87    *
88    * @return the newly created context.
89    *
90    * @throws AlreadyBound if the name is already in use.
91    * @throws InvalidName if the name has zero length or otherwise invalid.
92    */
bind_new_context(NameComponent[] a_name)93   NamingContext bind_new_context(NameComponent[] a_name)
94                           throws NotFound, AlreadyBound, CannotProceed,
95                                  InvalidName;
96 
97   /**
98    * Destroy this context (must be empty).
99    * @throws NotEmpty if the context being destroyed is not empty.
100    */
destroy()101   void destroy()
102         throws NotEmpty;
103 
104   /**
105    * Iterate over all bindings, defined in this namind context.
106    *
107    * @param amount the maximal number of context to return in the
108    * holder a_list. The remaining bindings are accessible via iterator
109    * an_iter. If the parameter amount is zero, all bindings are accessed only
110    * via this iterator.
111    *
112    * @param a_list the holder, where the returned bindigs are stored.
113    * @param an_iter the iterator that can be used to access the remaining
114    * bindings.
115    */
list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter)116   void list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter);
117 
118   /**
119    * Creates a new naming context, not bound to any name.
120    */
new_context()121   NamingContext new_context();
122 
123   /**
124    * Names or renames the object.
125    *
126    * @param a_name the new name, being given to the object. If
127    * the object is already named in this context, it is renamed.
128    *
129    * @param an_object the object, being named.
130    *
131    * @throws InvalidName if the name has zero length or otherwise invalid.
132    */
rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)133   void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
134        throws NotFound, CannotProceed, InvalidName;
135 
136   /**
137    * Names or renames the child context.
138    * If the child context is already named in
139    * the current context, it is renamed.
140    *
141    * @param a_name the name, being given to the child context.
142    * @param a_context the child context being named.
143    *
144    * @throws InvalidName if the name has zero length or otherwise invalid.
145    */
rebind_context(NameComponent[] a_name, NamingContext a_context)146   void rebind_context(NameComponent[] a_name, NamingContext a_context)
147                throws NotFound, CannotProceed, InvalidName;
148 
149   /**
150    * Get the object, bound to the specified name in this
151    * context.
152    *
153    * @param a_name the object name.
154    *
155    * @return the object, matching this name. The client
156    * usually casts or narrows (using the helper) the returned value
157    * to the more specific type.
158    *
159    * @throws NotFound
160    * @throws InvalidName if the name has zero length or otherwise invalid.
161    */
resolve(NameComponent[] a_name)162   org.omg.CORBA.Object resolve(NameComponent[] a_name)
163                         throws NotFound, CannotProceed, InvalidName;
164 
165   /**
166    * Removes the name from the binding context.
167    *
168    * @param a_name a name to remove.
169    *
170    * @throws InvalidName if the name has zero length or otherwise invalid.
171    */
unbind(NameComponent[] a_name)172   void unbind(NameComponent[] a_name)
173        throws NotFound, CannotProceed, InvalidName;
174 }
175