Solution Description
This is a description of the CORBA-related portions of the overall system. To see a description of the socket based
portion of the system, see the Solution Description for Assignment 1.
The Server
The server side o this system is much the same as that created for Assignment 1. The only differences are the
addition of another thread created by the HM_MultiServer class, called the HotelServerThread. This thread
controls the creation and operation of the CORBA interface to the HotelManager system.
The HotelServerThread is responsible for instantiating the ORB and the HotelServant class, and registering it
with the NamingService.
The HotelServant class provides the actual implementation of the Hotel IDL interface. The HotelServant
provides implementation for all the methods declared in the HotelOperations class, which was produced by the
idlj compiler. These methods provide the ‘translation’ between the IDL-defined methods, and the methods of the
HotelManager class, and vice versa for the return values.
The server is started in a similar fashion to the server in Assignment 1: by running the HM_MultiServer class
with four command line arguments: the manager password, and the port number to listen to for socket-based client
connections, the port for the CORBA-based client connections, and the host-name of the CORBA-based client
connections
Eg java HM_MultiServer password 4444 –ORBInitialPort 1050 –ORBInitialHost athene
The Client
The client side of this system consists of a graphical user interface which produces a list of Hotel servers
currently registered with the specified NamingContext. It achieves this by instantiating the ORB, resolving the
specified NamingContext, and looping through each Binding in the NamingContext, extracting the binding_name
(which is also the name of the hotel, as per the assignment instructions), and displaying them in a list.
The user then selects the hotel name from the list, and the client interface attempts to resolve that name within
the NamingContext. If such a Hotel exists, then it’s details (name and description, using the methods
HotelName() and HotelDescription() respectively) are displayed for the user to peruse. Once the user has
decided upon a Hotel, they can view a list of all the rooms in the hotel and their description (listRooms()), with
the ability to check the availability of a single room (roomAvailable()), or view all rooms available within a
given time frame (listAvailable()).
The client side of the system enables the user interface to accomplish these tasks by resolving the selected
NameComponent (ie, the hotel’s name, selected from the list) within the specified NamingContext (in this case,
‘Hotel’). If the name can be resolved, then it is assumed that the name belongs to a Hotel object, and the resultant
CORBA object is narrowed to a Hotel object using the HotelHelper.narrow( obj ) method. Once this has
successfully completed, a reference to that Hotel is passed to the user interface, which can then access the methods
of the HotelServant via the Hotel object (due to the relationships between the objects created by the idlj
compiler, particularly Hotel and HotelOperations,) and HotelServant.
The user interface (a stand-alone SWING application) is started by feeding in two command line arguments:
the port number and the host name of the system running the NamingService.
Ie java CORBAClientGUI –ORBInitialPort 1050 –ORBInitialHost athene
Class Diagram
NB: I have not shown standard Java or org.omg.CORBA classes in this diagram, only those created by the idlj
compiler or by myself. I have also only shown operations or variables in classes that I have created, not from any
of the idlj-compiler-created classes.
Furthermore, as this system is an extension of the program created for Assignment 1, I have extended the class
diagram from Assignment 1 to include the classes create for Assignment 2 (top right corner of the diagram).