KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > iiop > interfaces > IdlInterfaceHelper


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.iiop.interfaces;
23
24
25 /**
26 * org/jboss/test/iiop/interfaces/IdlInterfaceHelper.java .
27 * Generated by the IDL-to-Java compiler (portable), version "3.1"
28 * from IdlInterface.idl
29 * Tuesday, October 21, 2003 3:27:10 PM BRST
30 */

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