Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added default configuration in ConfigurationSet in case of new values
orbiter892caccdcad2
diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.javaindex 7da70867a..ebd9aeada 100644--- a/source/de/anomic/search/Switchboard.java+++ b/source/de/anomic/search/Switchboard.java@@ -569,7 +569,7 @@ public final class Switchboard extends serverSwitch {// update the working scheme with the backup scheme. This is necessary to include new features.// new features are always activated by default-+ workingScheme.fill(backupScheme);// set up the solr interfacefinal String solrurls = getConfig("federated.service.solr.indexing.url", "http://127.0.0.1:8983/solr");diff --git a/source/net/yacy/cora/storage/ConfigurationSet.java b/source/net/yacy/cora/storage/ConfigurationSet.javaindex 3232fad1a..6ac64ff30 100644--- a/source/net/yacy/cora/storage/ConfigurationSet.java+++ b/source/net/yacy/cora/storage/ConfigurationSet.java@@ -72,6 +72,64 @@ public class ConfigurationSet extends AbstractSet<String> implements Set<String>}}+ public boolean containsDisabled(final String o) {+ if (o == null) return false;+ final Iterator<Entry> i = new EntryIterator();+ Entry e;+ while (i.hasNext()) {+ e = i.next();+ if (!e.enabled() && o.equals(e.key)) return true;+ }+ return false;+ }++ @Override+ public boolean add(final String key) {+ return add(key, null);+ }++ public boolean add(final String key, final String comment) {+ return add(key, comment, true);+ }++ public boolean add(final String key, final String comment, final boolean enabled) {+ if (contains(key)) {+ try {+ if (!enabled) disable(key);+ } catch (final IOException e) {+ }+ return true;+ }+ if (containsDisabled(key)) {+ try {+ if (enabled) enable(key);+ } catch (final IOException e) {+ }+ return false;+ }+ // extend the lines+ final String[] l = new String[this.lines.length + (comment == null ? 2 : 3)];+ System.arraycopy(this.lines, 0, l, 0, this.lines.length);+ l[this.lines.length] = "";+ if (comment != null) l[this.lines.length + 1] = "## " + comment;+ l[this.lines.length + (comment == null ? 1 : 2)] = enabled ? key : "#" + key;+ this.lines = l;+ try {+ commit();+ } catch (final IOException e) {+ }+ return false;+ }++ public void fill(final ConfigurationSet other) {+ final Iterator<Entry> i = other.allIterator();+ Entry e;+ while (i.hasNext()) {+ e = i.next();+ if (contains(e.key) || containsDisabled(e.key)) continue;+ this.add(e.key(), other.commentHeadline(e.key()), e.enabled());+ }+ }@Overridepublic boolean isEmpty() {