Search in sources :

Example 1 with PreprocessorCommand

use of com.bakdata.conquery.commands.PreprocessorCommand in project conquery by bakdata.

the class StandaloneSupport method preprocessTmp.

public void preprocessTmp(File tmpDir, List<File> descriptions) throws Exception {
    final Environment env = testConquery.getDropwizard().getEnvironment();
    final net.sourceforge.argparse4j.inf.Namespace namespace = new net.sourceforge.argparse4j.inf.Namespace(Map.of("in", tmpDir, "out", tmpDir, "desc", descriptions));
    // We use this to change the visibility of the run method, hence it cannot be instantiated.
    new PreprocessorCommand(MoreExecutors.newDirectExecutorService()) {

        @Override
        public void run(Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, ConqueryConfig config) throws Exception {
            super.run(environment, namespace, config);
        }
    }.run(env, namespace, config);
}
Also used : ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) Environment(io.dropwizard.setup.Environment) PreprocessorCommand(com.bakdata.conquery.commands.PreprocessorCommand) Namespace(com.bakdata.conquery.models.worker.Namespace) IOException(java.io.IOException)

Example 2 with PreprocessorCommand

use of com.bakdata.conquery.commands.PreprocessorCommand in project conquery by bakdata.

the class Conquery method initialize.

@Override
public void initialize(Bootstrap<ConqueryConfig> bootstrap) {
    final ObjectMapper confMapper = bootstrap.getObjectMapper();
    Jackson.configure(confMapper);
    confMapper.setConfig(confMapper.getDeserializationConfig().withView(InternalOnly.class));
    // check for java compiler, needed for the class generation
    if (ToolProvider.getSystemJavaCompiler() == null) {
        throw new IllegalStateException("Conquery requires to be run on either a JDK or a ServerJRE");
    }
    // main config file is json
    bootstrap.setConfigurationFactoryFactory(JsonConfigurationFactory::new);
    bootstrap.addCommand(new ShardNode());
    bootstrap.addCommand(new PreprocessorCommand());
    bootstrap.addCommand(new CollectEntitiesCommand());
    bootstrap.addCommand(new StandaloneCommand(this));
    bootstrap.addCommand(new RecodeStoreCommand());
    bootstrap.addCommand(new MigrateCommand());
    ((MutableInjectableValues) confMapper.getInjectableValues()).add(Validator.class, bootstrap.getValidatorFactory().getValidator());
    // do some setup in other classes after initialization but before running a
    // command
    bootstrap.addBundle(new ConfiguredBundle<>() {

        @Override
        public void run(ConqueryConfig configuration, Environment environment) {
            configuration.configureObjectMapper(environment.getObjectMapper());
        }

        @Override
        public void initialize(Bootstrap<?> bootstrap) {
            // Allow overriding of config from environment variables.
            bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(), StringSubstitutor.createInterpolator()));
        }
    });
}
Also used : JsonConfigurationFactory(io.dropwizard.configuration.JsonConfigurationFactory) CollectEntitiesCommand(com.bakdata.conquery.commands.CollectEntitiesCommand) MutableInjectableValues(com.bakdata.conquery.io.jackson.MutableInjectableValues) PreprocessorCommand(com.bakdata.conquery.commands.PreprocessorCommand) InternalOnly(com.bakdata.conquery.io.jackson.InternalOnly) StandaloneCommand(com.bakdata.conquery.commands.StandaloneCommand) MigrateCommand(com.bakdata.conquery.commands.MigrateCommand) SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) ShardNode(com.bakdata.conquery.commands.ShardNode) RecodeStoreCommand(com.bakdata.conquery.commands.RecodeStoreCommand) ConqueryConfig(com.bakdata.conquery.models.config.ConqueryConfig) Environment(io.dropwizard.setup.Environment) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

PreprocessorCommand (com.bakdata.conquery.commands.PreprocessorCommand)2 ConqueryConfig (com.bakdata.conquery.models.config.ConqueryConfig)2 Environment (io.dropwizard.setup.Environment)2 CollectEntitiesCommand (com.bakdata.conquery.commands.CollectEntitiesCommand)1 MigrateCommand (com.bakdata.conquery.commands.MigrateCommand)1 RecodeStoreCommand (com.bakdata.conquery.commands.RecodeStoreCommand)1 ShardNode (com.bakdata.conquery.commands.ShardNode)1 StandaloneCommand (com.bakdata.conquery.commands.StandaloneCommand)1 InternalOnly (com.bakdata.conquery.io.jackson.InternalOnly)1 MutableInjectableValues (com.bakdata.conquery.io.jackson.MutableInjectableValues)1 Namespace (com.bakdata.conquery.models.worker.Namespace)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonConfigurationFactory (io.dropwizard.configuration.JsonConfigurationFactory)1 SubstitutingSourceProvider (io.dropwizard.configuration.SubstitutingSourceProvider)1 IOException (java.io.IOException)1