IDL Complex Type
interface

TBD

Properties inside an interface are represented by set-accessors and get-accessors.

 

// CORBA IDL
interface GoodDay 
{            
   string hello_simple();           
   wstring hello_wide( in wstring msg );            
};
e.g.
GoodDay
GoodDayOperations
GoodDayHelper
_GoodDayStub
GoodDayPOA
GoodDayPOATie
// J# 

package demo.hello;

/**
 * Interface definition : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
public interface GoodDay extends GoodDayOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
{
}


package demo.hello;

/** 
 * Helper class for : GoodDay
 *  
 * @author TomORB J# Native Compiler
 */ 
public class GoodDayHelper
{
   /**
    * Insert GoodDay into an any
    * @param a an any
    * @param t GoodDay value
    */
   public static void insert(org.omg.CORBA.Any a, demo.hello.GoodDay t)
	{
		a.insert_Object(t , type());
	}

   /**
    * Extract GoodDay from an any
    * @param a an any
    * @return the extracted GoodDay value
    */
   public static demo.hello.GoodDay extract(org.omg.CORBA.Any a)
   {
      if (!a.type().equal(type()))
         throw new org.omg.CORBA.MARSHAL();
      try {
         return demo.hello.GoodDayHelper.narrow(a.extract_Object());
      } catch (final org.omg.CORBA.BAD_PARAM e) {
         throw new org.omg.CORBA.MARSHAL(e.getMessage());
      }
   }

   //
   // Internal TypeCode value
   //
   private static org.omg.CORBA.TypeCode _tc = null;

   /**
    * Return the GoodDay TypeCode
    * @return a TypeCode
    */
   public static org.omg.CORBA.TypeCode type()
   {
      if (_tc == null) {
         org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
         _tc = orb.create_interface_tc(id(),"GoodDay");
      }
      return _tc;
   }

   /**
    * Return the GoodDay IDL ID
    * @return an ID
    */
   public static java.lang.String id()
   {
      return _id;
   }

   private final static java.lang.String _id = "IDL:demo/hello/GoodDay:1.0";

   /**
    * Read GoodDay from a marshalled stream
    * @param istream the input stream
    * @return the readed GoodDay value
    */
   public static demo.hello.GoodDay read(org.omg.CORBA.portable.InputStream istream)
   {
      return(demo.hello.GoodDay)istream.read_Object(demo.hello._GoodDayStub.class);
   }

   /**
    * Write GoodDay into a marshalled stream
    * @param ostream the output stream
    * @param value GoodDay value
    */
   public static void write(org.omg.CORBA.portable.OutputStream ostream, demo.hello.GoodDay value)
   {
      ostream.write_Object((org.omg.CORBA.portable.ObjectImpl)value);
   }

   /**
    * Narrow CORBA::Object to GoodDay
    * @param obj the CORBA Object
    * @return GoodDay Object
    */
   public static GoodDay narrow(org.omg.CORBA.Object obj)
   {
      if (obj == null)
         return null;
      if (obj instanceof GoodDay)
         return (GoodDay)obj;

      if (obj._is_a(id()))
      {
         _GoodDayStub stub = new _GoodDayStub();
         stub._set_delegate(((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate());
         return stub;
      }

      throw new org.omg.CORBA.BAD_PARAM();
   }

   /**
    * Unchecked Narrow CORBA::Object to GoodDay
    * @param obj the CORBA Object
    * @return GoodDay Object
    */
   public static GoodDay unchecked_narrow(org.omg.CORBA.Object obj)
   {
      if (obj == null)
         return null;
      if (obj instanceof GoodDay)
         return (GoodDay)obj;

      _GoodDayStub stub = new _GoodDayStub();
      stub._set_delegate(((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate());
      return stub;
   }
}


package demo.hello;

/**
 * Holder class for : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
final public class GoodDayHolder
		implements org.omg.CORBA.portable.Streamable
{
   /**
    * Internal GoodDay value
    */
   public demo.hello.GoodDay value;

   /**
    * Default constructor
    */
   public GoodDayHolder()
   { }

   /**
    * Constructor with value initialisation
    * @param initial the initial value
    */
   public GoodDayHolder(demo.hello.GoodDay initial)
   {
      value = initial;
   }

   /**
    * Read GoodDay from a marshalled stream
    * @param istream the input stream
   */
   public void _read(org.omg.CORBA.portable.InputStream istream)
   {
      value = GoodDayHelper.read(istream);
   }

   /**
    * Write GoodDay into a marshalled stream
    * @param ostream the output stream
    */
   public void _write(org.omg.CORBA.portable.OutputStream ostream)
   {
      GoodDayHelper.write(ostream,value);
   }

   /**
    * Return the GoodDay TypeCode
    * @return a TypeCode
    */
   public org.omg.CORBA.TypeCode _type()
   {
      return GoodDayHelper.type();
   }

}


package demo.hello;

/**
 * Interface definition : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
public interface GoodDayOperations
{
   /**
    * Operation hello_simple
    */
   public java.lang.String hello_simple();

   /**
    * Operation hello_wide
    */
   public java.lang.String hello_wide(java.lang.String msg);

}


package demo.hello;

/**
 * Interface definition : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
public abstract class GoodDayPOA extends org.omg.PortableServer.Servant
		implements GoodDayOperations, org.omg.CORBA.portable.InvokeHandler
{
   public GoodDay _this()
   {
      return GoodDayHelper.narrow(_this_object());
   }

   public GoodDay _this(org.omg.CORBA.ORB orb)
   {
      return GoodDayHelper.narrow(_this_object(orb));
   }

   private static java.lang.String [] _ids_list =
   {
      "IDL:demo/hello/GoodDay:1.0"
   };

   public java.lang.String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
   {
     return _ids_list;
   }

   public final org.omg.CORBA.portable.OutputStream _invoke(final java.lang.String opName,
             final org.omg.CORBA.portable.InputStream _is,
		     final org.omg.CORBA.portable.ResponseHandler handler)
   {
      if (opName.equals("hello_simple")) {
         return _invoke_hello_simple(_is, handler);
      } else if (opName.equals("hello_wide")) {
         return _invoke_hello_wide(_is, handler);
      } else {
         throw new org.omg.CORBA.BAD_OPERATION(opName);
      }
   }

   // helper methods
   private org.omg.CORBA.portable.OutputStream _invoke_hello_simple(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
   {
      org.omg.CORBA.portable.OutputStream _output;

      java.lang.String _arg_result = hello_simple();

      _output = handler.createReply();
      _output.write_string(_arg_result);

      return _output;
   }

   private org.omg.CORBA.portable.OutputStream _invoke_hello_wide(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
   {
      org.omg.CORBA.portable.OutputStream _output;
      java.lang.String arg0_in = _is.read_wstring();

      java.lang.String _arg_result = hello_wide(arg0_in);

      _output = handler.createReply();
      _output.write_wstring(_arg_result);

      return _output;
   }
}

package demo.hello;

/**
 * Interface definition : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
public class GoodDayPOATie extends GoodDayPOA
{
   //
   // Private reference to implementation object
   //
   private GoodDayOperations _tie;

   //
   // Private reference to POA
   //
   private org.omg.PortableServer.POA _poa;

   /**
    * Constructor
    */
   public GoodDayPOATie(GoodDayOperations tieObject)
   {
	   _tie = tieObject;
   }

   /**
    * Constructor
    */
   public GoodDayPOATie(GoodDayOperations tieObject, org.omg.PortableServer.POA poa)
   {
      _tie = tieObject;
      _poa = poa;
   }

   public GoodDay _this()
   {
      return GoodDayHelper.narrow( _this_object());
   }

   public GoodDay _this(org.omg.CORBA.ORB orb)
   {
      return GoodDayHelper.narrow( _this_object(orb));
   }

   /**
    * Get the delegate
    */
   public GoodDayOperations _delegate()
   {
      return _tie;
   }

   /**
    * Set the delegate
    */
   public void _delegate(GoodDayOperations delegate_)
   {
      _tie = delegate_;
   }

   /**
    * _default_POA method
    */
   public org.omg.PortableServer.POA _default_POA()
   {
      if (_poa != null)
         return _poa;
      else
         return super._default_POA();
   }

   /**
    * Operation hello_simple
    */
   public java.lang.String hello_simple()
   {
      return _tie.hello_simple();
   }

   /**
    * Operation hello_wide
    */
   public java.lang.String hello_wide(java.lang.String msg)
   {
      return _tie.hello_wide( msg);
   }

}


package demo.hello;

/**
 * Interface definition : GoodDay
 * 
 * @author TomORB J# Native Compiler
 */
public class _GoodDayStub extends org.omg.CORBA.portable.ObjectImpl
   implements GoodDay
{
   static final java.lang.String[] _ids_list =
   {
      "IDL:demo/hello/GoodDay:1.0"
   };

   public java.lang.String[] _ids()
   {
      return _ids_list;
   }

   private final static Class _opsType = demo.hello.GoodDayOperations.class;

   /**
    * Operation hello_simple
    */
   public java.lang.String hello_simple()
   {
      while(true)
      {
         if (!this._is_local())
         {
            org.omg.CORBA.portable.InputStream _input = null;
            try
            {
               org.omg.CORBA.portable.OutputStream _output = this._request("hello_simple",true);
               _input = this._invoke(_output);
               java.lang.String _arg_ret = _input.read_string();
               return _arg_ret;
            }
            catch(org.omg.CORBA.portable.RemarshalException _exception)
            {
               continue;
            }
            catch(org.omg.CORBA.portable.ApplicationException _exception)
            {
               java.lang.String _exception_id = _exception.getId();
               throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
            }
            finally
            {
               this._releaseReply(_input);
            }
         }
         else
         {
            org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("hello_simple",_opsType);
            if (_so == null)
               continue;
            demo.hello.GoodDayOperations _self = (demo.hello.GoodDayOperations) _so.servant;
            try
            {
               return _self.hello_simple();
            }
            finally
            {
               _servant_postinvoke(_so);
            }
         }
      }
   }

   /**
    * Operation hello_wide
    */
   public java.lang.String hello_wide(java.lang.String msg)
   {
      while(true)
      {
         if (!this._is_local())
         {
            org.omg.CORBA.portable.InputStream _input = null;
            try
            {
               org.omg.CORBA.portable.OutputStream _output = this._request("hello_wide",true);
               _output.write_wstring(msg);
               _input = this._invoke(_output);
               java.lang.String _arg_ret = _input.read_wstring();
               return _arg_ret;
            }
            catch(org.omg.CORBA.portable.RemarshalException _exception)
            {
               continue;
            }
            catch(org.omg.CORBA.portable.ApplicationException _exception)
            {
               java.lang.String _exception_id = _exception.getId();
               throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
            }
            finally
            {
               this._releaseReply(_input);
            }
         }
         else
         {
            org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("hello_wide",_opsType);
            if (_so == null)
               continue;
            demo.hello.GoodDayOperations _self = (demo.hello.GoodDayOperations) _so.servant;
	        try
            {
               return _self.hello_wide( msg);
            }
            finally
            {
               _servant_postinvoke(_so);
            }
         }
      }
   }

}