Assignment 3: Reverse Engineer a Software Package
final version as of Oct 15
Jim had the task of developing the first version of a wrapper tool for
wrapping existing services into a CHAIMS compliant megamodule. He thought
it would be no big deal and did most of the work at the end of the term.
To his credit, most of the wrapper worked. Unfortunately he did not get
around to implement all the primitives that should be understood by the
wrapper. He managed to hack together a test-routine (to be found in the
class CPAMInterface), and documented how a user would use this wrapper
template to wrap existing computational code. He did not write any maintenance
John has to take over the project and of course the first thing for
him is to understand the software. Jim is gone, so John cannot ask him
any more questions, and has to live with what little overview documentation
and code comments are available.
The code and documentation that Jim wrote is here
or as compressed tar-file (use uncompress
and tar xvf to unpackage the files) or as zip-file
(just double click the file on Windows). If you want, you can download
it, unzip it, and run it on Windows or Solaris with: java Test.
You have to use a machine where Java 1.2 (=Java 2.0) is installed, and
you might have to undefine the environment variable CLASSPATH. Possible
entries for methods are: concat, mult and fast. The method concat takes
the two parameters s1 and s2, and returns s2 (all strings).The method mult
takes the two parameters m1 and m2, and returns res (all integers). For
more information look at the description in the file TestModule1.java.
For this assignment you do not have to care about how to start up and register
a server, you do not have to wrap legacy code yourself (the class TestModule1.java
is an example of a very simple piece of wrapped code). You can also ignore
the class RMI_CPAM_V2_0 because when running Test.test you do not access
the wrapper remotely but just communicate with it locally. Running the
wrapper example is not really necessary for solving this assignment, but
it might you help to understand what it is about.
Jim generated some documentation with Javadoc, to view it load the file
Doc/index.html into your browser.
I added some comments to some of the variables, methods and classes,
in order to make the assignment easier. I also provided for you a crisp
description of what this is about so you have a starting point: CHAIMS
allows to access remote and distributed megamodules over a specific high-level
protocol. This protocol consists of a set of primitives.
These primitives allow to:
Of course, several connections can be made in parallel, and, within each
connection different or the same methods can be invoked several times in
Setup a connection to a megamodule: client gets connection number
or preset values of parameters: client supplies connection number and
parameter names, client gets values of parameters
preset values of parameters: client supplies connection number, parameter
names and parameter values
Estimate the cost for an invocation: client supplies connection number
, name of the method an estimation is to be made for, and what
kind of estimates are desired. Client receives estimates.
Invoke a method: client supplies connection number, name of method to be
invoked, and values for all parameters for which the server should not
take the preset values. Client receives an invocation number.
Examine the progress of an invocation: client supplies the number of the
invocation and requests either the status of the invocation or of a specific
result parameter. Client receives status information.
Extract results: client supplies the invocation number and the name of
the parameters for which it likes to get the values. Client receives the
values of these parameters.
Terminate: client supplies an invocation number, and server terminates
Termianteall: client supplies a connection number, and server terminates
all invocations of this connection and the connection.
You are free to use any kind of tool for the diagrams, or to write them
by hand. If diagrams are hand written, all other documentation inclusive
the lists of attributes and operations should be made in some text tool.
You are free to add the non-diagram documentation directly to the code
and to use Javadoc (http://java.sun.com/products/jdk/javadoc/ or http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/javadoc.html
to generate the documentation. Javadoc even allows you to write an overview
web-page and to link in graphics generated by some graphical tool. The
use of Javadoc is optional but might be of special interest for all those
developing Java applications.
Interaction Diagrams for the commands SETUP, INVOKE, ESTIMATE, SETPARAM
(start with the user interacting with the method test of CPAMInterface).
Show also the use of private and protected operations in your diagrams.
Detailed Class diagram:
Diagram of the following classes and their associations with navigability:
For all the classes: short description about purpose and responsibility
For the classes CPAMMegamodule, Invocation, Connection: list of all (public
and private) attributes with visibility and one-sentence description about
their purpose and other important things, list of all (public, protected
and private) operations with short description about their purpose. Of
course you can reuse the few existing descriptions!
A state chart for the class Invocation, showing both, the states that are
returned by the method "status()" as well as the states of the internal
variable "invocationProgress", and showing which methods result in which
state changes (use the method names as events on the transitions).
The design and implementation for the commands EXTRACT and TERMINATEALL
is missing. Create interaction diagrams for these two commands (as good
as you can based on the information provided).
Estimate how much time it would have saved you if Jim would have provided
design documentation in the first place.
Hand in the assignment in paper form. In case you use Javadoc, you can
also mail me (cs446@db) the URL that points to wherever I can view
the documentation with a normal web-browser.
In contrast to the previous assignments you are expected to work on
this assignment on your own. Of course you may discuss technical Java
question with whomever you want.