README for hw3, cscie160,  Russell Lowke  November 9th 2003.


Here I will attempt to describe my design for the ScheduleDriver of hw3.

1)   CLASS: ScheduleDriver

ScheduleDriver contains main(), and is the entry point for the application.
ScheduleDriver accepts 1 arg, which is the name of the config file, so usage is:

java cscie247.asn3.ScheduleDriver [configfile]

There is a static method in ScheduleDriver called readConfigFile() which 
opens the config file and extracts data from the file line by line, converting
those lines into Strings which are placed in an ArrayList, which is returned.

main() then takes the first item of the ArrayList read from the config file and
assigns it as the Class name [mClassName] that is to be created/instantiated.  
The remaining arguments are kept to be passed to instantiated Classes constructor.

reflection is used to create said Class, via a Reflection Class that I created,
which simplifies/encapsulates the reflection process.  
The Reflection constructor is passed the name of the class [mClassName] and the
remaining args from the config file [mArgsLst], and an instance of Class mClassName
is wrapped in the returned object.  In this way, the appropriate SF, XML, or DBMS
instance of ScheduleFactory is created.  main() now invokes the processSchedule()
method within the ScheduleFactory, again using reflection via the Reflection Class.
Finally, main() prints any critical errors thrown.


2)	CLASS: ScheduleFactory

The ScheduleDriver will have created one of three concrete factories, either
SFScheduleFactory, XMLScheduleFactory, or DBMSScheduleFactory, all of
which extend the abstract factory CourseScheduleFactory.  The concrete factory
in turn creates a trio of appropriate instances: a HolidayReader, a CourseReader, 
and a ScheduleWriter.  In this way the implementation is a valid Abstract Factory,
as a specific factory has been created to target a specific platform, and that
factory has created the appropriate objects needed to cater to that platform.
processSchedule() is declared as an abstract method within CourseScheduleFactory,
so must be present and implemented in all concrete ScheduleFactorys.
As previously stated processSchedule() is invoked via reflection from main().


3)	CLASS: HolidayReader, CourseReader and ScheduleWriter

The processSchedule() method in the concrete instance of ScheduleFactory now builds
the schedule using the trio of instance objects needed for the platform, the trio being
platform specific instances of HolidayReader, CourseReader and ScheduleWriter.
In the case of a Simple File (SF) platform a holiday file is passed to the HolidayReader,
which returns a ScheduleData object of the holidays.  Then a courses file is passed to the
CoursesReader which returns an ArrayList of ScheduleData objects for each course.
Now the holiday ScheduleData and the courses ScheduleData ArrayList is passed to the
ScheduleWriter, which prints the resultant schedule.

Please take a look at the remark statements at the beginning of each Class and each Method
for further design explanation.

 
 
 
 Russell Lowke