1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46:
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59: import ;
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67: import ;
68: import ;
69:
70: import ;
71:
72: import ;
73: import ;
74:
75:
90: public class OrbRestricted extends org.omg.CORBA_2_3.ORB
91: {
92:
95: public static final ORB Singleton = new OrbRestricted();
96:
97:
101: public IORInterceptor_3_0Operations iIor;
102:
103:
107: public ServerRequestInterceptorOperations iServer;
108:
109:
113: public ClientRequestInterceptorOperations iClient;
114:
115:
118: public int icSlotSize = 0;
119:
120:
123: protected Hashtable factories = new Hashtable();
124:
125:
128: protected Hashtable policyFactories = new Hashtable();
129:
130:
134: protected OrbRestricted()
135: {
136: }
137:
138:
139: public TypeCode create_alias_tc(String id, String name, TypeCode typecode)
140: {
141: return new AliasTypeCode(typecode, id, name);
142: }
143:
144:
145: public Any create_any()
146: {
147: gnuAny any = new gnuAny();
148: any.setOrb(this);
149: return any;
150: }
151:
152:
153: public TypeCode create_array_tc(int length, TypeCode element_type)
154: {
155: ArrayTypeCode p =
156: new ArrayTypeCode(TCKind.tk_array, element_type);
157: p.setLength(length);
158: return p;
159: }
160:
161:
162: public ContextList create_context_list()
163: {
164: return new gnuContextList();
165: }
166:
167:
168: public TypeCode create_enum_tc(String id, String name, String[] values)
169: {
170: RecordTypeCode r = new RecordTypeCode(TCKind.tk_enum);
171: for (int i = 0; i < values.length; i++)
172: {
173: r.field().name = values [ i ];
174: }
175:
176: r.setId(id);
177: r.setName(name);
178:
179: return r;
180: }
181:
182:
183: public Environment create_environment()
184: {
185: return new gnuEnvironment();
186: }
187:
188:
189: public ExceptionList create_exception_list()
190: {
191: return new gnuExceptionList();
192: }
193:
194:
195: public TypeCode create_exception_tc(String id, String name,
196: StructMember[] members
197: )
198: {
199: RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
200: r.setId(id);
201: r.setName(name);
202:
203: for (int i = 0; i < members.length; i++)
204: {
205: r.add(members [ i ]);
206: }
207:
208: return r;
209: }
210:
211:
216: public TypeCode create_interface_tc(String id, String name)
217: {
218: no();
219: return null;
220: }
221:
222:
223: public NVList create_list(int count)
224: {
225: return new gnuNVList(count);
226: }
227:
228:
229: public NamedValue create_named_value(String s, Any any, int flags)
230: {
231: return new gnuNamedValue();
232: }
233:
234:
235: public OutputStream create_output_stream()
236: {
237: BufferedCdrOutput stream = new BufferedCdrOutput();
238: stream.setOrb(this);
239: return stream;
240: }
241:
242:
243: public TypeCode create_sequence_tc(int bound, TypeCode element_type)
244: {
245: ArrayTypeCode p =
246: new ArrayTypeCode(TCKind.tk_sequence, element_type);
247: p.setLength(bound);
248: return p;
249: }
250:
251:
252: public TypeCode create_string_tc(int bound)
253: {
254: StringTypeCode p = new StringTypeCode(TCKind.tk_string);
255: p.setLength(bound);
256: return p;
257: }
258:
259:
260: public TypeCode create_struct_tc(String id, String name,
261: StructMember[] members
262: )
263: {
264: RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
265: r.setId(id);
266: r.setName(name);
267:
268: for (int i = 0; i < members.length; i++)
269: {
270: r.add(members [ i ]);
271: }
272:
273: return r;
274: }
275:
276:
277: public TypeCode create_union_tc(String id, String name,
278: TypeCode discriminator_type, UnionMember[] members
279: )
280: {
281: RecordTypeCode r = new RecordTypeCode(TCKind.tk_union);
282: r.setId(id);
283: r.setName(name);
284: r.setDiscriminator_type(discriminator_type);
285: r.setDefaultIndex(0);
286:
287: for (int i = 0; i < members.length; i++)
288: {
289: r.add(members [ i ]);
290: }
291:
292: return r;
293: }
294:
295:
296: public TypeCode create_wstring_tc(int bound)
297: {
298: StringTypeCode p = new StringTypeCode(TCKind.tk_wstring);
299: p.setLength(bound);
300: return p;
301: }
302:
303:
304: public TypeCode get_primitive_tc(TCKind tcKind)
305: {
306: try
307: {
308: return TypeKindNamer.getPrimitveTC(tcKind);
309: }
310: catch (BadKind ex)
311: {
312: throw new BAD_PARAM("This is not a primitive type code: " +
313: tcKind.value()
314: );
315: }
316: }
317:
318:
323: public String[] list_initial_services()
324: {
325: no();
326: throw new InternalError();
327: }
328:
329:
334: public String object_to_string(org.omg.CORBA.Object forObject)
335: {
336: no();
337: throw new InternalError();
338: }
339:
340:
348: public org.omg.CORBA.Object resolve_initial_references(String name)
349: throws InvalidName
350: {
351: no();
352: throw new InternalError();
353: }
354:
355:
360: public void run()
361: {
362: }
363:
364:
369: public void shutdown(boolean wait_for_completion)
370: {
371: }
372:
373:
378: public org.omg.CORBA.Object string_to_object(String IOR)
379: {
380: no();
381: throw new InternalError();
382: }
383:
384:
389: protected void set_parameters(Applet app, Properties props)
390: {
391: no();
392: }
393:
394:
399: protected void set_parameters(String[] args, Properties props)
400: {
401: no();
402: }
403:
404:
408: private final void no()
409: {
410:
411:
412: throw new NO_IMPLEMENT("Use init(args, props) for the functional version.");
413: }
414:
415:
420: public Request get_next_response() throws org.omg.CORBA.WrongTransaction
421: {
422: no();
423: throw new InternalError();
424: }
425:
426:
431: public boolean poll_next_response()
432: {
433: no();
434: throw new InternalError();
435: }
436:
437:
442: public void send_multiple_requests_deferred(Request[] requests)
443: {
444: no();
445: }
446:
447:
452: public void send_multiple_requests_oneway(Request[] requests)
453: {
454: no();
455: }
456:
457:
460: public ValueFactory register_value_factory(String repository_id,
461: ValueFactory factory
462: )
463: {
464: factories.put(repository_id, factory);
465: return factory;
466: }
467:
468:
471: public void unregister_value_factory(String id)
472: {
473: factories.remove(id);
474: }
475:
476:
486: public ValueFactory lookup_value_factory(String repository_id)
487: {
488: ValueFactory f = (ValueFactory) factories.get(repository_id);
489: if (f != null)
490: {
491: return f;
492: }
493:
494: f = (ValueFactory) ObjectCreator.createObject(repository_id,
495: "DefaultFactory"
496: );
497: if (f != null)
498: {
499: factories.put(repository_id, f);
500: }
501: return f;
502: }
503:
504:
507: public void destroy()
508: {
509: if (iIor != null)
510: {
511: iIor.destroy();
512: iIor = null;
513: }
514:
515: if (iServer != null)
516: {
517: iServer.destroy();
518: iServer = null;
519: }
520:
521: if (iClient != null)
522: {
523: iClient.destroy();
524: iClient = null;
525: }
526:
527: super.destroy();
528: }