/**
 * 
 */
package xpress;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import xpress.graphtags.GraphTagsResource;
import xpress.graphtags.TagRetriever;
import xpress.retrieve.TagCloudRetriever;
import xpress.storage.InMemoryRepository;
import xpress.storage.Repository;

import com.yammer.dropwizard.Service;
import com.yammer.dropwizard.assets.AssetsBundle;
import com.yammer.dropwizard.config.Bootstrap;
import com.yammer.dropwizard.config.Environment;

/**
 * @author mcq
 * 
 */
public class XpressService extends Service<XpressConfiguration> {

    public static void main(String[] args) throws Exception {
        new XpressService().run(args);
    }

    @Override
    public void initialize(Bootstrap<XpressConfiguration> bootstrap) {
        bootstrap.setName("Xpress");
        bootstrap.addBundle(new AssetsBundle("/assets/", "/"));
    }

    @Override
    public void run(XpressConfiguration configuration, Environment environment) {
        ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        Repository repository = ac.getBean(Repository.class);
        TagRetriever tagRetriever = ac.getBean(TagRetriever.class);

        TagCloudRetriever tagCloudRetriever = new TagCloudRetriever(repository);
        environment.addResource(new TagCloudResource(tagCloudRetriever));
        final VoteResource voteResource = new VoteResource(InMemoryRepository.getInstance());
        voteResource.setRepository(repository);
        environment.addResource(voteResource);
        environment.addResource(new MoodGraphResource(new MoodGraphGenerator(InMemoryRepository.getInstance())));
        final GraphTagsResource resource = new GraphTagsResource();
        resource.setTagRetriever(tagRetriever);
        environment.addResource(resource);

    }

}

@@ -1225,89 +1225,8 @@
 );%0A%0A
-        TagCloudRetriever tagCloudRetriever = new TagCloudRetriever(repository);%0A
     
@@ -1274,17 +1274,21 @@
 esource(
-t
+new T
 agCloudR
@@ -1299,140 +1299,8 @@
 ever
-));%0A        final VoteResource voteResource = new VoteResource(InMemoryRepository.getInstance());%0A        voteResource.setRepository
 (rep
@@ -1306,16 +1306,18 @@
 pository
+))
 );%0A     
@@ -1343,17 +1343,21 @@
 esource(
-v
+new V
 oteResou
@@ -1359,16 +1359,28 @@
 Resource
+(repository)
 );%0A     
@@ -1455,40 +1455,18 @@
 tor(
-InMemoryRepository.getInstance()
+repository
 )));

simplify all to use db repo