There
were a number of issues which had to be tackled when developing this
application. These included deciding on storage issues and layout.
Before dealing with development issues I had to get comfortable with
setting up RMI applications and understanding fully how they work.
This was simply done using a HelloWorld example. I also had to learn
about security policies in java and then got the application running
with the correct security permissions.
Basically
this application consists of a client and a server with an interface
between them which specifies the methods of the server which can be
used by the Client. A text file is used to specify a list of rooms
and their capacity. If the list of rooms is being updated all that
needs to be changed is this text file and this provides a healthy
level of abstraction from the code. Besides
the Client and the server there is a Room Class and a RoomList Class.
When the client first runs each room object is created using the details
specified in the text file. Each Room Object has a name, a capacity
and a 2D array which is used to store either a 0 or a 1. 0 represents
un-booked and 1 represents booked. When each object is created the
array which represents 7 days and 12 slots (from 8am to 8pm) is filled
with zeros to represent the fact that no rooms have yet been booked.
This is basically the storage method that I decided on for this application. The
way in which this application works is that, firstly the user is asked
for an input. Depending on that input the client runs a method available
to it from the server. (The methods specified in RoomBookingInterface).
The server then processes the request or calls the Room Object to
perform some task. Depending on the outcome, some result is returned
to the client for example a request for a specific rooms timetable
will result in the 2D timetable array being returned to the client
and then displayed to the screen. This
describes the process which this application is based on.
The
Client class provides a simple interface for any user of the system
to access. This interface requires some input from the command line
and then returns the results to the user via the screen. Any user
of the system can perform four basic operations:
The
corresponding methods which are used to perform these operations are:
The
server class contains the code behind these methods which can be used
by the client. To check the list of all rooms the server class utilises
the RoomList class which holds an array of all the rooms available.
It then returns this object to the client from where the client extracts
the list of rooms from the array contained within the object. For
the other methods the server access’ the Room class which contains
the methods for checking the availability of rooms and booking rooms.
It then returns the result to the client i.e. it lets them know whether
or not a room is available and whether or not they can book a room
and conformation of bookings. The
server also deals with the timetable for each room. Each room’s
timetable consists of a 7*12 array which is used to represent days
from Monday to Sunday and Timeslots from 8am to 8pm. When a timetable
is requested the server passes the array to the client where it is
then sent to the screen so the user can view the timetable for the
week.
The
room class is responsible for performing operations on the rooms i.e.
booking and checking availability. As specified before each room object
has a name, a capacity and an array of each timeslot over the week.
The time slots are from 0 – 11 and the represent 8am(0) to 7pm(11).
A room can be booked by specifying a start time i.e. if I wanted to
book a room from 7pm to 8pm I would input the number 11 which corresponds
to that timeslot. The days are from 0 – 6 with Monday being
(0) and Sunday being (6). The Room class is called by the server when
a request comes in from a client, it then performs the requested operation.
The book room and check room methods could be specified in the server
class but by specifying them in the room class it promotes a greater
level of abstraction between the classes.
This
class is simply used to store an array of all the rooms which were
specified in the text file. When a request for a full list of rooms
and their capacity has been entered the RoomList object is passed
back to the client where it reads the information from the array within the object and displays it on the
screen.
Included
with this document are all files needed to run this application. These
files are:
These
are the instructions to build from scratch i.e. creating the Class
files.
DIRECTORY will need to be replaced with whatever directory the policy file (connect.policy) is stored. For example when I run it from the DistAss1 directory on my H: drive, the command to run the file is
These
are the instructions to build from scratch i.e. creating the Class
files.
DIRECTORY will need to be replaced with whatever directory the policy file (connect.policy) is stored. For example when I run it from the DistAss1 directory on my H: drive the command to run the file is
|
- |
Project Preparation
OO Models
Z-specification
1. Proposal
1. Functional
Spec.
1.
Object Oriented Metrics
1.
Object Oriented Models
|