Skip to content
Browse files

code clean-up: "backend" refactored into "repository" to conform to

terminology used in architecture documents (in Wiki)
  • Loading branch information...
1 parent 518cc43 commit 7a5df33aeb4e0686888188a1a3ace3974703075e @hanecak hanecak committed
View
16 src/main/java/sk/opendata/odn/WicketApplication.java
@@ -29,8 +29,8 @@
import org.slf4j.LoggerFactory;
import sk.opendata.odn.repository.OdnRepositoryException;
-import sk.opendata.odn.repository.sesame.SesameBackend;
-import sk.opendata.odn.repository.solr.SolrBackend;
+import sk.opendata.odn.repository.sesame.SesameRepository;
+import sk.opendata.odn.repository.solr.SolrRepository;
import sk.opendata.odn.ui.AdminHomePage;
import sk.opendata.odn.ui.HomePage;
@@ -44,8 +44,8 @@
private static Logger logger = LoggerFactory.getLogger(WicketApplication.class);
- private SesameBackend sesameBackend = null;
- private SolrBackend solrBackend = null;
+ private SesameRepository sesameRepository = null;
+ private SolrRepository solrRepository = null;
private Scheduler scheduler = null;
/**
@@ -57,8 +57,8 @@ public WicketApplication() {
mountBookmarkablePage("admin", AdminHomePage.class);
// initialize repositories
- sesameBackend = SesameBackend.getInstance();
- solrBackend = SolrBackend.getInstance();
+ sesameRepository = SesameRepository.getInstance();
+ solrRepository = SolrRepository.getInstance();
// initialize job scheduler
logger.debug("initializing job scheduler ...");
@@ -82,8 +82,8 @@ protected void onDestroy() {
logger.debug("shuting down job scheduler ...");
try {
scheduler.shutdown();
- sesameBackend.shutDown();
- solrBackend.shutDown();
+ sesameRepository.shutDown();
+ solrRepository.shutDown();
} catch (SchedulerException e) {
logger.error("scheduler exception", e);
// TODO is it a "good practice" to pass that also up to Wicket?
View
8 ...java/sk/opendata/odn/harvester/datanest/organizations/OrganizationsDatanestHarvester.java
@@ -40,8 +40,8 @@
import sk.opendata.odn.model.OrganizationRecord;
import sk.opendata.odn.repository.OdnRepositoryException;
-import sk.opendata.odn.repository.sesame.SesameBackend;
-import sk.opendata.odn.repository.solr.SolrBackend;
+import sk.opendata.odn.repository.sesame.SesameRepository;
+import sk.opendata.odn.repository.solr.SolrRepository;
import sk.opendata.odn.serialization.OdnSerializationException;
import sk.opendata.odn.serialization.rdf.OrganizationRdfSerializer;
import sk.opendata.odn.serialization.solr.SolrSerializer;
@@ -77,13 +77,13 @@ public OrganizationsDatanestHarvester() throws IOException,
super();
OrganizationRdfSerializer rdfSerializer = new OrganizationRdfSerializer(
- SesameBackend.getInstance(),
+ SesameRepository.getInstance(),
datanestProperties
.getProperty(KEY_DATANEST_ORGANIZATIONS_SEZAME_REPO_NAME));
serializers.add(rdfSerializer);
SolrSerializer<OrganizationRecord> solrSerializer = new SolrSerializer<OrganizationRecord>(
- SolrBackend.getInstance());
+ SolrRepository.getInstance());
serializers.add(solrSerializer);
}
View
8 ...endata/odn/harvester/datanest/organizations/PoliticalPartyDonationsDatanestHarvester.java
@@ -40,8 +40,8 @@
import sk.opendata.odn.model.Currency;
import sk.opendata.odn.model.PoliticalPartyDonationRecord;
import sk.opendata.odn.repository.OdnRepositoryException;
-import sk.opendata.odn.repository.sesame.SesameBackend;
-import sk.opendata.odn.repository.solr.SolrBackend;
+import sk.opendata.odn.repository.sesame.SesameRepository;
+import sk.opendata.odn.repository.solr.SolrRepository;
import sk.opendata.odn.serialization.OdnSerializationException;
import sk.opendata.odn.serialization.rdf.PoliticalPartyDonationRdfSerializer;
import sk.opendata.odn.serialization.solr.SolrSerializer;
@@ -84,13 +84,13 @@ public PoliticalPartyDonationsDatanestHarvester() throws IOException,
super();
PoliticalPartyDonationRdfSerializer rdfSerializer = new PoliticalPartyDonationRdfSerializer(
- SesameBackend.getInstance(),
+ SesameRepository.getInstance(),
datanestProperties
.getProperty(KEY_DATANEST_PPD_SEZAME_REPO_NAME));
serializers.add(rdfSerializer);
SolrSerializer<PoliticalPartyDonationRecord> solrSerializer = new SolrSerializer<PoliticalPartyDonationRecord>(
- SolrBackend.getInstance());
+ SolrRepository.getInstance());
serializers.add(solrSerializer);
}
View
8 .../java/sk/opendata/odn/harvester/datanest/organizations/ProcurementsDatanestHarvester.java
@@ -39,8 +39,8 @@
import sk.opendata.odn.model.Currency;
import sk.opendata.odn.model.ProcurementRecord;
import sk.opendata.odn.repository.OdnRepositoryException;
-import sk.opendata.odn.repository.sesame.SesameBackend;
-import sk.opendata.odn.repository.solr.SolrBackend;
+import sk.opendata.odn.repository.sesame.SesameRepository;
+import sk.opendata.odn.repository.solr.SolrRepository;
import sk.opendata.odn.serialization.OdnSerializationException;
import sk.opendata.odn.serialization.rdf.ProcurementRdfSerializer;
import sk.opendata.odn.serialization.solr.SolrSerializer;
@@ -83,13 +83,13 @@ public ProcurementsDatanestHarvester() throws IOException,
super();
ProcurementRdfSerializer rdfSerializer = new ProcurementRdfSerializer(
- SesameBackend.getInstance(),
+ SesameRepository.getInstance(),
datanestProperties
.getProperty(KEY_DATANEST_PROCUREMENTS_SEZAME_REPO_NAME));
serializers.add(rdfSerializer);
SolrSerializer<ProcurementRecord> solrSerializer = new SolrSerializer<ProcurementRecord>(
- SolrBackend.getInstance());
+ SolrRepository.getInstance());
serializers.add(solrSerializer);
}
View
34 .../odn/repository/sesame/SesameBackend.java → ...n/repository/sesame/SesameRepository.java
@@ -39,25 +39,9 @@
import sk.opendata.odn.utils.ApplicationProperties;
/**
- * Sesame backend/repository for Open Data Node.
- *
- * "Little" terminology note:
- *
- * TODO:
- * 1) Remove this "terminology note"
- * 2) refactor class names from <xxx>Backend to <xxx>Repository
- *
- * <ul>
- * <li>in Open Data Node architecture, this (this class) is a repository</li>
- * <li>to achieve this, we're using multiple "Sesame repositories"</li>
- * <li>so we have a little problem with "repository" being a little bit
- * confusing (Open Data Node repository consists of one or more Sesame
- * repositories)</li>
- * <li>so, to avoid some of the confusion, this class is called "back-end"
- * instead of "repository"</li>
- * </ul>
+ * Sesame repository for Open Data Node.
*/
-public class SesameBackend implements OdnRepositoryInterface<RdfData> {
+public class SesameRepository implements OdnRepositoryInterface<RdfData> {
public final static String SESAME_REPOSITORY_PROPERTIES_NAME = "/repo-sesame.properties";
public final static String KEY_DEBUG_DUMP_RDF = "sesame.debug.dump_rdf";
@@ -66,11 +50,11 @@
public final static String KEY_ID = PREFIX_KEY_REPO + "id";
public final static String PREFIX_KEY_CONTEXTS = PREFIX_KEY_REPO + "contexts.";
- private static Logger logger = LoggerFactory.getLogger(SesameBackend.class);
+ private static Logger logger = LoggerFactory.getLogger(SesameRepository.class);
private ApplicationProperties srProperties = null;
private HTTPRepository sesameRepo = null;
- private static SesameBackend instance = null;
+ private static SesameRepository instance = null;
/**
* Initialize Sesame back-end.
@@ -78,23 +62,23 @@
* @throws IOException
* when error occurs while loading properties
*/
- private SesameBackend() throws IOException {
+ private SesameRepository() throws IOException {
// load properties
srProperties = ApplicationProperties
.getInstance(SESAME_REPOSITORY_PROPERTIES_NAME);
}
/**
- * Get the instance of Sesame back-end singleton.
+ * Get the instance of Sesame repository singleton.
*
- * @return instance of Sesame backend
+ * @return instance of Sesame repository
* @throws IOException
* when error occurs while loading properties
*/
- public static SesameBackend getInstance() throws IOException {
+ public static SesameRepository getInstance() throws IOException {
if (instance == null)
- instance = new SesameBackend();
+ instance = new SesameRepository();
return instance;
}
View
31 ...data/odn/repository/solr/SolrBackend.java → ...a/odn/repository/solr/SolrRepository.java
@@ -36,28 +36,19 @@
import sk.opendata.odn.utils.ApplicationProperties;
/**
- * SOLR backend/repository for Open Data Node.
- *
- * "Little" terminology note:
- *
- * <ul>
- * <li>in Open Data Node architecture, this (this class) is a repository</li>
- * <li>in SOLR, it is called "index"</li>
- * <li>to achieve this, we're using "SOLR index"</li>
- * <li>but to be in-line with naming chosen for Sesame, "repository" is used</li>
- * </ul>
+ * SOLR repository for Open Data Node.
*/
-public class SolrBackend implements OdnRepositoryInterface<List<SolrItem>> {
+public class SolrRepository implements OdnRepositoryInterface<List<SolrItem>> {
public final static String SOLR_REPOSITORY_PROPERTIES_NAME = "/repo-solr.properties";
public final static String KEY_DEBUG_DUMP = "solr.debug.dump";
public final static String KEY_REPO_URL = "solr.repo.url";
- private static Logger logger = LoggerFactory.getLogger(SolrBackend.class);
+ private static Logger logger = LoggerFactory.getLogger(SolrRepository.class);
private ApplicationProperties srProperties = null;
private SolrServer solrServer = null;
- private static SolrBackend instance = null;
+ private static SolrRepository instance = null;
/**
* Initialize SOLR back-end.
@@ -65,7 +56,7 @@
* @throws IOException
* when error occurs while loading properties
*/
- private SolrBackend() throws IOException {
+ private SolrRepository() throws IOException {
// load properties
srProperties = ApplicationProperties
.getInstance(SOLR_REPOSITORY_PROPERTIES_NAME);
@@ -77,16 +68,16 @@ private SolrBackend() throws IOException {
}
/**
- * Get the instance of SOLR back-end singleton.
+ * Get the instance of SOLR repository singleton.
*
- * @return instance of SOLR backend
+ * @return instance of SOLR repository
* @throws IOException
* when error occurs while loading properties
*/
- public static SolrBackend getInstance() throws IOException {
+ public static SolrRepository getInstance() throws IOException {
if (instance == null)
- instance = new SolrBackend();
+ instance = new SolrRepository();
return instance;
}
@@ -163,11 +154,11 @@ public void shutDown() throws OdnRepositoryException {
}
/**
- * Purpose of this is to provide access to data stored in SOLR backend for search GUI.
+ * Purpose of this is to provide access to data stored in SOLR repository for search GUI.
*
* TODO: Clean-up this setter. It might not be a good idea to give away reference to that object.
*
- * @return SOLR server instance used by this backend
+ * @return SOLR server instance used by this repository
*/
public SolrServer getSolrServer() {
return solrServer;
View
6 src/main/java/sk/opendata/odn/ui/panel/ResultPanel.java
@@ -34,7 +34,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import sk.opendata.odn.repository.solr.SolrBackend;
+import sk.opendata.odn.repository.solr.SolrRepository;
import sk.opendata.odn.repository.solr.SolrItem;
import sk.opendata.odn.utils.PscUtil;
@@ -96,7 +96,7 @@ public void doSearch(final String query) throws IOException, SolrServerException
// nothing to do with empty search query
return;
- SolrBackend solrBackend = SolrBackend.getInstance();
+ SolrRepository solrRepository = SolrRepository.getInstance();
SolrQuery solrQuery = new SolrQuery();
solrQuery.setQuery(query);
@@ -159,7 +159,7 @@ public void doSearch(final String query) throws IOException, SolrServerException
// obtain results
- QueryResponse queryResponse = solrBackend.getSolrServer().query(solrQuery);
+ QueryResponse queryResponse = solrRepository.getSolrServer().query(solrQuery);
List<SolrItem> responseItems = queryResponse.getBeans(SolrItem.class);
// update the display

0 comments on commit 7a5df33

Please sign in to comment.
Something went wrong with that request. Please try again.