package com.quiptiq.wurmrest;

import javax.ws.rs.WebApplicationException;
import java.net.MalformedURLException;

import com.quiptiq.wurmrest.health.GameServiceHealthCheck;
import com.quiptiq.wurmrest.resources.BankResource;
import com.quiptiq.wurmrest.rmi.BankService;
import com.quiptiq.wurmrest.rmi.RmiGameService;
import com.quiptiq.wurmrest.rmi.RmiProvider;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Main application for starting up WurmRest
 */
public class WurmRestApplication extends Application<WurmRestConfiguration> {
    private static final Logger logger = LoggerFactory.getLogger(WurmRestApplication.class);

    private static final int UNKNOWN_ERROR = 1;

    public static void main(String[] args) {
        try {
            new WurmRestApplication().run(args);
        } catch (Exception e) {
            logger.error("Unexpected exception while running WurmRest application", e);
            System.exit(UNKNOWN_ERROR);
        }
    }

    @Override
    public String getName() {
        return "wurmrest";
    }

    @Override
    public void initialize(Bootstrap<WurmRestConfiguration> bootstrap) {

    }

    @Override
    public void run(WurmRestConfiguration wurmRestConfiguration, Environment environment) throws
            Exception {
        RmiProvider rmiProvider;
        try {
            rmiProvider = wurmRestConfiguration.getRmiProviderFactory().build();
        } catch (MalformedURLException e) {
            // Can't do anything if the URL is bad
            throw new WebApplicationException("Couldn't create service", e);
        }
        final BankResource bank = new BankResource(new BankService(rmiProvider));
        final GameServiceHealthCheck healthCheck =
                new GameServiceHealthCheck(new RmiGameService(rmiProvider));
        environment.healthChecks().register("Game Service", healthCheck);
        environment.jersey().register(bank);
    }
}

@@ -215,24 +215,124 @@
 nkResource;%0A
+import com.quiptiq.wurmrest.resources.ServerResource;%0Aimport com.quiptiq.wurmrest.rmi.AdminService;%0A
 import com.q
@@ -1879,32 +1879,215 @@
 (rmiProvider));%0A
+        environment.jersey().register(bank);%0A%0A        final ServerResource server = new ServerResource(new AdminService(rmiProvider));%0A        environment.jersey().register(server);%0A%0A
         final Ga
@@ -2276,53 +2276,8 @@
 k);%0A
-        environment.jersey().register(bank);%0A
     

Add server admin to resources