org.graylog2.commands.journal.AbstractJournalCommand Maven / Gradle / Ivy
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program 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
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* .
*/
package org.graylog2.commands.journal;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import org.graylog2.Configuration;
import org.graylog2.audit.AuditBindings;
import org.graylog2.bindings.ConfigurationModule;
import org.graylog2.bootstrap.CmdLineTool;
import org.graylog2.featureflag.FeatureFlags;
import org.graylog2.plugin.KafkaJournalConfiguration;
import org.graylog2.plugin.Plugin;
import org.graylog2.plugin.system.NodeId;
import org.graylog2.plugin.system.SimpleNodeId;
import org.graylog2.shared.bindings.SchedulerBindings;
import org.graylog2.shared.bindings.ServerStatusBindings;
import org.graylog2.shared.journal.LocalKafkaJournal;
import org.graylog2.shared.journal.LocalKafkaJournalModule;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public abstract class AbstractJournalCommand extends CmdLineTool {
protected static final Configuration configuration = new Configuration();
protected final KafkaJournalConfiguration kafkaJournalConfiguration = new KafkaJournalConfiguration();
protected LocalKafkaJournal journal;
public AbstractJournalCommand() {
this(null);
}
public AbstractJournalCommand(String commandName) {
super(commandName, configuration);
}
@Override
protected List getCommandBindings(FeatureFlags featureFlags) {
return Arrays.asList(
new ConfigurationModule(configuration),
new AbstractModule() {
@Override
public void configure() {
bind(NodeId.class).toInstance(new SimpleNodeId("dummy-nodeid"));
}
},
new ServerStatusBindings(capabilities()),
new SchedulerBindings(),
new LocalKafkaJournalModule(),
new AuditBindings());
}
@Override
protected List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy