KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.sun.corba.se.PortableActivationIDL;
2
3
4 /**
5 * com/sun/corba/se/PortableActivationIDL/_RepositoryStub.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 public class _RepositoryStub extends org.omg.CORBA.portable.ObjectImpl JavaDoc implements com.sun.corba.se.PortableActivationIDL.Repository
12 {
13
14
15   /** register server definition.
16     * This returns the serverId of the server. A newly created server is
17     * always uninstalled.
18     */

19   public String JavaDoc registerServer (com.sun.corba.se.PortableActivationIDL.RepositoryPackage.ServerDef serverDef) throws com.sun.corba.se.PortableActivationIDL.ServerAlreadyRegistered, com.sun.corba.se.PortableActivationIDL.BadServerDefinition
20   {
21             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
22             try {
23                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("registerServer", true);
24                 com.sun.corba.se.PortableActivationIDL.RepositoryPackage.ServerDefHelper.write ($out, serverDef);
25                 $in = _invoke ($out);
26                 String JavaDoc $result = org.omg.PortableInterceptor.ServerIdHelper.read ($in);
27                 return $result;
28             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
29                 $in = $ex.getInputStream ();
30                 String JavaDoc _id = $ex.getId ();
31                 if (_id.equals ("IDL:PortableActivationIDL/ServerAlreadyRegistered:1.0"))
32                     throw com.sun.corba.se.PortableActivationIDL.ServerAlreadyRegisteredHelper.read ($in);
33                 else if (_id.equals ("IDL:PortableActivationIDL/BadServerDefinition:1.0"))
34                     throw com.sun.corba.se.PortableActivationIDL.BadServerDefinitionHelper.read ($in);
35                 else
36                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
37             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
38                 return registerServer (serverDef );
39             } finally {
40                 _releaseReply ($in);
41             }
42   } // registerServer
43

44
45   /** unregister server definition
46     */

47   public void unregisterServer (String JavaDoc serverId) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered
48   {
49             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
50             try {
51                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("unregisterServer", true);
52                 org.omg.PortableInterceptor.ServerIdHelper.write ($out, serverId);
53                 $in = _invoke ($out);
54                 return;
55             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
56                 $in = $ex.getInputStream ();
57                 String JavaDoc _id = $ex.getId ();
58                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
59                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
60                 else
61                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
62             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
63                 unregisterServer (serverId );
64             } finally {
65                 _releaseReply ($in);
66             }
67   } // unregisterServer
68

69
70   /** get server definition
71     */

72   public com.sun.corba.se.PortableActivationIDL.RepositoryPackage.ServerDef getServer (String JavaDoc serverId) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered
73   {
74             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
75             try {
76                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getServer", true);
77                 org.omg.PortableInterceptor.ServerIdHelper.write ($out, serverId);
78                 $in = _invoke ($out);
79                 com.sun.corba.se.PortableActivationIDL.RepositoryPackage.ServerDef $result = com.sun.corba.se.PortableActivationIDL.RepositoryPackage.ServerDefHelper.read ($in);
80                 return $result;
81             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
82                 $in = $ex.getInputStream ();
83                 String JavaDoc _id = $ex.getId ();
84                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
85                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
86                 else
87                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
88             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
89                 return getServer (serverId );
90             } finally {
91                 _releaseReply ($in);
92             }
93   } // getServer
94

95
96   /** Return whether the server has been installed
97     */

98   public boolean isInstalled (String JavaDoc serverId) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered
99   {
100             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
101             try {
102                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("isInstalled", true);
103                 org.omg.PortableInterceptor.ServerIdHelper.write ($out, serverId);
104                 $in = _invoke ($out);
105                 boolean $result = $in.read_boolean ();
106                 return $result;
107             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
108                 $in = $ex.getInputStream ();
109                 String JavaDoc _id = $ex.getId ();
110                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
111                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
112                 else
113                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
114             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
115                 return isInstalled (serverId );
116             } finally {
117                 _releaseReply ($in);
118             }
119   } // isInstalled
120

121
122   /** Mark the server as being installed. Raises ServerAlreadyInstalled
123     * if the server is currently marked as installed.
124     */

125   public void install (String JavaDoc serverId) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered, com.sun.corba.se.PortableActivationIDL.ServerAlreadyInstalled
126   {
127             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
128             try {
129                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("install", true);
130                 org.omg.PortableInterceptor.ServerIdHelper.write ($out, serverId);
131                 $in = _invoke ($out);
132                 return;
133             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
134                 $in = $ex.getInputStream ();
135                 String JavaDoc _id = $ex.getId ();
136                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
137                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
138                 else if (_id.equals ("IDL:PortableActivationIDL/ServerAlreadyInstalled:1.0"))
139                     throw com.sun.corba.se.PortableActivationIDL.ServerAlreadyInstalledHelper.read ($in);
140                 else
141                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
142             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
143                 install (serverId );
144             } finally {
145                 _releaseReply ($in);
146             }
147   } // install
148

149
150   /** Mark the server as being uninstalled. Raises ServerAlreadyUninstalled
151     * if the server is currently marked as uninstalled.
152     */

153   public void uninstall (String JavaDoc serverId) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered, com.sun.corba.se.PortableActivationIDL.ServerAlreadyUninstalled
154   {
155             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
156             try {
157                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("uninstall", true);
158                 org.omg.PortableInterceptor.ServerIdHelper.write ($out, serverId);
159                 $in = _invoke ($out);
160                 return;
161             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
162                 $in = $ex.getInputStream ();
163                 String JavaDoc _id = $ex.getId ();
164                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
165                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
166                 else if (_id.equals ("IDL:PortableActivationIDL/ServerAlreadyUninstalled:1.0"))
167                     throw com.sun.corba.se.PortableActivationIDL.ServerAlreadyUninstalledHelper.read ($in);
168                 else
169                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
170             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
171                 uninstall (serverId );
172             } finally {
173                 _releaseReply ($in);
174             }
175   } // uninstall
176

177
178   /** list registered servers
179     */

180   public String JavaDoc[] listRegisteredServers ()
181   {
182             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
183             try {
184                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("listRegisteredServers", true);
185                 $in = _invoke ($out);
186                 String JavaDoc $result[] = com.sun.corba.se.PortableActivationIDL.ServerIdsHelper.read ($in);
187                 return $result;
188             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
189                 $in = $ex.getInputStream ();
190                 String JavaDoc _id = $ex.getId ();
191                 throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
192             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
193                 return listRegisteredServers ( );
194             } finally {
195                 _releaseReply ($in);
196             }
197   } // listRegisteredServers
198

199
200   /** Returns list of ALL applicationNames defined in ServerDefs of registered
201     * servers.
202     */

203   public String JavaDoc[] getApplicationNames ()
204   {
205             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
206             try {
207                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getApplicationNames", true);
208                 $in = _invoke ($out);
209                 String JavaDoc $result[] = com.sun.corba.se.PortableActivationIDL.RepositoryPackage.AppNamesHelper.read ($in);
210                 return $result;
211             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
212                 $in = $ex.getInputStream ();
213                 String JavaDoc _id = $ex.getId ();
214                 throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
215             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
216                 return getApplicationNames ( );
217             } finally {
218                 _releaseReply ($in);
219             }
220   } // getApplicationNames
221

222
223   /** Find the ServerID associated with the given application name.
224     */

225   public String JavaDoc getServerID (String JavaDoc applicationName) throws com.sun.corba.se.PortableActivationIDL.ServerNotRegistered
226   {
227             org.omg.CORBA.portable.InputStream JavaDoc $in = null;
228             try {
229                 org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getServerID", true);
230                 $out.write_string (applicationName);
231                 $in = _invoke ($out);
232                 String JavaDoc $result = org.omg.PortableInterceptor.ServerIdHelper.read ($in);
233                 return $result;
234             } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
235                 $in = $ex.getInputStream ();
236                 String JavaDoc _id = $ex.getId ();
237                 if (_id.equals ("IDL:PortableActivationIDL/ServerNotRegistered:1.0"))
238                     throw com.sun.corba.se.PortableActivationIDL.ServerNotRegisteredHelper.read ($in);
239                 else
240                     throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
241             } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
242                 return getServerID (applicationName );
243             } finally {
244                 _releaseReply ($in);
245             }
246   } // getServerID
247

248   // Type-specific CORBA::Object operations
249
private static String JavaDoc[] __ids = {
250     "IDL:PortableActivationIDL/Repository:1.0"};
251
252   public String JavaDoc[] _ids ()
253   {
254     return (String JavaDoc[])__ids.clone ();
255   }
256
257   private void readObject (java.io.ObjectInputStream JavaDoc s) throws java.io.IOException JavaDoc
258   {
259      String JavaDoc str = s.readUTF ();
260      String JavaDoc[] args = null;
261      java.util.Properties JavaDoc props = null;
262      org.omg.CORBA.Object JavaDoc obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
263      org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc) obj)._get_delegate ();
264      _set_delegate (delegate);
265   }
266
267   private void writeObject (java.io.ObjectOutputStream JavaDoc s) throws java.io.IOException JavaDoc
268   {
269      String JavaDoc[] args = null;
270      java.util.Properties JavaDoc props = null;
271      String JavaDoc str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
272      s.writeUTF (str);
273   }
274 } // class _RepositoryStub
275
Popular Tags