001/* NamingContext.java -- 002 Copyright (C) 2005, 2006 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.CosNaming.NamingContextPackage.AlreadyBound; 042import org.omg.CosNaming.NamingContextPackage.CannotProceed; 043import org.omg.CosNaming.NamingContextPackage.InvalidName; 044import org.omg.CosNaming.NamingContextPackage.NotEmpty; 045import org.omg.CosNaming.NamingContextPackage.NotFound; 046 047/** 048 * The naming context operations. The naming context can 049 * store (bound) and retrieve (resolve) the named objects or 050 * named child contexts. 051 * 052 * @see NamingContextExtOperations 053 * 054 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 055 */ 056public interface NamingContextOperations 057{ 058 /** 059 * Gives the object a name, valid in this context. 060 * 061 * @param a_name the name, being given to the object. 062 * @param an_object the object, being named. 063 * 064 * @throws AlreadyBound if the object is already named in this context. 065 * @throws InvalidName if the name has zero length or otherwise invalid. 066 */ 067 void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object) 068 throws NotFound, CannotProceed, InvalidName, AlreadyBound; 069 070 /** 071 * Gives a child context name, valid in this context. 072 * 073 * @param a_name the name, being given to the child context. 074 * @param a_context the child context being named. 075 * 076 * @throws AlreadyBound if the child context is already named in 077 * the current context. 078 */ 079 void bind_context(NameComponent[] a_name, NamingContext a_context) 080 throws NotFound, CannotProceed, InvalidName, AlreadyBound; 081 082 /** 083 * Create a new context and give it a given name (bound it) 084 * in the current context. 085 * 086 * @param a_name the name being given to the new context. 087 * 088 * @return the newly created context. 089 * 090 * @throws AlreadyBound if the name is already in use. 091 * @throws InvalidName if the name has zero length or otherwise invalid. 092 */ 093 NamingContext bind_new_context(NameComponent[] a_name) 094 throws NotFound, AlreadyBound, CannotProceed, 095 InvalidName; 096 097 /** 098 * Destroy this context (must be empty). 099 * @throws NotEmpty if the context being destroyed is not empty. 100 */ 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 */ 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 */ 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 */ 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 */ 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 */ 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 */ 172 void unbind(NameComponent[] a_name) 173 throws NotFound, CannotProceed, InvalidName; 174}