Commits

Sam Adams  committed d282fa4

Refactor webapp configuration to simplify overrides

  • Participants
  • Parent commits a99abb2

Comments (0)

Files changed (2)

File chempound-webapp/src/main/java/net/chempound/webapp/ChempoundWebappModule.java

 package net.chempound.webapp;
 
 import com.google.inject.AbstractModule;
-import com.google.inject.Module;
 import net.chempound.ChempoundConfigurationModule;
 import net.chempound.DefaultChempoundModule;
 import net.chempound.config.DefaultPropertySource;
 
     @Override
     protected void configure() {
-        install(getConfigurationModule());
-        install(getChempoundModule());
-        install(getWebAppModule());
-        install(getTripleStoreModule());
-        install(getResourceStoreModule());
+        installConfigurationModule();
+        installChempoundModule();
+        installWebAppModule();
+        installTripleStoreModule();
+        installResourceStoreModule();
         installPlugins();
     }
 
         return new DefaultPropertySource();
     }
 
-    protected Module getConfigurationModule() {
-        return new ChempoundConfigurationModule(getPropertySource());
+    protected void installConfigurationModule() {
+        install(new ChempoundConfigurationModule(getPropertySource()));
     }
 
-    protected Module getChempoundModule() {
-        return new DefaultChempoundModule();
+    protected void installChempoundModule() {
+        install(new DefaultChempoundModule());
     }
 
-    protected Module getWebAppModule() {
-        return new DefaultChempoundWebModule();
+    protected void installWebAppModule() {
+        install(new DefaultChempoundWebModule());
     }
 
-    protected Module getTripleStoreModule() {
-          return new JenaTripleStoreModule();
+    protected void installTripleStoreModule() {
+        install(new JenaTripleStoreModule());
     }
 
-    protected Module getResourceStoreModule() {
-        return new FileSystemResourceStoreModule();
+    protected void installResourceStoreModule() {
+        install(new FileSystemResourceStoreModule());
     }
 
     protected void installPlugins() {

File chempound-webapp/src/main/java/net/chempound/webapp/StubConfigurationWebAppModule.java

     }
 
     @Override
-    protected Module getConfigurationModule() {
+    protected void installConfigurationModule() {
         final ChempoundConfiguration configuration = new StubChempoundConfiguration(baseUri, workspace);
-        return new ChempoundConfigurationModule(configuration, new DefaultPropertySource());
+        install(new ChempoundConfigurationModule(configuration, new DefaultPropertySource()));
     }
 
     @Override
-    protected Module getTripleStoreModule() {
-        return new AbstractModule() {
+    protected void installTripleStoreModule() {
+        install(new AbstractModule() {
             @Override
             protected void configure() {
                 bind(TripleStore.class).to(InMemoryJenaTripleStore.class);
             }
-        };
+        });
     }
 
     @Override
-    protected Module getResourceStoreModule() {
-        return new AbstractModule() {
+    protected void installResourceStoreModule() {
+        install(new AbstractModule() {
             @Override
             protected void configure() {
                 bind(ResourceStore.class).to(InMemoryResourceStore.class);
             }
-        };
+        });
     }
 
     @Override