Download ORBACUS, this manual

Transcript
Programming Example
8 try
9 {
10
orb = ORB.init(args, props);
11
org.omg.CORBA.Object poaObj = null;
12
13
try
14
{
15
poaObj = orb.resolve_initial_references("RootPOA");
16
}
17
catch(org.omg.CORBA.ORBPackage.InvalidName ex)
18
{
19
throw new RuntimeException();
20
}
21
POA rootPOA = POAHelper.narrow(poaObj);
22
POAManager manager = rootPOA.the_POAManager();
23
org.omg.CORBA.Object obj = null;
24
25
try
26
{
27
obj = orb.resolve_initial_references("NameService");
28
}
29
catch(org.omg.CORBA.ORBPackage.InvalidName ex)
30
{
31
throw new RuntimeException();
32
}
33
if(obj == null)
34
35
{
36
throw new RuntimeException();
37
}
38
NamingContextExt nc = null;
39
40
try
41
{
42
nc = NamingContextExtHelper.narrow(obj);
43
}
44
catch(org.omg.CORBA.BAD_PARAM ex)
45
{
46
throw new RuntimeException();
47
}
10-22
Usually the application is initialized in the main method. For more information on ORB
initialization see Chapter 4.
ORBacus
143