// Path: src/main/java/org/graylog/collector/inputs/InputService.java
// public abstract class InputService extends AbstractService implements Input {
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/Output.java
// public interface Output {
//     String getId();
// 
//     Set<String> getInputs();
// 
//     void write(Message message);
// 
//     interface Factory<T extends Output, C extends Configuration> {
//         T create(C configuration);
//     }
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/OutputConfiguration.java
// public abstract class OutputConfiguration implements Configuration {
//     public interface Factory<C extends OutputConfiguration> {
//         C create(String id, Config config);
//     }
// 
//     @NotBlank
//     private final String id;
// 
//     @NotNull
//     private Set<String> inputs = Sets.newHashSet();
// 
//     public OutputConfiguration(String id, Config config) {
//         this.id = id;
// 
//         if (config.hasPath("inputs")) {
//             this.inputs = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(config.getString("inputs")));
//         }
//     }
// 
//     public abstract OutputService createOutput();
// 
//     @Override
//     public String getId() {
//         return id;
//     }
// 
//     public Set<String> getInputs() {
//         return inputs;
//     }
// 
//     @Override
//     public Map<String, String> toStringValues() {
//         return Collections.unmodifiableMap(new HashMap<String, String>() {
//             {
//                 put("id", getId());
//                 put("inputs", Joiner.on(",").join(getInputs()));
//             }
//         });
//     }
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/OutputService.java
// public abstract class OutputService extends AbstractService implements Output {
// }


import javax.inject.Inject;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Service;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;
import com.typesafe.config.ConfigObject;
import com.typesafe.config.ConfigValue;
import org.graylog.collector.inputs.Input;
import org.graylog.collector.inputs.InputConfiguration;
import org.graylog.collector.inputs.InputService;
import org.graylog.collector.outputs.Output;
import org.graylog.collector.outputs.OutputConfiguration;
import org.graylog.collector.outputs.OutputService;
/**
 * This file is part of Graylog.
 *
 * Graylog is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Graylog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Graylog.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.graylog.collector.config;



public class ConfigurationRegistry {
    private final Set<Service> services = Sets.newHashSet();
    private final Set<Input> inputs = Sets.newHashSet();
    private final Set<Output> outputs = Sets.newHashSet();

    private final Map<String, InputConfiguration.Factory<? extends InputConfiguration>> inputConfigFactories;
    private final Map<String, OutputConfiguration.Factory<? extends OutputConfiguration>> outputConfigFactories;

    private final List<ConfigurationError> errors = Lists.newArrayList();
    private final ConfigurationValidator validator;

    @Inject
    public ConfigurationRegistry(Config config,
                                 Map<String, InputConfiguration.Factory<? extends InputConfiguration>> inputConfigs,
                                 Map<String, OutputConfiguration.Factory<? extends OutputConfiguration>> outputConfigs) {
        this.inputConfigFactories = inputConfigs;
        this.outputConfigFactories = outputConfigs;
        this.validator = new ConfigurationValidator();

        try {
            processConfig(config);
// Path: src/main/java/org/graylog/collector/inputs/InputService.java
// public abstract class InputService extends AbstractService implements Input {
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/Output.java
// public interface Output {
//     String getId();
// 
//     Set<String> getInputs();
// 
//     void write(Message message);
// 
//     interface Factory<T extends Output, C extends Configuration> {
//         T create(C configuration);
//     }
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/OutputConfiguration.java
// public abstract class OutputConfiguration implements Configuration {
//     public interface Factory<C extends OutputConfiguration> {
//         C create(String id, Config config);
//     }
// 
//     @NotBlank
//     private final String id;
// 
//     @NotNull
//     private Set<String> inputs = Sets.newHashSet();
// 
//     public OutputConfiguration(String id, Config config) {
//         this.id = id;
// 
//         if (config.hasPath("inputs")) {
//             this.inputs = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(config.getString("inputs")));
//         }
//     }
// 
//     public abstract OutputService createOutput();
// 
//     @Override
//     public String getId() {
//         return id;
//     }
// 
//     public Set<String> getInputs() {
//         return inputs;
//     }
// 
//     @Override
//     public Map<String, String> toStringValues() {
//         return Collections.unmodifiableMap(new HashMap<String, String>() {
//             {
//                 put("id", getId());
//                 put("inputs", Joiner.on(",").join(getInputs()));
//             }
//         });
//     }
// }
// 
// Path: src/main/java/org/graylog/collector/outputs/OutputService.java
// public abstract class OutputService extends AbstractService implements Output {
// }


// Path: src/main/java/org/graylog/collector/config/ConfigurationRegistry.java
import javax.inject.Inject;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Service;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;
import com.typesafe.config.ConfigObject;
import com.typesafe.config.ConfigValue;
import org.graylog.collector.inputs.Input;
import org.graylog.collector.inputs.InputConfiguration;
import org.graylog.collector.inputs.InputService;
import org.graylog.collector.outputs.Output;
import org.graylog.collector.outputs.OutputConfiguration;
import org.graylog.collector.outputs.OutputService;

/**
 * This file is part of Graylog.
 *
 * Graylog is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Graylog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Graylog.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.graylog.collector.config;



public class ConfigurationRegistry {
    private final Set<Service> services = Sets.newHashSet();
    private final Set<Input> inputs = Sets.newHashSet();
    private final Set<Output> outputs = Sets.newHashSet();

    private final Map<String, InputConfiguration.Factory<? extends InputConfiguration>> inputConfigFactories;
    private final Map<String, OutputConfiguration.Factory<? extends OutputConfiguration>> outputConfigFactories;

    private final List<ConfigurationError> errors = Lists.newArrayList();
    private final ConfigurationValidator validator;

    @Inject
    public ConfigurationRegistry(Config config,
                                 Map<String, InputConfiguration.Factory<? extends InputConfiguration>> inputConfigs,
                                 Map<String, OutputConfiguration.Factory<? extends OutputConfiguration>> outputConfigs) {
        this.inputConfigFactories = inputConfigs;
        this.outputConfigFactories = outputConfigs;
        this.validator = new ConfigurationValidator();

        try {
            processConfig(config);
        } catch (ConfigException e) {