KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CosNaming > NamingContextHelper


1 package org.omg.CosNaming;
2
3
4 /**
5 * org/omg/CosNaming/NamingContextHelper.java .
6 * Generated by the IDL-to-Java compiler (portable), version "3.2"
7 * from ../../../../src/share/classes/org/omg/CosNaming/nameservice.idl
8 * Saturday, February 9, 2008 9:40:10 AM GMT
9 */

10
11
12 /**
13  * A naming context is an object that contains a set of name bindings in
14  * which each name is unique. Different names can be bound to an object
15  * in the same or different contexts at the same time. <p>
16  *
17  * See <a HREF="http://www.omg.org/technology/documents/formal/naming_service.htm">
18  * CORBA COS
19  * Naming Specification.</a>
20  */

21 abstract public class NamingContextHelper
22 {
23   private static String JavaDoc _id = "IDL:omg.org/CosNaming/NamingContext:1.0";
24
25   public static void insert (org.omg.CORBA.Any JavaDoc a, org.omg.CosNaming.NamingContext JavaDoc that)
26   {
27     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
28     a.type (type ());
29     write (out, that);
30     a.read_value (out.create_input_stream (), type ());
31   }
32
33   public static org.omg.CosNaming.NamingContext JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
34   {
35     return read (a.create_input_stream ());
36   }
37
38   private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
39   synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
40   {
41     if (__typeCode == null)
42     {
43       __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CosNaming.NamingContextHelper.id (), "NamingContext");
44     }
45     return __typeCode;
46   }
47
48   public static String JavaDoc id ()
49   {
50     return _id;
51   }
52
53   public static org.omg.CosNaming.NamingContext JavaDoc read (org.omg.CORBA.portable.InputStream JavaDoc istream)
54   {
55     return narrow (istream.read_Object (_NamingContextStub JavaDoc.class));
56   }
57
58   public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, org.omg.CosNaming.NamingContext JavaDoc value)
59   {
60     ostream.write_Object ((org.omg.CORBA.Object JavaDoc) value);
61   }
62
63   public static org.omg.CosNaming.NamingContext JavaDoc narrow (org.omg.CORBA.Object JavaDoc obj)
64   {
65     if (obj == null)
66       return null;
67     else if (obj instanceof org.omg.CosNaming.NamingContext JavaDoc)
68       return (org.omg.CosNaming.NamingContext JavaDoc)obj;
69     else if (!obj._is_a (id ()))
70       throw new org.omg.CORBA.BAD_PARAM JavaDoc ();
71     else
72     {
73       org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc)obj)._get_delegate ();
74       org.omg.CosNaming._NamingContextStub JavaDoc stub = new org.omg.CosNaming._NamingContextStub JavaDoc ();
75       stub._set_delegate(delegate);
76       return stub;
77     }
78   }
79
80   public static org.omg.CosNaming.NamingContext JavaDoc unchecked_narrow (org.omg.CORBA.Object JavaDoc obj)
81   {
82     if (obj == null)
83       return null;
84     else if (obj instanceof org.omg.CosNaming.NamingContext JavaDoc)
85       return (org.omg.CosNaming.NamingContext JavaDoc)obj;
86     else
87     {
88       org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc)obj)._get_delegate ();
89       org.omg.CosNaming._NamingContextStub JavaDoc stub = new org.omg.CosNaming._NamingContextStub JavaDoc ();
90       stub._set_delegate(delegate);
91       return stub;
92     }
93   }
94
95 }
96
Popular Tags