Source code: org/openorb/trader/kernel/Admin.java
1 /**
2 * Redistribution and use of this software and associated
3 * documentation ("Software"), with or without modification, are
4 * permitted provided that the following conditions are met:
5 *
6 * 1. Redistributions of source code must retain copyright statements
7 * and notices. Redistributions must also contain a copy of this
8 * document.
9 *
10 * 2. Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials provided
13 * with the distribution.
14 *
15 * 3. The name "Exolab" must not be used to endorse or promote
16 * products derived from this Software without prior written
17 * permission of Intalio Inc. For written permission, please
18 * contact info@exolab.org.
19 *
20 * 4. Products derived from this Software may not be called "Exolab"
21 * nor may "Exolab" appear in their names without prior written
22 * permission of Intalio Inc. Exolab is a registered trademark of
23 * Intalio Inc.
24 *
25 * 5. Due credit should be given to the Exolab Project
26 * (http://www.exolab.org/).
27 *
28 * THIS SOFTWARE IS PROVIDED BY INTALIO AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTALIO OR
32 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
35 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
38 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * Copyright 2000 (C) Intalio Inc. All Rights Reserved.
42 *
43 * $Id: Admin.java,v 1.2 2002/01/15 12:05:52 jews Exp $
44 *
45 * Date Author Changes
46 */
47
48 package org.openorb.trader.kernel;
49
50 /**
51 * This class implements the Admin interface for the OpenORB Trading Object Service.
52 *
53 * @author <a href="mailto:jdaniel@intalio.com">Jerome Daniel <daniel@intalio.com></a>
54 */
55
56 public class Admin extends org.omg.CosTrading.AdminPOA
57 {
58 // ------------------------------------------------------------------------------
59 //
60 // Attributes
61 //
62 // ------------------------------------------------------------------------------
63
64 /**
65 * Reference to the kernel
66 */
67 private org.openorb.trader.kernel.Kernel kernel;
68
69 // ------------------------------------------------------------------------------
70 //
71 // Constructor
72 //
73 // ------------------------------------------------------------------------------
74
75 public Admin( org.openorb.trader.kernel.Kernel kernel )
76 {
77 this.kernel = kernel;
78 }
79
80 // ------------------------------------------------------------------------------
81 //
82 // Admin interface implementation
83 //
84 // ------------------------------------------------------------------------------
85
86 public byte[] request_id_stem()
87 {
88 return kernel.request_id_stem();
89 }
90
91 public int set_def_search_card( int value )
92 {
93 return kernel.set_def_search_card( value );
94 }
95
96 public int set_max_search_card( int value )
97 {
98 return kernel.set_max_search_card( value );
99 }
100
101 public int set_def_match_card( int value )
102 {
103 return kernel.set_def_match_card( value );
104 }
105
106 public int set_max_match_card( int value )
107 {
108 return kernel.set_max_match_card( value );
109 }
110
111 public int set_def_return_card( int value )
112 {
113 return kernel.set_def_return_card( value );
114 }
115
116 public int set_max_return_card( int value )
117 {
118 return kernel.set_max_return_card( value );
119 }
120
121 public int set_max_list( int value )
122 {
123 return kernel.set_max_list( value );
124 }
125
126 public boolean set_supports_modifiable_properties( boolean value )
127 {
128 return kernel.set_supports_modifiable_properties( value );
129 }
130
131 public boolean set_supports_dynamic_properties( boolean value )
132 {
133 return kernel.set_supports_dynamic_properties( value );
134 }
135
136 public boolean set_supports_proxy_offers( boolean value )
137 {
138 return kernel.set_supports_proxy_offers( value );
139 }
140
141 public int set_def_hop_count( int value )
142 {
143 return kernel.set_def_hop_count( value );
144 }
145
146 public int set_max_hop_count( int value )
147 {
148 return kernel.set_max_hop_count( value );
149 }
150
151 public org.omg.CosTrading.FollowOption set_def_follow_policy( org.omg.CosTrading.FollowOption policy )
152 {
153 return kernel.set_def_follow_policy( policy );
154 }
155
156 public org.omg.CosTrading.FollowOption set_max_follow_policy( org.omg.CosTrading.FollowOption policy )
157 {
158 return kernel.set_max_follow_policy( policy );
159 }
160
161 public org.omg.CosTrading.FollowOption set_max_link_follow_policy( org.omg.CosTrading.FollowOption policy )
162 {
163 return kernel.set_max_link_follow_policy( policy );
164 }
165
166 public org.omg.CORBA.Object set_type_repos( org.omg.CORBA.Object repository )
167 {
168 return kernel.set_type_repos( repository );
169 }
170
171 public byte[] set_request_id_stem( byte[] stem )
172 {
173 return kernel.set_request_id_stem( stem );
174 }
175
176 /**
177 * Returns a list of offers
178 */
179 public void list_offers( int how_many, org.omg.CosTrading.OfferIdSeqHolder ids, org.omg.CosTrading.OfferIdIteratorHolder id_itr )
180 throws org.omg.CosTrading.NotImplemented
181 {
182 // -- get offers from the offer repository --
183
184 org.openorb.trader.persistence.OfferRef [] offers = kernel.offer_repository().offers();
185
186 // -- returns some of them into a list holder --
187
188 int max = how_many;
189
190 if ( max > offers.length )
191 max = offers.length;
192
193 ids.value = new String[ max ];
194
195 for ( int i = 0; i < max; i++ )
196 {
197 org.openorb.trader.persistence.Offer offer = ( org.openorb.trader.persistence.Offer ) offers[ i ].deref();
198
199 ids.value[ i ] = new Long( offer.uuid() ).toString();
200 }
201
202 // -- prepares the id iterator --
203
204 String [] values = new String[ offers.length - max ];
205
206 int j = 0;
207
208 for ( int i = max; i < offers.length; i++ )
209 {
210 org.openorb.trader.persistence.Offer offer = ( org.openorb.trader.persistence.Offer ) offers[ i ].deref();
211
212 values[ j++ ] = new Long( offer.uuid() ).toString();
213 }
214
215 id_itr.value = ( new org.openorb.trader.kernel.OfferIdIterator( values ) )._this( _orb() );
216 }
217
218 /**
219 * Returns a list of proxy offers
220 */
221 public void list_proxies( int how_many, org.omg.CosTrading.OfferIdSeqHolder ids, org.omg.CosTrading.OfferIdIteratorHolder id_itr )
222 throws org.omg.CosTrading.NotImplemented
223 {
224 // -- get proxy offers from the offer repository --
225
226 org.openorb.trader.persistence.ProxyOfferRef [] offers = kernel.offer_repository().proxies();
227
228 // -- returns some of them into a list holder --
229
230 int max = how_many;
231
232 if ( max > offers.length )
233 max = offers.length;
234
235 ids.value = new String[ max ];
236
237 for ( int i = 0; i < max; i++ )
238 {
239 org.openorb.trader.persistence.ProxyOffer offer = ( org.openorb.trader.persistence.ProxyOffer ) offers[ i ].deref();
240
241 ids.value[ i ] = new Long( offer.uuid() ).toString();
242 }
243
244 // -- prepares the id iterator --
245
246 String [] values = new String[ offers.length - max ];
247
248 int j = 0;
249
250 for ( int i = max; i < offers.length; i++ )
251 {
252 org.openorb.trader.persistence.ProxyOffer offer = ( org.openorb.trader.persistence.ProxyOffer ) offers[ i ].deref();
253
254 values[ j++ ] = new Long( offer.uuid() ).toString();
255 }
256
257 id_itr.value = ( new org.openorb.trader.kernel.OfferIdIterator( values ) )._this( _orb() );
258 }
259
260 // ------------------------------------------------------------------------------
261 //
262 // TraderComponents interface implementation
263 //
264 // ------------------------------------------------------------------------------
265
266 public org.omg.CosTrading.Lookup lookup_if()
267 {
268 return kernel.lookup_if();
269 }
270
271 public org.omg.CosTrading.Register register_if()
272 {
273 return kernel.register_if();
274 }
275
276 public org.omg.CosTrading.Link link_if()
277 {
278 return kernel.link_if();
279 }
280
281 public org.omg.CosTrading.Proxy proxy_if()
282 {
283 return kernel.proxy_if();
284 }
285
286 public org.omg.CosTrading.Admin admin_if()
287 {
288 return kernel.admin_if();
289 }
290
291 // ------------------------------------------------------------------------------
292 //
293 // SupportAttributes interface implementation
294 //
295 // ------------------------------------------------------------------------------
296
297 public boolean supports_modifiable_properties()
298 {
299 return kernel.supports_modifiable_properties();
300 }
301
302 public boolean supports_dynamic_properties()
303 {
304 return kernel.supports_dynamic_properties();
305 }
306
307 public boolean supports_proxy_offers()
308 {
309 return kernel.supports_proxy_offers();
310 }
311
312 public org.omg.CORBA.Object type_repos()
313 {
314 return kernel.type_repos();
315 }
316
317 // ------------------------------------------------------------------------------
318 //
319 // ImporAttributes interface implementation
320 //
321 // ------------------------------------------------------------------------------
322
323 public int def_search_card()
324 {
325 return kernel.def_search_card();
326 }
327
328 public int max_search_card()
329 {
330 return kernel.max_search_card();
331 }
332
333 public int def_match_card()
334 {
335 return kernel.def_match_card();
336 }
337
338 public int max_match_card()
339 {
340 return kernel.max_match_card();
341 }
342
343 public int def_return_card()
344 {
345 return kernel.def_return_card();
346 }
347
348 public int max_return_card()
349 {
350 return kernel.max_return_card();
351 }
352
353 public int max_list()
354 {
355 return kernel.max_list();
356 }
357
358 public int def_hop_count()
359 {
360 return kernel.def_hop_count();
361 }
362
363 public int max_hop_count()
364 {
365 return kernel.max_hop_count();
366 }
367
368 public org.omg.CosTrading.FollowOption def_follow_policy()
369 {
370 return kernel.def_follow_policy();
371 }
372
373 public org.omg.CosTrading.FollowOption max_follow_policy()
374 {
375 return kernel.max_follow_policy();
376 }
377
378 public org.omg.CosTrading.FollowOption max_link_follow_policy()
379 {
380 return kernel.max_link_follow_policy();
381 }
382 }