if (executionService == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); return XSPReplyUtils.toHttpResponse(executionService.schedule(new CollaborationSpawnJob(specification)), null);
/** * Responds to the request to push an artifact to the live store * When successful, this action creates the appropriate job and returns it. * * @param parameters The request parameters * @return The response */ private HttpResponse onMessagePushToLive(Map<String, String[]> parameters) { String[] ids = parameters.get("id"); if (ids == null || ids.length == 0) return new HttpResponse(HttpURLConnection.HTTP_BAD_REQUEST, HttpConstants.MIME_TEXT_PLAIN, "Expected an id parameter"); JobExecutionService executor = ServiceUtils.getService(JobExecutionService.class); if (executor == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); Job job = new PushArtifactToLiveJob(ids[0]); executor.schedule(job); return new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, job.serializedJSON()); } }
/** * Responds to the request to pull an artifact from the live store * When successful, this action creates the appropriate job and returns it. * * @param parameters The request parameters * @return The response */ private HttpResponse onMessagePullFromLive(Map<String, String[]> parameters) { String[] ids = parameters.get("id"); if (ids == null || ids.length == 0) return new HttpResponse(HttpURLConnection.HTTP_BAD_REQUEST, HttpConstants.MIME_TEXT_PLAIN, "Expected an id parameter"); JobExecutionService executor = ServiceUtils.getService(JobExecutionService.class); if (executor == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); Job job = new PullArtifactFromLiveJob(ids[0]); executor.schedule(job); return new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, job.serializedJSON()); }
/** * Responds to a request to delete an artifact * * @param parameters The request parameters * @return The response */ private HttpResponse onMessageDeleteArtifact(Map<String, String[]> parameters) { String[] ids = parameters.get("id"); if (ids == null || ids.length == 0) return new HttpResponse(HttpURLConnection.HTTP_BAD_REQUEST, HttpConstants.MIME_TEXT_PLAIN, "Expected an id parameter"); JobExecutionService executor = ServiceUtils.getService(JobExecutionService.class); if (executor == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); Job job = new DeleteArtifactJob(ids[0]); executor.schedule(job); return new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, job.serializedJSON()); }
/** * Responds to the request to pull an artifact from a connector * When successful, this action creates the appropriate job and returns it. * * @param connectorId The identifier of the connector to delete * @return The response */ private HttpResponse onMessagePullFromConnector(String connectorId) { JobExecutionService executor = Register.getComponent(JobExecutionService.class); if (executor == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); Job job = new PullArtifactJob(connectorId); executor.schedule(job); return new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, job.serializedJSON()); }
return; executionService.schedule(new PlatformRebootJob());
@Override public XSPReply perform(ImpactAnalysisSetup setup) { SecurityService securityService = Register.getComponent(SecurityService.class); if (securityService == null) return XSPReplyServiceUnavailable.instance(); XSPReply reply = securityService.checkAction(ImpactAnalysisService.ACTION_PERFORM); if (!reply.isSuccess()) return reply; JobExecutionService executionService = Register.getComponent(JobExecutionService.class); if (executionService == null) return XSPReplyServiceUnavailable.instance(); XOWLImpactAnalysisJob job = new XOWLImpactAnalysisJob(setup); executionService.schedule(job); return new XSPReplyResult<>(job); } }
/** * Responds to the request to push an artifact to a connector * When successful, this action creates the appropriate job and returns it. * * @param connectorId The identifier of the connector to delete * @param request The request to handle * @return The response */ private HttpResponse onMessagePushToConnector(String connectorId, HttpApiRequest request) { String artifact = request.getParameter("artifact"); if (artifact == null) return XSPReplyUtils.toHttpResponse(new XSPReplyApiError(ERROR_EXPECTED_QUERY_PARAMETERS, "'artifact'"), null); JobExecutionService executor = Register.getComponent(JobExecutionService.class); if (executor == null) return XSPReplyUtils.toHttpResponse(XSPReplyServiceUnavailable.instance(), null); Job job = new PushArtifactJob(connectorId, artifact); executor.schedule(job); return new HttpResponse(HttpURLConnection.HTTP_OK, HttpConstants.MIME_JSON, job.serializedJSON()); } }