src/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java

Thu, 31 Aug 2017 18:10:36 +0800

author
aoqi
date
Thu, 31 Aug 2017 18:10:36 +0800
changeset 748
6845b95cba6b
parent 158
91006f157c46
parent 0
7ef37b2cdcad
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.corba.se.impl.naming.pcosnaming;
aoqi@0 27
aoqi@0 28
aoqi@0 29 import org.omg.CORBA.Object;
aoqi@0 30 import org.omg.CORBA.SystemException;
aoqi@0 31 import org.omg.CORBA.BAD_PARAM;
aoqi@0 32 import org.omg.CORBA.CompletionStatus;
aoqi@0 33 import org.omg.CORBA.Policy;
aoqi@0 34 import org.omg.PortableServer.POA;
aoqi@0 35 import org.omg.PortableServer.LifespanPolicyValue;
aoqi@0 36 import org.omg.PortableServer.RequestProcessingPolicyValue;
aoqi@0 37 import org.omg.PortableServer.IdAssignmentPolicyValue;
aoqi@0 38 import org.omg.PortableServer.ServantRetentionPolicyValue;
aoqi@0 39
aoqi@0 40 import org.omg.CosNaming.*;
aoqi@0 41 import org.omg.CosNaming.NamingContextPackage.*;
aoqi@0 42 import org.omg.CosNaming.NamingContextExtPackage.*;
aoqi@0 43
aoqi@0 44 import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
aoqi@0 45 import com.sun.corba.se.impl.naming.cosnaming.NamingUtils;
aoqi@0 46
aoqi@0 47 import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
aoqi@0 48
aoqi@0 49 import com.sun.corba.se.spi.orb.ORB;
aoqi@0 50 import com.sun.corba.se.spi.logging.CORBALogDomains;
aoqi@0 51
aoqi@0 52 import com.sun.corba.se.impl.orbutil.ORBConstants;
aoqi@0 53 import com.sun.corba.se.impl.logging.NamingSystemException;
aoqi@0 54
aoqi@0 55 import java.io.Serializable;
aoqi@0 56 import java.util.Hashtable;
aoqi@0 57
aoqi@0 58 /**
aoqi@0 59 * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and
aoqi@0 60 * NamingContextExt interface.
aoqi@0 61 * <p>
aoqi@0 62 * The operations bind(), rebind(), bind_context() and rebind_context()
aoqi@0 63 * are all really implemented by doBind(). resolve() is really implemented
aoqi@0 64 * by doResolve(), unbind() by doUnbind(). list(), new_context() and
aoqi@0 65 * destroy() uses the NamingContextDataStore interface directly. All the
aoqi@0 66 * doX() methods are public static.
aoqi@0 67 * They synchronize on the NamingContextDataStore object.
aoqi@0 68 * <p>
aoqi@0 69 * None of the methods here are Synchronized because These methods will be
aoqi@0 70 * invoked from Super class's doBind( ), doResolve( ) which are already
aoqi@0 71 * Synchronized.
aoqi@0 72 */
aoqi@0 73
aoqi@0 74
aoqi@0 75 public class NamingContextImpl
aoqi@0 76 extends NamingContextExtPOA
aoqi@0 77 implements NamingContextDataStore, Serializable
aoqi@0 78 {
aoqi@0 79
aoqi@0 80 // The ORB is required to do string_to_object() operations
aoqi@0 81 // All the references are stored in the files in the form of IOR strings
aoqi@0 82 private transient ORB orb;
aoqi@0 83
aoqi@0 84 // The ObjectKey will be in the format NC<Index> which uniquely identifies
aoqi@0 85 // The NamingContext internaly
aoqi@0 86 private final String objKey;
aoqi@0 87
aoqi@0 88 // Hash table contains all the entries in the NamingContexts. The
aoqi@0 89 // CORBA.Object references will be stored in the form of IOR strings
aoqi@0 90 // and the Child Naming Contexts will have it's key as the entry in the
aoqi@0 91 // table. This table is written into File everytime an update is made
aoqi@0 92 // on this context.
aoqi@0 93 private final Hashtable theHashtable = new Hashtable( );
aoqi@0 94
aoqi@0 95 // The NameServiceHandle is required to get the ObjectId from the
aoqi@0 96 // NamingContext's references. These references are created using
aoqi@0 97 // POA in the NameService.
aoqi@0 98 private transient NameService theNameServiceHandle;
aoqi@0 99
aoqi@0 100 // ServantManager is the single point of contact to Read, Write and
aoqi@0 101 // Update the NamingContextFile
aoqi@0 102 private transient ServantManagerImpl theServantManagerImplHandle;
aoqi@0 103
aoqi@0 104 // All the INS (Interoperable Naming Service) methods are defined in this class
aoqi@0 105 // All the calls to INS will be delegated to this class.
aoqi@0 106 private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl;
aoqi@0 107
aoqi@0 108 private transient NamingSystemException readWrapper ;
aoqi@0 109
aoqi@0 110 private transient NamingSystemException updateWrapper ;
aoqi@0 111
aoqi@0 112 private static POA biPOA = null;
aoqi@0 113
aoqi@0 114 /**
aoqi@0 115 * Create a naming context servant.
aoqi@0 116 * Runs the super constructor.
aoqi@0 117 * @param orb an ORB object.
aoqi@0 118 * @param objKey as String
aoqi@0 119 * @param TheNameService as NameService
aoqi@0 120 * @param TheServantManagerImpl as ServantManagerImpl
aoqi@0 121 * @exception java.lang.Exception a Java exception.
aoqi@0 122 */
aoqi@0 123
aoqi@0 124 public NamingContextImpl(ORB orb, String objKey,
aoqi@0 125 NameService theNameService, ServantManagerImpl theServantManagerImpl )
aoqi@0 126 throws Exception
aoqi@0 127 {
aoqi@0 128 super();
aoqi@0 129
aoqi@0 130 this.orb = orb;
aoqi@0 131 readWrapper = NamingSystemException.get( orb,
aoqi@0 132 CORBALogDomains.NAMING_READ ) ;
aoqi@0 133 updateWrapper = NamingSystemException.get( orb,
aoqi@0 134 CORBALogDomains.NAMING_UPDATE ) ;
aoqi@0 135
aoqi@0 136 debug = true ; // orb.namingDebugFlag ;
aoqi@0 137 this.objKey = objKey;
aoqi@0 138 theNameServiceHandle = theNameService;
aoqi@0 139 theServantManagerImplHandle = theServantManagerImpl;
aoqi@0 140 insImpl =
aoqi@0 141 new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
aoqi@0 142 }
aoqi@0 143
aoqi@0 144 com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( )
aoqi@0 145 {
aoqi@0 146 if( insImpl == null )
aoqi@0 147 {
aoqi@0 148 // insImpl will be null if the NamingContext graph is rebuilt from
aoqi@0 149 // the persistence store.
aoqi@0 150 insImpl =
aoqi@0 151 new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
aoqi@0 152 }
aoqi@0 153 return insImpl;
aoqi@0 154 }
aoqi@0 155
aoqi@0 156
aoqi@0 157 public void setRootNameService( NameService theNameService ) {
aoqi@0 158 theNameServiceHandle = theNameService;
aoqi@0 159 }
aoqi@0 160
aoqi@0 161 public void setORB( ORB theOrb ) {
aoqi@0 162 orb = theOrb;
aoqi@0 163 }
aoqi@0 164
aoqi@0 165 public void setServantManagerImpl(
aoqi@0 166 ServantManagerImpl theServantManagerImpl )
aoqi@0 167 {
aoqi@0 168 theServantManagerImplHandle = theServantManagerImpl;
aoqi@0 169 }
aoqi@0 170
aoqi@0 171 public POA getNSPOA( ) {
aoqi@0 172 return theNameServiceHandle.getNSPOA( );
aoqi@0 173 }
aoqi@0 174
aoqi@0 175
aoqi@0 176
aoqi@0 177
aoqi@0 178 /**
aoqi@0 179 * Bind an object under a name in this NamingContext. If the name
aoqi@0 180 * contains multiple (n) components, n-1 will be resolved in this
aoqi@0 181 * NamingContext and the object bound in resulting NamingContext.
aoqi@0 182 * An exception is thrown if a binding with the supplied name already
aoqi@0 183 * exists. If the
aoqi@0 184 * object to be bound is a NamingContext it will not participate in
aoqi@0 185 * a recursive resolve.
aoqi@0 186 * @param n a sequence of NameComponents which is the name under which
aoqi@0 187 * the object will be bound.
aoqi@0 188 * @param obj the object reference to be bound.
aoqi@0 189 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 190 * components was supplied, but the first component could not be
aoqi@0 191 * resolved.
aoqi@0 192 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 193 * in resolving the n-1 components of the supplied name.
aoqi@0 194 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 195 * is invalid (i.e., has length less than 1).
aoqi@0 196 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound The supplied name
aoqi@0 197 * is already bound.
aoqi@0 198 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 199 * @see doBind
aoqi@0 200 */
aoqi@0 201 public void bind(NameComponent[] n, org.omg.CORBA.Object obj)
aoqi@0 202 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 203 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 204 org.omg.CosNaming.NamingContextPackage.InvalidName,
aoqi@0 205 org.omg.CosNaming.NamingContextPackage.AlreadyBound
aoqi@0 206 {
aoqi@0 207 if( obj == null ) {
aoqi@0 208 throw updateWrapper.objectIsNull() ;
aoqi@0 209 }
aoqi@0 210
aoqi@0 211 if (debug)
aoqi@0 212 dprint("bind " + nameToString(n) + " to " + obj);
aoqi@0 213 // doBind implements all four flavors of binding
aoqi@0 214 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 215 doBind(impl,n,obj,false,BindingType.nobject);
aoqi@0 216 }
aoqi@0 217
aoqi@0 218 /**
aoqi@0 219 * Bind a NamingContext under a name in this NamingContext. If the name
aoqi@0 220 * contains multiple (n) components, n-1 will be resolved in this
aoqi@0 221 * NamingContext and the object bound in resulting NamingContext.
aoqi@0 222 * An exception is thrown if a binding with the supplied name already
aoqi@0 223 * exists. The NamingContext will participate in recursive resolving.
aoqi@0 224 * @param n a sequence of NameComponents which is the name under which
aoqi@0 225 * the object will be bound.
aoqi@0 226 * @param obj the NamingContect object reference to be bound.
aoqi@0 227 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 228 * components was supplied, but the first component could not be
aoqi@0 229 * resolved.
aoqi@0 230 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 231 * in resolving the n-1 components of the supplied name.
aoqi@0 232 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 233 * is invalid (i.e., has length less than 1).
aoqi@0 234 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
aoqi@0 235 * already bound under the supplied name.
aoqi@0 236 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 237 * @see doBind
aoqi@0 238 */
aoqi@0 239 public void bind_context(NameComponent[] n, NamingContext nc)
aoqi@0 240 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 241 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 242 org.omg.CosNaming.NamingContextPackage.InvalidName,
aoqi@0 243 org.omg.CosNaming.NamingContextPackage.AlreadyBound
aoqi@0 244 {
aoqi@0 245 if( nc == null ) {
aoqi@0 246 throw updateWrapper.objectIsNull() ;
aoqi@0 247 }
aoqi@0 248 // doBind implements all four flavors of binding
aoqi@0 249 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 250 doBind(impl,n,nc,false,BindingType.ncontext);
aoqi@0 251 }
aoqi@0 252
aoqi@0 253 /**
aoqi@0 254 * Bind an object under a name in this NamingContext. If the name
aoqi@0 255 * contains multiple (n) components, n-1 will be resolved in this
aoqi@0 256 * NamingContext and the object bound in resulting NamingContext.
aoqi@0 257 * If a binding under the supplied name already exists it will be
aoqi@0 258 * unbound first. If the
aoqi@0 259 * object to be bound is a NamingContext it will not participate in
aoqi@0 260 * a recursive resolve.
aoqi@0 261 * @param n a sequence of NameComponents which is the name under which
aoqi@0 262 * the object will be bound.
aoqi@0 263 * @param obj the object reference to be bound.
aoqi@0 264 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 265 * components was supplied, but the first component could not be
aoqi@0 266 * resolved.
aoqi@0 267 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 268 * in resolving the n-1 components of the supplied name.
aoqi@0 269 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 270 * is invalid (i.e., has length less than 1).
aoqi@0 271 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 272 * @see doBind
aoqi@0 273 */
aoqi@0 274 public void rebind(NameComponent[] n, org.omg.CORBA.Object obj)
aoqi@0 275 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 276 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 277 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 278 {
aoqi@0 279 if( obj == null )
aoqi@0 280 {
aoqi@0 281 throw updateWrapper.objectIsNull() ;
aoqi@0 282 }
aoqi@0 283 try {
aoqi@0 284 if (debug)
aoqi@0 285 dprint("rebind " + nameToString(n) + " to " + obj);
aoqi@0 286 // doBind implements all four flavors of binding
aoqi@0 287 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 288 doBind(impl,n,obj,true,BindingType.nobject);
aoqi@0 289 } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
aoqi@0 290 // This should not happen
aoqi@0 291 throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
aoqi@0 292 }
aoqi@0 293 }
aoqi@0 294
aoqi@0 295 /**
aoqi@0 296 * Bind a NamingContext under a name in this NamingContext. If the name
aoqi@0 297 * contains multiple (n) components, the first n-1 components will be
aoqi@0 298 * resolved in this
aoqi@0 299 * NamingContext and the object bound in resulting NamingContext.
aoqi@0 300 * If a binding under the supplied name already exists it will be
aoqi@0 301 * unbound first. The NamingContext will participate in recursive resolving.
aoqi@0 302 * @param n a sequence of NameComponents which is the name under which
aoqi@0 303 * the object will be bound.
aoqi@0 304 * @param obj the object reference to be bound.
aoqi@0 305 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 306 * components was supplied, but the first component could not be
aoqi@0 307 * resolved.
aoqi@0 308 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 309 * in resolving the n-1 components of the supplied name.
aoqi@0 310 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 311 * is invalid (i.e., has length less than 1).
aoqi@0 312 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 313 * @see doBind
aoqi@0 314 */
aoqi@0 315 public void rebind_context(NameComponent[] n, NamingContext nc)
aoqi@0 316 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 317 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 318 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 319 {
aoqi@0 320 try {
aoqi@0 321 if (debug)
aoqi@0 322 dprint("rebind_context " + nameToString(n) + " to " + nc);
aoqi@0 323 // doBind implements all four flavors of binding
aoqi@0 324 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 325 doBind(impl,n,nc,true,BindingType.ncontext);
aoqi@0 326 } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
aoqi@0 327 // This should not happen
aoqi@0 328 throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ;
aoqi@0 329 }
aoqi@0 330 }
aoqi@0 331
aoqi@0 332 /**
aoqi@0 333 * Resolve a name in this NamingContext and return the object reference
aoqi@0 334 * bound to the name. If the name contains multiple (n) components,
aoqi@0 335 * the first component will be resolved in this NamingContext and the
aoqi@0 336 * remaining components resolved in the resulting NamingContext, provided
aoqi@0 337 * that the NamingContext bound to the first component of the name was
aoqi@0 338 * bound with bind_context().
aoqi@0 339 * @param n a sequence of NameComponents which is the name to be resolved.
aoqi@0 340 * @return the object reference bound under the supplied name.
aoqi@0 341 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 342 * components was supplied, but the first component could not be
aoqi@0 343 * resolved.
aoqi@0 344 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 345 * in resolving the n-1 components of the supplied name.
aoqi@0 346 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 347 * is invalid (i.e., has length less than 1).
aoqi@0 348 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 349 * @see doResolve
aoqi@0 350 */
aoqi@0 351 public org.omg.CORBA.Object resolve(NameComponent[] n)
aoqi@0 352 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 353 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 354 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 355 {
aoqi@0 356 if (debug)
aoqi@0 357 dprint("resolve " + nameToString(n));
aoqi@0 358 // doResolve actually resolves
aoqi@0 359 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 360 return doResolve(impl,n);
aoqi@0 361 }
aoqi@0 362
aoqi@0 363 /**
aoqi@0 364 * Remove a binding from this NamingContext. If the name contains
aoqi@0 365 * multiple (n) components, the first n-1 components will be resolved
aoqi@0 366 * from this NamingContext and the final component unbound in
aoqi@0 367 * the resulting NamingContext.
aoqi@0 368 * @param n a sequence of NameComponents which is the name to be unbound.
aoqi@0 369 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 370 * components was supplied, but the first component could not be
aoqi@0 371 * resolved.
aoqi@0 372 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 373 * in resolving the n-1 components of the supplied name.
aoqi@0 374 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 375 * is invalid (i.e., has length less than 1).
aoqi@0 376 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 377 * @see doUnbind
aoqi@0 378 */
aoqi@0 379 public void unbind(NameComponent[] n)
aoqi@0 380 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 381 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 382 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 383 {
aoqi@0 384 if (debug)
aoqi@0 385 dprint("unbind " + nameToString(n));
aoqi@0 386 // doUnbind actually unbinds
aoqi@0 387 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 388 doUnbind(impl,n);
aoqi@0 389 }
aoqi@0 390
aoqi@0 391 /**
aoqi@0 392 * List the contents of this NamingContest. A sequence of bindings
aoqi@0 393 * is returned (a BindingList) containing up to the number of requested
aoqi@0 394 * bindings, and a BindingIterator object reference is returned for
aoqi@0 395 * iterating over the remaining bindings.
aoqi@0 396 * @param how_many The number of requested bindings in the BindingList.
aoqi@0 397 * @param bl The BindingList as an out parameter.
aoqi@0 398 * @param bi The BindingIterator as an out parameter.
aoqi@0 399 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 400 * @see BindingListHolder
aoqi@0 401 * @see BindingIteratorImpl
aoqi@0 402 */
aoqi@0 403 public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
aoqi@0 404 {
aoqi@0 405 if (debug)
aoqi@0 406 dprint("list(" + how_many + ")");
aoqi@0 407 // List actually generates the list
aoqi@0 408 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 409 synchronized (impl) {
aoqi@0 410 impl.List(how_many,bl,bi);
aoqi@0 411 }
aoqi@0 412 if (debug && bl.value != null)
aoqi@0 413 dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
aoqi@0 414 "] + iterator: " + bi.value);
aoqi@0 415 }
aoqi@0 416
aoqi@0 417
aoqi@0 418 /**
aoqi@0 419 * Create a NamingContext object and return its object reference.
aoqi@0 420 * @return an object reference for a new NamingContext object implemented
aoqi@0 421 * by this Name Server.
aoqi@0 422 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 423 */
aoqi@0 424 public synchronized NamingContext new_context()
aoqi@0 425 {
aoqi@0 426 // Create actually creates a new naming context
aoqi@0 427 if (debug)
aoqi@0 428 dprint("new_context()");
aoqi@0 429 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 430 synchronized (impl) {
aoqi@0 431 return impl.NewContext();
aoqi@0 432 }
aoqi@0 433 }
aoqi@0 434
aoqi@0 435
aoqi@0 436 /**
aoqi@0 437 * Create a new NamingContext, bind it in this Naming Context and return
aoqi@0 438 * its object reference. This is equivalent to using new_context() followed
aoqi@0 439 * by bind_context() with the supplied name and the object reference for
aoqi@0 440 * the newly created NamingContext.
aoqi@0 441 * @param n a sequence of NameComponents which is the name to be unbound.
aoqi@0 442 * @return an object reference for a new NamingContext object implemented
aoqi@0 443 * by this Name Server, bound to the supplied name.
aoqi@0 444 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
aoqi@0 445 * already bound under the supplied name.
aoqi@0 446 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 447 * components was supplied, but the first component could not be
aoqi@0 448 * resolved.
aoqi@0 449 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 450 * in resolving the n-1 components of the supplied name.
aoqi@0 451 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 452 * is invalid (i.e., has length less than 1).
aoqi@0 453 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 454 * @see new_context
aoqi@0 455 * @see bind_context
aoqi@0 456 */
aoqi@0 457 public NamingContext bind_new_context(NameComponent[] n)
aoqi@0 458 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 459 org.omg.CosNaming.NamingContextPackage.AlreadyBound,
aoqi@0 460 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 461 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 462 {
aoqi@0 463 NamingContext nc = null;
aoqi@0 464 NamingContext rnc = null;
aoqi@0 465 try {
aoqi@0 466 if (debug)
aoqi@0 467 dprint("bind_new_context " + nameToString(n));
aoqi@0 468 // The obvious solution:
aoqi@0 469 nc = this.new_context();
aoqi@0 470 this.bind_context(n,nc);
aoqi@0 471 rnc = nc;
aoqi@0 472 nc = null;
aoqi@0 473 } finally {
aoqi@0 474 try {
aoqi@0 475 if(nc != null)
aoqi@0 476 nc.destroy();
aoqi@0 477 } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
aoqi@0 478 }
aoqi@0 479 }
aoqi@0 480 return rnc;
aoqi@0 481 }
aoqi@0 482
aoqi@0 483 /**
aoqi@0 484 * Destroy this NamingContext object. If this NamingContext contains
aoqi@0 485 * no bindings, the NamingContext is deleted.
aoqi@0 486 * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext
aoqi@0 487 * is not empty (i.e., contains bindings).
aoqi@0 488 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 489 */
aoqi@0 490 public void destroy()
aoqi@0 491 throws org.omg.CosNaming.NamingContextPackage.NotEmpty
aoqi@0 492 {
aoqi@0 493 if (debug)
aoqi@0 494 dprint("destroy ");
aoqi@0 495 NamingContextDataStore impl = (NamingContextDataStore)this;
aoqi@0 496 synchronized (impl) {
aoqi@0 497 if (impl.IsEmpty() == true)
aoqi@0 498 // The context is empty so it can be destroyed
aoqi@0 499 impl.Destroy();
aoqi@0 500 else
aoqi@0 501 // This context is not empty!
aoqi@0 502 throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
aoqi@0 503 }
aoqi@0 504 }
aoqi@0 505
aoqi@0 506 /**
aoqi@0 507 * Implements all four flavors of binding. It uses Resolve() to
aoqi@0 508 * check if a binding already exists (for bind and bind_context), and
aoqi@0 509 * unbind() to ensure that a binding does not already exist.
aoqi@0 510 * If the length of the name is 1, then Bind() is called with
aoqi@0 511 * the name and the object to bind. Otherwise, the first component
aoqi@0 512 * of the name is resolved in this NamingContext and the appropriate
aoqi@0 513 * form of bind passed to the resulting NamingContext.
aoqi@0 514 * This method is static for maximal reuse - even for extended naming
aoqi@0 515 * context implementations where the recursive semantics still apply.
aoqi@0 516 * @param impl an implementation of NamingContextDataStore
aoqi@0 517 * @param n a sequence of NameComponents which is the name under which
aoqi@0 518 * the object will be bound.
aoqi@0 519 * @param obj the object reference to be bound.
aoqi@0 520 * @param rebind Replace an existing binding or not.
aoqi@0 521 * @param bt Type of binding (as object or as context).
aoqi@0 522 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 523 * components was supplied, but the first component could not be
aoqi@0 524 * resolved.
aoqi@0 525 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 526 * in resolving the first component of the supplied name.
aoqi@0 527 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 528 * is invalid (i.e., has length less than 1).
aoqi@0 529 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is
aoqi@0 530 * already bound under the supplied name.
aoqi@0 531 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 532 * @see resolve
aoqi@0 533 * @see unbind
aoqi@0 534 * @see bind
aoqi@0 535 * @see bind_context
aoqi@0 536 * @see rebind
aoqi@0 537 * @see rebind_context
aoqi@0 538 */
aoqi@0 539 private void doBind(NamingContextDataStore impl,
aoqi@0 540 NameComponent[] n,
aoqi@0 541 org.omg.CORBA.Object obj,
aoqi@0 542 boolean rebind,
aoqi@0 543 org.omg.CosNaming.BindingType bt)
aoqi@0 544 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 545 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 546 org.omg.CosNaming.NamingContextPackage.InvalidName,
aoqi@0 547 org.omg.CosNaming.NamingContextPackage.AlreadyBound
aoqi@0 548 {
aoqi@0 549 // Valid name?
aoqi@0 550 if (n.length < 1)
aoqi@0 551 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 552
aoqi@0 553 // At bottom level?
aoqi@0 554 if (n.length == 1) {
aoqi@0 555 // The identifier must be set
aoqi@0 556 if( (n[0].id.length() == 0) && (n[0].kind.length() == 0) )
aoqi@0 557 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 558
aoqi@0 559 // Ensure synchronization of backend
aoqi@0 560 synchronized (impl) {
aoqi@0 561 // Yes: bind object in this context under the name
aoqi@0 562 BindingTypeHolder bth = new BindingTypeHolder();
aoqi@0 563 if (rebind) {
aoqi@0 564 org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth );
aoqi@0 565 if( objRef != null ) {
aoqi@0 566 // Refer Naming Service Doc:00-11-01 section 2.2.3.4
aoqi@0 567 // If there is an object already bound with the name
aoqi@0 568 // and the binding type is not ncontext a NotFound
aoqi@0 569 // Exception with a reason of not a context has to be
aoqi@0 570 // raised.
aoqi@0 571 // Fix for bug Id: 4384628
aoqi@0 572 if ( bth.value.value() == BindingType.nobject.value() ) {
aoqi@0 573 if ( bt.value() == BindingType.ncontext.value() ) {
aoqi@0 574 throw new NotFound(NotFoundReason.not_context, n);
aoqi@0 575 }
aoqi@0 576 } else {
aoqi@0 577 // Previously a Context was bound and now trying to
aoqi@0 578 // bind Object. It is invalid.
aoqi@0 579 if ( bt.value() == BindingType.nobject.value() ) {
aoqi@0 580 throw new NotFound(NotFoundReason.not_object, n);
aoqi@0 581 }
aoqi@0 582 }
aoqi@0 583 impl.Unbind(n[0]);
aoqi@0 584 }
aoqi@0 585 } else {
aoqi@0 586 if (impl.Resolve(n[0],bth) != null)
aoqi@0 587 throw new org.omg.CosNaming.NamingContextPackage.AlreadyBound();
aoqi@0 588 }
aoqi@0 589
aoqi@0 590 // Now there are no other bindings under this name
aoqi@0 591 impl.Bind(n[0],obj,bt);
aoqi@0 592 }
aoqi@0 593 } else {
aoqi@0 594 // No: bind in a different context
aoqi@0 595 NamingContext context = resolveFirstAsContext(impl,n);
aoqi@0 596
aoqi@0 597 // Compute tail
aoqi@0 598 NameComponent[] tail = new NameComponent[n.length - 1];
aoqi@0 599 System.arraycopy(n,1,tail,0,n.length-1);
aoqi@0 600
aoqi@0 601 // How should we propagate the bind
aoqi@0 602 switch (bt.value()) {
aoqi@0 603 case BindingType._nobject:
aoqi@0 604 {
aoqi@0 605 // Bind as object
aoqi@0 606 if (rebind)
aoqi@0 607 context.rebind(tail,obj);
aoqi@0 608 else
aoqi@0 609 context.bind(tail,obj);
aoqi@0 610 }
aoqi@0 611 break;
aoqi@0 612 case BindingType._ncontext:
aoqi@0 613 {
aoqi@0 614 // Narrow to a naming context using Java casts. It must work.
aoqi@0 615 NamingContext objContext = (NamingContext)obj;
aoqi@0 616 // Bind as context
aoqi@0 617 if (rebind)
aoqi@0 618 context.rebind_context(tail,objContext);
aoqi@0 619 else
aoqi@0 620 context.bind_context(tail,objContext);
aoqi@0 621 }
aoqi@0 622 break;
aoqi@0 623 default:
aoqi@0 624 // This should not happen
aoqi@0 625 throw updateWrapper.namingCtxBadBindingtype() ;
aoqi@0 626 }
aoqi@0 627 }
aoqi@0 628 }
aoqi@0 629
aoqi@0 630
aoqi@0 631 /**
aoqi@0 632 * Implements resolving names in this NamingContext. The first component
aoqi@0 633 * of the supplied name is resolved in this NamingContext by calling
aoqi@0 634 * Resolve(). If there are no more components in the name, the
aoqi@0 635 * resulting object reference is returned. Otherwise, the resulting object
aoqi@0 636 * reference must have been bound as a context and be narrowable to
aoqi@0 637 * a NamingContext. If this is the case, the remaining
aoqi@0 638 * components of the name is resolved in the resulting NamingContext.
aoqi@0 639 * This method is static for maximal reuse - even for extended naming
aoqi@0 640 * context implementations where the recursive semantics still apply.
aoqi@0 641 * @param impl an implementation of NamingContextDataStore
aoqi@0 642 * @param n a sequence of NameComponents which is the name to be resolved.
aoqi@0 643 * @return the object reference bound under the supplied name.
aoqi@0 644 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 645 * components was supplied, but the first component could not be
aoqi@0 646 * resolved.
aoqi@0 647 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 648 * in resolving the first component of the supplied name.
aoqi@0 649 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 650 * is invalid (i.e., has length less than 1).
aoqi@0 651 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 652 * @see resolve
aoqi@0 653 */
aoqi@0 654 public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl,
aoqi@0 655 NameComponent[] n)
aoqi@0 656 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 657 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 658 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 659 {
aoqi@0 660 org.omg.CORBA.Object obj = null;
aoqi@0 661 BindingTypeHolder bth = new BindingTypeHolder();
aoqi@0 662
aoqi@0 663 // Length must be greater than 0
aoqi@0 664 if (n.length < 1)
aoqi@0 665 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 666
aoqi@0 667 // The identifier must be set
aoqi@0 668 if (n.length == 1) {
aoqi@0 669 synchronized (impl) {
aoqi@0 670 // Resolve first level in this context
aoqi@0 671 obj = impl.Resolve(n[0],bth);
aoqi@0 672 }
aoqi@0 673 if (obj == null) {
aoqi@0 674 // Object was not found
aoqi@0 675 throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
aoqi@0 676 }
aoqi@0 677 return obj;
aoqi@0 678 } else {
aoqi@0 679 // n.length > 1
aoqi@0 680 if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
aoqi@0 681 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 682
aoqi@0 683 NamingContext context = resolveFirstAsContext(impl,n);
aoqi@0 684
aoqi@0 685 // Compute restOfName = name[1..length]
aoqi@0 686 NameComponent[] tail = new NameComponent[n.length -1];
aoqi@0 687 System.arraycopy(n,1,tail,0,n.length-1);
aoqi@0 688
aoqi@0 689 // Resolve rest of name in context
aoqi@0 690 return context.resolve(tail);
aoqi@0 691 }
aoqi@0 692 }
aoqi@0 693
aoqi@0 694 /**
aoqi@0 695 * Implements unbinding bound names in this NamingContext. If the
aoqi@0 696 * name contains only one component, the name is unbound in this
aoqi@0 697 * NamingContext using Unbind(). Otherwise, the first component
aoqi@0 698 * of the name is resolved in this NamingContext and
aoqi@0 699 * unbind passed to the resulting NamingContext.
aoqi@0 700 * This method is static for maximal reuse - even for extended naming
aoqi@0 701 * context implementations where the recursive semantics still apply.
aoqi@0 702 * @param impl an implementation of NamingContextDataStore
aoqi@0 703 * @param n a sequence of NameComponents which is the name to be unbound.
aoqi@0 704 * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple
aoqi@0 705 * components was supplied, but the first component could not be
aoqi@0 706 * resolved.
aoqi@0 707 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 708 * in resolving the n-1 components of the supplied name.
aoqi@0 709 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 710 * is invalid (i.e., has length less than 1).
aoqi@0 711 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 712 * @see resolve
aoqi@0 713 */
aoqi@0 714 public static void doUnbind(NamingContextDataStore impl,
aoqi@0 715 NameComponent[] n)
aoqi@0 716 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 717 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 718 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 719 {
aoqi@0 720 // Name valid?
aoqi@0 721 if (n.length < 1)
aoqi@0 722 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 723
aoqi@0 724 // Unbind here?
aoqi@0 725 if (n.length == 1) {
aoqi@0 726 // The identifier must be set
aoqi@0 727 if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) )
aoqi@0 728 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 729
aoqi@0 730 org.omg.CORBA.Object objRef = null;
aoqi@0 731 synchronized (impl) {
aoqi@0 732 // Yes: unbind in this context
aoqi@0 733 objRef = impl.Unbind(n[0]);
aoqi@0 734 }
aoqi@0 735
aoqi@0 736 if (objRef == null)
aoqi@0 737 // It was not bound
aoqi@0 738 throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
aoqi@0 739 // Done
aoqi@0 740 return;
aoqi@0 741 } else {
aoqi@0 742 // No: unbind in a different context
aoqi@0 743
aoqi@0 744 // Resolve first - must be resolveable
aoqi@0 745 NamingContext context = resolveFirstAsContext(impl,n);
aoqi@0 746
aoqi@0 747 // Compute tail
aoqi@0 748 NameComponent[] tail = new NameComponent[n.length - 1];
aoqi@0 749 System.arraycopy(n,1,tail,0,n.length-1);
aoqi@0 750
aoqi@0 751 // Propagate unbind to this context
aoqi@0 752 context.unbind(tail);
aoqi@0 753 }
aoqi@0 754 }
aoqi@0 755
aoqi@0 756 /**
aoqi@0 757 * Implements resolving a NameComponent in this context and
aoqi@0 758 * narrowing it to CosNaming::NamingContext. It will throw appropriate
aoqi@0 759 * exceptions if not found or not narrowable.
aoqi@0 760 * @param impl an implementation of NamingContextDataStore
aoqi@0 761 * @param n a NameComponents which is the name to be found.
aoqi@0 762 * @exception org.omg.CosNaming.NamingContextPackage.NotFound The
aoqi@0 763 * first component could not be resolved.
aoqi@0 764 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 765 * in resolving the first component of the supplied name.
aoqi@0 766 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 767 * @see resolve
aoqi@0 768 */
aoqi@0 769 protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
aoqi@0 770 NameComponent[] n)
aoqi@0 771 throws org.omg.CosNaming.NamingContextPackage.NotFound {
aoqi@0 772 org.omg.CORBA.Object topRef = null;
aoqi@0 773 BindingTypeHolder bth = new BindingTypeHolder();
aoqi@0 774 NamingContext context = null;
aoqi@0 775
aoqi@0 776 synchronized (impl) {
aoqi@0 777 // Resolve first - must be resolveable
aoqi@0 778 topRef = impl.Resolve(n[0],bth);
aoqi@0 779 if (topRef == null) {
aoqi@0 780 // It was not bound
aoqi@0 781 throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
aoqi@0 782 }
aoqi@0 783 }
aoqi@0 784
aoqi@0 785 // Was it bound as a context?
aoqi@0 786 if (bth.value != BindingType.ncontext) {
aoqi@0 787 // It was not a context
aoqi@0 788 throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
aoqi@0 789 }
aoqi@0 790
aoqi@0 791 // Narrow to a naming context
aoqi@0 792 try {
aoqi@0 793 context = NamingContextHelper.narrow(topRef);
aoqi@0 794 } catch (org.omg.CORBA.BAD_PARAM ex) {
aoqi@0 795 // It was not a context
aoqi@0 796 throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
aoqi@0 797 }
aoqi@0 798
aoqi@0 799 // Hmm. must be ok
aoqi@0 800 return context;
aoqi@0 801 }
aoqi@0 802
aoqi@0 803 public static String nameToString(NameComponent[] name)
aoqi@0 804 {
aoqi@0 805 StringBuffer s = new StringBuffer("{");
aoqi@0 806 if (name != null || name.length > 0) {
aoqi@0 807 for (int i=0;i<name.length;i++) {
aoqi@0 808 if (i>0)
aoqi@0 809 s.append(",");
aoqi@0 810 s.append("[").
aoqi@0 811 append(name[i].id).
aoqi@0 812 append(",").
aoqi@0 813 append(name[i].kind).
aoqi@0 814 append("]");
aoqi@0 815 }
aoqi@0 816 }
aoqi@0 817 s.append("}");
aoqi@0 818 return s.toString();
aoqi@0 819 }
aoqi@0 820
aoqi@0 821 // Debugging aids.
aoqi@0 822 private static boolean debug ;
aoqi@0 823
aoqi@0 824 private static void dprint(String msg) {
aoqi@0 825 NamingUtils.dprint("NamingContextImpl(" +
aoqi@0 826 Thread.currentThread().getName() + " at " +
aoqi@0 827 System.currentTimeMillis() +
aoqi@0 828 " ems): " + msg);
aoqi@0 829 }
aoqi@0 830
aoqi@0 831
aoqi@0 832 /**
aoqi@0 833 * Implements all flavors of binding( bind and bindcontext)
aoqi@0 834 * This method will be called from the superclass's doBind( ) method
aoqi@0 835 * which takes care of all the conditions before calling this method.
aoqi@0 836 * i.e., It checks whether the Name is already Bounded, Then in the
aoqi@0 837 * case of rebind it calls Unbind first.
aoqi@0 838 * This method does one level binding only, To have n-level binding
aoqi@0 839 * with compound names, doBind( ) calls this method recursively.
aoqi@0 840 * @param n a sequence of NameComponents which is the name under which
aoqi@0 841 * the object will be bound.
aoqi@0 842 * @param obj the object reference to be bound.
aoqi@0 843 * @param bt Type of binding (as object or as context).
aoqi@0 844 * @exception org.omg.CosNaming.NamingContextPackage.NotFound raised
aoqi@0 845 * if the NameComoponent list is invalid
aoqi@0 846 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
aoqi@0 847 * Could not proceed in resolving the Name from the given NameComponent
aoqi@0 848 * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
aoqi@0 849 * is already bound under the supplied name.
aoqi@0 850 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
aoqi@0 851 * system exceptions
aoqi@0 852 * @see Resolve
aoqi@0 853 * @see Unbind
aoqi@0 854 */
aoqi@0 855 public void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
aoqi@0 856 {
aoqi@0 857 if( obj == null ) {
aoqi@0 858 // Raise a Valid Exception and Return
aoqi@0 859 return;
aoqi@0 860 }
aoqi@0 861
aoqi@0 862 InternalBindingKey key = new InternalBindingKey(n);
aoqi@0 863 InternalBindingValue value;
aoqi@0 864
aoqi@0 865 try {
aoqi@0 866 if( bt.value() == BindingType._nobject ) {
aoqi@0 867 // If the BindingType is an ObjectRef then Stringify this ref and
aoqi@0 868 // Store it in InternalBindingValue instance. This is required
aoqi@0 869 // because the Object References has to be stored in file
aoqi@0 870 value = new InternalBindingValue(bt, orb.object_to_string(obj) );
aoqi@0 871 value.setObjectRef( obj );
aoqi@0 872 } else {
aoqi@0 873 // If the BindingType is a NamingContext then get it's object key
aoqi@0 874 // from the NameService and store it in the Internal Binding Value instance
aoqi@0 875 String theNCKey = theNameServiceHandle.getObjectKey( obj );
aoqi@0 876 value = new InternalBindingValue( bt, theNCKey );
aoqi@0 877 value.setObjectRef( obj );
aoqi@0 878 }
aoqi@0 879
aoqi@0 880 InternalBindingValue oldValue =
aoqi@0 881 (InternalBindingValue)this.theHashtable.put(key,value);
aoqi@0 882
aoqi@0 883 if( oldValue != null) {
aoqi@0 884 // There was an entry with this name in the Hashtable and hence throw CTX_ALREADY_BOUND
aoqi@0 885 // exception
aoqi@0 886 throw updateWrapper.namingCtxRebindAlreadyBound() ;
aoqi@0 887 } else {
aoqi@0 888 try {
aoqi@0 889 // Everything went smooth so update the NamingContext file with the
aoqi@0 890 // latest Hashtable image
aoqi@0 891 theServantManagerImplHandle.updateContext( objKey, this );
aoqi@0 892 } catch( Exception e ) {
aoqi@0 893 // Something went wrong while updating the context
aoqi@0 894 // so speak the error
aoqi@0 895 throw updateWrapper.bindUpdateContextFailed( e ) ;
aoqi@0 896 }
aoqi@0 897 }
aoqi@0 898 } catch( Exception e ) {
aoqi@0 899 // Something went wrong while Binding the Object Reference
aoqi@0 900 // Speak the error again.
aoqi@0 901 throw updateWrapper.bindFailure( e ) ;
aoqi@0 902 }
aoqi@0 903 }
aoqi@0 904
aoqi@0 905 /**
aoqi@0 906 * This method resolves the NamingContext or Object Reference for one level
aoqi@0 907 * The doResolve( ) method calls Resolve( ) recursively to resolve n level
aoqi@0 908 * Names.
aoqi@0 909 * @param n a sequence of NameComponents which is the name to be resolved.
aoqi@0 910 * @param bt Type of binding (as object or as context).
aoqi@0 911 * @return the object reference bound under the supplied name.
aoqi@0 912 * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
aoqi@0 913 * or a Corba Object reference not found under this Name
aoqi@0 914 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 915 * in resolving the the supplied name.
aoqi@0 916 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 917 * is invalid (i.e., has length less than 1).
aoqi@0 918 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 919 * @see Bind
aoqi@0 920 */
aoqi@0 921 public Object Resolve(NameComponent n, BindingTypeHolder bth)
aoqi@0 922 throws SystemException
aoqi@0 923 {
aoqi@0 924 if( ( n.id.length() == 0 ) &&( n.kind.length() == 0 ) ) {
aoqi@0 925 // If the NameComponent list has no entry then it means the current
aoqi@0 926 // context was requested
aoqi@0 927 bth.value = BindingType.ncontext;
aoqi@0 928 return theNameServiceHandle.getObjectReferenceFromKey(
aoqi@0 929 this.objKey );
aoqi@0 930 }
aoqi@0 931
aoqi@0 932 InternalBindingKey key = new InternalBindingKey(n);
aoqi@0 933 InternalBindingValue value =
aoqi@0 934 (InternalBindingValue) this.theHashtable.get(key);
aoqi@0 935
aoqi@0 936 if( value == null ) {
aoqi@0 937 // No entry was found for the given name and hence return NULL
aoqi@0 938 // NamingContextDataStore throws appropriate exception if
aoqi@0 939 // required.
aoqi@0 940 return null;
aoqi@0 941 }
aoqi@0 942
aoqi@0 943 Object theObjectFromStringifiedReference = null;
aoqi@0 944 bth.value = value.theBindingType;
aoqi@0 945
aoqi@0 946 try {
aoqi@0 947 // Check whether the entry found in the Hashtable starts with NC
aoqi@0 948 // Which means it's a name context. So get the NamingContext reference
aoqi@0 949 // from ServantManager, which would either return from the cache or
aoqi@0 950 // read it from the File.
aoqi@0 951 if( value.strObjectRef.startsWith( "NC" ) ) {
aoqi@0 952 bth.value = BindingType.ncontext;
aoqi@0 953 return theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
aoqi@0 954 } else {
aoqi@0 955 // Else, It is a Object Reference. Check whether Object Reference
aoqi@0 956 // can be obtained directly, If not then convert the stringified
aoqi@0 957 // reference to object and return.
aoqi@0 958 theObjectFromStringifiedReference = value.getObjectRef( );
aoqi@0 959
aoqi@0 960 if (theObjectFromStringifiedReference == null ) {
aoqi@0 961 try {
aoqi@0 962 theObjectFromStringifiedReference =
aoqi@0 963 orb.string_to_object( value.strObjectRef );
aoqi@0 964 value.setObjectRef( theObjectFromStringifiedReference );
aoqi@0 965 } catch( Exception e ) {
aoqi@0 966 throw readWrapper.resolveConversionFailure(
aoqi@0 967 CompletionStatus.COMPLETED_MAYBE, e );
aoqi@0 968 }
aoqi@0 969 }
aoqi@0 970 }
aoqi@0 971 } catch ( Exception e ) {
aoqi@0 972 throw readWrapper.resolveFailure(
aoqi@0 973 CompletionStatus.COMPLETED_MAYBE, e );
aoqi@0 974 }
aoqi@0 975
aoqi@0 976 return theObjectFromStringifiedReference;
aoqi@0 977 }
aoqi@0 978
aoqi@0 979 /**
aoqi@0 980 * This method Unbinds the NamingContext or Object Reference for one level
aoqi@0 981 * The doUnbind( ) method from superclass calls Unbind() to recursively
aoqi@0 982 * Unbind using compound Names.
aoqi@0 983 * @param n a sequence of NameComponents which is the name to be resolved.
aoqi@0 984 * @return the object reference bound under the supplied name.
aoqi@0 985 * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
aoqi@0 986 * or a Corba Object reference not found under this Name
aoqi@0 987 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
aoqi@0 988 * in resolving the the supplied name.
aoqi@0 989 * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name
aoqi@0 990 * is invalid (i.e., has length less than 1).
aoqi@0 991 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 992 * @see Bind
aoqi@0 993 */
aoqi@0 994
aoqi@0 995 public Object Unbind(NameComponent n) throws SystemException
aoqi@0 996 {
aoqi@0 997 try {
aoqi@0 998 InternalBindingKey key = new InternalBindingKey(n);
aoqi@0 999 InternalBindingValue value = null;
aoqi@0 1000
aoqi@0 1001 try {
aoqi@0 1002 value = (InternalBindingValue) this.theHashtable.remove(key);
aoqi@0 1003 } catch( Exception e ) {
aoqi@0 1004 // Ignore the exception in Hashtable.remove
aoqi@0 1005 }
aoqi@0 1006
aoqi@0 1007 theServantManagerImplHandle.updateContext( objKey, this );
aoqi@0 1008
aoqi@0 1009 if( value == null ) {
aoqi@0 1010 return null;
aoqi@0 1011 }
aoqi@0 1012
aoqi@0 1013 if( value.strObjectRef.startsWith( "NC" ) ) {
aoqi@0 1014 theServantManagerImplHandle.readInContext( value.strObjectRef );
aoqi@0 1015 Object theObjectFromStringfiedReference =
aoqi@0 1016 theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
aoqi@0 1017 return theObjectFromStringfiedReference;
aoqi@0 1018 } else {
aoqi@0 1019 Object theObjectFromStringifiedReference = value.getObjectRef( );
aoqi@0 1020
aoqi@0 1021 if( theObjectFromStringifiedReference == null ) {
aoqi@0 1022 theObjectFromStringifiedReference =
aoqi@0 1023 orb.string_to_object( value.strObjectRef );
aoqi@0 1024 }
aoqi@0 1025
aoqi@0 1026 return theObjectFromStringifiedReference;
aoqi@0 1027 }
aoqi@0 1028 } catch( Exception e ) {
aoqi@0 1029 throw updateWrapper.unbindFailure( CompletionStatus.COMPLETED_MAYBE, e );
aoqi@0 1030 }
aoqi@0 1031 }
aoqi@0 1032
aoqi@0 1033 /**
aoqi@0 1034 * List the contents of this NamingContext. It creates a new
aoqi@0 1035 * PersistentBindingIterator object and passes it a clone of the
aoqi@0 1036 * hash table and an orb object. It then uses the
aoqi@0 1037 * newly created object to return the required number of bindings.
aoqi@0 1038 * @param how_many The number of requested bindings in the BindingList.
aoqi@0 1039 * @param bl The BindingList as an out parameter.
aoqi@0 1040 * @param bi The BindingIterator as an out parameter.
aoqi@0 1041 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 1042 */
aoqi@0 1043
aoqi@0 1044 public void List(int how_many, BindingListHolder bl,
aoqi@0 1045 BindingIteratorHolder bi) throws SystemException
aoqi@0 1046 {
aoqi@0 1047 if( biPOA == null ) {
aoqi@0 1048 createbiPOA( );
aoqi@0 1049 }
aoqi@0 1050 try {
aoqi@0 1051 PersistentBindingIterator bindingIterator =
aoqi@0 1052 new PersistentBindingIterator(this.orb,
aoqi@0 1053 (Hashtable)this.theHashtable.clone(), biPOA);
aoqi@0 1054 // Have it set the binding list
aoqi@0 1055 bindingIterator.list(how_many,bl);
aoqi@0 1056
aoqi@0 1057 byte[] objectId = biPOA.activate_object( bindingIterator );
aoqi@0 1058 org.omg.CORBA.Object obj = biPOA.id_to_reference( objectId );
aoqi@0 1059
aoqi@0 1060 // Get the object reference for the binding iterator servant
aoqi@0 1061 org.omg.CosNaming.BindingIterator bindingRef =
aoqi@0 1062 org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
aoqi@0 1063
aoqi@0 1064 bi.value = bindingRef;
aoqi@0 1065 } catch (org.omg.CORBA.SystemException e) {
aoqi@0 1066 throw e;
aoqi@0 1067 } catch( Exception e ) {
aoqi@0 1068 throw readWrapper.transNcListGotExc( e ) ;
aoqi@0 1069 }
aoqi@0 1070 }
aoqi@0 1071
aoqi@0 1072 private synchronized void createbiPOA( ) {
aoqi@0 1073 if( biPOA != null ) {
aoqi@0 1074 return;
aoqi@0 1075 }
aoqi@0 1076 try {
aoqi@0 1077 POA rootPOA = (POA) orb.resolve_initial_references(
aoqi@0 1078 ORBConstants.ROOT_POA_NAME );
aoqi@0 1079 rootPOA.the_POAManager().activate( );
aoqi@0 1080
aoqi@0 1081 int i = 0;
aoqi@0 1082 Policy[] poaPolicy = new Policy[3];
aoqi@0 1083 poaPolicy[i++] = rootPOA.create_lifespan_policy(
aoqi@0 1084 LifespanPolicyValue.TRANSIENT);
aoqi@0 1085 poaPolicy[i++] = rootPOA.create_id_assignment_policy(
aoqi@0 1086 IdAssignmentPolicyValue.SYSTEM_ID);
aoqi@0 1087 poaPolicy[i++] = rootPOA.create_servant_retention_policy(
aoqi@0 1088 ServantRetentionPolicyValue.RETAIN);
aoqi@0 1089 biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
aoqi@0 1090 biPOA.the_POAManager().activate( );
aoqi@0 1091 } catch( Exception e ) {
aoqi@0 1092 throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
aoqi@0 1093 }
aoqi@0 1094 }
aoqi@0 1095
aoqi@0 1096
aoqi@0 1097 /**
aoqi@0 1098 * Create a NamingContext object and return its object reference.
aoqi@0 1099 * @return an object reference for a new NamingContext object implemented
aoqi@0 1100 * by this Name Server.
aoqi@0 1101 * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
aoqi@0 1102 */
aoqi@0 1103 public NamingContext NewContext() throws SystemException
aoqi@0 1104 {
aoqi@0 1105 try {
aoqi@0 1106 return theNameServiceHandle.NewContext( );
aoqi@0 1107 } catch( org.omg.CORBA.SystemException e ) {
aoqi@0 1108 throw e;
aoqi@0 1109 } catch( Exception e ) {
aoqi@0 1110 throw updateWrapper.transNcNewctxGotExc( e ) ;
aoqi@0 1111 }
aoqi@0 1112 }
aoqi@0 1113
aoqi@0 1114
aoqi@0 1115 /**
aoqi@0 1116 * Destroys the NamingContext.
aoqi@0 1117 */
aoqi@0 1118 public void Destroy() throws SystemException
aoqi@0 1119 {
aoqi@0 1120 // XXX note that orb.disconnect is illegal here, since the
aoqi@0 1121 // POA is used. However, there may be some associated state
aoqi@0 1122 // that needs to be cleaned up in ServerManagerImpl which we will
aoqi@0 1123 // look into further at another time.
aoqi@0 1124 /*
aoqi@0 1125 // XXX This needs to be replaced by cleaning up the
aoqi@0 1126 // file that backs up the naming context. No explicit
aoqi@0 1127 // action is necessary at the POA level, since this is
aoqi@0 1128 // created with the non-retain policy.
aoqi@0 1129 /*
aoqi@0 1130 try { orb.disconnect(
aoqi@0 1131 theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
aoqi@0 1132 } catch( org.omg.CORBA.SystemException e ) {
aoqi@0 1133 throw e;
aoqi@0 1134 } catch( Exception e ) {
aoqi@0 1135 throw updateWrapper.transNcDestroyGotEx( e ) ;
aoqi@0 1136 }
aoqi@0 1137 */
aoqi@0 1138 }
aoqi@0 1139
aoqi@0 1140 /**
aoqi@0 1141 * This operation creates a stringified name from the array of Name
aoqi@0 1142 * components.
aoqi@0 1143 * @param n Name of the object <p>
aoqi@0 1144 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
aoqi@0 1145 * Indicates the name does not identify a binding.<p>
aoqi@0 1146 *
aoqi@0 1147 */
aoqi@0 1148 public String to_string(org.omg.CosNaming.NameComponent[] n)
aoqi@0 1149 throws org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 1150 {
aoqi@0 1151 // Name valid?
aoqi@0 1152 if ( (n == null ) || (n.length == 0) )
aoqi@0 1153 {
aoqi@0 1154 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1155 }
aoqi@0 1156
aoqi@0 1157 String theStringifiedName = getINSImpl().convertToString( n );
aoqi@0 1158
aoqi@0 1159 if( theStringifiedName == null )
aoqi@0 1160 {
aoqi@0 1161 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1162 }
aoqi@0 1163
aoqi@0 1164 return theStringifiedName;
aoqi@0 1165 }
aoqi@0 1166
aoqi@0 1167 /**
aoqi@0 1168 * This operation converts a Stringified Name into an equivalent array
aoqi@0 1169 * of Name Components.
aoqi@0 1170 * @param sn Stringified Name of the object <p>
aoqi@0 1171 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
aoqi@0 1172 * Indicates the name does not identify a binding.<p>
aoqi@0 1173 *
aoqi@0 1174 */
aoqi@0 1175 public org.omg.CosNaming.NameComponent[] to_name(String sn)
aoqi@0 1176 throws org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 1177 {
aoqi@0 1178 // Name valid?
aoqi@0 1179 if ( (sn == null ) || (sn.length() == 0) )
aoqi@0 1180 {
aoqi@0 1181 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1182 }
aoqi@0 1183 org.omg.CosNaming.NameComponent[] theNameComponents =
aoqi@0 1184 getINSImpl().convertToNameComponent( sn );
aoqi@0 1185 if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
aoqi@0 1186 {
aoqi@0 1187 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1188 }
aoqi@0 1189 for( int i = 0; i < theNameComponents.length; i++ ) {
aoqi@0 1190 // If there is a name component whose id and kind null or
aoqi@0 1191 // zero length string, then an invalid name exception needs to be
aoqi@0 1192 // raised.
aoqi@0 1193 if ( ( ( theNameComponents[i].id == null )
aoqi@0 1194 ||( theNameComponents[i].id.length() == 0 ) )
aoqi@0 1195 &&( ( theNameComponents[i].kind == null )
aoqi@0 1196 ||( theNameComponents[i].kind.length() == 0 ) ) ) {
aoqi@0 1197 throw new InvalidName();
aoqi@0 1198 }
aoqi@0 1199 }
aoqi@0 1200 return theNameComponents;
aoqi@0 1201 }
aoqi@0 1202
aoqi@0 1203 /**
aoqi@0 1204 * This operation creates a URL based "iiopname://" format name
aoqi@0 1205 * from the Stringified Name of the object.
aoqi@0 1206 * @param addr internet based address of the host machine where
aoqi@0 1207 * Name Service is running <p>
aoqi@0 1208 * @param sn Stringified Name of the object <p>
aoqi@0 1209 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
aoqi@0 1210 * Indicates the name does not identify a binding.<p>
aoqi@0 1211 * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
aoqi@0 1212 * Indicates the internet based address of the host machine is
aoqi@0 1213 * incorrect <p>
aoqi@0 1214 *
aoqi@0 1215 */
aoqi@0 1216
aoqi@0 1217 public String to_url(String addr, String sn)
aoqi@0 1218 throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
aoqi@0 1219 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 1220 {
aoqi@0 1221 // Name valid?
aoqi@0 1222 if ( (sn == null ) || (sn.length() == 0) )
aoqi@0 1223 {
aoqi@0 1224 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1225 }
aoqi@0 1226 if( addr == null )
aoqi@0 1227 {
aoqi@0 1228 throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
aoqi@0 1229 }
aoqi@0 1230 String urlBasedAddress = null;
aoqi@0 1231 try {
aoqi@0 1232 urlBasedAddress = getINSImpl().createURLBasedAddress( addr, sn );
aoqi@0 1233 } catch (Exception e ) {
aoqi@0 1234 urlBasedAddress = null;
aoqi@0 1235 }
aoqi@0 1236 // Extra check to see that corba name url created is valid as per
aoqi@0 1237 // INS spec grammer.
aoqi@0 1238 try {
aoqi@0 1239 INSURLHandler.getINSURLHandler().parseURL( urlBasedAddress );
aoqi@0 1240 } catch( BAD_PARAM e ) {
aoqi@0 1241 throw new
aoqi@0 1242 org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
aoqi@0 1243 }
aoqi@0 1244 return urlBasedAddress;
aoqi@0 1245 }
aoqi@0 1246
aoqi@0 1247 /**
aoqi@0 1248 * This operation resolves the Stringified name into the object
aoqi@0 1249 * reference.
aoqi@0 1250 * @param sn Stringified Name of the object <p>
aoqi@0 1251 * @exception org.omg.CosNaming.NamingContextPackage.NotFound
aoqi@0 1252 * Indicates there is no object reference for the given name. <p>
aoqi@0 1253 * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
aoqi@0 1254 * Indicates that the given compound name is incorrect <p>
aoqi@0 1255 * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
aoqi@0 1256 * Indicates the name does not identify a binding.<p>
aoqi@0 1257 *
aoqi@0 1258 */
aoqi@0 1259 public org.omg.CORBA.Object resolve_str(String sn)
aoqi@0 1260 throws org.omg.CosNaming.NamingContextPackage.NotFound,
aoqi@0 1261 org.omg.CosNaming.NamingContextPackage.CannotProceed,
aoqi@0 1262 org.omg.CosNaming.NamingContextPackage.InvalidName
aoqi@0 1263 {
aoqi@0 1264 org.omg.CORBA.Object theObject = null;
aoqi@0 1265 // Name valid?
aoqi@0 1266 if ( (sn == null ) || (sn.length() == 0) )
aoqi@0 1267 {
aoqi@0 1268 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1269 }
aoqi@0 1270 org.omg.CosNaming.NameComponent[] theNameComponents =
aoqi@0 1271 getINSImpl().convertToNameComponent( sn );
aoqi@0 1272 if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
aoqi@0 1273 {
aoqi@0 1274 throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
aoqi@0 1275 }
aoqi@0 1276 theObject = resolve( theNameComponents );
aoqi@0 1277 return theObject;
aoqi@0 1278 }
aoqi@0 1279
aoqi@0 1280 /**
aoqi@0 1281 * This is a Debugging Method
aoqi@0 1282 */
aoqi@0 1283 public boolean IsEmpty()
aoqi@0 1284 {
aoqi@0 1285 return this.theHashtable.isEmpty();
aoqi@0 1286 }
aoqi@0 1287
aoqi@0 1288 /**
aoqi@0 1289 * This is a Debugging Method
aoqi@0 1290 */
aoqi@0 1291 public void printSize( )
aoqi@0 1292 {
aoqi@0 1293 System.out.println( "Hashtable Size = " + theHashtable.size( ) );
aoqi@0 1294 java.util.Enumeration e = theHashtable.keys( );
aoqi@0 1295 for( ; e.hasMoreElements(); )
aoqi@0 1296 {
aoqi@0 1297 InternalBindingValue thevalue =
aoqi@0 1298 (InternalBindingValue) this.theHashtable.get(e.nextElement());
aoqi@0 1299 if( thevalue != null )
aoqi@0 1300 {
aoqi@0 1301 System.out.println( "value = " + thevalue.strObjectRef);
aoqi@0 1302 }
aoqi@0 1303 }
aoqi@0 1304 }
aoqi@0 1305
aoqi@0 1306 }

mercurial