public String setStatus()

in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/worker/RemoteRunDelegate.java [268:316]


	public String setStatus(Status s) throws BadStateChangeException {
		try {
			log.info("setting status of run " + id + " to " + s);
			switch (s) {
			case Initialized:
				run.setStatus(RemoteStatus.Initialized);
				break;
			case Operating:
				if (run.getStatus() == RemoteStatus.Initialized) {
					if (!factory.isAllowingRunsToStart())
						throw new OverloadedException();
					secContext.conveySecurity();
				}
				run.setGenerateProvenance(generateProvenance);
				run.setStatus(RemoteStatus.Operating);
				factory.getMasterEventFeed()
						.started(
								this,
								"started run execution",
								"The execution of run '" + getName()
										+ "' has started.");
				break;
			case Stopped:
				run.setStatus(RemoteStatus.Stopped);
				break;
			case Finished:
				run.setStatus(RemoteStatus.Finished);
				break;
			}
			return null;
		} catch (IllegalStateTransitionException e) {
			throw new BadStateChangeException(e.getMessage());
		} catch (RemoteException e) {
			throw new BadStateChangeException(e.getMessage(), e.getCause());
		} catch (GeneralSecurityException | IOException e) {
			throw new BadStateChangeException(e.getMessage(), e);
		} catch (ImplementationException e) {
			if (e.getCause() != null)
				throw new BadStateChangeException(e.getMessage(), e.getCause());
			throw new BadStateChangeException(e.getMessage(), e);
		} catch (StillWorkingOnItException e) {
			log.info("still working on setting status of run " + id + " to "
					+ s, e);
			return e.getMessage();
		} catch (InterruptedException e) {
			throw new BadStateChangeException(
					"interrupted while waiting to insert notification into database");
		}
	}