KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > PortableServer > _ServantLocatorStub


1 package org.omg.PortableServer;
2
3
4 /**
5 * org/omg/PortableServer/_ServantLocatorStub.java .
6 * Generated by the IDL-to-Java compiler (portable), version "3.2"
7 * from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
8 * Saturday, February 9, 2008 9:40:03 AM GMT
9 */

10
11
12 /**
13      * When the POA has the NON_RETAIN policy it uses servant
14      * managers that are ServantLocators. Because the POA
15      * knows that the servant returned by this servant
16      * manager will be used only for a single request,
17      * it can supply extra information to the servant
18      * manager's operations and the servant manager's pair
19      * of operations may be able to cooperate to do
20      * something different than a ServantActivator.
21      * When the POA uses the ServantLocator interface,
22      * immediately after performing the operation invocation
23      * on the servant returned by preinvoke, the POA will
24      * invoke postinvoke on the servant manager, passing the
25      * ObjectId value and the Servant value as parameters
26      * (among others). This feature may be used to force
27      * every request for objects associated with a POA to
28      * be mediated by the servant manager.
29      */

30 public class _ServantLocatorStub extends org.omg.CORBA.portable.ObjectImpl JavaDoc implements org.omg.PortableServer.ServantLocator JavaDoc
31 {
32   final public static java.lang.Class JavaDoc _opsClass = ServantLocatorOperations JavaDoc.class;
33
34
35
36   /**
37      * This operations is used to get a servant that will be
38      * used to process the request that caused preinvoke to
39      * be called.
40      * @param oid the object id associated with object on
41      * which the request was made.
42      * @param adapter the reference for POA in which the
43      * object is being activated.
44      * @param operation the operation name.
45      * @param the_cookie an opaque value that can be set
46      * by the servant manager to be used
47      * during postinvoke.
48      * @return Servant used to process incoming request.
49      * @exception ForwardRequest to indicate to the ORB
50      * that it is responsible for delivering
51      * the current request and subsequent
52      * requests to the object denoted in the
53      * forward_reference member of the exception.
54      */

55   public org.omg.PortableServer.Servant JavaDoc preinvoke (byte[] oid, org.omg.PortableServer.POA JavaDoc adapter, String JavaDoc operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder JavaDoc the_cookie) throws org.omg.PortableServer.ForwardRequest JavaDoc
56   {
57       org.omg.CORBA.portable.ServantObject JavaDoc $so = _servant_preinvoke ("preinvoke", _opsClass);
58       ServantLocatorOperations JavaDoc $self = (ServantLocatorOperations JavaDoc) $so.servant;
59
60       try {
61          return $self.preinvoke (oid, adapter, operation, the_cookie);
62       } finally {
63           _servant_postinvoke ($so);
64       }
65   } // preinvoke
66

67
68   /**
69      * This operation is invoked whenener a servant completes
70      * a request.
71      * @param oid the object id ssociated with object on which
72      * the request was made.
73      * @param adapter the reference for POA in which the
74      * object was active.
75      * @param the_cookie an opaque value that contains
76      * the data set by preinvoke.
77      * @param the_servant reference to the servant that is
78      * associated with the object.
79      */

80   public void postinvoke (byte[] oid, org.omg.PortableServer.POA JavaDoc adapter, String JavaDoc operation, java.lang.Object JavaDoc the_cookie, org.omg.PortableServer.Servant JavaDoc the_servant)
81   {
82       org.omg.CORBA.portable.ServantObject JavaDoc $so = _servant_preinvoke ("postinvoke", _opsClass);
83       ServantLocatorOperations JavaDoc $self = (ServantLocatorOperations JavaDoc) $so.servant;
84
85       try {
86          $self.postinvoke (oid, adapter, operation, the_cookie, the_servant);
87       } finally {
88           _servant_postinvoke ($so);
89       }
90   } // postinvoke
91

92   // Type-specific CORBA::Object operations
93
private static String JavaDoc[] __ids = {
94     "IDL:omg.org/PortableServer/ServantLocator:1.0",
95     "IDL:omg.org/PortableServer/ServantManager:1.0"};
96
97   public String JavaDoc[] _ids ()
98   {
99     return (String JavaDoc[])__ids.clone ();
100   }
101
102   private void readObject (java.io.ObjectInputStream JavaDoc s) throws java.io.IOException JavaDoc
103   {
104      String JavaDoc str = s.readUTF ();
105      String JavaDoc[] args = null;
106      java.util.Properties JavaDoc props = null;
107      org.omg.CORBA.Object JavaDoc obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
108      org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc) obj)._get_delegate ();
109      _set_delegate (delegate);
110   }
111
112   private void writeObject (java.io.ObjectOutputStream JavaDoc s) throws java.io.IOException JavaDoc
113   {
114      String JavaDoc[] args = null;
115      java.util.Properties JavaDoc props = null;
116      String JavaDoc str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
117      s.writeUTF (str);
118   }
119 } // class _ServantLocatorStub
120
Popular Tags