1 // Copyright (C) 2005 Audrius Meskauskas (AudriusA@Bioinformatics.org) |
|
2 |
|
3 // Mauve is free software; you can redistribute it and/or modify |
|
4 // it under the terms of the GNU General Public License as published by |
|
5 // the Free Software Foundation; either version 2, or (at your option) |
|
6 // any later version. |
|
7 |
|
8 // Mauve is distributed in the hope that it will be useful, |
|
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 // GNU General Public License for more details. |
|
12 |
|
13 // You should have received a copy of the GNU General Public License |
|
14 // along with Mauve; see the file COPYING. If not, write to |
|
15 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
16 // Boston, MA 02111-1307, USA. */ |
|
17 |
|
18 package gnu.testlet.org.omg.PortableServer.POAOperations.communication; |
|
19 |
|
20 import org.omg.CORBA.MARSHAL; |
|
21 import org.omg.CORBA.portable.ApplicationException; |
|
22 import org.omg.CORBA.portable.InputStream; |
|
23 import org.omg.CORBA.portable.ObjectImpl; |
|
24 import org.omg.CORBA.portable.OutputStream; |
|
25 import org.omg.CORBA.portable.RemarshalException; |
|
26 |
|
27 /** |
|
28 * The remote POA control interface. |
|
29 */ |
|
30 public class poa_remotePoaControlStub |
|
31 extends org.omg.CORBA.portable.ObjectImpl |
|
32 implements remotePoaControl |
|
33 { |
|
34 /** |
|
35 * Set the name of POA to that subsequent operations |
|
36 * will apply. This POA must be the child of the POA |
|
37 * to that this remotePoaControl servant is connected. |
|
38 */ |
|
39 public void setControlTarget(String child_poa_name) |
|
40 { |
|
41 InputStream in = null; |
|
42 try |
|
43 { |
|
44 OutputStream out = _request("setControlTarget", true); |
|
45 out.write_string(child_poa_name); |
|
46 in = _invoke(out); |
|
47 return; |
|
48 } |
|
49 catch (ApplicationException ex) |
|
50 { |
|
51 in = ex.getInputStream(); |
|
52 throw new MARSHAL(ex.getId()); |
|
53 } |
|
54 catch (RemarshalException remarsh) |
|
55 { |
|
56 setControlTarget(child_poa_name); |
|
57 } |
|
58 finally |
|
59 { |
|
60 _releaseReply(in); |
|
61 } |
|
62 } // setControlTarget |
|
63 |
|
64 /** |
|
65 * Set the mode of the POA being controlled (active, |
|
66 * holding, discarding, deactivated). |
|
67 */ |
|
68 public void setPoaMode(int mode) |
|
69 { |
|
70 InputStream in = null; |
|
71 try |
|
72 { |
|
73 OutputStream out = _request("setPoaMode", true); |
|
74 out.write_long(mode); |
|
75 in = _invoke(out); |
|
76 return; |
|
77 } |
|
78 catch (ApplicationException ex) |
|
79 { |
|
80 in = ex.getInputStream(); |
|
81 throw new MARSHAL(ex.getId()); |
|
82 } |
|
83 catch (RemarshalException remarsh) |
|
84 { |
|
85 setPoaMode(mode); |
|
86 } |
|
87 finally |
|
88 { |
|
89 _releaseReply(in); |
|
90 } |
|
91 } // setPoaMode |
|
92 |
|
93 /** |
|
94 * Get the mode of POA being controlled. |
|
95 */ |
|
96 public int getPoaMode() |
|
97 { |
|
98 InputStream in = null; |
|
99 try |
|
100 { |
|
101 OutputStream out = _request("getPoaMode", true); |
|
102 in = _invoke(out); |
|
103 return in.read_long(); |
|
104 } |
|
105 catch (ApplicationException ex) |
|
106 { |
|
107 in = ex.getInputStream(); |
|
108 throw new MARSHAL(ex.getId()); |
|
109 } |
|
110 catch (RemarshalException remarsh) |
|
111 { |
|
112 return getPoaMode(); |
|
113 } |
|
114 finally |
|
115 { |
|
116 _releaseReply(in); |
|
117 } |
|
118 } // getPoaMode |
|
119 |
|
120 private static String[] ids = { remotePoaControlHelper.id() }; |
|
121 |
|
122 public String[] _ids() |
|
123 { |
|
124 return ids; |
|
125 } |
|
126 } |
|