Author: andy
Date: Mon May 27 16:31:10 2013
New Revision: 1486655
URL: http://svn.apache.org/r1486655
Log:
Separate out a configuration object for each service of a dataset.
Added:
jena/trunk/jena-fuseki/ServiceRef.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Stats.java
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/StatsServlet.java
Added: jena/trunk/jena-fuseki/ServiceRef.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/ServiceRef.java?rev=1486655&view=auto
==============================================================================
--- jena/trunk/jena-fuseki/ServiceRef.java (added)
+++ jena/trunk/jena-fuseki/ServiceRef.java Mon May 27 16:31:10 2013
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.fuseki.server;
+
+import java.util.ArrayList ;
+import java.util.List ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+/** Configuration of an individual service */
+public class ServiceRef
+{
+ public final String name ;
+
+ /** Endpoints (as absolute path URLs) */
+ public List<String> endpoints = new ArrayList<String>() ;
+ /** Count of requests received - good or bad */
+ public AtomicLong countRequests = new AtomicLong(0) ;
+ /** Count of requests received that fail request checking in some way */
+ public AtomicLong countRequestsBad = new AtomicLong(0) ;
+ /** Count of requests that are cancelled (e..g timeouts) */
+ public AtomicLong countRequestsCancelled = new AtomicLong(0) ;
+ /** Count of requests that fail because of internal server issues (bugs) */
+ public AtomicLong countRequestsOK = new AtomicLong(0) ;
+
+ public ServiceRef(String serviceName)
+ {
+ this.name = serviceName ;
+ }
+
+ public boolean isActive() { return endpoints.isEmpty() ; }
+}
+
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
Mon May 27 16:31:10 2013
@@ -20,11 +20,11 @@
*/
// Could be neater - much, much neater!
-package org.apache.jena.fuseki.mgt;
+
+package org.apache.jena.fuseki.mgt ;
import java.io.IOException ;
import java.io.PrintWriter ;
-import java.util.List ;
import javax.servlet.http.HttpServlet ;
import javax.servlet.http.HttpServletRequest ;
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletRes
import org.apache.jena.fuseki.Fuseki ;
import org.apache.jena.fuseki.server.DatasetRef ;
import org.apache.jena.fuseki.server.SPARQLServer ;
+import org.apache.jena.fuseki.server.ServiceRef ;
import org.apache.jena.web.HttpSC ;
import org.slf4j.Logger ;
@@ -45,7 +46,7 @@ import com.hp.hpl.jena.tdb.TDB ;
public class MgtCmdServlet extends HttpServlet
{
private static Logger log = Fuseki.serverLog ;
-
+
public MgtCmdServlet()
{
@@ -56,50 +57,46 @@ public class MgtCmdServlet extends HttpS
{
return ;
}
-
- public static String paramCmd = "cmd" ;
- public static String cmdBackup = "backup" ; //
&dataset=/datasetname
- public static String cmdRestart = "restart" ; // Not implemented.
- public static String cmdShutdown = "shutdown" ; // Server stops,
no questions asked.
-
- ActionBackup actionBackup = new ActionBackup() ;
-
+
+ public static String paramCmd = "cmd" ;
+ public static String cmdBackup = "backup" ; //
&dataset=/datasetname
+ public static String cmdRestart = "restart" ; // Not implemented.
+ public static String cmdShutdown = "shutdown" ; // Server stops, no
+ // questions asked.
+
+ ActionBackup actionBackup = new ActionBackup() ;
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException
{
- //Commands format:
- // ?cmd=backup&<other args per command>
-
+ // Commands format:
+ // ?cmd=backup&<other args per command>
+
String[] args = req.getParameterValues(paramCmd) ;
- if ( args == null )
- {
+ if ( args == null ) {
resp.setContentType("text/plain") ;
resp.setStatus(HttpSC.BAD_REQUEST_400) ;
-
+
return ;
}
- for ( String cmd : args )
- {
+ for ( String cmd : args ) {
if ( log.isInfoEnabled() )
- log.info("Management command: "+cmd) ;
-
- if ( cmd.equalsIgnoreCase(cmdBackup))
- {
+ log.info("Management command: " + cmd) ;
+
+ if ( cmd.equalsIgnoreCase(cmdBackup) ) {
actionBackup.doPost(req, resp) ;
continue ;
}
- if ( cmd.equalsIgnoreCase(cmdRestart))
- {
-
+ if ( cmd.equalsIgnoreCase(cmdRestart) ) {
+
continue ;
}
- if ( cmd.equalsIgnoreCase(cmdShutdown))
- {
+ if ( cmd.equalsIgnoreCase(cmdShutdown) ) {
Fuseki.getServer().stop() ;
continue ;
}
- log.warn("Unrecognized command : "+cmd) ;
-
+ log.warn("Unrecognized command : " + cmd) ;
+
}
}
@@ -107,78 +104,58 @@ public class MgtCmdServlet extends HttpS
public void doGet(HttpServletRequest req, HttpServletResponse resp)
{
try {
-
- //serverLog.info("Fuseki Server Config servlet") ;
-
+ // serverLog.info("Fuseki Server Config servlet") ;
+
PrintWriter out = resp.getWriter() ;
- resp.setContentType("text/plain");
+ resp.setContentType("text/plain") ;
SPARQLServer server = Fuseki.getServer() ;
-
+
out.println("Software:") ;
-
String fusekiVersion = Fuseki.VERSION ;
if ( fusekiVersion.equals("${project.version}") )
fusekiVersion = "(development)" ;
-
+
out.printf(" %s %s\n", Fuseki.NAME, fusekiVersion) ;
out.printf(" %s %s\n", TDB.NAME, TDB.VERSION) ;
out.printf(" %s %s\n", ARQ.NAME, ARQ.VERSION) ;
out.printf(" %s %s\n", Jena.NAME, Jena.VERSION) ;
-
- //out.printf("Port: %s\n",
server.getServer().getConnectors()[0].getPort()) ;
+
+ // out.printf("Port: %s\n",
+ // server.getServer().getConnectors()[0].getPort()) ;
out.println() ;
-
- for ( DatasetRef dsRef : server.getDatasets() )
- {
+
+ for ( DatasetRef dsRef : server.getDatasets() ) {
datasetRefDetails(out, dsRef) ;
out.println() ;
}
-
-
- } catch (IOException ex) {}
-
+ }
+ catch (IOException ex) {}
}
-
+
private static void datasetRefDetails(PrintWriter out, DatasetRef dsRef)
{
if ( dsRef.name != null )
- out.println("Name = "+dsRef.name) ;
+ out.println("Name = " + dsRef.name) ;
else
out.println("Name = <unset>") ;
-
- endpointDetail(out, "Query", dsRef, dsRef.queryEP) ;
- endpointDetail(out, "Update", dsRef, dsRef.updateEP) ;
- endpointDetail(out, "Upload", dsRef, dsRef.uploadEP) ;
- endpointDetail(out, "Graphs(Read)", dsRef, dsRef.readGraphStoreEP) ;
- endpointDetail(out, "Graphs(RW)", dsRef, dsRef.readWriteGraphStoreEP) ;
-
- // dataset
- }
-
-// public String name = null ;
-// public List<String> queryEP = new ArrayList<String>() ;
-// public List<String> updateEP = new ArrayList<String>() ;
-// public List<String> uploadEP = new ArrayList<String>() ;
-// public List<String> readGraphStoreEP = new ArrayList<String>() ;
-// public List<String> readWriteGraphStoreEP = new ArrayList<String>() ;
-// public DatasetGraph dataset = null ;
-
-// @Override
-// public void doPost(HttpServletRequest req, HttpServletResponse resp)
-// {
-// }
- private static void endpointDetail(PrintWriter out, String label,
DatasetRef dsRef , List<String> endpoints)
+ endpointDetail(out, "Query", dsRef, dsRef.query) ;
+ endpointDetail(out, "Update", dsRef, dsRef.update) ;
+ endpointDetail(out, "Upload", dsRef, dsRef.upload) ;
+ endpointDetail(out, "Graphs(Read)", dsRef, dsRef.readGraphStore) ;
+ endpointDetail(out, "Graphs(RW)", dsRef, dsRef.readWriteGraphStore) ;
+ }
+
+ private static void endpointDetail(PrintWriter out, String label,
DatasetRef dsRef, ServiceRef service)
{
boolean first = true ;
out.printf(" %-15s :: ", label) ;
-
- for ( String s : endpoints )
- {
- if ( ! first )
+
+ for ( String s : service.endpoints ) {
+ if ( !first )
out.print(" , ") ;
first = false ;
- s= "/"+dsRef.name+"/"+s ;
+ s = "/" + dsRef.name + "/" + s ;
out.print(s) ;
}
out.println() ;
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
Mon May 27 16:31:10 2013
@@ -28,6 +28,7 @@ import org.apache.jena.atlas.iterator.It
import org.apache.jena.fuseki.Fuseki ;
import org.apache.jena.fuseki.server.DatasetRef ;
import org.apache.jena.fuseki.server.DatasetRegistry ;
+import org.apache.jena.fuseki.server.ServiceRef ;
import com.hp.hpl.jena.shared.PrefixMapping ;
import com.hp.hpl.jena.sparql.core.DatasetGraph ;
@@ -88,7 +89,7 @@ public class MgtFunctions
DatasetRef ref = getFromRegistry(dataset) ;
if ( ref == null )
return dft ;
- return serviceNameOrDefault(ref.queryEP, dft) ;
+ return serviceNameOrDefault(ref.query, dft) ;
}
/** Return a SPARQL update service name for the dataset */
@@ -98,7 +99,7 @@ public class MgtFunctions
DatasetRef ref = getFromRegistry(dataset) ;
if ( ref == null )
return dft ;
- return serviceNameOrDefault(ref.updateEP, dft) ;
+ return serviceNameOrDefault(ref.update, dft) ;
}
/** Return a SPARQL upload service name for the dataset */
@@ -108,7 +109,7 @@ public class MgtFunctions
DatasetRef ref = getFromRegistry(dataset) ;
if ( ref == null )
return dft ;
- return serviceNameOrDefault(ref.uploadEP, dft) ;
+ return serviceNameOrDefault(ref.upload, dft) ;
}
/** Return a SPARQL Graph Store Protocol (Read) service name for the
dataset */
@@ -118,7 +119,7 @@ public class MgtFunctions
DatasetRef ref = getFromRegistry(dataset) ;
if ( ref == null )
return dft ;
- return serviceNameOrDefault(ref.readGraphStoreEP, dft) ;
+ return serviceNameOrDefault(ref.readGraphStore, dft) ;
}
/** Return a SPARQL Graph Store Protocol (Read-Write) service name for the
dataset */
@@ -128,7 +129,7 @@ public class MgtFunctions
DatasetRef ref = getFromRegistry(dataset) ;
if ( ref == null )
return dft ;
- return serviceNameOrDefault(ref.readWriteGraphStoreEP, dft) ;
+ return serviceNameOrDefault(ref.readWriteGraphStore, dft) ;
}
private static DatasetRef getFromRegistry(String dataset)
@@ -146,11 +147,11 @@ public class MgtFunctions
return ref ;
}
- private static String serviceNameOrDefault(List<String> services, String
defaultValue)
+ private static String serviceNameOrDefault(ServiceRef service, String
defaultValue)
{
- if ( services.isEmpty() )
+ if ( service.endpoints.isEmpty() )
return defaultValue ;
- String x = services.get(0) ;
+ String x = service.endpoints.get(0) ;
if ( x.startsWith("/") )
x = x.substring(1) ;
return x ;
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
Mon May 27 16:31:10 2013
@@ -18,8 +18,6 @@
package org.apache.jena.fuseki.server;
-import java.util.ArrayList ;
-import java.util.List ;
import java.util.concurrent.atomic.AtomicLong ;
import com.hp.hpl.jena.query.ReadWrite ;
@@ -28,14 +26,20 @@ import com.hp.hpl.jena.sparql.core.Datas
public class DatasetRef
{
public String name = null ;
-
- public List<String> queryEP = new ArrayList<String>() ;
- public List<String> updateEP = new ArrayList<String>() ;
- public List<String> uploadEP = new ArrayList<String>() ;
- public List<String> readGraphStoreEP = new ArrayList<String>() ;
- public List<String> readWriteGraphStoreEP = new ArrayList<String>() ;
public DatasetGraph dataset = null ;
+ public ServiceRef query = new ServiceRef("query") ;
+ public ServiceRef update = new ServiceRef("update") ;
+ public ServiceRef upload = new ServiceRef("upload") ;
+ public ServiceRef readGraphStore = new ServiceRef("gspRead") ;
+ public ServiceRef readWriteGraphStore = new
ServiceRef("gspReadWrite") ;
+
+// public List<String> queryEP = new ArrayList<String>() ;
+// public List<String> updateEP = new ArrayList<String>() ;
+// public List<String> uploadEP = new ArrayList<String>() ;
+// public List<String> readGraphStoreEP = new ArrayList<String>() ;
+// public List<String> readWriteGraphStoreEP = new ArrayList<String>() ;
+
/** Counter of active read transactions */
public AtomicLong activeReadTxn = new AtomicLong(0) ;
@@ -66,29 +70,6 @@ public class DatasetRef
/** Count of SPARQL Queries with execution errors (not timeouts) */
public AtomicLong countQueryBadExecution = new AtomicLong(0) ;
- // SPARQL Update
-
- /** Count of SPARQL Update */
- public AtomicLong countUpdate = new AtomicLong(0) ;
-
- // File upload
-
- /** Count of Uploads */
- public AtomicLong countUpload = new AtomicLong(0) ;
-
- // SPARQL Graph Store Protocol:
-
- /** Count of GSP GET */
- public AtomicLong countGET = new AtomicLong(0) ;
- /** Count of GSP POST */
- public AtomicLong countPOST = new AtomicLong(0) ;
- /** Count of GSP PUT */
- public AtomicLong countPUT = new AtomicLong(0) ;
- /** Count of GSP DELETE */
- public AtomicLong countDELETE = new AtomicLong(0) ;
- /** Count of GSP HEAD */
- public AtomicLong countHEAD = new AtomicLong(0) ;
-
public void startTxn(ReadWrite mode)
{
switch(mode)
@@ -125,10 +106,11 @@ public class DatasetRef
public boolean isReadOnly()
{
- return updateEP.size() == 0 &&
- uploadEP.size() == 0 &&
- readWriteGraphStoreEP.size() == 0 &&
- !allowDatasetUpdate ;
+ return ! allowDatasetUpdate &&
+ ! update.isActive() &&
+ ! upload.isActive() &&
+ ! readWriteGraphStore.isActive()
+ ;
}
}
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
Mon May 27 16:31:10 2013
@@ -86,23 +86,23 @@ public class FusekiConfig
public static ServerConfig defaultConfiguration(String datasetPath,
DatasetGraph dsg, boolean allowUpdate)
{
- DatasetRef sDesc = new DatasetRef() ;
- sDesc.name = datasetPath ;
- sDesc.dataset = dsg ;
- sDesc.queryEP.add(HttpNames.ServiceQuery) ;
- sDesc.queryEP.add(HttpNames.ServiceQueryAlt) ;
+ DatasetRef dbDesc = new DatasetRef() ;
+ dbDesc.name = datasetPath ;
+ dbDesc.dataset = dsg ;
+ dbDesc.query.endpoints.add(HttpNames.ServiceQuery) ;
+ dbDesc.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
if ( allowUpdate )
{
- sDesc.updateEP.add(HttpNames.ServiceUpdate) ;
- sDesc.uploadEP.add(HttpNames.ServiceUpload) ;
- sDesc.readWriteGraphStoreEP.add(HttpNames.ServiceData) ;
- sDesc.allowDatasetUpdate = true ;
+ dbDesc.update.endpoints.add(HttpNames.ServiceUpdate) ;
+ dbDesc.upload.endpoints.add(HttpNames.ServiceUpload) ;
+ dbDesc.readWriteGraphStore.endpoints.add(HttpNames.ServiceData) ;
+ dbDesc.allowDatasetUpdate = true ;
}
else
- sDesc.readGraphStoreEP.add(HttpNames.ServiceData) ;
+ dbDesc.readGraphStore.endpoints.add(HttpNames.ServiceData) ;
ServerConfig config = new ServerConfig() ;
- config.services = Arrays.asList(sDesc) ;
+ config.datasets = Arrays.asList(dbDesc) ;
config.port = 3030 ;
config.mgtPort = 3031 ;
config.pagesPort = config.port ;
@@ -149,7 +149,7 @@ public class FusekiConfig
// TODO Properties for the other fields.
ServerConfig config = new ServerConfig() ;
- config.services = services ;
+ config.datasets = services ;
config.port = 3030 ;
config.mgtPort = 3031 ;
config.pagesPort = config.port ;
@@ -215,11 +215,11 @@ public class FusekiConfig
sDesc.name = ((Literal)getOne(svc, "fu:name")).getLexicalForm() ;
log.info(" name = "+sDesc.name) ;
- addServiceEP("query", sDesc.name, sDesc.queryEP, svc,
"fu:serviceQuery") ;
- addServiceEP("update", sDesc.name, sDesc.updateEP, svc,
"fu:serviceUpdate") ;
- addServiceEP("upload", sDesc.name, sDesc.uploadEP, svc,
"fu:serviceUpload") ;
- addServiceEP("graphStore(RW)", sDesc.name,
sDesc.readWriteGraphStoreEP, svc, "fu:serviceReadWriteGraphStore") ;
- addServiceEP("graphStore(R)", sDesc.name, sDesc.readGraphStoreEP, svc,
"fu:serviceReadGraphStore") ;
+ addServiceEP("query", sDesc.name, sDesc.query, svc, "fu:serviceQuery")
;
+ addServiceEP("update", sDesc.name, sDesc.update, svc,
"fu:serviceUpdate") ;
+ addServiceEP("upload", sDesc.name, sDesc.upload, svc,
"fu:serviceUpload") ;
+ addServiceEP("graphStore(RW)", sDesc.name, sDesc.readWriteGraphStore,
svc, "fu:serviceReadWriteGraphStore") ;
+ addServiceEP("graphStore(R)", sDesc.name, sDesc.readGraphStore, svc,
"fu:serviceReadGraphStore") ;
// Extract timeout overriding configuration if present.
if (svc.hasProperty(FusekiVocab.pAllowTimeoutOverride)) {
@@ -259,14 +259,14 @@ public class FusekiConfig
return Iter.toList(rIter) ;
}
- private static void addServiceEP(String label, String name, List<String>
output, Resource svc, String property)
+ private static void addServiceEP(String label, String name, ServiceRef
service, Resource svc, String property)
{
ResultSet rs = query("SELECT * { ?svc "+property+" ?ep}",
svc.getModel(), "svc", svc) ;
for ( ; rs.hasNext() ; )
{
QuerySolution soln = rs.next() ;
String epName = soln.getLiteral("ep").getLexicalForm() ;
- output.add(epName) ;
+ service.endpoints.add(epName) ;
log.info(" "+label+" = /"+name+"/"+epName) ;
}
}
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
Mon May 27 16:31:10 2013
@@ -75,8 +75,8 @@ public class SPARQLServer
ServletContextHandler context =
buildServer(serverConfig.jettyConfigFile, config.enableCompression) ;
// Build them all.
- for ( DatasetRef sDesc : serverConfig.services )
- configureOneDataset(context, sDesc, config.enableCompression) ;
+ for ( DatasetRef dsDesc : serverConfig.datasets )
+ configureOneDataset(context, dsDesc, config.enableCompression) ;
}
public void start()
@@ -111,7 +111,7 @@ public class SPARQLServer
}
public Server getServer() { return server ; }
- public List<DatasetRef> getDatasets() { return serverConfig.services ; }
+ public List<DatasetRef> getDatasets() { return serverConfig.datasets ; }
public ServerConfig getServerConfig()
{
@@ -218,9 +218,9 @@ public class SPARQLServer
public static boolean überServlet = false ;
private static List<String> ListOfEmptyString = Arrays.asList("") ;
- private void configureOneDataset(ServletContextHandler context, DatasetRef
sDesc, boolean enableCompression)
+ private void configureOneDataset(ServletContextHandler context, DatasetRef
dsDesc, boolean enableCompression)
{
- String datasetPath = sDesc.name ;
+ String datasetPath = dsDesc.name ;
if ( datasetPath.equals("/") )
datasetPath = "" ;
else if ( ! datasetPath.startsWith("/") )
@@ -229,7 +229,7 @@ public class SPARQLServer
if ( datasetPath.endsWith("/") )
datasetPath = datasetPath.substring(0, datasetPath.length()-1) ;
- DatasetRegistry.get().put(datasetPath, sDesc) ;
+ DatasetRegistry.get().put(datasetPath, dsDesc) ;
serverLog.info(format("Dataset path = %s", datasetPath)) ;
HttpServlet sparqlQuery = new SPARQL_QueryDataset(verboseLogging) ;
@@ -243,11 +243,11 @@ public class SPARQLServer
{
// If uberserver, these are unnecessary but can be used.
// If just means the überservlet isn't handling these operations.
- addServlet(context, datasetPath, sparqlQuery, sDesc.queryEP,
enableCompression) ;
- addServlet(context, datasetPath, sparqlUpdate, sDesc.updateEP,
false) ;
- addServlet(context, datasetPath, sparqlUpload, sDesc.uploadEP,
false) ; // No point - no results of any size.
- addServlet(context, datasetPath, sparqlHttpR,
sDesc.readGraphStoreEP, enableCompression) ;
- addServlet(context, datasetPath, sparqlHttpRW,
sDesc.readWriteGraphStoreEP, enableCompression) ;
+ addServlet(context, datasetPath, sparqlQuery, dsDesc.query,
enableCompression) ;
+ addServlet(context, datasetPath, sparqlUpdate, dsDesc.update,
false) ;
+ addServlet(context, datasetPath, sparqlUpload, dsDesc.upload,
false) ; // No point - no results of any size.
+ addServlet(context, datasetPath, sparqlHttpR,
dsDesc.readGraphStore, enableCompression) ;
+ addServlet(context, datasetPath, sparqlHttpRW,
dsDesc.readWriteGraphStore, enableCompression) ;
// This adds direct operations on the dataset itself.
//addServlet(context, datasetPath, sparqlDataset,
ListOfEmptyString, enableCompression) ;
}
@@ -320,6 +320,12 @@ public class SPARQLServer
addServlet(context, staticContent, pathSpec, false) ;
}
+ private void addServlet(ServletContextHandler context, String datasetPath,
HttpServlet servlet,
+ ServiceRef serviceRef, boolean enableCompression)
+ {
+ addServlet(context, datasetPath, servlet, serviceRef.endpoints,
enableCompression) ;
+ }
+
// SHARE
private static void addServlet(ServletContextHandler context, String
datasetPath, HttpServlet servlet, List<String> pathSpecs, boolean
enableCompression)
{
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
Mon May 27 16:31:10 2013
@@ -37,8 +37,8 @@ public class ServerConfig
public String jettyConfigFile ;
/** The local directory for serving the static pages */
public String pages ;
- /** The list of services */
- public List<DatasetRef> services ;
+ /** The list of datasets */
+ public List<DatasetRef> datasets ;
/** Enable Accept-Encoding compression */
public boolean enableCompression = false ;
Added:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java?rev=1486655&view=auto
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
(added)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/ServiceRef.java
Mon May 27 16:31:10 2013
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.fuseki.server;
+
+import java.util.ArrayList ;
+import java.util.List ;
+import java.util.concurrent.atomic.AtomicLong ;
+
+/** Configuration of an individual service */
+public class ServiceRef
+{
+ public final String name ;
+
+ /** Endpoints (as absolute path URLs) */
+ public List<String> endpoints = new ArrayList<String>() ;
+
+ // Attach counters to services or datasets
+ // Can we have a counter of the same name on different services?
+ // Cost : number of maps.
+
+
+ /** Count of requests received - good or bad */
+ public AtomicLong countRequests = new AtomicLong(0) ;
+ /** Count of requests received that fail request checking in some way */
+ public AtomicLong countRequestsBad = new AtomicLong(0) ;
+ /** Count of requests that are cancelled (e..g timeouts) */
+ public AtomicLong countRequestsCancelled = new AtomicLong(0) ;
+ /** Count of requests that fail because of internal server issues (bugs) */
+ public AtomicLong countRequestsOK = new AtomicLong(0) ;
+
+ public ServiceRef(String serviceName)
+ {
+ this.name = serviceName ;
+ }
+
+ public boolean isActive() { return endpoints.isEmpty() ; }
+}
+
Added:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Stats.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Stats.java?rev=1486655&view=auto
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Stats.java
(added)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/Stats.java
Mon May 27 16:31:10 2013
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.fuseki.server;
+
+public class Stats
+{
+ public enum Counters {
+ DatasetRequests,
+ DatasetRequestsOK,
+ DatasetRequestsBad,
+ QueryRequests , QueryRequestsOK, QueryBadRequests , QueryExecErrors
,
+ UpdateRequests , UpdateRequestsOK, UpdateBadRequests ,
UpdateExecErrors ,
+ }
+}
+
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
Mon May 27 16:31:10 2013
@@ -33,7 +33,6 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse ;
import org.apache.commons.lang.StringUtils ;
-import org.apache.jena.atlas.io.IO ;
import org.apache.jena.atlas.web.AcceptList ;
import org.apache.jena.atlas.web.MediaType ;
import org.apache.jena.fuseki.DEF ;
@@ -139,69 +138,18 @@ public class ResponseResultSet
contentType = WebContent.contentTypeTextPlain ;
// Better : dispatch on MediaType
- // ---- Form: XML
if ( equal(serializationType, WebContent.contentTypeResultsXML) )
- {
- try {
- sparqlXMLOutput(action, contentType, resultSet, stylesheetURL,
null) ;
- }
- catch (Exception ex) {
- log.debug("Exception [SELECT/XML]"+ex, ex) ;
- // 200 already sent :-(
- errorOccurred(ex) ;
- }
- return ;
- }
-
- // ---- Form: JSON
- if ( equal(serializationType, WebContent.contentTypeResultsJSON) )
- {
- try {
- jsonOutput(action, contentType, resultSet, booleanResult) ;
- }
- // This catches things like NIO exceptions.
- catch (Exception ex) {
- log.info(format("[%d] Exception [SELECT/JSON] %s", id, ex),
ex) ;
- errorOccurred(ex) ;
- }
- return ;
- }
-
- // ---- Form: text
- // Text is not streaming.
- if ( equal(serializationType, WebContent.contentTypeTextPlain) )
- {
- try {
- textOutput(action, contentType, resultSet, qPrologue,
booleanResult) ;
- }
- catch (QueryCancelledException ex)
- {
- slog.info("[%d] SELECT/Text : Query timeout during execution",
id) ;
- try {
- response.sendError(HttpSC.SERVICE_UNAVAILABLE_503, "Query
timeout during execution") ;
- } catch (IOException ex2) { IO.exception(ex2) ; }
- errorOccurred(ex) ;
- }
- // This catches things like NIO exceptions.
- catch (Exception ex) {
- xlog.debug("[%d] Exception [SELECT/Text] "+ex, ex, id) ;
- errorOccurred(ex) ;
- }
- return ;
- }
-
- if ( equal(serializationType, WebContent.contentTypeTextCSV) ||
- equal(serializationType, WebContent.contentTypeTextTSV) )
- {
- try {
- csvtsvOutput(action, contentType, serializationType,
resultSet, booleanResult) ;
- }
- // This catches things like NIO exceptions.
- catch (Exception ex) { log.debug(format("[%d] Exception
[SELECT/CSV-TSV] %s",id, ex), ex) ; }
- return ;
- }
-
- errorBadRequest("Can't determine output serialization:
"+serializationType) ;
+ sparqlXMLOutput(action, contentType, resultSet, stylesheetURL,
booleanResult) ;
+ else if ( equal(serializationType, WebContent.contentTypeResultsJSON) )
+ jsonOutput(action, contentType, resultSet, booleanResult) ;
+ else if ( equal(serializationType, WebContent.contentTypeTextPlain) )
+ textOutput(action, contentType, resultSet, qPrologue,
booleanResult) ;
+ else if ( equal(serializationType, WebContent.contentTypeTextCSV) )
+ csvOutput(action, contentType, resultSet, booleanResult) ;
+ else if (equal(serializationType, WebContent.contentTypeTextTSV) )
+ tsvOutput(action, contentType, resultSet, booleanResult) ;
+ else
+ errorBadRequest("Can't determine output serialization:
"+serializationType) ;
}
@@ -282,6 +230,7 @@ public class ResponseResultSet
private static void textOutput(HttpAction action, String contentType,
final ResultSet resultSet, final Prologue qPrologue, final Boolean
booleanResult)
{
+ // Text is not streaming.
OutputContent proc = new OutputContent(){
@Override
public void output(ServletOutputStream out)
@@ -296,36 +245,32 @@ public class ResponseResultSet
output(action, contentType, WebContent.charsetUTF8, proc) ;
}
- private static void csvtsvOutput(HttpAction action, String contentType,
String serializationType,
- final ResultSet resultSet, final Boolean
booleanResult) {
- OutputContent proc ;
- if ( serializationType.equals(WebContent.contentTypeTextCSV) )
- {
- proc = new OutputContent(){
- @Override
- public void output(ServletOutputStream out)
- {
- if ( resultSet != null )
- ResultSetFormatter.outputAsCSV(out, resultSet) ;
- if ( booleanResult != null )
- ResultSetFormatter.outputAsCSV(out,
booleanResult.booleanValue()) ;
- }
- } ;
- }
- else
- {
- proc = new OutputContent(){
- @Override
- public void output(ServletOutputStream out)
- {
- if ( resultSet != null )
- ResultSetFormatter.outputAsTSV(out, resultSet) ;
- if ( booleanResult != null )
- ResultSetFormatter.outputAsTSV(out,
booleanResult.booleanValue()) ;
- }
- } ;
- }
- output(action, contentType, WebContent.charsetUTF8, proc) ;
+ private static void csvOutput(HttpAction action, String contentType, final
ResultSet resultSet, final Boolean booleanResult) {
+ OutputContent proc = new OutputContent(){
+ @Override
+ public void output(ServletOutputStream out)
+ {
+ if ( resultSet != null )
+ ResultSetFormatter.outputAsCSV(out, resultSet) ;
+ if ( booleanResult != null )
+ ResultSetFormatter.outputAsCSV(out,
booleanResult.booleanValue()) ;
+ }
+ } ;
+ output(action, contentType, WebContent.charsetUTF8, proc) ;
+ }
+
+ private static void tsvOutput(HttpAction action, String contentType, final
ResultSet resultSet, final Boolean booleanResult) {
+ OutputContent proc = new OutputContent(){
+ @Override
+ public void output(ServletOutputStream out)
+ {
+ if ( resultSet != null )
+ ResultSetFormatter.outputAsTSV(out, resultSet) ;
+ if ( booleanResult != null )
+ ResultSetFormatter.outputAsTSV(out,
booleanResult.booleanValue()) ;
+ }
+ } ;
+ output(action, contentType, WebContent.charsetUTF8, proc) ;
}
private static void output(HttpAction action, String contentType, String
charset, OutputContent proc)
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
Mon May 27 16:31:10 2013
@@ -19,17 +19,7 @@
package org.apache.jena.fuseki.servlets;
import static java.lang.String.format ;
-import static org.apache.jena.fuseki.HttpNames.paramAccept ;
-import static org.apache.jena.fuseki.HttpNames.paramCallback ;
-import static org.apache.jena.fuseki.HttpNames.paramDefaultGraphURI ;
-import static org.apache.jena.fuseki.HttpNames.paramForceAccept ;
-import static org.apache.jena.fuseki.HttpNames.paramNamedGraphURI ;
-import static org.apache.jena.fuseki.HttpNames.paramOutput1 ;
-import static org.apache.jena.fuseki.HttpNames.paramOutput2 ;
-import static org.apache.jena.fuseki.HttpNames.paramQuery ;
-import static org.apache.jena.fuseki.HttpNames.paramQueryRef ;
-import static org.apache.jena.fuseki.HttpNames.paramStyleSheet ;
-import static org.apache.jena.fuseki.HttpNames.paramTimeout ;
+import static org.apache.jena.fuseki.HttpNames.* ;
import java.io.IOException ;
import java.io.InputStream ;
@@ -95,7 +85,7 @@ public abstract class SPARQL_Query exten
MediaType ct = FusekiLib.contentType(action.request) ;
String incoming = ct.getContentType() ;
-
+
// POST application/sparql-query
if (WebContent.contentTypeSPARQLQuery.equals(incoming))
{
@@ -146,16 +136,17 @@ public abstract class SPARQL_Query exten
// Use of the dataset describing parameters is check later.
try {
- validate(action.request, allParams) ;
+ validateParams(action.request, allParams) ;
validateRequest(action) ;
} catch (ActionErrorException ex) {
inc(action.desc.countQueryBadSyntax) ; throw ex ; }
+ // Query not yet parsed.
}
/** Validate the request after checking HTTP method and HTTP Parameters */
protected abstract void validateRequest(HttpAction action) ;
/** Helper for validating request */
- protected void validate(HttpServletRequest request, Collection<String>
params)
+ protected void validateParams(HttpServletRequest request,
Collection<String> params)
{
MediaType ct = FusekiLib.contentType(request) ;
boolean mustHaveQueryParam = true ;
@@ -233,11 +224,19 @@ public abstract class SPARQL_Query exten
// NB syntax is ARQ (a superset of SPARQL)
query = QueryFactory.create(queryString, Syntax.syntaxARQ) ;
queryStringLog = formatForLog(query) ;
+ validateQuery(action, query) ;
+ } catch (ActionErrorException ex) {
+ inc(action.desc.countQueryBadSyntax) ;
+ throw ex ;
+ } catch (QueryParseException ex) {
+ inc(action.desc.countQueryBadSyntax) ;
+ errorBadRequest("Parse error: \n" + queryString + "\n\r" +
messageForQPE(ex)) ;
}
- catch (QueryParseException ex) { errorBadRequest("Parse error:
\n"+queryString +"\n\r" + messageForQPE(ex)) ; }
// Should not happen.
- catch (QueryException ex) { errorBadRequest("Error: \n"+queryString
+"\n\r" + ex.getMessage()) ; }
- validateQuery(action, query) ;
+ catch (QueryException ex) {
+ inc(action.desc.countQueryBadSyntax) ;
+ errorBadRequest("Error: \n" + queryString + "\n\r" +
ex.getMessage()) ;
+ }
// Assumes finished whole thing by end of sendResult.
action.beginRead() ;
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_ServletBase.java
Mon May 27 16:31:10 2013
@@ -70,7 +70,7 @@ public abstract class SPARQL_ServletBase
response = action.response ;
initResponse(request, response) ;
Context cxt = ARQ.getContext() ;
-
+
try {
execCommonWorker(action) ;
} catch (QueryCancelledException ex) {
@@ -137,6 +137,7 @@ public abstract class SPARQL_ServletBase
return ;
}
} else {
+ // ????
desc = new DatasetRef();
desc.dataset = dummyDSG;
}
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_UberServlet.java
Mon May 27 16:31:10 2013
@@ -31,6 +31,7 @@ import org.apache.jena.fuseki.FusekiExce
import org.apache.jena.fuseki.HttpNames ;
import org.apache.jena.fuseki.conneg.ConNeg ;
import org.apache.jena.fuseki.server.DatasetRef ;
+import org.apache.jena.fuseki.server.ServiceRef ;
import org.apache.jena.riot.WebContent ;
/** This servlet can be attached to a dataset location
@@ -71,15 +72,15 @@ public abstract class SPARQL_UberServlet
public static class AccessByConfig extends SPARQL_UberServlet
{
public AccessByConfig(boolean verbose_debug) { super(verbose_debug) ; }
- @Override protected boolean allowQuery(HttpAction action) { return
isEnabled(action.desc.queryEP) ; }
- @Override protected boolean allowUpdate(HttpAction action) { return
isEnabled(action.desc.updateEP) ; }
- @Override protected boolean allowREST_R(HttpAction action) { return
isEnabled(action.desc.readGraphStoreEP) || allowREST_W(action); }
- @Override protected boolean allowREST_W(HttpAction action) { return
isEnabled(action.desc.readWriteGraphStoreEP) ; }
+ @Override protected boolean allowQuery(HttpAction action) { return
isEnabled(action.desc.query) ; }
+ @Override protected boolean allowUpdate(HttpAction action) { return
isEnabled(action.desc.update) ; }
+ @Override protected boolean allowREST_R(HttpAction action) { return
isEnabled(action.desc.readGraphStore) || allowREST_W(action); }
+ @Override protected boolean allowREST_W(HttpAction action) { return
isEnabled(action.desc.readWriteGraphStore) ; }
// Quad operations tied to presence/absence of GSP.
- @Override protected boolean allowQuadsR(HttpAction action) { return
isEnabled(action.desc.readGraphStoreEP) ; }
- @Override protected boolean allowQuadsW(HttpAction action) { return
isEnabled(action.desc.readWriteGraphStoreEP) ; }
+ @Override protected boolean allowQuadsR(HttpAction action) { return
isEnabled(action.desc.readGraphStore) ; }
+ @Override protected boolean allowQuadsW(HttpAction action) { return
isEnabled(action.desc.readWriteGraphStore) ; }
- private boolean isEnabled(List<String> ep) { return ep.size() > 0 ; }
+ private boolean isEnabled(ServiceRef service) { return
service.isActive() ; }
}
/* This can be used for a single servlet for everything (über-servlet)
@@ -181,7 +182,7 @@ public abstract class SPARQL_UberServlet
// SPARQL Query
if ( ! allowQuery(action))
errorForbidden("Forbidden: SPARQL query") ;
- executeRequest(action, queryServlet, desc.queryEP) ;
+ executeRequest(action, queryServlet, desc.query) ;
return ;
}
@@ -190,7 +191,7 @@ public abstract class SPARQL_UberServlet
// SPARQL Update
if ( ! allowQuery(action))
errorForbidden("Forbidden: SPARQL query") ;
- executeRequest(action, updateServlet, desc.updateEP) ;
+ executeRequest(action, updateServlet, desc.update) ;
return ;
}
@@ -201,6 +202,7 @@ public abstract class SPARQL_UberServlet
}
errorBadRequest("Malformed request") ;
+ errorForbidden("Forbidden: SPARQL Graph Store Protocol : Read
operation : "+method) ;
}
final boolean checkForPossibleService = true ;
@@ -209,11 +211,11 @@ public abstract class SPARQL_UberServlet
// There is a trailing part.
// Check it's not the same name as a registered service.
// If so, dispatch to that service.
- if ( checkDispatch(action, desc.queryEP, trailing, queryServlet) )
return ;
- if ( checkDispatch(action, desc.updateEP, trailing, updateServlet)
) return ;
- if ( checkDispatch(action, desc.uploadEP, trailing, uploadServlet)
) return ;
- if ( checkDispatch(action, desc.readGraphStoreEP, trailing,
restServlet_R) ) return ;
- if ( checkDispatch(action, desc.readWriteGraphStoreEP, trailing,
restServlet_RW) ) return ;
+ if ( checkDispatch(action, desc.query, trailing, queryServlet) )
return ;
+ if ( checkDispatch(action, desc.update, trailing, updateServlet) )
return ;
+ if ( checkDispatch(action, desc.upload, trailing, uploadServlet) )
return ;
+ if ( checkDispatch(action, desc.readGraphStore, trailing,
restServlet_R) ) return ;
+ if ( checkDispatch(action, desc.readWriteGraphStore, trailing,
restServlet_RW) ) return ;
}
// There is a trailing part - params are illegal by this point.
if ( hasParams )
@@ -234,13 +236,12 @@ public abstract class SPARQL_UberServlet
HttpNames.METHOD_HEAD.equalsIgnoreCase(method) )
{
if ( ! allowREST_R(action))
- errorForbidden("Forbidden: SPARQL Graph Store Protocol : Read
operation : "+method) ;
// Graphs Store Protocol, indirect naming, read
// Indirect naming. Prefer the R service if available.
- if ( desc.readGraphStoreEP.size() > 0 )
- executeRequest(action, restServlet_R, desc.readGraphStoreEP) ;
- else if ( desc.readWriteGraphStoreEP.size() > 0 )
- executeRequest(action, restServlet_RW,
desc.readWriteGraphStoreEP) ;
+ if ( desc.readGraphStore.isActive() )
+ executeRequest(action, restServlet_R, desc.readGraphStore) ;
+ else if ( desc.readWriteGraphStore.isActive() )
+ executeRequest(action, restServlet_RW,
desc.readWriteGraphStore) ;
else
errorMethodNotAllowed(method) ;
return ;
@@ -249,13 +250,13 @@ public abstract class SPARQL_UberServlet
// Graphs Store Protocol, indirect naming, write
if ( ! allowREST_W(action))
errorForbidden("Forbidden: SPARQL Graph Store Protocol : Write
operation : "+method) ;
- executeRequest(action, restServlet_RW, desc.readWriteGraphStoreEP) ;
+ executeRequest(action, restServlet_RW, desc.readWriteGraphStore) ;
return ;
}
- private void executeRequest(HttpAction action, SPARQL_ServletBase servlet,
List<String> endpointList)
+ private void executeRequest(HttpAction action, SPARQL_ServletBase servlet,
ServiceRef service)
{
- if ( endpointList == null || endpointList.size() == 0 )
+ if ( service.endpoints.size() == 0 )
errorMethodNotAllowed(action.request.getMethod()) ;
servlet.executeLifecycle(action) ;
}
@@ -290,9 +291,9 @@ public abstract class SPARQL_UberServlet
return mt ;
}
- private boolean checkDispatch(HttpAction action, List<String>
endpointNames, String srvName , SPARQL_ServletBase servlet)
+ private boolean checkDispatch(HttpAction action, ServiceRef service,
String srvName , SPARQL_ServletBase servlet)
{
- if ( ! endpointNames.contains(srvName) )
+ if ( ! service.endpoints.contains(srvName) )
return false ;
servlet.executeLifecycle(action) ;
return true ;
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/StatsServlet.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/StatsServlet.java?rev=1486655&r1=1486654&r2=1486655&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/StatsServlet.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/StatsServlet.java
Mon May 27 16:31:10 2013
@@ -40,7 +40,6 @@ public class StatsServlet extends HttpSe
resp.setContentType("text/plain");
Iterator<String> iter = DatasetRegistry.get().keys() ;
-
while(iter.hasNext())
{
String ds = iter.next() ;
@@ -67,14 +66,14 @@ public class StatsServlet extends HttpSe
out.println(" Timeouts = "+desc.countQueryTimeout) ;
out.println(" Bad exec = "+desc.countQueryBadExecution);
out.println(" SPARQL Update:") ;
- out.println(" Updates = "+desc.countUpdate) ;
- out.println(" Upload:") ;
- out.println(" Uploads = "+desc.countUpload) ;
- out.println(" SPARQL Graph Store Protocol:") ;
- out.println(" GETs = "+desc.countGET) ;
- out.println(" POSTs = "+desc.countPOST) ;
- out.println(" PUTs = "+desc.countPUT) ;
- out.println(" DELETEs = "+desc.countDELETE) ;
+// out.println(" Updates = "+desc.update.
+// out.println(" Upload:") ;
+// out.println(" Uploads = "+desc.countUpload) ;
+// out.println(" SPARQL Graph Store Protocol:") ;
+// out.println(" GETs = "+desc.countGET) ;
+// out.println(" POSTs = "+desc.countPOST) ;
+// out.println(" PUTs = "+desc.countPUT) ;
+// out.println(" DELETEs = "+desc.countDELETE) ;
//out.println(" HEADs = "+desc.countHEAD) ;
}