Mark node as unused for now.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 84e813e..77b80cf 100644 (file)
@@ -46,6 +46,9 @@ public class Core extends AbstractService {
        /** The configuration. */
        private Configuration configuration;
 
+       /** Interface to freenet. */
+       private FreenetInterface freenetInterface;
+
        /** The local Sones. */
        private final Set<Sone> localSones = new HashSet<Sone>();
 
@@ -72,6 +75,27 @@ public class Core extends AbstractService {
                return this;
        }
 
+       /**
+        * Sets the Freenet interface to use.
+        *
+        * @param freenetInterface
+        *            The Freenet interface to use
+        * @return This core (for method chaining)
+        */
+       public Core freenetInterface(FreenetInterface freenetInterface) {
+               this.freenetInterface = freenetInterface;
+               return this;
+       }
+
+       /**
+        * Returns the local Sones.
+        *
+        * @return The local Sones
+        */
+       public Set<Sone> localSones() {
+               return localSones;
+       }
+
        //
        // ACTIONS
        //
@@ -99,7 +123,10 @@ public class Core extends AbstractService {
                logger.entering(Core.class.getName(), "loadConfiguration()");
 
                /* get names of all local Sones. */
-               String allSoneNamesString = configuration.getStringValue("Sone/Names").getValue("");
+               String allSoneNamesString = configuration.getStringValue("Sone/Names").getValue(null);
+               if (allSoneNamesString == null) {
+                       allSoneNamesString = "";
+               }
                List<String> allSoneNames;
                try {
                        allSoneNames = StringEscaper.parseLine(allSoneNamesString);
@@ -113,7 +140,7 @@ public class Core extends AbstractService {
                        String insertUri = configuration.getStringValue("Sone/Name." + soneName + "/InsertURI").getValue(null);
                        String requestUri = configuration.getStringValue("Sone/Name." + soneName + "/RequestURI").getValue(null);
                        try {
-                               localSones.add(new Sone(new FreenetURI(requestUri), new FreenetURI(insertUri)));
+                               localSones.add(new Sone(soneName, new FreenetURI(requestUri), new FreenetURI(insertUri)));
                        } catch (MalformedURLException mue1) {
                                logger.log(Level.WARNING, "Could not create Sone from requestUri (“" + requestUri + "”) and insertUri (“" + insertUri + "”)!", mue1);
                        }