Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard;
 
The base class for Dropwizard services.

Parameters:
<T> the type of configuration class for this service
public abstract class Service<T extends Configuration> {
    static {
        // make sure spinning up Hibernate Validator doesn't yell at us
        LoggingFactory.bootstrap();
    }

    
Returns the java.lang.Class of the configuration class type parameter.

    public final Class<T> getConfigurationClass() {
        return Generics.getTypeParameter(getClass(), Configuration.class);
    }

    
Initializes the service bootstrap.

Parameters:
bootstrap the service bootstrap
    public abstract void initialize(Bootstrap<T> bootstrap);

    
When the service runs, this is called after the Bundles are run. Override it to add providers, resources, etc. for your service.

Parameters:
configuration the parsed com.yammer.dropwizard.config.Configuration object
environment the service's com.yammer.dropwizard.config.Environment
Throws:
java.lang.Exception if something goes wrong
    public abstract void run(T configurationEnvironment environmentthrows Exception;

    
Parses command-line arguments and runs the service. Call this method from a public static void main entry point in your application.

Parameters:
arguments the command-line arguments
Throws:
java.lang.Exception if something goes wrong
    public final void run(String[] argumentsthrows Exception {
        final Bootstrap<T> bootstrap = new Bootstrap<T>(this);
        bootstrap.addCommand(new ServerCommand<T>(this));
        initialize(bootstrap);
        final Cli cli = new Cli(this.getClass(), bootstrap);
        cli.run(arguments);
    }
New to GrepCode? Check out our FAQ X