agave-jobs/jobs-api/src/main/java/org/iplantc/service/jobs/resources/JobUpdateResource.java
/**
	 * This method represents the HTTP GET action. It provides a simple,
	 * convenient way for jobs to update their own status information while
	 * running. If the job id, token, or status included in the URL are invalid
	 * or the form data is invalid, a HTTP
	 * {@link org.restlet.data.Status#CLIENT_ERROR_BAD_REQUEST 400} code is
	 * sent. If a problem occurs looking up the job a HTTP
	 * {@link org.restlet.data.Status#SERVER_ERROR_INTERNAL 500} code is sent.
	 */
This method represents the HTTP GET action. It provides a simple,
convenient way for jobs to update their own status information while
running. If the job id, token, or status included in the URL are invalid
or the form data is invalid, a HTTP
org.restlet.data.Status#CLIENT_ERROR_BAD_REQUEST 400 code is
sent. If a problem occurs looking up the job a HTTP
org.restlet.data.Status#SERVER_ERROR_INTERNAL 500 code is sent.
This method represents the HTTP GET action . It provides a simple convenient way for jobs to update their own status information while running . If the job id token or status included in the URL are invalid or the form data is invalid a HTTP org . restlet . data . Status#CLIENT_ERROR_BAD_REQUEST 400 code is sent . If a problem occurs looking up the job a HTTP org . restlet . data . Status#SERVER_ERROR_INTERNAL 500 code is sent .
@Override
	public Representation represent(Variant variant) throws ResourceException
	{
		try
		{
		    JobCallback jobCallback = new JobCallback(uuid, status, updateToken, localSchedulerId);
            JobCallbackManager callbackManager = new JobCallbackManager();
            Job job = callbackManager.process(jobCallback);
            return new IplantSuccessRepresentation(job.toJSON());
		}
		catch (ObjectNotFoundException e) {
		    getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND);
            return new IplantErrorRepresentation("No job found with the given id and key");
		}
		catch (JobCallbackException e) {
		    getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
            return new IplantErrorRepresentation(e.getMessage());
		}
		catch (PermissionException e) {
		    getResponse().setStatus(Status.CLIENT_ERROR_FORBIDDEN);
		    return new IplantErrorRepresentation(e.getMessage());
		}
		catch (Throwable e)
		{
			log.debug("Callback failed: " + e.getMessage());
			getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
			return new IplantErrorRepresentation("Failed to process job callback.");
		}
		finally {
			try { HibernateUtil.closeSession(); } catch (Throwable ignored) {}
		}
	}
@ Override public Representation represent ( Variant variant ) throws ResourceException { try { JobCallback jobCallback = new JobCallback ( uuid , status , updateToken , localSchedulerId ) ; JobCallbackManager callbackManager = new JobCallbackManager ( ) ; Job job = callbackManager . process ( jobCallback ) ; return new IplantSuccessRepresentation ( job . toJSON ( ) ) ; } catch ( ObjectNotFoundException e ) { getResponse ( ) . setStatus ( Status . CLIENT_ERROR_NOT_FOUND ) ; return new IplantErrorRepresentation ( "No job found with the given id and key" ) ; } catch ( JobCallbackException e ) { getResponse ( ) . setStatus ( Status . CLIENT_ERROR_BAD_REQUEST ) ; return new IplantErrorRepresentation ( e . getMessage ( ) ) ; } catch ( PermissionException e ) { getResponse ( ) . setStatus ( Status . CLIENT_ERROR_FORBIDDEN ) ; return new IplantErrorRepresentation ( e . getMessage ( ) ) ; } catch ( Throwable e ) { log . debug ( "Callback failed: " + e . getMessage ( ) ) ; getResponse ( ) . setStatus ( Status . SERVER_ERROR_INTERNAL ) ; return new IplantErrorRepresentation ( "Failed to process job callback." ) ; } finally { try { HibernateUtil . closeSession ( ) ; } catch ( Throwable ignored ) { } } }
This method represents the HTTP GET action.
This method represents the HTTP GET action .
// can't set a stopped job back to running. Bad request