Write the idl program for the hello world program


















Policy; import org. POA; import org. ORBInitialHost", "localhost" ; properties. The servant contains one method for each IDL operation, in this example, the sayHello and shutdown methods.

Servant methods are just like ordinary Java methods; the extra code to deal with the ORB, with marshaling arguments and results, and so on, is provided by the skeleton. This has been done in order to demonstrate the persistence of the server in this example.

This is not a recommended programming convention for the following reasons: If the orb. Other threads can invoke orb. If you have multiple servants associated with the ORB, using the shutdown false method by one of them will make all of them unavailable. The orb. Implementing the Client Application PersistentClient. You can substitute a different port if necessary.

For more information on the idlj options, link to IDL-to-Java compiler options. The idlj compiler generates a number of files. The actual number of files generated depends on the options selected when the IDL file is compiled. The generated files provide standard functionality, so you can ignore them until it is time to deploy and run your program. The files generated by the idlj compiler for Hello. It implements the Hello.

The Hello. It provides operations for out and inout arguments, which CORBA allows, but which do not map easily to Java's semantics. 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. This class provides auxiliary functionality, notably 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 Any s. The Holder class delegates to the methods in the Helper class for reading and writing. 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.

OutputStream and org. It implements org. This interface contains the methods sayHello and shutdown. 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.

Note that is the port on which you want the name server to run. Note that when using Solaris software, you must become root to start a process on a port under For this example, since both client and server on running on the development machine, we have set the host to localhost.

When developing on more than one machine, you will replace this with the name of the host. For an example of how to run this program on two machines, see Running the Hello World Program on 2 machines. For this example, you can omit -ORBInitialHost localhost since the name server is running on the same host as the Hello server. For this example, you can omit -ORBInitialHost localhost since the name server is running on the same host as the Hello client.

When you have finished this tutorial, be sure to shut down or kill the name server orbd.



0コメント

  • 1000 / 1000