add constraint checks to ensure setting the initial state from the unset
state.  when entering into a terminal state for a job, ensure that all
the child jobs are in terminal states.  Remove unneeded tests.

Add better error reporting from the JSPs, as well as tracing for stored
procedure calls.  Fix query to find terminal states of a job.