57 |
* where the program has been started. |
* where the program has been started. |
58 |
* |
* |
59 |
* The IOR.txt file is written by the server |
* The IOR.txt file is written by the server |
60 |
* {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}. |
* {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}. |
61 |
* The server should be reachable over Internet, unless blocked by |
* The server should be reachable over Internet, unless blocked by |
62 |
* security tools. |
* security tools. |
63 |
* |
* |
83 |
/** |
/** |
84 |
* The invocation target. |
* The invocation target. |
85 |
*/ |
*/ |
86 |
comTester object; |
DemoTester object; |
87 |
|
|
88 |
/** |
/** |
89 |
* Get the object reference. |
* Get the object reference. |
102 |
|
|
103 |
String ior = new String(c); |
String ior = new String(c); |
104 |
DirectTest we = new DirectTest(); |
DirectTest we = new DirectTest(); |
105 |
we.object = (comTester) orb.string_to_object(ior); |
we.object = (DemoTester) orb.string_to_object(ior); |
106 |
we.Demo(); |
we.Demo(); |
107 |
orb.shutdown(false); |
orb.shutdown(false); |
108 |
} |
} |
199 |
{ |
{ |
200 |
System.out.println("***** Pass structure"); |
System.out.println("***** Pass structure"); |
201 |
|
|
202 |
passThis arg = new passThis(); |
StructureToPass arg = new StructureToPass(); |
203 |
arg.a = "A"; |
arg.a = "A"; |
204 |
arg.b = "B"; |
arg.b = "B"; |
205 |
|
|
206 |
returnThis r = object.passStructure(arg); |
StructureToReturn r = object.passStructure(arg); |
207 |
|
|
208 |
System.out.println(" Fields of the returned structure:"); |
System.out.println(" Fields of the returned structure:"); |
209 |
|
|
257 |
// +-- bb |
// +-- bb |
258 |
System.out.println("***** Pass and return the tree."); |
System.out.println("***** Pass and return the tree."); |
259 |
|
|
260 |
node n = nod("Root"); |
TreeNode n = nod("Root"); |
261 |
|
|
262 |
n.children = new node[] { nod("a"), nod("b") }; |
n.children = new TreeNode[] { nod("a"), nod("b") }; |
263 |
n.children [ 1 ].children = new node[] { nod("ba"), nod("bb") }; |
n.children [ 1 ].children = new TreeNode[] { nod("ba"), nod("bb") }; |
264 |
n.children [ 1 ].children [ 0 ].children = new node[] { nod("bac") }; |
n.children [ 1 ].children [ 0 ].children = new TreeNode[] { nod("bac") }; |
265 |
|
|
266 |
nodeHolder nh = new nodeHolder(n); |
TreeNodeHolder nh = new TreeNodeHolder(n); |
267 |
|
|
268 |
// The server should add '++' to each node name. |
// The server should add '++' to each TreeNode name. |
269 |
object.passTree(nh); |
object.passTree(nh); |
270 |
|
|
271 |
// Convert the returned tree to some strig representation. |
// Convert the returned tree to some strig representation. |
288 |
object.throwException(123); |
object.throwException(123); |
289 |
throw new InternalError(); |
throw new InternalError(); |
290 |
} |
} |
291 |
catch (ourUserException uex) |
catch (WeThrowThisException uex) |
292 |
{ |
{ |
293 |
System.out.println(" The user exception with field " + uex.ourField + |
System.out.println(" The user exception with field " + uex.ourField + |
294 |
", has been thrown on remote side." |
", has been thrown on remote side." |
312 |
/** |
/** |
313 |
* Get the string representation of the passed tree. |
* Get the string representation of the passed tree. |
314 |
* @param b the string buffer to accumulate the representation. |
* @param b the string buffer to accumulate the representation. |
315 |
* @param n the tree (root node). |
* @param n the tree (root TreeNode). |
316 |
*/ |
*/ |
317 |
private void getImage(StringBuffer b, node n) |
private void getImage(StringBuffer b, TreeNode n) |
318 |
{ |
{ |
319 |
b.append(n.name); |
b.append(n.name); |
320 |
b.append(": ("); |
b.append(": ("); |
328 |
} |
} |
329 |
|
|
330 |
/** |
/** |
331 |
* Create a node with the given header. |
* Create a TreeNode with the given header. |
332 |
* |
* |
333 |
* @param hdr the node header. |
* @param hdr the TreeNode header. |
334 |
* @return the created node. |
* @return the created TreeNode. |
335 |
*/ |
*/ |
336 |
private node nod(String hdr) |
private TreeNode nod(String hdr) |
337 |
{ |
{ |
338 |
node n = new node(); |
TreeNode n = new TreeNode(); |
339 |
n.children = new node[ 0 ]; |
n.children = new TreeNode[ 0 ]; |
340 |
n.name = hdr; |
n.name = hdr; |
341 |
|
|
342 |
return n; |
return n; |