clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1502332 - in /clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core: access/TcManager.java sparql/SparqlPreParser.java
Date Thu, 11 Jul 2013 19:21:16 GMT
Author: reto
Date: Thu Jul 11 19:21:16 2013
New Revision: 1502332

URL: http://svn.apache.org/r1502332
Log:
CLEREZZA-468: removed circular dependency between TcManager and SparqlPreParser

Modified:
    clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
    clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java

Modified: clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java?rev=1502332&r1=1502331&r2=1502332&view=diff
==============================================================================
--- clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
(original)
+++ clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
Thu Jul 11 19:21:16 2013
@@ -112,8 +112,7 @@ public class TcManager extends TcProvide
     @Reference(policy = ReferencePolicy.DYNAMIC,
             cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected QueryEngine queryEngine;
-    @Reference
-    protected SparqlPreParser sparqlPreParser;
+
     private ComponentContext componentContext;
     private Collection<UriRef> mGraphsToRegisterOnActivation = new HashSet<UriRef>();
     private Collection<UriRef> graphsToRegisterOnActivation = new HashSet<UriRef>();
@@ -157,7 +156,6 @@ public class TcManager extends TcProvide
                         System.out.println("QE: "
                                 + instance.queryEngine.getClass());
                     }
-                    instance.sparqlPreParser = new SparqlPreParser(instance);
                 }
             }
         }
@@ -282,6 +280,7 @@ public class TcManager extends TcProvide
      */
     public Object executeSparqlQuery(String query, TripleCollection defaultGraph) throws
ParseException {
         final UriRef defaultGraphName = new UriRef("urn:x-temp:/kjsfadfhfasdffds");
+        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
         final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
         TcProvider singleTargetTcProvider = null;
         if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName)))
{
@@ -299,6 +298,7 @@ public class TcManager extends TcProvide
     }
     
     public Object executeSparqlQuery(String query, UriRef defaultGraphName) throws ParseException
{
+        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
         final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
         TcProvider singleTargetTcProvider = null;
         if ((referencedGraphs != null)) {

Modified: clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java?rev=1502332&r1=1502331&r2=1502332&view=diff
==============================================================================
--- clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java
(original)
+++ clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/sparql/SparqlPreParser.java
Thu Jul 11 19:21:16 2013
@@ -22,14 +22,11 @@ import java.io.StringReader;
 import java.util.HashSet;
 import java.util.Set;
 import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.access.TcProvider;
 import org.apache.clerezza.rdf.core.sparql.query.DataSet;
 import org.apache.clerezza.rdf.core.sparql.query.Query;
 import org.apache.clerezza.rdf.core.sparql.query.SparqlUnit;
 import org.apache.clerezza.rdf.core.sparql.update.Update;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
 
 /**
  * This class implements an OSGi service to provide a method to obtain referred Graphs in
a SPARQL Query or Update.
@@ -37,18 +34,16 @@ import org.apache.felix.scr.annotations.
  * @author hasan
  */
 
-@Component
-@Service(SparqlPreParser.class)
+
 public class SparqlPreParser {
 
-    @Reference
-    TcManager tcManager;
+    TcProvider tcProvider;
 
     public SparqlPreParser() {
     }
 
-    public SparqlPreParser(TcManager tcManager) {
-        this.tcManager = tcManager;
+    public SparqlPreParser(TcProvider tcProvider) {
+        this.tcProvider = tcProvider;
     }
 
     /**
@@ -80,7 +75,7 @@ public class SparqlPreParser {
             }
         } else {
             Update u = sparqlUnit.getUpdate();
-            referredGraphs = u.getReferredGraphs(defaultGraph, tcManager);
+            referredGraphs = u.getReferredGraphs(defaultGraph, tcProvider);
         }
         if (referredGraphs.isEmpty()) {
             return null;



Mime
View raw message