1 7 8 package com.sun.corba.se.impl.naming.cosnaming; 9 10 import org.omg.CORBA.ORB ; 12 import org.omg.CORBA.Object ; 13 14 import org.omg.CosNaming.Binding ; 16 import org.omg.CosNaming.BindingType ; 17 import org.omg.CosNaming.BindingHolder ; 18 import org.omg.CosNaming.BindingListHolder ; 19 import org.omg.CosNaming.BindingIteratorHolder ; 20 import org.omg.CosNaming.BindingIteratorPOA ; 21 import org.omg.CORBA.BAD_PARAM ; 22 23 41 public abstract class BindingIteratorImpl extends BindingIteratorPOA 42 { 43 protected ORB orb ; 44 45 51 public BindingIteratorImpl(ORB orb) 52 throws java.lang.Exception 53 { 54 super(); 55 this.orb = orb ; 56 } 57 58 67 public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b) 68 { 69 return NextOne(b); 71 } 72 73 83 public synchronized boolean next_n(int how_many, 84 org.omg.CosNaming.BindingListHolder blh) 85 { 86 if( how_many == 0 ) { 87 throw new BAD_PARAM ( " 'how_many' parameter is set to 0 which is" + 88 " invalid" ); 89 } 90 return list( how_many, blh ); 91 } 92 93 102 public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh) 103 { 104 int numberToGet = Math.min(RemainingElements(),how_many); 106 107 Binding [] bl = new Binding [numberToGet]; 109 BindingHolder bh = new BindingHolder (); 110 int i = 0; 111 while (i < numberToGet && this.NextOne(bh) == true) { 113 bl[i] = bh.value; 114 i++; 115 } 116 if (i == 0) { 118 blh.value = new Binding [0]; 120 return false; 121 } 122 123 blh.value = bl; 125 126 return true; 127 } 128 129 130 131 132 139 public synchronized void destroy() 140 { 141 this.Destroy(); 143 } 144 145 153 protected abstract boolean NextOne(org.omg.CosNaming.BindingHolder b); 154 155 160 protected abstract void Destroy(); 161 162 166 protected abstract int RemainingElements(); 167 } 168 | Popular Tags |