Files
PolyORB/testsuite/corba/interop/java/common/Server.java
Jérôme Hugues c94d96524a Reorganization of the Java interoperability testsuite
[Imported from Perforce change 9740 at 2006-12-01 21:49:22]

Subversion-branch: /trunk/polyorb
Subversion-revision: 37209
2005-11-25 15:04:30 +00:00

60 lines
1.5 KiB
Java

// Java All Types static server, cf all_types.idl for more details
import idl.*;
public class Server
{
public static void main( String args[] )
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( args, null );
org.omg.CORBA.Object objPoa = null;
org.omg.PortableServer.POA rootPOA = null;
try
{
objPoa = orb.resolve_initial_references( "RootPOA" );
}
catch ( org.omg.CORBA.ORBPackage.InvalidName ex )
{
System.out.println( "Couldn't find RootPOA!" );
System.exit( 1 );
}
rootPOA = org.omg.PortableServer.POAHelper.narrow( objPoa );
Alltypes at_obj = new Alltypes();
try
{
org.omg.CORBA.Object obj = at_obj._this( orb );
String reference = orb.object_to_string( obj );
try
{
java.io.FileOutputStream file = new java.io.FileOutputStream( "IOR" );
java.io.PrintStream pfile = new java.io.PrintStream( file );
pfile.println( reference );
file.close();
}
catch ( java.io.IOException ex )
{
System.out.println( "File error" );
}
rootPOA.the_POAManager().activate();
System.out.println( "The server is ready..." );
orb.run();
}
catch ( java.lang.Exception ex )
{
System.out.println( "An exception has been intercepted" );
ex.printStackTrace();
}
}
}