Commits

Anonymous committed cb97e3e

Refactoring configuration / property loading

  • Participants
  • Parent commits b614abf

Comments (0)

Files changed (2)

src/main/java/net/chempound/ext/fourstore/FourStoreConfiguration.java

+package net.chempound.ext.fourstore;
+
+import net.chempound.config.ExtensionConfiguration;
+import net.chempound.config.PropertySource;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.net.URI;
+
+@Singleton
+public class FourStoreConfiguration {
+
+    private final ExtensionConfiguration config;
+
+    @Inject
+    public FourStoreConfiguration(final PropertySource propertySource) {
+        this.config = new ExtensionConfiguration("4store", propertySource);
+    }
+
+    public URI getUrl() {
+        return URI.create(config.getRequiredProperty(/*chempound.ext.4store.*/"url"));
+    }
+}

src/main/java/net/chempound/ext/fourstore/FourStoreTripleStore.java

     private final String dataUri;
 
     @Inject
-    public FourStoreTripleStore(final URI url) {
+    public FourStoreTripleStore(final FourStoreConfiguration config) {
+        this(config.getUrl());
+    }
+
+    FourStoreTripleStore(final URI url) {
         super(createSparqlUri(url));
         this.dataUri = url.toString() + "/data/";
         try {