KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.sun.corba.se.spi.activation;
2
3
4 /**
5 * com/sun/corba/se/spi/activation/_LocatorStub.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 _LocatorStub extends org.omg.CORBA.portable.ObjectImpl JavaDoc implements com.sun.corba.se.spi.activation.Locator
12 {
13
14
15   // Starts the server if it is not already running.
16
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
17   {
18             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
19             try {
20                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("locateServer", true);
21                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
22                 $out.write_string (endPoint);
23                 $in = _invoke ($out);
24                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation $result = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationHelper.read ($in);
25                 return $result;
26             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
27                 $in = $ex.getInputStream ();
28                 String JavaDoc _id = $ex.getId ();
29                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
30                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
31                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
32                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
33                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
34                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
35                 else
36                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
37             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
38                 return locateServer (serverId, endPoint );
39             } finally {
40                 _releaseReply ($in);
41             }
42   } // locateServer
43

44
45   // Starts the server if it is not already running.
46
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
47   {
48             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
49             try {
50                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("locateServerForORB", true);
51                 com.sun.corba.se.spi.activation.ServerIdHelper.write ($out, serverId);
52                 com.sun.corba.se.spi.activation.ORBidHelper.write ($out, orbId);
53                 $in = _invoke ($out);
54                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB $result = com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.read ($in);
55                 return $result;
56             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
57                 $in = $ex.getInputStream ();
58                 String JavaDoc _id = $ex.getId ();
59                 if (_id.equals ("IDL:activation/InvalidORBid:1.0"))
60                     throw com.sun.corba.se.spi.activation.InvalidORBidHelper.read ($in);
61                 else if (_id.equals ("IDL:activation/ServerNotRegistered:1.0"))
62                     throw com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.read ($in);
63                 else if (_id.equals ("IDL:activation/ServerHeldDown:1.0"))
64                     throw com.sun.corba.se.spi.activation.ServerHeldDownHelper.read ($in);
65                 else
66                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
67             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
68                 return locateServerForORB (serverId, orbId );
69             } finally {
70                 _releaseReply ($in);
71             }
72   } // locateServerForORB
73

74
75   // get the port for the endpoint of the locator
76
public int getEndpoint (String JavaDoc endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint
77   {
78             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
79             try {
80                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getEndpoint", true);
81                 $out.write_string (endPointType);
82                 $in = _invoke ($out);
83                 int $result = com.sun.corba.se.spi.activation.TCPPortHelper.read ($in);
84                 return $result;
85             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
86                 $in = $ex.getInputStream ();
87                 String JavaDoc _id = $ex.getId ();
88                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
89                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
90                 else
91                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
92             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
93                 return getEndpoint (endPointType );
94             } finally {
95                 _releaseReply ($in);
96             }
97   } // getEndpoint
98

99
100   // to pick a particular port type.
101
public int getServerPortForType (com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB location, String JavaDoc endPointType) throws com.sun.corba.se.spi.activation.NoSuchEndPoint
102   {
103             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
104             try {
105                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getServerPortForType", true);
106                 com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORBHelper.write ($out, location);
107                 $out.write_string (endPointType);
108                 $in = _invoke ($out);
109                 int $result = com.sun.corba.se.spi.activation.TCPPortHelper.read ($in);
110                 return $result;
111             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
112                 $in = $ex.getInputStream ();
113                 String JavaDoc _id = $ex.getId ();
114                 if (_id.equals ("IDL:activation/NoSuchEndPoint:1.0"))
115                     throw com.sun.corba.se.spi.activation.NoSuchEndPointHelper.read ($in);
116                 else
117                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
118             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
119                 return getServerPortForType (location, endPointType );
120             } finally {
121                 _releaseReply ($in);
122             }
123   } // getServerPortForType
124

125   // Type-specific CORBA::Object operations
126
private static String JavaDoc[] __ids = {
127     "IDL:activation/Locator:1.0"};
128
129   public String JavaDoc[] _ids ()
130   {
131     return (String JavaDoc[])__ids.clone ();
132   }
133
134   private void readObject (java.io.ObjectInputStream JavaDoc s) throws java.io.IOException JavaDoc
135   {
136      String JavaDoc str = s.readUTF ();
137      String JavaDoc[] args = null;
138      java.util.Properties JavaDoc props = null;
139      org.omg.CORBA.Object JavaDoc obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
140      org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc) obj)._get_delegate ();
141      _set_delegate (delegate);
142   }
143
144   private void writeObject (java.io.ObjectOutputStream JavaDoc s) throws java.io.IOException JavaDoc
145   {
146      String JavaDoc[] args = null;
147      java.util.Properties JavaDoc props = null;
148      String JavaDoc str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
149      s.writeUTF (str);
150   }
151 } // class _LocatorStub
152
Popular Tags