Files
DistributedSystems/week1_TinsaeGhilay/Task2/GraphicsApp/RectanglePOA.java
2025-12-12 22:48:54 +01:00

115 lines
3.3 KiB
Java

package GraphicsApp;
/**
* GraphicsApp/RectanglePOA.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from Graphics.idl
* Tuesday, November 11, 2025 6:46:29 PM CET
*/
// rectangle contains shapes which GraphicalObjects a
public abstract class RectanglePOA extends org.omg.PortableServer.Servant
implements GraphicsApp.RectangleOperations, org.omg.CORBA.portable.InvokeHandler
{
// Constructors
private static java.util.Hashtable _methods = new java.util.Hashtable ();
static
{
_methods.put ("_get_objects", new java.lang.Integer (0));
_methods.put ("_set_objects", new java.lang.Integer (1));
_methods.put ("addObject", new java.lang.Integer (2));
_methods.put ("removeObjectAtPosition", new java.lang.Integer (3));
}
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
if (__method == null)
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
switch (__method.intValue ())
{
// hopping this will be an array of shapes.
case 0: // GraphicsApp/Rectangle/_get_objects
{
GraphicsApp.GraphicalObject $result[] = null;
$result = this.objects ();
out = $rh.createReply();
GraphicsApp.ObjectSequenceHelper.write (out, $result);
break;
}
// hopping this will be an array of shapes.
case 1: // GraphicsApp/Rectangle/_set_objects
{
GraphicsApp.GraphicalObject newObjects[] = GraphicsApp.ObjectSequenceHelper.read (in);
this.objects (newObjects);
out = $rh.createReply();
break;
}
// function to add shape
case 2: // GraphicsApp/Rectangle/addObject
{
GraphicsApp.GraphicalObject newShape = GraphicsApp.GraphicalObjectHelper.read (in);
this.addObject (newShape);
out = $rh.createReply();
break;
}
// and may be remove a shape from a position?
case 3: // GraphicsApp/Rectangle/removeObjectAtPosition
{
try {
int index = in.read_ulong ();
this.removeObjectAtPosition (index);
out = $rh.createReply();
} catch (GraphicsApp.RectanglePackage.IndexOutOfBounds $ex) {
out = $rh.createExceptionReply ();
GraphicsApp.RectanglePackage.IndexOutOfBoundsHelper.write (out, $ex);
}
break;
}
default:
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
}
return out;
} // _invoke
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:GraphicsApp/Rectangle:1.0"};
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
{
return (String[])__ids.clone ();
}
public Rectangle _this()
{
return RectangleHelper.narrow(
super._this_object());
}
public Rectangle _this(org.omg.CORBA.ORB orb)
{
return RectangleHelper.narrow(
super._this_object(orb));
}
} // class RectanglePOA