1 26 27 package org.objectweb.openccm.explorer.CosTrading; 28 29 30 import org.omg.CosTrading.Admin; 31 import org.omg.CosTrading.Register; 32 import org.omg.CosTrading.OfferIdIterator; 33 import org.omg.CosTrading.OfferIdSeqHolder; 34 import org.omg.CosTrading.OfferIdIteratorHolder; 35 import org.omg.CosTrading.RegisterPackage.OfferInfo; 36 37 44 public class Offers { 45 46 52 56 protected Admin admin_; 57 58 62 protected Register reg_; 63 64 70 76 public Offers(Admin admin) { 77 admin_ = admin; 78 reg_ = admin_.register_if(); 79 } 80 81 87 93 99 public OfferInfo[] 100 getOffers() 101 { 102 return getOffers(100); 103 } 104 105 111 public OfferInfo[] 112 getOffers(int how_many_step) 113 { 114 java.util.List oid_list = new java.util.LinkedList (); 116 OfferIdSeqHolder oid_seq = new OfferIdSeqHolder(); 117 OfferIdIteratorHolder oid_iter = new OfferIdIteratorHolder(); 118 try { 119 120 admin_.list_offers(how_many_step, oid_seq, oid_iter); 122 123 if (oid_seq.value.length == 0) return new OfferInfo[0]; 125 for (int i=0 ; i<oid_seq.value.length ; i++) { 126 oid_list.add(oid_seq.value[i]); 127 } 128 129 if (oid_iter.value != null) { 131 OfferIdIterator iter = oid_iter.value; 132 boolean again = iter.next_n(how_many_step, oid_seq); 133 { 134 for (int i=0 ; i<oid_seq.value.length ; i++) { 135 oid_list.add(oid_seq.value[i]); 136 } 137 again = iter.next_n(how_many_step, oid_seq); 138 } while (again); 139 iter.destroy(); 140 } 141 } catch (org.omg.CosTrading.NotImplemented ex) { 142 return new OfferInfo[0]; 144 } 145 146 java.util.List info_list = new java.util.LinkedList (); 148 for (java.util.Iterator iter = oid_list.iterator() ; iter.hasNext() ; ) 149 { 150 String oid = (String )iter.next(); 151 try { 152 OfferInfo info = reg_.describe(oid); 153 info_list.add(info); 154 } catch (org.omg.CosTrading.IllegalOfferId ex) { 155 } catch (org.omg.CosTrading.UnknownOfferId ex) { 157 } catch (org.omg.CosTrading.RegisterPackage.ProxyOfferId ex) { 160 } 162 } 163 164 return (OfferInfo[])info_list.toArray(new OfferInfo[0]); 165 } 166 } 167 | Popular Tags |