Commits

Sam Adams committed 641cd42

Refactoring ContentHandler > ContentType

Comments (0)

Files changed (3)

crystallography-handler/src/main/java/uk/ac/cam/ch/wwmm/chempound/crystal/CrystallographyModule.java

 package uk.ac.cam.ch.wwmm.chempound.crystal;
 
-import uk.ac.cam.ch.wwmm.chempound.crystal.display.CrystalContentHandler;
+import uk.ac.cam.ch.wwmm.chempound.crystal.display.CrystalContentType;
 import uk.ac.cam.ch.wwmm.chempound.crystal.rdf.CrystalPersonalities;
 import uk.ac.cam.ch.wwmm.chempound.crystal.search.CrystalSearchProvider;
 import uk.ac.cam.ch.wwmm.chempound.webapp.plugins.ChempoundPluginModule;
 
     @Override
     protected void configure() {
-        bindContentHandler(CrystalContentHandler.class);
+        bindContentHandler(CrystalContentType.class);
         bindSearchProvider(CrystalSearchProvider.class);
     }
 

crystallography-handler/src/main/java/uk/ac/cam/ch/wwmm/chempound/crystal/display/CrystalContentHandler.java

-package uk.ac.cam.ch.wwmm.chempound.crystal.display;
-
-import com.google.inject.Injector;
-import com.hp.hpl.jena.rdf.model.Model;
-import uk.ac.cam.ch.wwmm.chempound.crystal.rdf.ont.Cryst;
-import uk.ac.cam.ch.wwmm.chempound.webapp.FreemarkerService;
-import uk.ac.cam.ch.wwmm.chempound.webapp.output.AbstractContentHandler;
-import uk.ac.cam.ch.wwmm.chempound.webapp.output.SplashWriter;
-
-import javax.inject.Inject;
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * @author Sam Adams
- */
-public class CrystalContentHandler extends AbstractContentHandler {
-
-    private static final URI TYPE_URI = URI.create(Cryst.CrystallographicExperiment.getURI());
-
-    private Injector injector;
-
-    @Inject
-    public CrystalContentHandler(Injector injector, FreemarkerService freemarkerService) throws IOException {
-        super(TYPE_URI, 10);
-        this.injector = injector;
-        freemarkerService.registerPlugin("crystal", getClass(), "/uk/ac/cam/ch/wwmm/chempound/crystal/templates");
-    }
-
-    @Override
-    public SplashWriter getWriter(Model model, URI aggregationUri) {
-        return injector.getInstance(CrystalWriter.class);
-    }
-
-}

crystallography-handler/src/main/java/uk/ac/cam/ch/wwmm/chempound/crystal/display/CrystalContentType.java

+package uk.ac.cam.ch.wwmm.chempound.crystal.display;
+
+import com.google.inject.Injector;
+import com.hp.hpl.jena.rdf.model.Model;
+import uk.ac.cam.ch.wwmm.chempound.crystal.rdf.ont.Cryst;
+import uk.ac.cam.ch.wwmm.chempound.webapp.FreemarkerService;
+import uk.ac.cam.ch.wwmm.chempound.webapp.output.ContentType;
+import uk.ac.cam.ch.wwmm.chempound.webapp.output.SplashWriter;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.net.URI;
+
+/**
+ * @author Sam Adams
+ */
+public class CrystalContentType extends ContentType {
+
+    private static final URI TYPE_URI = URI.create(Cryst.CrystallographicExperiment.getURI());
+
+    private Injector injector;
+
+    @Inject
+    public CrystalContentType(Injector injector, FreemarkerService freemarkerService) throws IOException {
+        super(TYPE_URI, 10);
+        this.injector = injector;
+        freemarkerService.registerPlugin("crystal", getClass(), "/uk/ac/cam/ch/wwmm/chempound/crystal/templates");
+    }
+
+    @Override
+    public SplashWriter getWriter(Model model, URI aggregationUri) {
+        return injector.getInstance(CrystalWriter.class);
+    }
+
+}