README for hw5, cscie247,  Russell Lowke  December 14th 2003.


Design and Implementation choices for Distress, hw5.


1) I've created implementation classes and interfaces to the Distress objects, implementations have a suffix of "Impl", while the interfaces are called the base name of the object.  The Distress domain, as specified, has been reduced to have eight implementation classes, these being:

    UserImpl.java  SingleFamilyImpl.java  RealtorImpl.java  PropertyProfileImpl.java  PropertyImpl.java    
    DistressImpl.java  ConsumerImpl.java   CondominiumImpl.java

all these implementation classes are now defined as serializable so, if need be, they may be passed remotely, and all are contained in the package cscie247.asn5.server, along with

    DistressWriter.java  DistressServer.java

Common elements such as shared interfaces, defined exceptions, enumeration types, SearchCriteria and SearchItem are all stored in the package cscie247.asn5.  Enumerations, SearchCriteria and SearchItem have been made serializable as they are passed remotely.  SearchItem [singular] is a wrapper for storing each search request,  which are stored in an ArrayList in SearchCriteria [plural].

DistressClient is the only class in the package cscie247.asn5.client .  It contains tweaked print ("prt") methods taken from DistressWriter allowing it to print any object from the Distress domain remotely if desired.

 All exceptions that can't be dealt with are ultimately printed as errors in main()

2) Unfortunately, the typesafe Java enumerations I was using in assignment 4  no longer function when used in remote comparisons.  [for specifics on this see  http://www.javaworld.com/javatips/jw-javatip122_p.html   "Beware of Java typesafe enumerations"]  All my enumeration classes now contain an index to battle this, with a getter method getIndex() to access the index.  By calling .getIndex() on the enumeration I can be sure of getting a constant value.  This only need only be done when trying to make a remote enumeration comparison.  This occurs in two areas only.  When searching through comparing criteria [see line 183 of PropertyImpl.java], and when dump/printing objects from the client side [see lines 152, 154, 186, 188 of DistressClient.java].  All of my enumerations now implement the interface TypeEnum, which simply declares the method getIndex().

3) I couldn't register Distress in the NameService as "DISTRESS Service", as specified, because there is a space in the name.  I simply removed the space and used "DISTRESSService" instead.

4) I am not developing on a Windows machine, rather Unix, and am using .bat files in the form
suggested by ggimler on the asn4 Bulletin board.  He suggests the following method to trigger .bat from Unix

to run on unix:
/bin/sh compile.bat
/bin/sh run.bat

My .bat files work fine in Unix using these commands.

My run.bat calls unix commands "ping", and "&". I am unsure of how these commands will work in your marking environment.

I have also included three other .bat files  registry.bat, server.bat, and client.bat  these were useful to me during development

5) DistressServer accepts the hostName and portNumber as parameters.
    USAGE:  java DistressServer hostName portNumber
   if two parameters are not specified then default hostName of "localhost" and portNumber of 1099 is used
   
   DistressClient also accepts the hostName and portNumber as parameters.
    USAGE:  DistressClient hostName portNumber
   if two parameters are not specified then default hostName of "localhost" and portNumber of 1099 is used

6) The singleton implementation of DistressImpl had to be modified slightly to work in a rmi environment.
    Instead of declaring new from within the field declarations it is instantiated from getDistress(),
     see line 57 of DistressImpl.java
     
        // ensure Distress is a singleton.  Only instantiate once.
        if (fDistress == null) {
            fDistress = new DistressImpl();
        }

7)  Distress is a singleton pattern called by DistressClient.java, it is also an example of the use of a facade pattern.
    
    Implementation of RMI in Distress is an example of the Remote Proxy design pattern.
    
   


Russell Lowke