001    package org.omg.CosNaming;
002    
003    
004    /**
005    * org/omg/CosNaming/NamingContextHelper.java .
006    * Generated by the IDL-to-Java compiler (portable), version "3.2"
007    * from /home/iurt/rpm/BUILD/geronimo-spec-corba/src/main/idl/CosNaming.idl
008    * Saturday, November 26, 2011 9:53:36 PM UTC
009    */
010    
011    
012    /** 
013       * A naming context is an object that contains a set of name bindings in 
014       * which each name is unique. Different names can be bound to an object 
015       * in the same or different contexts at the same time. <p>
016       * 
017       * See <a href=" http://www.omg.org/corba/sectrans.htm#nam">CORBA COS 
018       * Naming Specification.</a>
019       */
020    abstract public class NamingContextHelper
021    {
022      private static String  _id = "IDL:omg.org/CosNaming/NamingContext:1.0";
023    
024      public static void insert (org.omg.CORBA.Any a, org.omg.CosNaming.NamingContext that)
025      {
026        org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
027        a.type (type ());
028        write (out, that);
029        a.read_value (out.create_input_stream (), type ());
030      }
031    
032      public static org.omg.CosNaming.NamingContext extract (org.omg.CORBA.Any a)
033      {
034        return read (a.create_input_stream ());
035      }
036    
037      private static org.omg.CORBA.TypeCode __typeCode = null;
038      synchronized public static org.omg.CORBA.TypeCode type ()
039      {
040        if (__typeCode == null)
041        {
042          __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CosNaming.NamingContextHelper.id (), "NamingContext");
043        }
044        return __typeCode;
045      }
046    
047      public static String id ()
048      {
049        return _id;
050      }
051    
052      public static org.omg.CosNaming.NamingContext read (org.omg.CORBA.portable.InputStream istream)
053      {
054        return narrow (istream.read_Object (_NamingContextStub.class));
055      }
056    
057      public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CosNaming.NamingContext value)
058      {
059        ostream.write_Object ((org.omg.CORBA.Object) value);
060      }
061    
062      public static org.omg.CosNaming.NamingContext narrow (org.omg.CORBA.Object obj)
063      {
064        if (obj == null)
065          return null;
066        else if (obj instanceof org.omg.CosNaming.NamingContext)
067          return (org.omg.CosNaming.NamingContext)obj;
068        else if (!obj._is_a (id ()))
069          throw new org.omg.CORBA.BAD_PARAM ();
070        else
071        {
072          org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
073          org.omg.CosNaming._NamingContextStub stub = new org.omg.CosNaming._NamingContextStub ();
074          stub._set_delegate(delegate);
075          return stub;
076        }
077      }
078    
079      public static org.omg.CosNaming.NamingContext unchecked_narrow (org.omg.CORBA.Object obj)
080      {
081        if (obj == null)
082          return null;
083        else if (obj instanceof org.omg.CosNaming.NamingContext)
084          return (org.omg.CosNaming.NamingContext)obj;
085        else
086        {
087          org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
088          org.omg.CosNaming._NamingContextStub stub = new org.omg.CosNaming._NamingContextStub ();
089          stub._set_delegate(delegate);
090          return stub;
091        }
092      }
093    
094    }