1 /* 2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package org.omg.PortableServer; 27 28 29 /** 30 * org/omg/PortableServer/CurrentHelper.java . 31 * Generated by the IDL-to-Java compiler (portable), version "3.1" 32 * from ../../../../src/share/classes/org/omg/PortableServer/poa.idl 33 * Tuesday, October 23, 2001 1:17:01 PM PDT 34 */ 35 36 37 /** 38 * The PortableServer::Current interface, derived from 39 * CORBA::Current, provides method implementations with 40 * access to the identity of the object on which the 41 * method was invoked. The Current interface is provided 42 * to support servants that implement multiple objects, 43 * but can be used within the context of POA-dispatched 44 * method invocations on any servant. To provide location 45 * transparency, ORBs are required to support use of 46 * Current in the context of both locally and remotely 47 * invoked operations. An instance of Current can be 48 * obtained by the application by issuing the 49 * CORBA::ORB::resolve_initial_references("POACurrent") 50 * operation. Thereafter, it can be used within the 51 * context of a method dispatched by the POA to obtain 52 * the POA and ObjectId that identify the object on 53 * which that operation was invoked. 54 */ 55 abstract public class CurrentHelper 56 { 57 private static String _id = "IDL:omg.org/PortableServer/Current:2.3"; 58 59 public static void insert (org.omg.CORBA.Any a, 60 org.omg.PortableServer.Current that) 61 { 62 org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); 63 a.type (type ()); 64 write (out, that); 65 a.read_value (out.create_input_stream (), type ()); 66 } 67 68 public static org.omg.PortableServer.Current extract (org.omg.CORBA.Any a) 69 { 70 return read (a.create_input_stream ()); 71 } 72 73 private static org.omg.CORBA.TypeCode __typeCode = null; 74 synchronized public static org.omg.CORBA.TypeCode type () 75 { 76 if (__typeCode == null) 77 { 78 __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc ( 79 org.omg.PortableServer.CurrentHelper.id (), "Current"); 80 } 81 return __typeCode; 82 } 83 84 public static String id () 85 { 86 return _id; 87 } 88 89 public static org.omg.PortableServer.Current read ( 90 org.omg.CORBA.portable.InputStream istream) 91 { 92 throw new org.omg.CORBA.MARSHAL (); 93 } 94 95 public static void write (org.omg.CORBA.portable.OutputStream ostream, 96 org.omg.PortableServer.Current value) 97 { 98 throw new org.omg.CORBA.MARSHAL (); 99 } 100 101 public static org.omg.PortableServer.Current narrow ( 102 org.omg.CORBA.Object obj) 103 { 104 if (obj == null) 105 return null; 106 else if (obj instanceof org.omg.PortableServer.Current) 107 return (org.omg.PortableServer.Current)obj; 108 else if (!obj._is_a (id ())) 109 throw new org.omg.CORBA.BAD_PARAM (); 110 return null; 111 } 112 113 }