agave-jobs/jobs-api/src/main/java/org/iplantc/service/jobs/resources/JobUpdateResource.java
/**
	 * Handles POST requests from a running job. The content will get forwarded to
	 * as a user-defined event on the job.
	 */
Handles POST requests from a running job. The content will get forwarded to
as a user-defined event on the job.
Handles POST requests from a running job . The content will get forwarded to as a user - defined event on the job .
@Override
	public void acceptRepresentation(Representation entity) throws ResourceException
	{
		AgaveLogServiceClient.log(AgaveLogServiceClient.ServiceKeys.JOBS02.name(),
				AgaveLogServiceClient.ActivityKeys.JobsCustomRuntimeEvent.name(),
				username, "", getRequest().getClientInfo().getUpstreamAddress());
		try
		{
			JsonNode customRuntimeJsonBody = getPostedEntityAsObjectNode(false);
		    JobCallback jobCallback = new JobCallback(uuid, status, updateToken);
            JobCallbackManager callbackManager = new JobCallbackManager();
            callbackManager.processCustomRuntimeEvent(jobCallback, customRuntimeJsonBody);
            getResponse().setStatus(Status.SUCCESS_ACCEPTED);
            getResponse().setEntity(new IplantSuccessRepresentation(customRuntimeJsonBody.toString()));
		}
		catch (ObjectNotFoundException e) {
			throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND,
					"No job found with the given id and key", e);
		}
		catch (JobCallbackException e) {
			throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, 
					e.getMessage(), e);
		}
		catch (PermissionException e) {
			throw new ResourceException(Status.CLIENT_ERROR_FORBIDDEN, 
					e.getMessage(), e);
		}
		catch (FileNotFoundException e) {
			throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
		}
		catch (Throwable e)
		{
			log.debug("Custom runtime callback event " + status + " failed unexpectedly for job " + 
					uuid + ". " + e.getMessage());
			throw new ResourceException(Status.SERVER_ERROR_INTERNAL, 
					"Failed to process job callback", e);
		}
		finally {
			try { HibernateUtil.closeSession(); } catch (Throwable ignored) {}
		}
	}
@ Override public void acceptRepresentation ( Representation entity ) throws ResourceException { AgaveLogServiceClient . log ( AgaveLogServiceClient . ServiceKeys . JOBS02 . name ( ) , AgaveLogServiceClient . ActivityKeys . JobsCustomRuntimeEvent . name ( ) , username , "" , getRequest ( ) . getClientInfo ( ) . getUpstreamAddress ( ) ) ; try { JsonNode customRuntimeJsonBody = getPostedEntityAsObjectNode ( false ) ; JobCallback jobCallback = new JobCallback ( uuid , status , updateToken ) ; JobCallbackManager callbackManager = new JobCallbackManager ( ) ; callbackManager . processCustomRuntimeEvent ( jobCallback , customRuntimeJsonBody ) ; getResponse ( ) . setStatus ( Status . SUCCESS_ACCEPTED ) ; getResponse ( ) . setEntity ( new IplantSuccessRepresentation ( customRuntimeJsonBody . toString ( ) ) ) ; } catch ( ObjectNotFoundException e ) { throw new ResourceException ( Status . CLIENT_ERROR_NOT_FOUND , "No job found with the given id and key" , e ) ; } catch ( JobCallbackException e ) { throw new ResourceException ( Status . CLIENT_ERROR_BAD_REQUEST , e . getMessage ( ) , e ) ; } catch ( PermissionException e ) { throw new ResourceException ( Status . CLIENT_ERROR_FORBIDDEN , e . getMessage ( ) , e ) ; } catch ( FileNotFoundException e ) { throw new ResourceException ( Status . CLIENT_ERROR_NOT_FOUND ) ; } catch ( Throwable e ) { log . debug ( "Custom runtime callback event " + status + " failed unexpectedly for job " + uuid + ". " + e . getMessage ( ) ) ; throw new ResourceException ( Status . SERVER_ERROR_INTERNAL , "Failed to process job callback" , e ) ; } finally { try { HibernateUtil . closeSession ( ) ; } catch ( Throwable ignored ) { } } }
Handles POST requests from a running job.
Handles POST requests from a running job .
// can't set a stopped job back to running. Bad request