Package org.graylog2.inputs

Examples of org.graylog2.inputs.Input


                        new CacheLoader<String, Optional<MessageInput>>() {
                            @Override
                            public Optional<MessageInput> load(String key) throws Exception {
                                LOG.debug("Loading message input {}", key);
                                try {
                                    final Input input = inputService.find(key);
                                    return Optional.fromNullable(inputService.buildMessageInput(input));
                                } catch (NotFoundException | NoSuchInputTypeException e) {
                                    return Optional.absent();
                                }
                            }
View Full Code Here


            return cache.get(inputId, new Callable<List<Extractor>>() {
                @Override
                public List<Extractor> call() throws Exception {
                    LOG.debug("Re-loading extractors for input <{}> into cache.", inputId);

                    Input input = inputService.find(inputId);

                    List<Extractor> sorted = Lists.newArrayList(inputService.getExtractors(input));

                    Collections.sort(sorted, new Comparator<Extractor>() {
                        public int compare(Extractor e1, Extractor e2) {
View Full Code Here

            throw new WebApplicationException(Response.Status.BAD_REQUEST);
        }

        input.addStaticField(csfr.key, csfr.value);

        Input mongoInput = inputService.find(input.getPersistId());
        try {
            inputService.addStaticField(mongoInput, csfr.key, csfr.value);
        } catch (ValidationException e) {
            LOG.error("Static field persist validation failed.", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
View Full Code Here

            throw new WebApplicationException(404);
        }

        input.getStaticFields().remove(key);

        Input mongoInput = inputService.find(input.getPersistId());
        inputService.removeStaticField(mongoInput, key);

        String msg = "Removed static field [" + key + "] of input <" + inputId + ">.";
        LOG.info(msg);
        activityWriter.write(new Activity(msg, StaticFieldsResource.class));
View Full Code Here

        } else {
            inputData.put(MessageInput.FIELD_NODE_ID, serverStatus.getNodeId().toString());
        }

        // ... and check if it would pass validation. We don't need to go on if it doesn't.
        Input mongoInput = new InputImpl(inputData);

        // Persist input.
        String id;
        id = inputService.save(mongoInput);
        input.setPersistId(id);
View Full Code Here

        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);
View Full Code Here

        } catch (ConfigurationException e) {
            LOG.error("Cannot create extractor. Missing configuration.", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }

        Input mongoInput = inputService.find(input.getPersistId());
        try {
            inputService.addExtractor(mongoInput, extractor);
        } catch (ValidationException e) {
            LOG.error("Extractor persist validation failed.", e);
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
View Full Code Here

            LOG.error("Missing inputId. Returning HTTP 400.");
            throw new WebApplicationException(400);
        }
        checkPermission(RestPermissions.INPUTS_READ, inputId);

        Input input = inputService.find(inputId);

        if (input == null) {
            LOG.error("Input <{}> not found.", inputId);
            throw new WebApplicationException(404);
        }
View Full Code Here

            LOG.error("Input <{}> not found.", inputId);
            throw new javax.ws.rs.NotFoundException("Couldn't find input " + inputId);
        }

        // Remove from Mongo.
        final Input mongoInput = inputService.find(input.getPersistId());
        final List<Extractor> extractorList = inputService.getExtractors(mongoInput);
        final ImmutableMap<String, Extractor> idMap =
                Maps.uniqueIndex(extractorList, new Function<Extractor, String>() {
                    @Override
                    public String apply(
View Full Code Here

            LOG.error("Missing inputId. Returning HTTP 400.");
            throw new WebApplicationException(400);
        }
        checkPermission(RestPermissions.INPUTS_EDIT, inputPersistId);

        Input mongoInput = inputService.find(inputPersistId);

        OrderExtractorsRequest oer;
        try {
            oer = objectMapper.readValue(body, OrderExtractorsRequest.class);
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.graylog2.inputs.Input

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.