Java Reference
In-Depth Information
{
syncObj.wait();
}
}
catch (Exception ex)
{
System.out.println("*** Server error! ***");
ex.printStackTrace();
}
}
}
class HelloServant extends _HelloImplBase
{
public String getGreeting()
{
return ("Hello there!");
}
}
5. Compile the server and the idlj-generated fi les.
From the directory above directory SimpleCORBAExample , execute the following
command within a command window:
javac HelloServer.java SimpleCORBAExample\*.java
(Correct errors and recompile, as necessary.)
6. Create a client.
Our client program will be called HelloClient.java and, like the server program, will
import package SimpleCORBAExample . It should also import two of the three CORBA
packages imported by the server: org.omg.CosNaming and org.omg.CORBA . There are
several steps required of the client, most of them being identical to those required of the
server, so the explanations given for the server in step 4 above are not repeated hereā€¦
(i) Create and initialise the ORB .
ORB orb = ORB.init(args,null);
(ii) Get a reference to the root naming context .
org.omg.CORBA.Object objectRef =
orb.resolve_initial_references("NameService");
(iii) 'Narrow' the context reference .
NamingContext namingContext =
NamingContextHelper.narrow(objectRef);
(iv) Create a NameComponent object for our interface .
NameComponent nameComp =
new NameComponent("Hello", "");
Search WWH ::




Custom Search