KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > activation > _ServerManagerStub


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

10
11 public class _ServerManagerStub extends org.omg.CORBA.portable.ObjectImpl JavaDoc implements com.sun.corba.se.spi.activation.ServerManager
12 {
13
14
15   // A new ORB started server registers itself with the Activator
16
public void active (int serverId, com.sun.corba.se.spi.activation.Server serverObj) throws com.sun.corba.se.spi.activation.ServerNotRegistered
17   {
18             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
19             try {
20                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("active", true);
21                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
22                 com.sun.corba.se.spi.activation.ServerHelper.write ($out, serverObj);
23                 $in = _invoke ($out);
24                 return;
25             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
26                 $in = $ex.getInputStream ();
27                 String JavaDoc _id = $ex.getId ();
28                 if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
29                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
30                 else
31                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
32             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
33                 active (serverId, serverObj );
34             } finally {
35                 _releaseReply ($in);
36             }
37   } // active
38

39
40   // Install a particular kind of endpoint
41
public void registerEndpoints (int serverId, String JavaDoc orbId, com.sun.corba.se.spi.activation.EndPointInfo[] endPointInfo) throws com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.NoSuchEndPoint, com.sun.corba.se.spi.activation.ORBAlreadyRegistered
42   {
43             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
44             try {
45                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("registerEndpoints", true);
46                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
47                 com.sun.corba.se.spi.activation.ORBidHelper.write ($out, orbId);
48                 com.sun.corba.se.spi.activation.EndpointInfoListHelper.write ($out, endPointInfo);
49                 $in = _invoke ($out);
50                 return;
51             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
52                 $in = $ex.getInputStream ();
53                 String JavaDoc _id = $ex.getId ();
54                 if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
55                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
56                 else if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
57                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
58                 else if (_id.equals ("IDL:activation/ORBAlreadyRegistered:1.0"))
59                     throw com.sun.corba.se.spi.activation.ORBAlreadyRegisteredHelper.read ($in);
60                 else
61                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
62             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
63                 registerEndpoints (serverId, orbId, endPointInfo );
64             } finally {
65                 _releaseReply ($in);
66             }
67   } // registerEndpoints
68

69
70   // list active servers
71
public int[] getActiveServers ()
72   {
73             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
74             try {
75                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getActiveServers", true);
76                 $in = _invoke ($out);
77                 int $result[] = com.sun.corba.se.spi.activation.ServerIdsHelper.read ($in);
78                 return $result;
79             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
80                 $in = $ex.getInputStream ();
81                 String JavaDoc _id = $ex.getId ();
82                 throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
83             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
84                 return getActiveServers ( );
85             } finally {
86                 _releaseReply ($in);
87             }
88   } // getActiveServers
89

90
91   // If the server is not running, start it up.
92
public void activate (int serverId) throws com.sun.corba.se.spi.activation.ServerAlreadyActive, com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.ServerHeldDown
93   {
94             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
95             try {
96                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("activate", true);
97                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
98                 $in = _invoke ($out);
99                 return;
100             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
101                 $in = $ex.getInputStream ();
102                 String JavaDoc _id = $ex.getId ();
103                 if (_id.equals ("IDL:activation/ServerAlreadyActive:1.0"))
104                     throw com.sun.corba.se.spi.activation.ServerAlreadyActiveHelper.read ($in);
105                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
106                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
107                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
108                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
109                 else
110                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
111             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
112                 activate (serverId );
113             } finally {
114                 _releaseReply ($in);
115             }
116   } // activate
117

118
119   // If the server is running, shut it down
120
public void shutdown (int serverId) throws com.sun.corba.se.spi.activation.ServerNotActive, com.sun.corba.se.spi.activation.ServerNotRegistered
121   {
122             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
123             try {
124                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("shutdown", true);
125                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
126                 $in = _invoke ($out);
127                 return;
128             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
129                 $in = $ex.getInputStream ();
130                 String JavaDoc _id = $ex.getId ();
131                 if (_id.equals ("IDL:activation/ServerNotActive:1.0"))
132                     throw com.sun.corba.se.spi.activation.ServerNotActiveHelper.read ($in);
133                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
134                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
135                 else
136                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
137             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
138                 shutdown (serverId );
139             } finally {
140                 _releaseReply ($in);
141             }
142   } // shutdown
143

144
145   // currently running, this method will activate it.
146
public void install (int serverId) throws com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.ServerHeldDown, com.sun.corba.se.spi.activation.ServerAlreadyInstalled
147   {
148             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
149             try {
150                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("install", true);
151                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
152                 $in = _invoke ($out);
153                 return;
154             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
155                 $in = $ex.getInputStream ();
156                 String JavaDoc _id = $ex.getId ();
157                 if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
158                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
159                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
160                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
161                 else if (_id.equals ("IDL:activation/ServerAlreadyInstalled:1.0"))
162                     throw com.sun.corba.se.spi.activation.ServerAlreadyInstalledHelper.read ($in);
163                 else
164                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
165             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
166                 install (serverId );
167             } finally {
168                 _releaseReply ($in);
169             }
170   } // install
171

172
173   // list all registered ORBs for a server
174
public String JavaDoc[] getORBNames (int serverId) throws com.sun.corba.se.spi.activation.ServerNotRegistered
175   {
176             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
177             try {
178                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getORBNames", true);
179                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
180                 $in = _invoke ($out);
181                 String JavaDoc $result[] = com.sun.corba.se.spi.activation.ORBidListHelper.read ($in);
182                 return $result;
183             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
184                 $in = $ex.getInputStream ();
185                 String JavaDoc _id = $ex.getId ();
186                 if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
187                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
188                 else
189                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
190             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
191                 return getORBNames (serverId );
192             } finally {
193                 _releaseReply ($in);
194             }
195   } // getORBNames
196

197
198   // After this hook completes, the server may still be running.
199
public void uninstall (int serverId) throws com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.ServerHeldDown, com.sun.corba.se.spi.activation.ServerAlreadyUninstalled
200   {
201             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
202             try {
203                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("uninstall", true);
204                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
205                 $in = _invoke ($out);
206                 return;
207             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
208                 $in = $ex.getInputStream ();
209                 String JavaDoc _id = $ex.getId ();
210                 if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
211                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
212                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
213                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
214                 else if (_id.equals ("IDL:activation/ServerAlreadyUninstalled:1.0"))
215                     throw com.sun.corba.se.spi.activation.ServerAlreadyUninstalledHelper.read ($in);
216                 else
217                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
218             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
219                 uninstall (serverId );
220             } finally {
221                 _releaseReply ($in);
222             }
223   } // uninstall
224

225
226   // Starts the server if it is not already running.
227
public com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation locateServer (int serverId, String JavaDoc endPoint) throws com.sun.corba.se.spi.activation.NoSuchEndPoint, com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.ServerHeldDown
228   {
229             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
230             try {
231                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("locateServer", true);
232                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
233                 $out.write_string (endPoint);
234                 $in = _invoke ($out);
235                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation $result = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.read ($in);
236                 return $result;
237             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
238                 $in = $ex.getInputStream ();
239                 String JavaDoc _id = $ex.getId ();
240                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
241                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
242                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
243                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
244                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
245                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
246                 else
247                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
248             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
249                 return locateServer (serverId, endPoint );
250             } finally {
251                 _releaseReply ($in);
252             }
253   } // locateServer
254

255
256   // Starts the server if it is not already running.
257
public com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB locateServerForORB (int serverId, String JavaDoc orbId) throws com.sun.corba.se.spi.activation.InvalidORBid, com.sun.corba.se.spi.activation.ServerNotRegistered, com.sun.corba.se.spi.activation.ServerHeldDown
258   {
259             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
260             try {
261                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("locateServerForORB", true);
262                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
263                 com.sun.corba.se.spi.activation.ORBidHelper.write ($out, orbId);
264                 $in = _invoke ($out);
265                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB $result = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.read ($in);
266                 return $result;
267             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
268                 $in = $ex.getInputStream ();
269                 String JavaDoc _id = $ex.getId ();
270                 if (_id.equals ("IDL:activation/InvalidORBid:1.0"))
271                     throw com.sun.corba.se.spi.activation.InvalidORBidHelper.read ($in);
272                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
273                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
274                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
275                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
276                 else
277                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
278             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
279                 return locateServerForORB (serverId, orbId );
280             } finally {
281                 _releaseReply ($in);
282             }
283   } // locateServerForORB
284

285
286   // get the port for the endpoint of the locator
287
public int getEndpoint (String JavaDoc endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint
288   {
289             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
290             try {
291                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getEndpoint", true);
292                 $out.write_string (endPointType);
293                 $in = _invoke ($out);
294                 int $result = com.sun.corba.se.spi.activation.TCPPortHelper.read ($in);
295                 return $result;
296             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
297                 $in = $ex.getInputStream ();
298                 String JavaDoc _id = $ex.getId ();
299                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
300                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
301                 else
302                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
303             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
304                 return getEndpoint (endPointType );
305             } finally {
306                 _releaseReply ($in);
307             }
308   } // getEndpoint
309

310
311   // to pick a particular port type.
312
public int getServerPortForType (com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB location, String JavaDoc endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint
313   {
314             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
315             try {
316                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getServerPortForType", true);
317                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.write ($out, location);
318                 $out.write_string (endPointType);
319                 $in = _invoke ($out);
320                 int $result = com.sun.corba.se.spi.activation.TCPPortHelper.read ($in);
321                 return $result;
322             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
323                 $in = $ex.getInputStream ();
324                 String JavaDoc _id = $ex.getId ();
325                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
326                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
327                 else
328                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
329             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
330                 return getServerPortForType (location, endPointType );
331             } finally {
332                 _releaseReply ($in);
333             }
334   } // getServerPortForType
335

336   // Type-specific CORBA::Object operations
337
private static String JavaDoc[] __ids = {
338     "IDL:activation/ServerManager:1.0",
339     "IDL:activation/Activator:1.0",
340     "IDL:activation/Locator:1.0"};
341
342   public String JavaDoc[] _ids ()
343   {
344     return (String JavaDoc[])__ids.clone ();
345   }
346
347   private void readObject (java.io.ObjectInputStream JavaDoc s) throws java.io.IOException JavaDoc
348   {
349      String JavaDoc str = s.readUTF ();
350      String JavaDoc[] args = null;
351      java.util.Properties JavaDoc props = null;
352      org.omg.CORBA.Object JavaDoc obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
353      org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc) obj)._get_delegate ();
354      _set_delegate (delegate);
355   }
356
357   private void writeObject (java.io.ObjectOutputStream JavaDoc s) throws java.io.IOException JavaDoc
358   {
359      String JavaDoc[] args = null;
360      java.util.Properties JavaDoc props = null;
361      String JavaDoc str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
362      s.writeUTF (str);
363   }
364 } // class _ServerManagerStub
365
Popular Tags