Skip to content

Commit

Permalink
[ issue #44 ] Renamed Cloud Graph & DatasetGraph implementation as they
Browse files Browse the repository at this point in the history
are no longer read-only
  • Loading branch information
agazzarini committed Jun 10, 2015
1 parent ff0c079 commit e8e98e4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,26 @@
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.gazzax.labs.solrdf.Field;
import org.gazzax.labs.solrdf.NTriples;
import org.gazzax.labs.solrdf.graph.DatasetGraphSupertypeLayer;
import org.gazzax.labs.solrdf.graph.SolRDFGraph;
import org.gazzax.labs.solrdf.graph.standalone.LocalDatasetGraph;
import org.gazzax.labs.solrdf.log.Log;
import org.gazzax.labs.solrdf.log.MessageCatalog;
import org.slf4j.LoggerFactory;

import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.sparql.core.DatasetGraph;

/**
* A read only SolRDF implementation of a Jena Dataset.
* This is a read only dataset graph because changes (i.e. updates and deletes) are executed using
* {@link DistributedUpdateProcessor}; that means each node will be responsible to apply local changes using
* its own {@link LocalDatasetGraph} instance.
* A Jena {@link DatasetGraph} implementaton that will be used when SolRDF is running in SolrCloud.
*
* @author Andrea Gazzarini
* @since 1.0
*/
public class ReadOnlyCloudDatasetGraph extends DatasetGraphSupertypeLayer {
static final Log LOGGER = new Log(LoggerFactory.getLogger(ReadOnlyCloudDatasetGraph.class));
public class CloudDatasetGraph extends DatasetGraphSupertypeLayer {
static final Log LOGGER = new Log(LoggerFactory.getLogger(CloudDatasetGraph.class));

protected CloudSolrServer cloud;

Expand All @@ -56,7 +52,7 @@ public class ReadOnlyCloudDatasetGraph extends DatasetGraphSupertypeLayer {
* @param request the Solr query request.
* @param response the Solr query response.
*/
public ReadOnlyCloudDatasetGraph(
public CloudDatasetGraph(
final SolrQueryRequest request,
final SolrQueryResponse response,
final CloudSolrServer server) {
Expand All @@ -66,12 +62,12 @@ public ReadOnlyCloudDatasetGraph(

@Override
protected Graph _createNamedGraph(final Node graphNode) {
return new ReadOnlyCloudGraph(graphNode, cloud, ReadOnlyCloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
return new CloudGraph(graphNode, cloud, CloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
}

@Override
protected Graph _createDefaultGraph() {
return new ReadOnlyCloudGraph(null, cloud, ReadOnlyCloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
return new CloudGraph(null, cloud, CloudGraph.DEFAULT_QUERY_FETCH_SIZE, listener);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,36 @@
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.search.SyntaxError;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.gazzax.labs.solrdf.Field;
import org.gazzax.labs.solrdf.Strings;
import org.gazzax.labs.solrdf.graph.GraphEventConsumer;
import org.gazzax.labs.solrdf.graph.SolRDFGraph;
import org.gazzax.labs.solrdf.graph.standalone.LocalGraph;
import org.gazzax.labs.solrdf.log.Log;
import org.gazzax.labs.solrdf.log.MessageCatalog;
import org.slf4j.LoggerFactory;

import com.hp.hpl.jena.datatypes.RDFDatatype;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.shared.AddDeniedException;
import com.hp.hpl.jena.shared.DeleteDeniedException;

/**
* A read only SolRDF Cloud {@link Graph} implementation.
* This is a read only graph because changes (i.e. updates and deletes) are executed using
* {@link DistributedUpdateProcessor}; that means each node will be responsible to apply local changes using
* its own {@link LocalGraph} instance.
* A {@link SolRDFGraph} implementation for running SolRDF in SolrCloud.
*
* @author Andrea Gazzarini
* @since 1.0
*/
public final class ReadOnlyCloudGraph extends SolRDFGraph {
static final Log LOGGER = new Log(LoggerFactory.getLogger(ReadOnlyCloudGraph.class));
public final class CloudGraph extends SolRDFGraph {
static final Log LOGGER = new Log(LoggerFactory.getLogger(CloudGraph.class));

final FieldInjectorRegistry registry = new FieldInjectorRegistry();
final SolrServer cloud;

private SolrQuery graphSizeQuery;

/**
* Builds a new {@link ReadOnlyCloudGraph} with the given data.
* Builds a new {@link CloudGraph} with the given data.
*
* @param graphNode the graph name.
* @param request the Solr query request.
Expand All @@ -59,7 +53,7 @@ public final class ReadOnlyCloudGraph extends SolRDFGraph {
* @param fetchSize the fetch size that will be used in reads.
* @param consumer the Graph event consumer that will be notified on relevant events.
*/
ReadOnlyCloudGraph(
CloudGraph(
final Node graphNode,
final SolrServer cloud,
final int fetchSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.solr.update.processor.UpdateRequestProcessor;
import org.gazzax.labs.solrdf.Names;
import org.gazzax.labs.solrdf.graph.GraphEventConsumer;
import org.gazzax.labs.solrdf.graph.cloud.ReadOnlyCloudDatasetGraph;
import org.gazzax.labs.solrdf.graph.cloud.CloudDatasetGraph;
import org.gazzax.labs.solrdf.graph.standalone.LocalDatasetGraph;
import org.gazzax.labs.solrdf.log.Log;
import org.gazzax.labs.solrdf.log.MessageCatalog;
Expand Down Expand Up @@ -150,7 +150,7 @@ UsingList usingList(final SolrParams parameters)
*/
DatasetGraph datasetGraph(final SolrQueryRequest request, final SolrQueryResponse response) {
return CLUSTER != null
? new ReadOnlyCloudDatasetGraph(request, response, CLUSTER)
? new CloudDatasetGraph(request, response, CLUSTER)
: new LocalDatasetGraph(request, response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.solr.search.SyntaxError;
import org.gazzax.labs.solrdf.Names;
import org.gazzax.labs.solrdf.graph.GraphEventConsumer;
import org.gazzax.labs.solrdf.graph.cloud.ReadOnlyCloudDatasetGraph;
import org.gazzax.labs.solrdf.graph.cloud.CloudDatasetGraph;
import org.gazzax.labs.solrdf.graph.standalone.LocalDatasetGraph;
import org.gazzax.labs.solrdf.log.Log;
import org.gazzax.labs.solrdf.log.MessageCatalog;
Expand Down Expand Up @@ -235,7 +235,7 @@ String queryString(final SolrQueryRequest request) {
*/
DatasetGraph datasetGraph(final SolrQueryRequest request, final SolrQueryResponse response, final QParser parser, final GraphEventConsumer consumer) {
return request.getCore().getCoreDescriptor().getCoreContainer().isZooKeeperAware()
? new ReadOnlyCloudDatasetGraph(request, response, server)
? new CloudDatasetGraph(request, response, server)
: new LocalDatasetGraph(request, response, parser, consumer);
}
}

0 comments on commit e8e98e4

Please sign in to comment.