KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > PortableActivationIDL > _ServerManagerImplBase


1 package com.sun.corba.se.PortableActivationIDL;
2
3
4 /**
5 * com/sun/corba/se/PortableActivationIDL/_ServerManagerImplBase.java .
6 * Generated by the IDL-to-Java compiler (portable), version "3.2"
7 * from ../../../../src/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
8 * Saturday, February 9, 2008 2:04:41 AM PST
9 */

10
11
12 /** Interface used to combine the Activator and Locator when both are
13     * implemented together in the same process, as is currently the case
14     * for our implementation.
15     */

16 public abstract class _ServerManagerImplBase extends org.omg.CORBA.portable.ObjectImpl JavaDoc
17                 implements com.sun.corba.se.PortableActivationIDL.ServerManager, org.omg.CORBA.portable.InvokeHandler JavaDoc
18 {
19
20   // Constructors
21
public _ServerManagerImplBase ()
22   {
23   }
24
25   private static java.util.Hashtable JavaDoc _methods = new java.util.Hashtable JavaDoc ();
26   static
27   {
28     _methods.put ("registerServer", new java.lang.Integer JavaDoc (0));
29     _methods.put ("serverGoingDown", new java.lang.Integer JavaDoc (1));
30     _methods.put ("registerORB", new java.lang.Integer JavaDoc (2));
31     _methods.put ("registerPOA", new java.lang.Integer JavaDoc (3));
32     _methods.put ("poaDestroyed", new java.lang.Integer JavaDoc (4));
33     _methods.put ("activate", new java.lang.Integer JavaDoc (5));
34     _methods.put ("shutdown", new java.lang.Integer JavaDoc (6));
35     _methods.put ("install", new java.lang.Integer JavaDoc (7));
36     _methods.put ("uninstall", new java.lang.Integer JavaDoc (8));
37     _methods.put ("getActiveServers", new java.lang.Integer JavaDoc (9));
38     _methods.put ("getORBNames", new java.lang.Integer JavaDoc (10));
39     _methods.put ("lookupPOATemplate", new java.lang.Integer JavaDoc (11));
40     _methods.put ("locateServer", new java.lang.Integer JavaDoc (12));
41     _methods.put ("locateServerForORB", new java.lang.Integer JavaDoc (13));
42     _methods.put ("getEndpoint", new java.lang.Integer JavaDoc (14));
43     _methods.put ("getServerPortForType", new java.lang.Integer JavaDoc (15));
44   }
45
46   public org.omg.CORBA.portable.OutputStream JavaDoc _invoke (String JavaDoc $method,
47                                 org.omg.CORBA.portable.InputStream JavaDoc in,
48                                 org.omg.CORBA.portable.ResponseHandler JavaDoc $rh)
49   {
50     org.omg.CORBA.portable.OutputStream JavaDoc out = null;
51     java.lang.Integer JavaDoc __method = (java.lang.Integer JavaDoc)_methods.get ($method);
52     if (__method == null)
53       throw new org.omg.CORBA.BAD_OPERATION JavaDoc (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
54
55     switch (__method.intValue ())
56     {
57
58   /** A new ORB started server registers itself with the Activator
59     */

60        case 0: // PortableActivationIDL/Activator/registerServer
61
{
62          try {
63            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
64            com.sun.corba.se.PortableActivationIDL.ServerProxy serverObj = com.sun.corba.se.PortableActivationIDL.ServerProxyHelper.read (in);
65            this.registerServer (serverId, serverObj);
66            out = $rh.createReply();
67          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
68            out = $rh.createExceptionReply ();
69            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
70          }
71          break;
72        }
73
74
75   /** A server is shutting down that was started by this activator.
76     * Complete termination of the server is detected by the death of the
77     * process implementing the server.
78     */

79        case 1: // PortableActivationIDL/Activator/serverGoingDown
80
{
81          String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
82          this.serverGoingDown (serverId);
83          out = $rh.createReply();
84          break;
85        }
86
87
88   /** Called whenever an ORB instance is created. This registers
89     * the transport endpoints and the ORB proxy callback object.
90     * Note that we cannot detect when an ORB shuts down, although
91     * all of the POA shutdowns should still be reported.
92     */

93        case 2: // PortableActivationIDL/Activator/registerORB
94
{
95          try {
96            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
97            String JavaDoc orbId = org.omg.PortableInterceptor.ORBIdHelper.read (in);
98            com.sun.corba.se.PortableActivationIDL.ORBProxy orb = com.sun.corba.se.PortableActivationIDL.ORBProxyHelper.read (in);
99            com.sun.corba.se.PortableActivationIDL.EndPointInfo endPointInfo[] = com.sun.corba.se.PortableActivationIDL.EndpointInfoListHelper.read (in);
100            this.registerORB (serverId, orbId, orb, endPointInfo);
101            out = $rh.createReply();
102          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
103            out = $rh.createExceptionReply ();
104            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
105          } catch (com.sun.corba.se.PortableActivationIDL.NoSuchEndPoint $ex) {
106            out = $rh.createExceptionReply ();
107            com.sun.corba.se.PortableActivationIDL.NoSuchEndPointHelper.write (out, $ex);
108          } catch (com.sun.corba.se.PortableActivationIDL.ORBAlreadyRegistered $ex) {
109            out = $rh.createExceptionReply ();
110            com.sun.corba.se.PortableActivationIDL.ORBAlreadyRegisteredHelper.write (out, $ex);
111          }
112          break;
113        }
114
115
116   /** Construct or find an ORBD object template corresponding to the
117     * server's object template and return it. Called whenever a
118     * persistent POA is created.
119     */

120        case 3: // PortableActivationIDL/Activator/registerPOA
121
{
122          String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
123          String JavaDoc orbId = org.omg.PortableInterceptor.ORBIdHelper.read (in);
124          org.omg.PortableInterceptor.ObjectReferenceTemplate JavaDoc poaTemplate = org.omg.PortableInterceptor.ObjectReferenceTemplateHelper.read (in);
125          org.omg.PortableInterceptor.ObjectReferenceTemplate JavaDoc $result = null;
126          $result = this.registerPOA (serverId, orbId, poaTemplate);
127          out = $rh.createReply();
128          org.omg.PortableInterceptor.ObjectReferenceTemplateHelper.write (out, $result);
129          break;
130        }
131
132
133   /** Called whenever a POA is destroyed.
134     */

135        case 4: // PortableActivationIDL/Activator/poaDestroyed
136
{
137          String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
138          String JavaDoc orbId = org.omg.PortableInterceptor.ORBIdHelper.read (in);
139          org.omg.PortableInterceptor.ObjectReferenceTemplate JavaDoc poaTemplate = org.omg.PortableInterceptor.ObjectReferenceTemplateHelper.read (in);
140          this.poaDestroyed (serverId, orbId, poaTemplate);
141          out = $rh.createReply();
142          break;
143        }
144
145
146   /** If the server is not running, start it up. This is allowed
147     * whether or not the server has been installed.
148     */

149        case 5: // PortableActivationIDL/Activator/activate
150
{
151          try {
152            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
153            this.activate (serverId);
154            out = $rh.createReply();
155          } catch (com.sun.corba.se.PortableActivationIDL.ServerAlreadyActive $ex) {
156            out = $rh.createExceptionReply ();
157            com.sun.corba.se.PortableActivationIDL.ServerAlreadyActiveHelper.write (out, $ex);
158          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
159            out = $rh.createExceptionReply ();
160            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
161          } catch (com.sun.corba.se.PortableActivationIDL.ServerHeldDown $ex) {
162            out = $rh.createExceptionReply ();
163            com.sun.corba.se.PortableActivationIDL.ServerHeldDownHelper.write (out, $ex);
164          }
165          break;
166        }
167
168
169   /** If the server is running, shut it down
170     */

171        case 6: // PortableActivationIDL/Activator/shutdown
172
{
173          try {
174            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
175            this.shutdown (serverId);
176            out = $rh.createReply();
177          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotActive $ex) {
178            out = $rh.createExceptionReply ();
179            com.sun.corba.se.PortableActivationIDL.ServerNotActiveHelper.write (out, $ex);
180          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
181            out = $rh.createExceptionReply ();
182            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
183          }
184          break;
185        }
186
187
188   /** Invoke the server install hook. If the server is not
189     * currently running, this method will activate it.
190     */

191        case 7: // PortableActivationIDL/Activator/install
192
{
193          try {
194            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
195            this.install (serverId);
196            out = $rh.createReply();
197          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
198            out = $rh.createExceptionReply ();
199            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
200          } catch (com.sun.corba.se.PortableActivationIDL.ServerHeldDown $ex) {
201            out = $rh.createExceptionReply ();
202            com.sun.corba.se.PortableActivationIDL.ServerHeldDownHelper.write (out, $ex);
203          } catch (com.sun.corba.se.PortableActivationIDL.ServerAlreadyInstalled $ex) {
204            out = $rh.createExceptionReply ();
205            com.sun.corba.se.PortableActivationIDL.ServerAlreadyInstalledHelper.write (out, $ex);
206          }
207          break;
208        }
209
210
211   /** Invoke the server uninstall hook. If the server is not
212     * currently running, this method will activate it.
213     * After this hook completes, the server may still be running.
214     */

215        case 8: // PortableActivationIDL/Activator/uninstall
216
{
217          try {
218            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
219            this.uninstall (serverId);
220            out = $rh.createReply();
221          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
222            out = $rh.createExceptionReply ();
223            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
224          } catch (com.sun.corba.se.PortableActivationIDL.ServerHeldDown $ex) {
225            out = $rh.createExceptionReply ();
226            com.sun.corba.se.PortableActivationIDL.ServerHeldDownHelper.write (out, $ex);
227          } catch (com.sun.corba.se.PortableActivationIDL.ServerAlreadyUninstalled $ex) {
228            out = $rh.createExceptionReply ();
229            com.sun.corba.se.PortableActivationIDL.ServerAlreadyUninstalledHelper.write (out, $ex);
230          }
231          break;
232        }
233
234
235   /** list active servers
236     */

237        case 9: // PortableActivationIDL/Activator/getActiveServers
238
{
239          String JavaDoc $result[] = null;
240          $result = this.getActiveServers ();
241          out = $rh.createReply();
242          com.sun.corba.se.PortableActivationIDL.ServerIdsHelper.write (out, $result);
243          break;
244        }
245
246
247   /** list all registered ORBs for a server
248     */

249        case 10: // PortableActivationIDL/Activator/getORBNames
250
{
251          try {
252            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
253            String JavaDoc $result[] = null;
254            $result = this.getORBNames (serverId);
255            out = $rh.createReply();
256            com.sun.corba.se.PortableActivationIDL.ORBidListHelper.write (out, $result);
257          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
258            out = $rh.createExceptionReply ();
259            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
260          }
261          break;
262        }
263
264
265   /** Find the server template that corresponds to the ORBD's
266     * adapter id.
267     */

268        case 11: // PortableActivationIDL/Activator/lookupPOATemplate
269
{
270          String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
271          String JavaDoc orbId = org.omg.PortableInterceptor.ORBIdHelper.read (in);
272          String JavaDoc orbAdapterName[] = org.omg.PortableInterceptor.AdapterNameHelper.read (in);
273          org.omg.PortableInterceptor.ObjectReferenceTemplate JavaDoc $result = null;
274          $result = this.lookupPOATemplate (serverId, orbId, orbAdapterName);
275          out = $rh.createReply();
276          org.omg.PortableInterceptor.ObjectReferenceTemplateHelper.write (out, $result);
277          break;
278        }
279
280
281   /** locate server - returns the port with a specific type for all registered
282     * ORBs of an active server.
283     * Starts the server if it is not already running.
284     */

285        case 12: // PortableActivationIDL/Locator/locateServer
286
{
287          try {
288            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
289            String JavaDoc endPoint = in.read_string ();
290            com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerType $result = null;
291            $result = this.locateServer (serverId, endPoint);
292            out = $rh.createReply();
293            com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerTypeHelper.write (out, $result);
294          } catch (com.sun.corba.se.PortableActivationIDL.NoSuchEndPoint $ex) {
295            out = $rh.createExceptionReply ();
296            com.sun.corba.se.PortableActivationIDL.NoSuchEndPointHelper.write (out, $ex);
297          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
298            out = $rh.createExceptionReply ();
299            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
300          } catch (com.sun.corba.se.PortableActivationIDL.ServerHeldDown $ex) {
301            out = $rh.createExceptionReply ();
302            com.sun.corba.se.PortableActivationIDL.ServerHeldDownHelper.write (out, $ex);
303          }
304          break;
305        }
306
307
308   /** locate server - returns all ports registered with a specified ORB for
309     * an active server
310     * Starts the server if it is not already running.
311     */

312        case 13: // PortableActivationIDL/Locator/locateServerForORB
313
{
314          try {
315            String JavaDoc serverId = org.omg.PortableInterceptor.ServerIdHelper.read (in);
316            String JavaDoc orbId = org.omg.PortableInterceptor.ORBIdHelper.read (in);
317            com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerORB $result = null;
318            $result = this.locateServerForORB (serverId, orbId);
319            out = $rh.createReply();
320            com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerORBHelper.write (out, $result);
321          } catch (com.sun.corba.se.PortableActivationIDL.InvalidORBid $ex) {
322            out = $rh.createExceptionReply ();
323            com.sun.corba.se.PortableActivationIDL.InvalidORBidHelper.write (out, $ex);
324          } catch (com.sun.corba.se.PortableActivationIDL.ServerNotRegistered $ex) {
325            out = $rh.createExceptionReply ();
326            com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.write (out, $ex);
327          } catch (com.sun.corba.se.PortableActivationIDL.ServerHeldDown $ex) {
328            out = $rh.createExceptionReply ();
329            com.sun.corba.se.PortableActivationIDL.ServerHeldDownHelper.write (out, $ex);
330          }
331          break;
332        }
333
334
335   /** get the port for the endpoint of the locator
336     */

337        case 14: // PortableActivationIDL/Locator/getEndpoint
338
{
339          try {
340            String JavaDoc endPointType = in.read_string ();
341            int $result = (int)0;
342            $result = this.getEndpoint (endPointType);
343            out = $rh.createReply();
344            out.write_long ($result);
345          } catch (com.sun.corba.se.PortableActivationIDL.NoSuchEndPoint $ex) {
346            out = $rh.createExceptionReply ();
347            com.sun.corba.se.PortableActivationIDL.NoSuchEndPointHelper.write (out, $ex);
348          }
349          break;
350        }
351
352
353   /** Useful from external BadServerIdHandlers which need
354     * to pick a particular port type.
355     */

356        case 15: // PortableActivationIDL/Locator/getServerPortForType
357
{
358          try {
359            com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerORB location = com.sun.corba.se.PortableActivationIDL.LocatorPackage.ServerLocationPerORBHelper.read (in);
360            String JavaDoc endPointType = in.read_string ();
361            int $result = (int)0;
362            $result = this.getServerPortForType (location, endPointType);
363            out = $rh.createReply();
364            out.write_long ($result);
365          } catch (com.sun.corba.se.PortableActivationIDL.NoSuchEndPoint $ex) {
366            out = $rh.createExceptionReply ();
367            com.sun.corba.se.PortableActivationIDL.NoSuchEndPointHelper.write (out, $ex);
368          }
369          break;
370        }
371
372        default:
373          throw new org.omg.CORBA.BAD_OPERATION JavaDoc (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
374     }
375
376     return out;
377   } // _invoke
378

379   // Type-specific CORBA::Object operations
380
private static String JavaDoc[] __ids = {
381     "IDL:PortableActivationIDL/ServerManager:1.0",
382     "IDL:PortableActivationIDL/Activator:1.0",
383     "IDL:PortableActivationIDL/Locator:1.0"};
384
385   public String JavaDoc[] _ids ()
386   {
387     return (String JavaDoc[])__ids.clone ();
388   }
389
390
391 } // class _ServerManagerImplBase
392
Popular Tags