001/* NamingContext.java --
002   Copyright (C) 2005 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package org.omg.CosNaming;
040
041import org.omg.CORBA.portable.IDLEntity;
042import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
043import org.omg.CosNaming.NamingContextPackage.CannotProceed;
044import org.omg.CosNaming.NamingContextPackage.InvalidName;
045import org.omg.CosNaming.NamingContextPackage.NotEmpty;
046import org.omg.CosNaming.NamingContextPackage.NotFound;
047
048/**
049 * The interface for the naming context. The naming context can
050 * store (bound) and retrieve (resolve) the named objects or
051 * named child contexts. These operations are defined in a separate
052 * interface.
053 *
054 * @see NamingContextExt
055 *
056 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
057 */
058public interface NamingContext
059  extends NamingContextOperations, org.omg.CORBA.Object, IDLEntity
060{
061  /**
062   * Gives the object a name, valid in this context.
063   *
064   * @param a_name the name, being given to the object.
065   * @param an_object the object, being named.
066   *
067   * @throws AlreadyBound if the object is already named in this context.
068   * @throws InvalidName if the name has zero length or otherwise invalid.
069   *
070   * @specnote since 1.3 this method has moved into NamingContextOperations.
071   */
072  void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
073     throws NotFound, CannotProceed, InvalidName, AlreadyBound;
074
075  /**
076   * Gives a child context name, valid in this context.
077   *
078   * @param a_name the name, being given to the child context.
079   * @param a_context the child context being named.
080   *
081   * @throws AlreadyBound if the child context is already named in
082   * the current context.
083   *
084   * @specnote since 1.3 this method has moved into NamingContextOperations.
085   */
086  void bind_context(NameComponent[] a_name, NamingContext a_context)
087             throws NotFound, CannotProceed, InvalidName, AlreadyBound;
088
089  /**
090   * Create a new context and give it a given name (bound it)
091   * in the current context.
092   *
093   * @param a_name the name being given to the new context.
094   *
095   * @return the newly created context.
096   *
097   * @throws AlreadyBound if the name is already in use.
098   * @throws InvalidName if the name has zero length or otherwise invalid.
099   *
100   * @specnote since 1.3 this method has moved into NamingContextOperations.
101   */
102  NamingContext bind_new_context(NameComponent[] a_name)
103                          throws NotFound, AlreadyBound, CannotProceed,
104                                 InvalidName;
105
106  /**
107   * Destroy this context (must be empty).
108   * @throws NotEmpty if the context being destroyed is not empty.
109   *
110   * @specnote since 1.3 this method has moved into NamingContextOperations.
111   */
112  void destroy()
113        throws NotEmpty;
114
115  /**
116   * Iterate over all bindings, defined in this namind context.
117   *
118   * @param amount the maximal number of context to return in the
119   * holder a_list. The remaining bindings are accessible via iterator
120   * an_iter. If the parameter amount is zero, all bindings are accessed only
121   * via this iterator.
122   *
123   * @param a_list the holder, where the returned bindigs are stored.
124   * @param an_iter the iterator that can be used to access the remaining
125   * bindings.
126   *
127   * @specnote since 1.3 this method has moved into NamingContextOperations.
128   */
129  void list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter);
130
131  /**
132   * Creates a new naming context, not bound to any name.
133   *
134   * @specnote since 1.3 this method has moved into NamingContextOperations.
135   */
136  NamingContext new_context();
137
138  /**
139   * Names or renames the object.
140   *
141   * @param a_name the new name, being given to the object. If
142   * the object is already named in this context, it is renamed.
143   *
144   * @param an_object the object, being named.
145   *
146   * @throws InvalidName if the name has zero length or otherwise invalid.
147   *
148   * @specnote since 1.3 this method has moved into NamingContextOperations.
149   */
150  void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object)
151       throws NotFound, CannotProceed, InvalidName;
152
153  /**
154   * Names or renames the child context.
155   * If the child context is already named in
156   * the current context, it is renamed.
157   *
158   * @param a_name the name, being given to the child context.
159   * @param a_context the child context being named.
160   *
161   * @throws InvalidName if the name has zero length or otherwise invalid.
162   *
163   * @specnote since 1.3 this method has moved into NamingContextOperations.
164   */
165  void rebind_context(NameComponent[] a_name, NamingContext a_context)
166               throws NotFound, CannotProceed, InvalidName;
167
168  /**
169   * Get the object, bound to the specified name in this
170   * context.
171   *
172   * @param a_name the object name.
173   *
174   * @return the object, matching this name. The client
175   * usually casts or narrows (using the helper) the returned value
176   * to the more specific type.
177   *
178   * @throws NotFound
179   * @throws InvalidName if the name has zero length or otherwise invalid.
180   *
181   * @specnote since 1.3 this method has moved into NamingContextOperations.
182   */
183  org.omg.CORBA.Object resolve(NameComponent[] a_name)
184                        throws NotFound, CannotProceed, InvalidName;
185
186  /**
187   * Removes the name from the binding context.
188   *
189   * @param a_name a name to remove.
190   *
191   * @throws InvalidName if the name has zero length or otherwise invalid.
192   *
193   * @specnote since 1.3 this method has moved into NamingContextOperations.
194   */
195  void unbind(NameComponent[] a_name)
196       throws NotFound, CannotProceed, InvalidName;
197}