Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / interop-tests / wchar / Server.java
blob0fe85f960a1dd018b00e43143901fdecd83b6e58
1 package interop.wchar;
3 import java.io.*;
5 import org.omg.CORBA.*;
6 import org.omg.PortableServer.*;
7 import interop.*;
9 /**
10 * Server.java
12 * Java implemention of the interoperability tests for wchars.
14 * @author Phil Mesnier
15 * @version
18 public class Server
20 public static void main(String[] args)
22 String iorfile = "IOR";
23 boolean verbose = false;
24 for (int i = 0; i < args.length; i++)
26 if (args[i].equals ("-o"))
27 iorfile = args[++i];
28 else if (args[i].equals ("-v"))
29 verbose = true;
30 else
32 System.out.println( "Usage: jaco interop.wchar.Server " +
33 "-o <ior_file> " +
34 "-v ");
35 System.exit( 1 );
39 try
41 //init ORB
42 ORB orb = ORB.init( args, null );
44 //init POA
45 POA poa =
46 POAHelper.narrow( orb.resolve_initial_references( "RootPOA" ));
48 poa.the_POAManager().activate();
50 // create a GoodDay object
51 WChar_PasserImpl servant = new WChar_PasserImpl(orb, verbose);
53 // create the object reference
54 org.omg.CORBA.Object obj =
55 poa.servant_to_reference( servant );
57 PrintWriter pw =
58 new PrintWriter( new FileWriter( iorfile ));
60 // print stringified object reference to file
61 pw.println( orb.object_to_string( obj ));
63 pw.flush();
64 pw.close();
66 // wait for requests
67 orb.run();
69 catch( Exception e )
71 System.out.println( e );
72 e.printStackTrace();