commit 3553cf0e510df1d0a3e3a45352b075a5d9469cfb Author: Karsten Loesing karsten.loesing@gmx.net Date: Fri Aug 15 08:53:20 2014 +0200
fixup! Split ApplicationFactory into four factories. --- .../onionoo/docs/DocumentStoreFactory.java | 18 ++++++++++++++++++ .../onionoo/server/NodeIndexerFactory.java | 18 ++++++++++++++++++ .../onionoo/updater/DescriptorSourceFactory.java | 19 +++++++++++++++++++ .../org/torproject/onionoo/util/TimeFactory.java | 18 ++++++++++++++++++ 4 files changed, 73 insertions(+)
diff --git a/src/main/java/org/torproject/onionoo/docs/DocumentStoreFactory.java b/src/main/java/org/torproject/onionoo/docs/DocumentStoreFactory.java new file mode 100644 index 0000000..ab62231 --- /dev/null +++ b/src/main/java/org/torproject/onionoo/docs/DocumentStoreFactory.java @@ -0,0 +1,18 @@ +/* Copyright 2014 The Tor Project + * See LICENSE for licensing information */ +package org.torproject.onionoo.docs; + +public class DocumentStoreFactory { + + private static DocumentStore documentStoreInstance; + public static void setDocumentStore(DocumentStore documentStore) { + documentStoreInstance = documentStore; + } + public static DocumentStore getDocumentStore() { + if (documentStoreInstance == null) { + documentStoreInstance = new DocumentStore(); + } + return documentStoreInstance; + } +} + diff --git a/src/main/java/org/torproject/onionoo/server/NodeIndexerFactory.java b/src/main/java/org/torproject/onionoo/server/NodeIndexerFactory.java new file mode 100644 index 0000000..a605adf --- /dev/null +++ b/src/main/java/org/torproject/onionoo/server/NodeIndexerFactory.java @@ -0,0 +1,18 @@ +/* Copyright 2014 The Tor Project + * See LICENSE for licensing information */ +package org.torproject.onionoo.server; + +public class NodeIndexerFactory { + + private static NodeIndexer nodeIndexerInstance; + public static void setNodeIndexer(NodeIndexer nodeIndexer) { + nodeIndexerInstance = nodeIndexer; + } + public static NodeIndexer getNodeIndexer() { + if (nodeIndexerInstance == null) { + nodeIndexerInstance = new NodeIndexer(); + } + return nodeIndexerInstance; + } +} + diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorSourceFactory.java b/src/main/java/org/torproject/onionoo/updater/DescriptorSourceFactory.java new file mode 100644 index 0000000..b495120 --- /dev/null +++ b/src/main/java/org/torproject/onionoo/updater/DescriptorSourceFactory.java @@ -0,0 +1,19 @@ +/* Copyright 2014 The Tor Project + * See LICENSE for licensing information */ +package org.torproject.onionoo.updater; + +public class DescriptorSourceFactory { + + private static DescriptorSource descriptorSourceInstance; + public static void setDescriptorSource( + DescriptorSource descriptorSource) { + descriptorSourceInstance = descriptorSource; + } + public static DescriptorSource getDescriptorSource() { + if (descriptorSourceInstance == null) { + descriptorSourceInstance = new DescriptorSource(); + } + return descriptorSourceInstance; + } +} + diff --git a/src/main/java/org/torproject/onionoo/util/TimeFactory.java b/src/main/java/org/torproject/onionoo/util/TimeFactory.java new file mode 100644 index 0000000..b53b7a3 --- /dev/null +++ b/src/main/java/org/torproject/onionoo/util/TimeFactory.java @@ -0,0 +1,18 @@ +/* Copyright 2014 The Tor Project + * See LICENSE for licensing information */ +package org.torproject.onionoo.util; + +public class TimeFactory { + + private static Time timeInstance; + public static void setTime(Time time) { + timeInstance = time; + } + public static Time getTime() { + if (timeInstance == null) { + timeInstance = new Time(); + } + return timeInstance; + } +} +