1 /* NamingContext.java --
2    Copyright (C) 2005 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.CORBA.portable.IDLEntity;
42 import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
43 import org.omg.CosNaming.NamingContextPackage.CannotProceed;
44 import org.omg.CosNaming.NamingContextPackage.InvalidName;
45 import org.omg.CosNaming.NamingContextPackage.NotEmpty;
46 import org.omg.CosNaming.NamingContextPackage.NotFound;
47 
48 /**
49  * The naming context operations. The naming context can
50  * store (bound) and retrieve (resolve) the named objects or
51  * named child contexts.
52  *
53  * @see NamingContextExtOperations
54  *
55  * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
56  */
57 public interface NamingContextOperations
58   extends IDLEntity
59 {
60   /**
61    * Gives the object a name, valid in this context.
62    *
63    * @param a_name the name, being given to the object.
64    * @param an_object the object, being named.
65    *
66    * @throws AlreadyBound if the object is already named in this context.
67    * @throws InvalidName if the name has zero length or otherwise invalid.
68    */
bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)69   void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
70      throws NotFound, CannotProceed, InvalidName, AlreadyBound;
71 
72   /**
73    * Gives a child context name, valid in this context.
74    *
75    * @param a_name the name, being given to the child context.
76    * @param a_context the child context being named.
77    *
78    * @throws AlreadyBound if the child context is already named in
79    * the current context.
80    */
bind_context(NameComponent[] a_name, NamingContext a_context)81   void bind_context(NameComponent[] a_name, NamingContext a_context)
82              throws NotFound, CannotProceed, InvalidName, AlreadyBound;
83 
84   /**
85    * Create a new context and give it a given name (bound it)
86    * in the current context.
87    *
88    * @param a_name the name being given to the new context.
89    *
90    * @return the newly created context.
91    *
92    * @throws AlreadyBound if the name is already in use.
93    * @throws InvalidName if the name has zero length or otherwise invalid.
94    */
bind_new_context(NameComponent[] a_name)95   NamingContext bind_new_context(NameComponent[] a_name)
96                           throws NotFound, AlreadyBound, CannotProceed,
97                                  InvalidName;
98 
99   /**
100    * Destroy this context (must be empty).
101    * @throws NotEmpty if the context being destroyed is not empty.
102    */
destroy()103   void destroy()
104         throws NotEmpty;
105 
106   /**
107    * Iterate over all bindings, defined in this namind context.
108    *
109    * @param amount the maximal number of context to return in the
110    * holder a_list. The remaining bindings are accessible via iterator
111    * an_iter. If the parameter amount is zero, all bindings are accessed only
112    * via this iterator.
113    *
114    * @param a_list the holder, where the returned bindigs are stored.
115    * @param an_iter the iterator that can be used to access the remaining
116    * bindings.
117    */
list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter)118   void list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter);
119 
120   /**
121    * Creates a new naming context, not bound to any name.
122    */
new_context()123   NamingContext new_context();
124 
125   /**
126    * Names or renames the object.
127    *
128    * @param a_name the new name, being given to the object. If
129    * the object is already named in this context, it is renamed.
130    *
131    * @param an_object the object, being named.
132    *
133    * @throws InvalidName if the name has zero length or otherwise invalid.
134    */
rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)135   void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
136        throws NotFound, CannotProceed, InvalidName;
137 
138   /**
139    * Names or renames the child context.
140    * If the child context is already named in
141    * the current context, it is renamed.
142    *
143    * @param a_name the name, being given to the child context.
144    * @param a_context the child context being named.
145    *
146    * @throws InvalidName if the name has zero length or otherwise invalid.
147    */
rebind_context(NameComponent[] a_name, NamingContext a_context)148   void rebind_context(NameComponent[] a_name, NamingContext a_context)
149                throws NotFound, CannotProceed, InvalidName;
150 
151   /**
152    * Get the object, bound to the specified name in this
153    * context.
154    *
155    * @param a_name the object name.
156    *
157    * @return the object, matching this name. The client
158    * usually casts or narrows (using the helper) the returned value
159    * to the more specific type.
160    *
161    * @throws NotFound
162    * @throws InvalidName if the name has zero length or otherwise invalid.
163    */
resolve(NameComponent[] a_name)164   org.omg.CORBA.Object resolve(NameComponent[] a_name)
165                         throws NotFound, CannotProceed, InvalidName;
166 
167   /**
168    * Removes the name from the binding context.
169    *
170    * @param a_name a name to remove.
171    *
172    * @throws InvalidName if the name has zero length or otherwise invalid.
173    */
unbind(NameComponent[] a_name)174   void unbind(NameComponent[] a_name)
175        throws NotFound, CannotProceed, InvalidName;
176 }
177