1 26 27 package org.objectweb.openccm.explorer.CosTrading; 28 29 30 import org.omg.CosTrading.Admin; 31 import org.omg.CosTrading.Proxy; 32 import org.omg.CosTrading.OfferIdIterator; 33 import org.omg.CosTrading.ProxyPackage.ProxyInfo; 34 import org.omg.CosTrading.OfferIdSeqHolder; 35 import org.omg.CosTrading.OfferIdIteratorHolder; 36 37 45 public class ProxyOffers { 46 47 53 57 protected Admin admin_; 58 59 63 protected Proxy proxy_; 64 65 71 77 public ProxyOffers(Admin admin) 78 { 79 admin_ = admin; 80 proxy_ = admin.proxy_if(); 81 } 82 83 89 95 101 public ProxyInfo[] getOffers() 102 { 103 return getOffers(100); 104 } 105 106 113 public ProxyInfo[] getOffers(int how_many_step) 114 { 115 java.util.List oid_list = new java.util.LinkedList (); 117 OfferIdSeqHolder oid_seq = new OfferIdSeqHolder(); 118 OfferIdIteratorHolder oid_iter = new OfferIdIteratorHolder(); 119 try { 120 121 admin_.list_proxies(how_many_step, oid_seq, oid_iter); 123 124 if (oid_seq.value.length == 0) return new ProxyInfo[0]; 126 for (int i=0 ; i<oid_seq.value.length ; i++) { 127 oid_list.add(oid_seq.value[i]); 128 } 129 130 if (oid_iter.value != null) { 132 OfferIdIterator iter = oid_iter.value; 133 boolean again = iter.next_n(how_many_step, oid_seq); 134 { 135 for (int i=0 ; i<oid_seq.value.length ; i++) { 136 oid_list.add(oid_seq.value[i]); 137 } 138 again = iter.next_n(how_many_step, oid_seq); 139 } while (again); 140 iter.destroy(); 141 } 142 } catch (org.omg.CosTrading.NotImplemented ex) { 143 return new ProxyInfo[0]; 145 } 146 147 java.util.List info_list = new java.util.LinkedList (); 149 for (java.util.Iterator iter = oid_list.iterator() ; iter.hasNext() ; ) 150 { 151 String oid = (String )iter.next(); 152 try { 153 ProxyInfo info = proxy_.describe_proxy(oid); 154 info_list.add(info); 155 } catch (org.omg.CosTrading.IllegalOfferId ex) { 156 } catch (org.omg.CosTrading.UnknownOfferId ex) { 158 } catch (org.omg.CosTrading.ProxyPackage.NotProxyOfferId ex) { 161 } 163 } 164 165 return (ProxyInfo[])info_list.toArray(new ProxyInfo[0]); 166 } 167 168 } 169 | Popular Tags |