200 likes | 400 Views
Demo CORBA on local machine. IDL – to – Java Compiler. Check in folder C:Program FilesJavajdk1.6.0_05bin, measure there has idlj.exe, java.exe, javac.exe and orbd.exe. module HelloApp { interface Hello { string sayHello(); oneway void shutdown(); }; };
E N D
IDL – to – Java Compiler Check in folder C:\Program Files\Java\jdk1.6.0_05\bin, measure there has idlj.exe, java.exe, javac.exe and orbd.exe.
module HelloApp { interface Hello { string sayHello(); oneway void shutdown(); }; }; Each interface statement in the IDL will map to a Java interface statement when mapped. Writing hello.idl
The tool idlj reads OMG IDL files and creates the required Java files. Go to a command line prompt. Change to the directory containing your Hello.idl file. Enter the compiler command: idlj -fall hello.idl It will generate a directory called HelloApp and inside it contains six files. Mapping hello.idl to Java
Open Hello.java in text editor. Hello.java is the signature interface and is used as the signature type in method declarations when interfaces of the specified type are used in other interfaces. IDL statements map to the generated Java statements : The extends statement showed that all CORBA objects are derived from org.omg.CORBA.Object to require CORBA functionality. Hello.java
IDL-to-Java mapping puts all of the operations defined on the IDL interface in the operations interface, HelloOperations.java. The operations interface is used in the server-side mapping and as a mechanism for providing optimized calls for co-located clients and servers. The IDL statements map to the generated Java statements the two operations defined in this interface. HelloOperations.java
This abstract class is the stream-based server skeleton, providing basic CORBA functionality for the server. • It extends org.omg.PortableServer.Servant, and implements the InvokeHandler interface and the HelloOperations interface. • The server class, HelloServant, extends HelloPOA. • The IDL-to-Java mapping puts all of the operations defined on the IDL interface into this file, which is shared by both the stubs and skeletons. HelloPOA.java
This class is the client stub, providing CORBA functionality for the client. It extends org.omg.CORBA.portable.ObjectImpl and implements the Hello.java interface. _HelloStub.java
This class provides the narrow() method required to cast CORBA object references to their proper types. The Helper class is responsible for reading and writing the data type to CORBA streams, and inserting and extracting the data type from Anys. HelloHelper.java
This final class holds a public instance member of type Hello. • Whenever the IDL type is an out or an inout parameter, the Holder class is used. • It provides operations for org.omg.CORBA.portable.OutputStream and org.omg.CORBA.portable.InputStream arguments, which CORBA allows, but which do not map easily to Java's semantics. • It implements org.omg.CORBA.portable.Streamable. HelloHolder.java
Compile helloServer.java 1. Run the Java compiler on HelloServer.java: javac HelloServer.java HelloApp\*.java 2. The files HelloServer.class and HelloImpl.class are generated in the Hello directory.
Compile helloClient.java Run the Java compiler on HelloClient.java: javac HelloClient.java HelloApp\*.java The HelloClient.class is generated to the Hello directory.
Enter in cmd: start orbd -ORBInitialPort 1050 -ORBInitialHost localhost It will generate a folder named orb.db and running on background Running the Hello World Application Start orbd..
Enter at cmd: start java HelloServer -ORBInitialPort 1050 -ORBInitialHost localhost Running background Running the Hello World Application Start the Hello Server..
Enter at cmd: java HelloClient -ORBInitialPort 1050 –ORBInitialHost localhost Running the Hello World Application Run the Hello Client..
Done!! & Thank you…