Information Technology Reference
In-Depth Information
import DateApp.∗;
import org.omg.CosNaming.∗;
import org.omg.CORBA.∗;
public class DateClient {
static Date dateImpl;
public static void main(String args[]) {
try {
// create and initialize the ORB
ORB orb = ORB.init(args, null);
// get the root naming context
org.omg.CORBA.Object objRef =
orb.resolve_initial_references(
"NameService"
);
// Use NamingContextExt instead of NamingContext. This is
// part of the Interoperable naming Service.
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
// resolve the Object Reference in Naming
String name =
"Date"
;
dateImpl = DateHelper.narrow(ncRef.resolve_str(name));
System.out.println(
"Server's Date: "
+ dateImpl.getDate());
dateImpl.shutdown();
} catch (Exception e) {
System.out.println(
"ERROR : "
+e);
e.printStackTrace(System.out);
}
}
}
Figure 2.10. An example of a simple CORBA client. Code in
the shaded area implements Java's CORBA framework.
by allowing for the discovery and spontaneous interaction between services in a
network.
AsmentionedinSection2.3, in order to reduce the programmers' burden,
RPC systems attempt to mask the differences between local and remote procedures
so that a remote procedure call is treated the same as a local procedure call.
Most distributed systems provide a unified view of objects in terms of their
location so that all objects are considered equal regardless of their physical loca-
tion. Indeed, many distributed systems, including most RPC systems, try and
mask the differences between local and remote objects by providing programmer
transparency.
Search WWH ::
Custom Search