Examples of Output


Examples of org.graylog2.plugin.streams.Output

    public Response remove(@ApiParam(name = "streamid", value = "The id of the stream whose outputs we want.", required = true) @PathParam("streamid") String streamid,
                           @ApiParam(name = "outputId", value = "The id of the output that should be deleted", required = true) @PathParam("outputId") String outputId) throws org.graylog2.database.NotFoundException {
        checkPermission(RestPermissions.STREAM_OUTPUTS_DELETE);

        final Stream stream = streamService.load(streamid);
        final Output output = outputService.load(outputId);

        streamService.removeOutput(stream, output);

        return Response.status(Response.Status.OK).build();
    }
View Full Code Here

Examples of org.graylog2.plugin.streams.Output

    }

    public MessageOutput getOutputForId(String id) {
        if (!getRunningMessageOutputs().containsKey(id))
            try {
                final Output output = outputService.load(id);
                register(id, launchOutput(output));
            } catch (NotFoundException | MessageOutputConfigurationException e) {
                LOG.error("Unable to launch output <{}>: {}", id, e);
                return null;
            }
View Full Code Here

Examples of org.graylog2.plugin.streams.Output

        assertEquals(messageOutputs.size(), 0);
    }

    public void testGetMessageOutputsForSingleStream() throws Exception {
        final Stream stream = mock(Stream.class);
        final Output output = mock(Output.class);
        final String outputId = "foobar";
        final MessageOutput messageOutput = mock(MessageOutput.class);
        final Set<Output> outputSet = new HashSet<Output>() {{ add(output); }};
        when(stream.getOutputs()).thenReturn(outputSet);
        when(output.getId()).thenReturn(outputId);
        when(outputRegistry.getOutputForId(eq(outputId))).thenReturn(messageOutput);
        final OutputRouter outputRouter = new OutputRouter(defaultMessageOutput, outputRegistry);

        final Collection<MessageOutput> messageOutputs = outputRouter.getMessageOutputsForStream(stream);
View Full Code Here

Examples of org.graylog2.plugin.streams.Output

        assertTrue(messageOutputs.contains(messageOutput));
    }

    public void testGetMessageOutputsForStreamWithTwoOutputs() throws Exception {
        final Stream stream = mock(Stream.class);
        final Output output1 = mock(Output.class);
        final Output output2 = mock(Output.class);
        final String output1Id = "foo";
        final String output2Id = "bar";
        final MessageOutput messageOutput1 = mock(MessageOutput.class);
        final MessageOutput messageOutput2 = mock(MessageOutput.class);
        final Set<Output> outputSet = new HashSet<Output>() {{ add(output1); add(output2); }};
        when(stream.getOutputs()).thenReturn(outputSet);
        when(output1.getId()).thenReturn(output1Id);
        when(output2.getId()).thenReturn(output2Id);
        when(outputRegistry.getOutputForId(eq(output1Id))).thenReturn(messageOutput1);
        when(outputRegistry.getOutputForId(eq(output2Id))).thenReturn(messageOutput2);
        final OutputRouter outputRouter = new OutputRouter(defaultMessageOutput, outputRegistry);

        final Collection<MessageOutput> messageOutputs = outputRouter.getMessageOutputsForStream(stream);
View Full Code Here

Examples of org.graylog2.restclient.models.Output

        }

        final Form<OutputLaunchRequest> outputForm = form(OutputLaunchRequest.class).bindFromRequest();
        final OutputLaunchRequest request = outputForm.get();

        final Output output = outputService.create(request);

        streamService.addOutput(streamId, output.getId());

        flash("success", "Output " + output.getTitle() + " has been created!");
        return redirect(routes.StreamOutputsController.index(streamId));
    }
View Full Code Here

Examples of org.graylog2.restclient.models.Output

        if (stream == null) {
            flash("error", "Stream <" + streamId + "> does not exist!");
            return redirect(routes.StreamsController.index());
        }

        final Output output = outputService.get(outputId);

        if (output == null) {
            flash("error", "Output <" + outputId + "> does not exist!");
            return redirect(routes.StreamsController.index());
        }

        streamService.addOutput(streamId, outputId);

        flash("succes", "Output <" + output.getTitle() + "> has been added to Stream!");

        return redirect(routes.StreamOutputsController.index(streamId));
    }
View Full Code Here

Examples of org.graylog2.restclient.models.Output

        if (stream == null) {
            flash("error", "Stream <" + streamId + "> does not exist!");
            return redirect(routes.StreamsController.index());
        }

        final Output output = outputService.get(outputId);

        if (output == null) {
            flash("error", "Output <" + outputId + "> does not exist!");
            return redirect(routes.StreamsController.index());
        }

        streamService.removeOutput(streamId, outputId);

        flash("succes", "Output <" + output.getTitle() + "> has been removed to Stream!");

        return redirect(routes.StreamOutputsController.index(streamId));
    }
View Full Code Here

Examples of org.graylog2.restclient.models.Output

        }

        final Form<OutputLaunchRequest> outputForm = form(OutputLaunchRequest.class).bindFromRequest();
        final OutputLaunchRequest request = outputForm.get();

        final Output output = outputService.create(request);

        flash("success", "Output \"" + output.getTitle() + "\" has been created!");
        return redirect(routes.OutputsController.index());
    }
View Full Code Here

Examples of org.graylog2.restclient.models.Output

    public Result terminate(String outputId, String redirectToStream) throws APIException, IOException {
        if (!Permissions.isPermitted(RestPermissions.OUTPUTS_TERMINATE)) {
            return redirect(routes.StartpageController.redirect());
        }

        final Output output = outputService.get(outputId);
        if (output == null) {
            flash("error", "No such output!");
        } else {
            outputService.delete(outputId);
            flash("success", "Output \"" + output.getTitle() + "\" has been deleted!");
        }

        if (redirectToStream != null && !redirectToStream.isEmpty()) {
            return redirect(routes.StreamOutputsController.index(redirectToStream));
        } else {
View Full Code Here

Examples of org.hibernate.result.Output

  // outputs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  @Override
  public boolean execute() {
    try {
      final Output rtn = outputs().getCurrent();
      return rtn != null && ResultSetOutput.class.isInstance( rtn );
    }
    catch (NoMoreReturnsException e) {
      return false;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.