blob: 9b35d1627fcbe8dbbbc9e315cb7b2114ee070c06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package interop.wchar;
import java.io.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import interop.*;
/**
* Server.java
*
* Java implemention of the interoperability tests for wchars.
*
* @author Phil Mesnier
* @version
*/
public class Server
{
public static void main(String[] args)
{
String iorfile = "IOR";
boolean verbose = false;
for (int i = 0; i < args.length; i++)
{
if (args[i].equals ("-o"))
iorfile = args[++i];
else if (args[i].equals ("-v"))
verbose = true;
else
{
System.out.println( "Usage: jaco interop.wchar.Server " +
"-o <ior_file> " +
"-v ");
System.exit( 1 );
}
}
try
{
//init ORB
ORB orb = ORB.init( args, null );
//init POA
POA poa =
POAHelper.narrow( orb.resolve_initial_references( "RootPOA" ));
poa.the_POAManager().activate();
// create a GoodDay object
WChar_PasserImpl servant = new WChar_PasserImpl(orb, verbose);
// create the object reference
org.omg.CORBA.Object obj =
poa.servant_to_reference( servant );
PrintWriter pw =
new PrintWriter( new FileWriter( iorfile ));
// print stringified object reference to file
pw.println( orb.object_to_string( obj ));
pw.flush();
pw.close();
// wait for requests
orb.run();
}
catch( Exception e )
{
System.out.println( e );
e.printStackTrace();
}
}
}
|