Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard.cli;
 
A command which executes with a configured com.yammer.dropwizard.config.Environment.

Parameters:
<T> the com.yammer.dropwizard.config.Configuration subclass which is loaded from the configuration file
See also:
com.yammer.dropwizard.config.Configuration
public abstract class EnvironmentCommand<T extends Configurationextends ConfiguredCommand<T> {
    private final Service<T> service;

    
Creates a new environment command.

Parameters:
service the service providing this command
name the name of the command, used for command line invocation
description a description of the command's purpose
    protected EnvironmentCommand(Service<T> serviceString nameString description) {
        super(namedescription);
        this. = service;
    }
    @Override
    protected final void run(Bootstrap<T> bootstrapNamespace namespace, T configurationthrows Exception {
        final Environment environment = new Environment(bootstrap.getName(),
                                                        configuration,
                                                        bootstrap.getObjectMapperFactory().copy(),
                                                        new Validator());
        bootstrap.runWithBundles(configurationenvironment);
        .run(configurationenvironment);
        run(environmentnamespaceconfiguration);
    }

    
Runs the command with the given com.yammer.dropwizard.config.Environment and com.yammer.dropwizard.config.Configuration.

Parameters:
environment the configured environment
namespace the parsed command line namespace
configuration the configuration object
Throws:
java.lang.Exception if something goes wrong
    protected abstract void run(Environment environmentNamespace namespace, T configurationthrows Exception;
New to GrepCode? Check out our FAQ X