Package org.graylog2.restclient.models

Examples of org.graylog2.restclient.models.Radio


    public void testParallelExecution() throws Exception {
        setupNodes(AddressNodeId.create("http://horst1:12900"), AddressNodeId.create("http://horst2:12900"));

        final Collection<Node> nodes = serverNodes.all();
        final Iterator<Node> it = nodes.iterator();
        Node node1 = it.next();
        Node node2 = it.next();
        api.setHttpClient(client);

        final ApiRequestBuilder<EmptyResponse> requestBuilder = api.get(EmptyResponse.class).path("/some/resource");
        final URL url1 = requestBuilder.prepareUrl(node1);
        final URL url2 = requestBuilder.prepareUrl(node2);
View Full Code Here


        final ArrayList<Node> nodes = Lists.newArrayList();
        for (AddressNodeId n : nodeDesc) {
            NodeSummaryResponse r = new NodeSummaryResponse();
            r.transportAddress = n.address;
            r.id = n.nodeId;
            final Node node = factory.fromSummaryResponse(r);
            node.touch();
            nodes.add(node);
        }
        serverNodes.put(nodes);
    }
View Full Code Here

        final Map<Input, Map<ClusterEntity, InputState>> globalInputs = Maps.newHashMap();
        final List<InputState> localInputs = Lists.newArrayList();

        try {
            Radio radio = nodeService.loadRadio(radioId);

            if (radio == null) {
                String message = "Did not find radio.";
                return status(404, views.html.errors.error.render(message, new RuntimeException(), request()));
            }

            for (InputState inputState : inputService.loadAllInputStates(radio)) {
                if (!inputState.getInput().getGlobal())
                    localInputs.add(inputState);
                else {
                    Map<ClusterEntity, InputState> clusterEntityInputStateMap = Maps.newHashMap();
                    clusterEntityInputStateMap.put(radio, inputState);
                    globalInputs.put(inputState.getInput(), clusterEntityInputStateMap);
                }
            }

            BreadcrumbList bc = new BreadcrumbList();
            bc.addCrumb("System", routes.SystemController.index(0));
            bc.addCrumb("Nodes", routes.NodesController.nodes());
            bc.addCrumb(radio.getShortNodeId(), routes.RadiosController.show(radio.getId()));
            bc.addCrumb("Inputs", routes.InputsController.manageRadio(radio.getId()));

            return ok(views.html.system.inputs.manage_radio.render(
                    currentUser(),
                    bc,
                    radio,
                    globalInputs,
                    localInputs,
                    radio.getAllInputTypeInformation(),
                    nodeService.loadMasterNode()
            ));
        } catch (IOException e) {
            return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
        } catch (APIException e) {
View Full Code Here

        }
        final Form<LaunchInputRequest> form = launchInputRequestForm.bindFromRequest();
        final LaunchInputRequest request = form.get();

        try {
            final Radio radio = nodeService.loadRadio(radioId);
            final InputTypeSummaryResponse inputInfo = radio.getInputTypeInformation(request.type);

            final Map<String, Object> configuration;
            try {
                configuration = extractConfiguration(request.configuration, inputInfo);
            } catch (IllegalArgumentException e) {
                return status(400, views.html.errors.error.render("Invalid input configuration", new RuntimeException("Invalid configuration for input " + request.title), request()));
            }

            try {
                if (radio.launchInput(request.title, request.type, false, configuration, currentUser(), inputInfo.isExclusive) == null) {
                    return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, new RuntimeException("Could not launch input " + request.title), request()));
                }
            } catch (ExclusiveInputException e) {
                flash("error", "This input is exclusive and already running.");
                return redirect(routes.InputsController.index());
View Full Code Here

    public Result show(String index, String id) {
        try {
            MessageResult message = messagesService.getMessage(index, id);
            Node sourceNode = getSourceNode(message);
            Radio sourceRadio = getSourceRadio(message);

            List<Stream> messageInStreams = Lists.newArrayList();

            for (String streamId : message.getStreamIds()) {
                if (isPermitted(STREAMS_READ, streamId)) {
View Full Code Here

    public Result partial(String index, String id) {
        try {
            MessageResult message = messagesService.getMessage(index, id);
            Node sourceNode = getSourceNode(message);
            Radio sourceRadio = getSourceRadio(message);
            List<Stream> messageInStreams = Lists.newArrayList();

            for (String streamId : message.getStreamIds()) {
                if (isPermitted(STREAMS_READ, streamId)) {
                    try {
View Full Code Here

        }
    }

    public Result ofRadio(String radioId, String preFilter) {
        try {
            Radio radio = nodeService.loadRadio(radioId);

            BreadcrumbList bc = new BreadcrumbList();
            bc.addCrumb("System", routes.SystemController.index(0));
            bc.addCrumb("Nodes", routes.NodesController.nodes());
            bc.addCrumb(radio.getShortNodeId(), routes.RadiosController.show(radio.getId()));
            bc.addCrumb("Metrics", routes.MetricsController.ofRadio(radio.getId(), ""));

            return ok(views.html.system.metrics.of_node.render(currentUser(), bc, radio, radio.getMetrics("org.graylog2"), preFilter));
        } catch (IOException e) {
            return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
        } catch (APIException e) {
            String message = "Could not fetch system information. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
            return status(500, views.html.errors.error.render(message, e, request()));
View Full Code Here

    @Inject
    private NodeService nodeService;

    public Result show(String radioId) {
        try {
            Radio radio = nodeService.loadRadio(radioId);

            BreadcrumbList bc = new BreadcrumbList();
            bc.addCrumb("System", routes.SystemController.index(0));
            bc.addCrumb("Nodes", routes.NodesController.nodes());
            bc.addCrumb(radio.getShortNodeId(), routes.RadiosController.show(radio.getId()));

            return ok(views.html.system.radios.show.render(currentUser(), bc, radio));
        } catch (NodeService.NodeNotFoundException e) {
            return status(404, views.html.errors.error.render(ApiClient.ERROR_MSG_NODE_NOT_FOUND, e, request()));
        }
View Full Code Here

        }
    }

    public Result threadDump(String radioId) {
        try {
            Radio radio = nodeService.loadRadio(radioId);

            BreadcrumbList bc = new BreadcrumbList();
            bc.addCrumb("System", routes.SystemController.index(0));
            bc.addCrumb("Nodes", routes.NodesController.nodes());
            bc.addCrumb(radio.getShortNodeId(), routes.RadiosController.show(radio.getId()));
            bc.addCrumb("Thread dump", routes.RadiosController.threadDump(radioId));

            return ok(views.html.system.threaddump.render(currentUser(), bc, radio, radio.getThreadDump()));
        } catch (IOException e) {
            return status(504, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
        } catch (APIException e) {
            String message = "Could not fetch system information. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
            return status(504, views.html.errors.error.render(message, e, request()));
View Full Code Here

        }
    }

    public Result overrideLbStatus(String radioId, String override) {
        try {
            Radio radio = nodeService.loadRadio(radioId);
            radio.overrideLbStatus(override);
            return redirect(routes.NodesController.nodes());
        } catch (IOException e) {
            return status(504, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
        } catch (APIException e) {
            String message = "Could not set load balancer state. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";
View Full Code Here

TOP

Related Classes of org.graylog2.restclient.models.Radio

Copyright © 2018 www.massapicom. 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.