e.g.
MyException
MyExceptionHelper |
// J#
package demo.grid.MyServerPackage;
/**
* Exception definition : MyException
*
* @author TomORB J# Native Compiler
*/
public final class MyException extends org.omg.CORBA.UserException
{
/**
* Exception member why
*/
public java.lang.String why;
/**
* Default constructor
*/
public MyException()
{
super(MyExceptionHelper.id());
}
/**
* Constructor with fields initialization
* @param why why exception member
*/
public MyException(java.lang.String why)
{
super(MyExceptionHelper.id());
this.why = why;
}
/**
* Full constructor with fields initialization
* @param why why exception member
*/
public MyException(java.lang.String orb_reason, java.lang.String why)
{
super(MyExceptionHelper.id() +" " + orb_reason);
this.why = why;
}
}
package demo.grid.MyServerPackage;
/**
* Helper class for : MyException
*
* @author TomORB J# Native Compiler
*/
public class MyExceptionHelper
{
/**
* Insert MyException into an any
* @param a an any
* @param t MyException value
*/
public static void insert(org.omg.CORBA.Any a, demo.grid.MyServerPackage.MyException t)
{
a.insert_Streamable(new demo.grid.MyServerPackage.MyExceptionHolder(t));
}
/**
* Extract MyException from an any
* @param a an any
* @return the extracted MyException value
*/
public static demo.grid.MyServerPackage.MyException extract(org.omg.CORBA.Any a)
{
if (!a.type().equal(type()))
throw new org.omg.CORBA.MARSHAL();
return read(a.create_input_stream());
}
//
// Internal TypeCode value
//
private static org.omg.CORBA.TypeCode _tc = null;
private static boolean _working = false;
/**
* Return the MyException TypeCode
* @return a TypeCode
*/
public static org.omg.CORBA.TypeCode type()
{
if (_tc == null) {
synchronized(org.omg.CORBA.TypeCode.class) {
if (_tc != null)
return _tc;
if (_working)
return org.omg.CORBA.ORB.init().create_recursive_tc(id());
_working = true;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember []_members = new org.omg.CORBA.StructMember[1];
_members[0] = new org.omg.CORBA.StructMember();
_members[0].name = "why";
_members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
_tc = orb.create_exception_tc(id(),"MyException",_members);
_working = false;
}
}
return _tc;
}
/**
* Return the MyException IDL ID
* @return an ID
*/
public static java.lang.String id()
{
return _id;
}
private final static java.lang.String _id = "IDL:demo/grid/MyServer/MyException:1.0";
/**
* Read MyException from a marshalled stream
* @param istream the input stream
* @return the readed MyException value
*/
public static demo.grid.MyServerPackage.MyException read(org.omg.CORBA.portable.InputStream istream)
{
demo.grid.MyServerPackage.MyException new_one = new demo.grid.MyServerPackage.MyException();
if (!istream.read_string().equals(id()))
throw new org.omg.CORBA.MARSHAL();
new_one.why = istream.read_string();
return new_one;
}
/**
* Write MyException into a marshalled stream
* @param ostream the output stream
* @param value MyException value
*/
public static void write(org.omg.CORBA.portable.OutputStream ostream, demo.grid.MyServerPackage.MyException value)
{
ostream.write_string(id());
ostream.write_string(value.why);
}
}
package demo.grid.MyServerPackage;
/**
* Holder class for : MyException
*
* @author TomORB J# Native Compiler
*/
final public class MyExceptionHolder
implements org.omg.CORBA.portable.Streamable
{
/**
* Internal MyException value
*/
public demo.grid.MyServerPackage.MyException value;
/**
* Default constructor
*/
public MyExceptionHolder()
{ }
/**
* Constructor with value initialisation
* @param initial the initial value
*/
public MyExceptionHolder(demo.grid.MyServerPackage.MyException initial)
{
value = initial;
}
/**
* Read MyException from a marshalled stream
* @param istream the input stream
*/
public void _read(org.omg.CORBA.portable.InputStream istream)
{
value = MyExceptionHelper.read(istream);
}
/**
* Write MyException into a marshalled stream
* @param ostream the output stream
*/
public void _write(org.omg.CORBA.portable.OutputStream ostream)
{
MyExceptionHelper.write(ostream,value);
}
/**
* Return the MyException TypeCode
* @return a TypeCode
*/
public org.omg.CORBA.TypeCode _type()
{
return MyExceptionHelper.type();
}
}
|