package com.yammer.dropwizard;

import com.yammer.dropwizard.bundles.BasicBundle;
import com.yammer.dropwizard.cli.Cli;
import com.yammer.dropwizard.cli.ServerCommand;
import com.yammer.dropwizard.config.Bootstrap;
import com.yammer.dropwizard.config.Configuration;
import com.yammer.dropwizard.config.Environment;
import com.yammer.dropwizard.config.LoggingFactory;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

/**
 * The base class for Dropwizard services.
 *
 * @param <T> the type of configuration class for this service
 */
@SuppressWarnings("EmptyMethod")
public abstract class Service<T extends Configuration> {
    static {
        // make sure spinning up Hibernate Validator doesn't yell at us
        LoggingFactory.bootstrap();
    }

    /**
     * Returns the {@link Class} of the configuration class type parameter.
     *
     * @return the configuration class
     * @see <a href="http://gafter.blogspot.com/2006/12/super-type-tokens.html">Super Type
     *      Tokens</a>
     */
    @SuppressWarnings("unchecked")
    public final Class<T> getConfigurationClass() {
        Type t = getClass();
        while (t instanceof Class<?>) {
            t = ((Class<?>) t).getGenericSuperclass();
        }
        // Similar to [Issue-89] (see {@link com.yammer.dropwizard.cli.ConfiguredCommand#getConfigurationClass})
        if (t instanceof ParameterizedType) {
            // should typically have one of type parameters (first one) that matches:
            for (Type param : ((ParameterizedType) t).getActualTypeArguments()) {
                if (param instanceof Class<?>) {
                    final Class<?> cls = (Class<?>) param;
                    if (Configuration.class.isAssignableFrom(cls)) {
                        return (Class<T>) cls;
                    }
                }
            }
        }
        throw new IllegalStateException(
                "Can not figure out Configuration type parameterization for " + getClass().getName());
    }

    /**
     * When the service runs, this is called after the {@link Bundle}s are run. Override it to add
     * providers, resources, etc. for your service.
     *
     * @param configuration the parsed {@link Configuration} object
     * @param environment   the service's {@link Environment}
     * @throws Exception if something goes wrong
     */
    public abstract void run(T configuration, Environment environment) throws Exception;

    /**
     * Initializes the service bootstrap.
     *
     * @param bootstrap the service bootstrap
     */
    @SuppressWarnings("UnusedParameters")
    public void initialize(Bootstrap<T> bootstrap) {
        // no default implementation
    }

    /**
     * Parses command-line arguments and runs the service. Call this method from a {@code public
     * static void main} entry point in your application.
     *
     * @param arguments the command-line arguments
     * @throws Exception if something goes wrong
     */
    @SuppressWarnings("UseOfSystemOutOrSystemErr")
    public final void run(String[] arguments) throws Exception {
        final Bootstrap<T> bootstrap = new Bootstrap<T>(this);
        bootstrap.addCommand(new ServerCommand<T>(this));
        bootstrap.addBundle(new BasicBundle());
        initialize(bootstrap);
        final Cli cli = new Cli(this.getClass(), bootstrap);
        cli.run(arguments);
    }
}

@@ -2003,32 +2003,205 @@
 Name());%0A    %7D%0A%0A
+    /**%0A     * Initializes the service bootstrap.%0A     *%0A     * @param bootstrap the service bootstrap%0A     */%0A    public abstract void initialize(Bootstrap%3CT%3E bootstrap);%0A%0A
     /**%0A     * W
@@ -2631,258 +2631,8 @@
 n;%0A%0A
-    /**%0A     * Initializes the service bootstrap.%0A     *%0A     * @param bootstrap the service bootstrap%0A     */%0A    @SuppressWarnings(%22UnusedParameters%22)%0A    public void initialize(Bootstrap%3CT%3E bootstrap) %7B%0A        // no default implementation%0A    %7D%0A%0A
     

Make Service#initialize abstract.