@Produces(MediaType.APPLICATION_JSON)
@ApiResponses(value = {
@ApiResponse(code = 404, message = "No such input on this node.")
})
public Response launchExisting(@ApiParam(name = "inputId", required = true) @PathParam("inputId") String inputId) {
InputState inputState = inputRegistry.getInputState(inputId);
final MessageInput messageInput;
if (inputState == null) {
try {
final Input input = inputService.find(inputId);
messageInput = inputService.getMessageInput(input);
messageInput.initialize();
} catch (NoSuchInputTypeException | org.graylog2.database.NotFoundException e) {
final String error = "Cannot launch input <" + inputId + ">. Input not found.";
LOG.info(error);
throw new NotFoundException(error);
}
} else
messageInput = inputState.getMessageInput();
if (messageInput == null) {
final String error = "Cannot launch input <" + inputId + ">. Input not found.";
LOG.info(error);
throw new NotFoundException(error);