use of org.apache.stanbol.reasoners.servicesapi.UnboundReasoningServiceException in project stanbol by apache.
the class ReasoningServicesResource method getServiceDocumentation.
@GET
@Produces(TEXT_HTML)
@Path("{service}")
public Response getServiceDocumentation(@PathParam(value = "service") String serviceID, @Context HttpHeaders headers) {
try {
this.service = this.getServicesManager().get(serviceID);
} catch (UnboundReasoningServiceException e) {
log.info("Service {} is not bound", serviceID);
ResponseBuilder rb = Response.status(Status.NOT_FOUND);
rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
return rb.build();
}
ResponseBuilder rb = Response.ok(new Viewable("service", this));
rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
return rb.build();
}
use of org.apache.stanbol.reasoners.servicesapi.UnboundReasoningServiceException in project stanbol by apache.
the class ReasoningServiceTaskResource method prepare.
public void prepare(String serviceID, String taskIDstr, String jobFlag) {
this.taskID = taskIDstr;
log.debug("Called service {} to perform task {}", serviceID, taskID);
// Parameters for customized reasoning services
this.parameters = prepareParameters();
// Retrieve the service
try {
service = getService(serviceID);
} catch (UnboundReasoningServiceException e) {
log.error("Service not found: {}", serviceID);
throw new WebApplicationException(e, Response.Status.NOT_FOUND);
}
log.debug("Service retrieved");
// Check if the task is allowed
if (this.service.supportsTask(taskID) || taskID.equals(ReasoningServiceExecutor.TASK_CHECK)) {
// Ok
} else {
log.error("Unsupported task (not found): {}", taskID);
throw new WebApplicationException(new Exception("Unsupported task (not found): " + taskID), Response.Status.NOT_FOUND);
}
// Check for the job parameter
if (!jobFlag.equals("")) {
log.debug("Job param is {}", job);
if (jobFlag.equals("/job")) {
log.debug("Ask for background job");
this.job = true;
} else {
log.error("Malformed request");
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
}
// Now we check if the service implementation is supported
if (getCurrentService() instanceof JenaReasoningService) {
} else if (getCurrentService() instanceof OWLApiReasoningService) {
} else {
log.error("This implementation of ReasoningService is not supported: {}", getCurrentService().getClass());
throw new WebApplicationException(new Exception("This implementation of ReasoningService is not supported: " + getCurrentService().getClass()), Response.Status.INTERNAL_SERVER_ERROR);
}
log.debug("Implementation is supported");
}
Aggregations