1 7 22 23 package com.sun.corba.se.impl.naming.pcosnaming; 24 25 import org.omg.CORBA.SystemException ; 27 import org.omg.CORBA.ORB ; 28 import org.omg.CORBA.INTERNAL ; 29 30 import org.omg.CosNaming.Binding ; 32 import org.omg.CosNaming.BindingType ; 33 import org.omg.CosNaming.BindingTypeHolder ; 34 import org.omg.CosNaming.NameComponent ; 35 import org.omg.PortableServer.POA ; 36 37 import com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl; 39 import com.sun.corba.se.impl.naming.pcosnaming.InternalBindingValue; 40 41 import com.sun.corba.se.impl.naming.cosnaming.BindingIteratorImpl; 42 43 import java.util.Hashtable ; 45 import java.util.Enumeration ; 46 47 56 public class PersistentBindingIterator extends BindingIteratorImpl 57 { 58 private POA biPOA; 59 68 public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable, 69 POA thePOA ) throws java.lang.Exception 70 { 71 super(orb); 72 this.orb = orb; 73 theHashtable = aTable; 74 theEnumeration = this.theHashtable.keys(); 75 currentSize = this.theHashtable.size(); 76 biPOA = thePOA; 77 } 78 79 86 final public boolean NextOne(org.omg.CosNaming.BindingHolder b) 87 { 88 boolean hasMore = theEnumeration.hasMoreElements(); 90 if (hasMore) { 91 InternalBindingKey theBindingKey = 92 ((InternalBindingKey)theEnumeration.nextElement()); 93 InternalBindingValue theElement = 94 (InternalBindingValue)theHashtable.get( theBindingKey ); 95 NameComponent n = new NameComponent ( theBindingKey.id, theBindingKey.kind ); 96 NameComponent [] nlist = new NameComponent [1]; 97 nlist[0] = n; 98 BindingType theType = theElement.theBindingType; 99 100 b.value = 101 new Binding ( nlist, theType ); 102 } else { 103 b.value = new Binding (new NameComponent [0],BindingType.nobject); 105 } 106 return hasMore; 107 } 108 109 113 final public void Destroy() 114 { 115 try { 117 byte[] objectId = biPOA.servant_to_id( this ); 118 if( objectId != null ) { 119 biPOA.deactivate_object( objectId ); 120 } 121 } 122 catch( Exception e ) { 123 throw new INTERNAL ( "Exception in BindingIterator.Destroy " + e ); 124 } 125 } 126 127 131 public final int RemainingElements() { 132 return currentSize; 133 } 134 135 private int currentSize; 136 private Hashtable theHashtable; 137 private Enumeration theEnumeration; 138 private org.omg.CORBA.ORB orb; 139 } 140 | Popular Tags |