1 7 8 package com.sun.corba.se.impl.naming.cosnaming; 9 10 import org.omg.CORBA.SystemException ; 12 import org.omg.CORBA.ORB ; 13 import org.omg.PortableServer.POA ; 14 15 import org.omg.CosNaming.Binding ; 17 import org.omg.CosNaming.BindingType ; 18 import org.omg.CosNaming.BindingTypeHolder ; 19 import org.omg.CosNaming.NameComponent ; 20 21 import com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl; 23 import com.sun.corba.se.impl.naming.cosnaming.InternalBindingValue; 24 25 import java.util.Hashtable ; 27 import java.util.Enumeration ; 28 29 38 public class TransientBindingIterator extends BindingIteratorImpl 39 { 40 private POA nsPOA; 43 52 public TransientBindingIterator(ORB orb, Hashtable aTable, 53 POA thePOA ) 54 throws java.lang.Exception 55 { 56 super(orb); 57 theHashtable = aTable; 58 theEnumeration = this.theHashtable.elements(); 59 currentSize = this.theHashtable.size(); 60 this.nsPOA = thePOA; 61 } 62 63 70 final public boolean NextOne(org.omg.CosNaming.BindingHolder b) 71 { 72 boolean hasMore = theEnumeration.hasMoreElements(); 74 if (hasMore) { 75 b.value = 76 ((InternalBindingValue)theEnumeration.nextElement()).theBinding; 77 currentSize--; 78 } else { 79 b.value = new Binding (new NameComponent [0],BindingType.nobject); 81 } 82 return hasMore; 83 } 84 85 90 final public void Destroy() 91 { 92 try { 94 byte[] objectId = nsPOA.servant_to_id( this ); 95 if( objectId != null ) { 96 nsPOA.deactivate_object( objectId ); 97 } 98 } 99 catch( Exception e ) { 100 NamingUtils.errprint("BindingIterator.Destroy():caught exception:"); 101 NamingUtils.printException(e); 102 } 103 } 104 105 109 public final int RemainingElements() { 110 return currentSize; 111 } 112 113 private int currentSize; 114 private Hashtable theHashtable; 115 private Enumeration theEnumeration; 116 } 117 | Popular Tags |