Commits

Anonymous committed 89d559e

Configure WebApp modules

Comments (0)

Files changed (4)

quixote-repository-chempound/pom.xml

     <dependencies>
 
         <dependency>
+            <groupId>net.chempound.ext</groupId>
+            <artifactId>chempound-4store</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
             <groupId>net.chempound</groupId>
             <artifactId>chempound-webapp</artifactId>
             <version>0.1-SNAPSHOT</version>

quixote-repository-chempound/src/main/java/uk/ac/cam/ch/wwmm/quixote/QuixoteChempoundServletConfig.java

 package uk.ac.cam.ch.wwmm.quixote;
 
-import com.google.inject.Module;
-import net.chempound.webapp.ChempoundServletConfig;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Stage;
+import com.google.inject.servlet.GuiceServletContextListener;
+import net.chempound.webapp.ChempoundServletModule;
 
 /**
  * @author Sam Adams
  */
-public class QuixoteChempoundServletConfig extends ChempoundServletConfig {
+public class QuixoteChempoundServletConfig extends GuiceServletContextListener {
 
-    public QuixoteChempoundServletConfig() {
-        super();
+    @Override
+    protected Injector getInjector() {
+        return Guice.createInjector(Stage.PRODUCTION,
+                new QuxoteWebappModule(),
+                new ChempoundServletModule()
+        );
     }
-
-    protected Module getPluginsModule() {
-        return new QuixotePluginsModule();
-    }
-
 }

quixote-repository-chempound/src/main/java/uk/ac/cam/ch/wwmm/quixote/QuixoteWebappLauncher.java

 package uk.ac.cam.ch.wwmm.quixote;
 
-import com.google.inject.Module;
 import net.chempound.webapp.ChempoundWebappLauncher;
 
 /**
  * @author Sam Adams
  */
-public class QuixoteWebappLauncher extends ChempoundWebappLauncher {
+public class QuixoteWebappLauncher {
 
     public static void main(final String[] args) throws Exception {
-        final QuixoteWebappLauncher launcher = new QuixoteWebappLauncher();
+        final ChempoundWebappLauncher launcher = new ChempoundWebappLauncher(new QuxoteWebappModule());
         launcher.start();
     }
 
-    @Override
-    protected Module getPluginsModule() {
-        return new QuixotePluginsModule();
-    }
-
 }

quixote-repository-chempound/src/main/java/uk/ac/cam/ch/wwmm/quixote/QuxoteWebappModule.java

+package uk.ac.cam.ch.wwmm.quixote;
+
+import com.google.inject.Module;
+import net.chempound.compchem.CompChemModule;
+import net.chempound.crystal.CrystallographyModule;
+import net.chempound.ext.fourstore.FourStoreTripleStoreModule;
+import net.chempound.plugins.jmol.JmolModule;
+import net.chempound.plugins.jquery.JQueryModule;
+import net.chempound.webapp.ChempoundWebappModule;
+import net.chempound.webapp.search.chemistry.StructureSearchProviderModule;
+
+public class QuxoteWebappModule extends ChempoundWebappModule {
+
+    @Override
+    protected void installPlugins() {
+        install(new StructureSearchProviderModule());
+        install(new CrystallographyModule());
+        install(new CompChemModule());
+
+        install(new JQueryModule());
+        install(new JmolModule());
+    }
+
+    @Override
+    protected Module getTripleStoreModule() {
+        return new FourStoreTripleStoreModule();
+    }
+}