You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/08/07 19:21:56 UTC
svn commit: r1616551 - in
/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena: query/ARQ.java
sparql/engine/http/Service.java
sparql/engine/main/iterator/QueryIterService.java
Author: andy
Date: Thu Aug 7 17:21:55 2014
New Revision: 1616551
URL: http://svn.apache.org/r1616551
Log:
JENA-761 : Symbol ARQ.serviceAllowed
Modified:
jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java
jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/Service.java
jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterService.java
Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java?rev=1616551&r1=1616550&r2=1616551&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/query/ARQ.java Thu Aug 7 17:21:55 2014
@@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory ;
import com.hp.hpl.jena.sparql.ARQConstants ;
import com.hp.hpl.jena.sparql.SystemARQ ;
import com.hp.hpl.jena.sparql.algebra.optimize.TransformOrderByDistinctApplication ;
+import com.hp.hpl.jena.sparql.engine.http.Service ;
import com.hp.hpl.jena.sparql.engine.main.StageBuilder ;
import com.hp.hpl.jena.sparql.lib.Metadata ;
import com.hp.hpl.jena.sparql.mgt.ARQMgt ;
@@ -221,6 +222,14 @@ public class ARQ
public static final Symbol serviceParams = ARQConstants.allocSymbol("serviceParams") ;
/**
+ * Control whether SERVICE processing is allowed.
+ * If the context of the query exexcution contains this,
+ * and it's set to "false", then SERVICE is not allowed.
+ */
+
+ public static final Symbol serviceAllowed = Service.serviceAllowed ;
+
+ /**
* A Long value that specifies the number of bindings (or triples for CONSTRUCT queries) to be stored in memory by sort
* operations or hash tables before switching to temporary disk files. The value defaults to -1, which will always
* keep the bindings in memory and never write to temporary files. The amount of memory used will vary based on
Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/Service.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/Service.java?rev=1616551&r1=1616550&r2=1616551&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/Service.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/http/Service.java Thu Aug 7 17:21:55 2014
@@ -82,6 +82,14 @@ public class Service {
public static final Symbol serviceContext = ARQConstants.allocSymbol(base, "serviceContext");
/**
+ * Control whether SERVICE processing is allowed.
+ * If the context contains this, and it is set to "false",
+ * then SERVICE is not allowed.
+ */
+
+ public static final Symbol serviceAllowed = ARQConstants.allocSymbol(base, "serviceAllowed");
+
+ /**
* Set timeout. The value of this symbol gives the value of the timeout in
* milliseconds
* <ul>
@@ -105,6 +113,9 @@ public class Service {
* @return Query iterator of service results
*/
public static QueryIterator exec(OpService op, Context context) {
+ if ( context != null && context.isFalse(serviceAllowed) )
+ throw new QueryExecException("SERVICE execution disabled") ;
+
if (!op.getService().isURI())
throw new QueryExecException("Service URI not bound: " + op.getService());
Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterService.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterService.java?rev=1616551&r1=1616550&r2=1616551&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterService.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/engine/main/iterator/QueryIterService.java Thu Aug 7 17:21:55 2014
@@ -20,6 +20,7 @@ package com.hp.hpl.jena.sparql.engine.ma
import org.apache.jena.atlas.logging.Log ;
+import com.hp.hpl.jena.query.QueryExecException ;
import com.hp.hpl.jena.sparql.algebra.Op ;
import com.hp.hpl.jena.sparql.algebra.op.OpService ;
import com.hp.hpl.jena.sparql.engine.ExecutionContext ;
@@ -40,6 +41,8 @@ public class QueryIterService extends Qu
public QueryIterService(QueryIterator input, OpService opService, ExecutionContext context)
{
super(input, context) ;
+ if ( context.getContext().isFalse(Service.serviceAllowed) )
+ throw new QueryExecException("SERVICE not allowed") ;
this.opService = opService ;
}