KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > PortableServer > CurrentHelper


1 /*
2  * @(#)CurrentHelper.java 1.4 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package org.omg.PortableServer;
9
10
11 /**
12 * org/omg/PortableServer/CurrentHelper.java .
13 * Generated by the IDL-to-Java compiler (portable), version "3.1"
14 * from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
15 * Tuesday, October 23, 2001 1:17:01 PM PDT
16 */

17
18
19 /**
20  * The PortableServer::Current interface, derived from
21  * CORBA::Current, provides method implementations with
22  * access to the identity of the object on which the
23  * method was invoked. The Current interface is provided
24  * to support servants that implement multiple objects,
25  * but can be used within the context of POA-dispatched
26  * method invocations on any servant. To provide location
27  * transparency, ORBs are required to support use of
28  * Current in the context of both locally and remotely
29  * invoked operations. An instance of Current can be
30  * obtained by the application by issuing the
31  * CORBA::ORB::resolve_initial_references("POACurrent")
32  * operation. Thereafter, it can be used within the
33  * context of a method dispatched by the POA to obtain
34  * the POA and ObjectId that identify the object on
35  * which that operation was invoked.
36  */

37 abstract public class CurrentHelper
38 {
39     private static String JavaDoc _id = "IDL:omg.org/PortableServer/Current:2.3";
40
41     public static void insert (org.omg.CORBA.Any JavaDoc a,
42         org.omg.PortableServer.Current JavaDoc that)
43     {
44         org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
45         a.type (type ());
46         write (out, that);
47         a.read_value (out.create_input_stream (), type ());
48     }
49
50     public static org.omg.PortableServer.Current JavaDoc extract (org.omg.CORBA.Any JavaDoc a)
51     {
52         return read (a.create_input_stream ());
53     }
54
55     private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
56     synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
57     {
58         if (__typeCode == null)
59         {
60             __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (
61                 org.omg.PortableServer.CurrentHelper.id (), "Current");
62         }
63         return __typeCode;
64     }
65
66     public static String JavaDoc id ()
67     {
68         return _id;
69     }
70
71     public static org.omg.PortableServer.Current JavaDoc read (
72         org.omg.CORBA.portable.InputStream JavaDoc istream)
73     {
74         throw new org.omg.CORBA.MARSHAL JavaDoc ();
75     }
76
77     public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream,
78         org.omg.PortableServer.Current JavaDoc value)
79     {
80         throw new org.omg.CORBA.MARSHAL JavaDoc ();
81     }
82
83     public static org.omg.PortableServer.Current JavaDoc narrow (
84         org.omg.CORBA.Object JavaDoc obj)
85     {
86         if (obj == null)
87             return null;
88         else if (obj instanceof org.omg.PortableServer.Current JavaDoc)
89             return (org.omg.PortableServer.Current JavaDoc)obj;
90         else if (!obj._is_a (id ()))
91             throw new org.omg.CORBA.BAD_PARAM JavaDoc ();
92         return null;
93     }
94
95 }
96
Popular Tags