log.finest ("Read code: 0x" + Integer.toString (code, 16));
switch (code) {
case SUBMIT_JOB:
Job job = null;
String location = null;
try {
location = (String)din.readUTF ();
}
catch (IOException e) {
logErrorOrWarn (SYSTEM_ID, "Error while reading job location for submit from client: " + e.getMessage ());
break;
}
try {
FileInputStream fis = new FileInputStream (location);
JCEPInputStream ois = new JCEPInputStream (fis);
job = (Job)ois.readObject ();
job.setAnnotation (ois.getLastAnnotation ());
}
catch (MalformedURLException e) {
logErrorOrWarn (SYSTEM_ID, "Unable to load class from URL for submit: " + e.getMessage ());
try {
notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
}
catch (IOException e2) {
logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
break;
}
break;
}
catch (IOException e) {
logErrorOrWarn (SYSTEM_ID, "Unable to read job file for submit: " + location);
try {
notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
}
catch (IOException e2) {
logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
break;
}
break;
}
catch (ClassNotFoundException e) {
logErrorOrWarn (SYSTEM_ID, "Unable to load job class for submit: " + e.getMessage ());
try {
notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
}
catch (IOException e2) {
logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
break;
}
break;
}
try {
engine.submitJob (job);
registeredJobId = job.getJobId ();
}
catch (CommandFailedException e) {
try {
notifyCommandFailed (SUBMIT_JOB, job.getJobId (), e.getMessage ());
}
catch (IOException e2) {
logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
break;
}
}