4 import java.rmi.Remote;
5 import javax.rmi.PortableRemoteObject;
6 import javax.rmi.CORBA.Tie;
8 import org.omg.CORBA.BAD_OPERATION;
9 import org.omg.CORBA.ORB;
10 import org.omg.CORBA.SystemException;
11 import org.omg.CORBA.portable.OutputStream;
12 import org.omg.CORBA.portable.ResponseHandler;
13 import org.omg.CORBA.portable.UnknownException;
14 import org.omg.PortableServer.Servant;
15 import org.omg.PortableServer.POA;
16 import org.omg.PortableServer.POAPackage.WrongPolicy;
17 import org.omg.PortableServer.POAPackage.ObjectNotActive;
18 import org.omg.PortableServer.POAPackage.ServantNotActive;
20 import org.omg.CORBA_2_3.portable.InputStream;
23 * This class accepts remote calls to the served GIOP object and delegates them
24 * to the enclosed implementing class. Being servant, it must be connected to
26 * It is normally generated with grmic -poa
28 public class _#nameImpl_Tie extends Servant implements Tie
31 * All decoded remote calls are forwarded to this target.
36 * The array of repository ids, supported by this GIOP Object
38 private static final String[] type_ids =
44 * Get an array of all interfaces, supported by this
48 * @param objectId unused
50 * @return the array of Ids.
52 public String[] _all_interfaces(POA poa,
61 * Set the invocation target, where all received calls are finally
64 * @param a_target the forwarding target
66 * @throws ClassCastException if the target is not an instance of
69 public void setTarget(Remote a_target)
71 this.target = (#implName) a_target;
75 * Get the invocation target, where all received calls are finally
78 * @return the target, an instance of
81 public Remote getTarget()
87 * Return the actual GIOP object that would handle this request.
89 * @return the GIOP object.
91 public org.omg.CORBA.Object thisObject()
93 return _this_object();
97 * Deactivate this {@link Servant}. The WrongPolicy, ObjectNotActive
98 * and ServantNotActive exceptions, if thrown during deactivation, are
99 * catched and silently ignored.
101 public void deactivate()
105 _poa().deactivate_object(_poa().servant_to_id(this));
107 catch (WrongPolicy exception)
110 catch (ObjectNotActive exception)
113 catch (ServantNotActive exception)
119 * Get the {@link ORB} where this {@link Servant} is connected.
129 * Connect this servant to the given ORB. It is recommended to connect
130 * servant to the ORBs root or other POA rather than using this method.
132 public void orb(ORB orb)
136 ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
138 catch (ClassCastException e)
140 throw new org.omg.CORBA.BAD_PARAM(
141 "POA Servant requires an instance of org.omg.CORBA_2_3.ORB"
147 * This method is invoked by ORB in response to the remote call. It redirects
148 * the call to one of the methods in the target.
150 * @param method the name of the method to call.
151 * @param parameter_stream the input stream, from where the parameters must be
153 * @param reply the response hander, providing methods to return the result.
155 * @return the output stream, created by the response handler
157 * @throws SystemException if one occurs during method invocation.
159 public OutputStream _invoke(String method,
160 org.omg.CORBA.portable.InputStream parameter_stream,
161 ResponseHandler reply
162 ) throws SystemException
166 InputStream in =(InputStream) parameter_stream;
167 switch (method.charAt(#hashCharPos))
173 throw new BAD_OPERATION("No such method: '"+method+"'");
175 catch (SystemException ex)
181 throw new UnknownException(ex);