Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jgeluk/jena-fuseki
base: c3537b60e4
...
head fork: jgeluk/jena-fuseki
compare: a84429da53
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
View
2  .classpath
@@ -5,5 +5,7 @@
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
View
19 .project
@@ -6,6 +6,16 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -15,9 +25,18 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
View
12 .settings/.jsdtscope
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/webapp"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
View
5 .settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
+#Fri Feb 10 16:23:21 EST 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
View
11 .settings/org.eclipse.wst.common.component
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="jena-fuseki">
+ <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
+ <property name="context-root" value="jena-fuseki"/>
+ <property name="java-output-path" value="/jena-fuseki/target/classes"/>
+ </wb-module>
+</project-modules>
View
6 .settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <installed facet="java" version="1.6"/>
+ <installed facet="jst.web" version="3.0"/>
+ <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>
View
1  .settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
View
1  .settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window
View
114 src/main/java/org/apache/jena/fuseki/servlets/ConfigServlet.java
@@ -5,21 +5,26 @@
package org.apache.jena.fuseki.servlets;
-import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
-import com.hp.hpl.jena.util.FileManager;
-
import org.apache.jena.fuseki.*;
import org.apache.jena.fuseki.server.FusekiConfig;
import org.apache.jena.fuseki.server.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/** The servlet class.
+import com.hp.hpl.jena.util.FileManager;
+import com.hp.hpl.jena.util.FileUtils;
+import com.hp.hpl.jena.util.Locator;
+import com.hp.hpl.jena.util.LocatorFile;
+import com.hp.hpl.jena.util.TypedStream;
+
+/** The ConfigServlet class.
* @author Andy Seaborne
* @version $Id: Servlet.java,v 1.39 2010-10-16 16:46:43 andy_seaborne Exp $
*
@@ -36,7 +41,10 @@
// This happens very early - check it.
static {
- try { log = LoggerFactory.getLogger(ConfigServlet.class) ; }
+ try {
+ log = LoggerFactory.getLogger(ConfigServlet.class) ;
+ log.info("Loading " + ConfigServlet.class.toString ()) ;
+ }
catch (Exception ex)
{
System.err.println("Exception creating the logger") ;
@@ -48,11 +56,11 @@
static boolean initAttempted = false ;
- int urlLimit = 8*1024 ;
+ //int urlLimit = 8*1024 ;
- String printName = "HTTP SPARQL";
// Servlet info
ServletConfig servletConfig = null;
+
// Web app info
ServletContext servletContext = null;
@@ -63,6 +71,31 @@
// The former means the configuration is in the webapp/servlet environment
// The latter means the main application will programmatically do it.
+ class LocatorServletContext implements Locator {
+
+ @Override
+ public TypedStream open(String resourceName_) {
+
+ String fn = FileUtils.toFilename(resourceName_) ;
+ if (fn == null) {
+ log.trace("LocatorServletContext: failed to open: {}", resourceName_) ;
+ return null ;
+ }
+
+ InputStream in = servletContext.getResourceAsStream(fn);
+ if (in == null)
+ return null ;
+
+ log.debug("Reading as servlet resource: {}", resourceName_);
+
+ return new TypedStream(in) ;
+
+ }
+
+ @Override
+ public String getName() { return "LocatorServletContext" ; }
+ }
+
public ConfigServlet()
{
this(Fuseki.NAME);
@@ -76,15 +109,18 @@ public ConfigServlet(String string)
@Override
public void init() throws ServletException
{
+ log.debug("init");
super.init() ;
return ;
}
- /** Initializes the servlet.
- */
+ /**
+ * Initializes the servlet.
+ */
@Override
public void init(ServletConfig config) throws ServletException
{
+ log.debug("init with config");
super.init(config);
//
@@ -102,27 +138,26 @@ public void init(ServletConfig config) throws ServletException
initAttempted = true ;
servletConfig = config;
-
- // Modify the (Jena) global filemanager to include loading by servlet context
- //FileManager fileManager = FileManager.get() ;
- if (config != null)
- {
+ //
+ // Modify the (Jena) global filemanager to include loading by servlet context
+ // and local file name (for files in WEB-INF dir).
+ //
+ FileManager fileManager = FileManager.get() ;
+
+ if (servletConfig != null) {
servletContext = config.getServletContext();
- //fileManager.addLocator(new LocatorServletContext(servletContext)) ;
+ fileManager.addLocator(new LocatorServletContext()) ;
+ fileManager.addLocator(new LocatorFile(servletContext.getRealPath("/WEB-INF"))) ;
+ fileManager.addLocator(new LocatorFile("C:\\Data\\I396191\\git\\jena-fuseki\\pages-update")) ;
}
-
- printName = config.getServletName();
- String configURI = config.getInitParameter(Fuseki.configurationFileProperty) ;
+
servletEnv() ;
- /*
- try {
- Dispatcher.initServiceRegistry(fileManager, configURI) ;
- } catch (ConfigurationErrorException confEx)
- {
- throw new ServletException("Fuseki configuration error", confEx) ;
- }*/
-
+ processConfiguration(servletConfig.getInitParameter(Fuseki.configurationFileProperty));
+ }
+
+ private void processConfiguration (String configURI) {
+
if (configURI != null) {
Fuseki.configLog.info("Configuration file: "+configURI) ;
serverConfig = FusekiConfig.configure(configURI) ;
@@ -131,8 +166,11 @@ public void init(ServletConfig config) throws ServletException
//serverConfig = FusekiConfig.defaultConfiguration(datasetPath, dsg, allowUpdate) ;
}
- if (Integer.parseInt (config.getInitParameter("port")) > 0) {
- serverConfig.port = Integer.parseInt (config.getInitParameter("port"));
+ if (servletContext != null) {
+ String portString = servletContext.getInitParameter("port") ;
+ if (portString != null && Integer.parseInt (portString) > 0) {
+ serverConfig.port = Integer.parseInt (portString);
+ }
}
}
@@ -152,11 +190,13 @@ protected void service(HttpServletRequest req, HttpServletResponse resp)
super.service(req, resp);
}
*/
+
+ /*
@Override
public void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
{
doCommon(httpRequest, httpResponse) ;
- }
+ }*/
/*
@@ -317,8 +357,7 @@ public static String chooseServiceURI(String uri, HttpServletRequest httpRequest
@Override
public String getServletInfo()
{
- //return this.getClass().getName() ;
- return printName;
+ return servletConfig.getServletName();
}
// Need a way to pair requests and responses.
@@ -330,12 +369,15 @@ public String getServletInfo()
private void servletEnv()
{
- if ( ! log.isDebugEnabled() )
- return ;
+
+ Fuseki.configLog.info("Servlet name: {}", servletConfig.getServletName()) ;
+
+ //if ( ! log.isDebugEnabled() )
+ // return ;
try {
java.net.URL url = servletContext.getResource("/") ;
- log.trace("Fuseki base directory: "+url) ;
+ log.debug("Fuseki base directory: "+url) ;
} catch (Exception ex) {}
if (servletConfig != null)
@@ -348,7 +390,7 @@ private void servletEnv()
for (; en.hasMoreElements();)
{
String s = en.nextElement();
- log.trace("Servlet parameter: " + s + " = " + servletConfig.getInitParameter(s));
+ log.debug("Servlet parameter: " + s + " = " + servletConfig.getInitParameter(s));
}
}
if (servletContext != null)
@@ -357,6 +399,8 @@ private void servletEnv()
String tmp = servletContext.getServletContextName();
//msg(Level.FINE, "Webapp = " + (tmp != null ? tmp : "<null>"));
log.debug("Webapp = " + (tmp != null ? tmp : "<null>"));
+
+ log.debug("Context path = {}", servletContext.getContextPath()) ;
// NB This servlet may not have been loaded as part of a web app
@SuppressWarnings("unchecked")
View
22 src/main/resources/log4j.properties
@@ -1,5 +1,5 @@
-log4j.rootLogger=INFO, stdlog
-## log4j.rootLogger=INFO, FusekiFileLog
+log4j.rootLogger=DEBUG, stdlog
+## log4j.rootLogger=DEBUG, FusekiFileLog
log4j.appender.stdlog=org.apache.log4j.ConsoleAppender
## log4j.appender.stdlog.target=System.err
@@ -17,22 +17,24 @@ log4j.appender.stdlog.layout.ConversionPattern=%d{HH:mm:ss} %-5p %-20c{1} :: %m%
log4j.logger.org.eclipse.jetty=FATAL
# Execution logging
-log4j.logger.com.hp.hpl.jena.arq.info=INFO
-log4j.logger.com.hp.hpl.jena.arq.exec=INFO
+log4j.logger.com.hp.hpl.jena.arq.DEBUG=DEBUG
+log4j.logger.com.hp.hpl.jena.arq.exec=DEBUG
# Everything else in Jena
-log4j.logger.com.hp.hpl.jena=WARN
+log4j.logger.com.hp.hpl.jena=DEBUG
log4j.logger.org.apache.jena=WARN
log4j.logger.org.openjena=WARN
-log4j.logger.org.openjena.riot=INFO
+log4j.logger.org.openjena.riot=DEBUG
# Joseki server
-log4j.logger.org.joseki=INFO
+log4j.logger.org.joseki=DEBUG
# Fuseki
# Server log.
-log4j.logger.org.apache.jena.fuseki.Server=INFO
+log4j.logger.org.apache.jena.fuseki.Server=DEBUG
# Request log.
-log4j.logger.org.apache.jena.fuseki.Fuseki=INFO
+log4j.logger.org.apache.jena.fuseki.Fuseki=DEBUG
# Internal logs
-log4j.logger.org.apache.jena.fuseki=INFO
+log4j.logger.org.apache.jena.fuseki=DEBUG
+log4j.logger.org.apache.jena.fuseki.Fuseki=DEBUG
+
View
3  src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
View
87 src/main/webapp/WEB-INF/config.ttl
@@ -0,0 +1,87 @@
+@prefix : <#> .
+@prefix fuseki: <http://jena.apache.org/fuseki#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
+@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
+
+[] rdf:type fuseki:Server ;
+ # Timeout - server-wide default: milliseconds.
+ # Format 1: "1000" -- 1 second timeout
+ # Format 2: "10000,60000" -- 10s timeout to first result, then 60s timeout to for rest of query.
+ # See java doc for ARQ.queryTimeout
+ # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000" ] ;
+
+ # ja:loadClass "your.code.Class" ;
+
+ fuseki:services (
+ <#service1>
+ <#service2>
+ <#service3>
+ ) .
+
+# Custom code.
+# For each declaration, static "Class.init()" will be called.
+[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
+
+# TDB
+tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
+tdb:GraphTDB rdfs:subClassOf ja:Model .
+
+## ---------------------------------------------------------------
+## Updatable in-memory dataset.
+
+<#service1> rdf:type fuseki:Service ;
+ fuseki:name "ds" ; # http://host:port/ds
+ fuseki:serviceQuery "query" ; # SPARQL query service
+ fuseki:serviceQuery "sparql" ; # SPARQL query service
+ fuseki:serviceUpdate "update" ; # SPARQL query service
+ fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
+ fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
+ # A separate read-only graph store endpoint:
+ fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol (read only)
+ fuseki:dataset <#books> ;
+ .
+
+<#emptyDataset> rdf:type ja:RDFDataset .
+
+## ---------------------------------------------------------------
+## Read-only access to a small books database.
+
+<#service2> rdf:type fuseki:Service ;
+ fuseki:name "books" ; # http://host:port/books
+ fuseki:serviceQuery "query" ; # SPARQL query service
+ fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol (read only)
+ fuseki:dataset <#books> ; # Configuration
+ .
+
+<#books> rdf:type ja:RDFDataset ;
+ rdfs:label "Books" ;
+ ja:defaultGraph [
+ rdfs:label "books.ttl" ;
+ a ja:MemoryModel ;
+ ja:content [
+# ja:externalContent <file:books.ttl>
+ ja:externalContent <file:///C%3A/Data/I396191/git/jena-fuseki/pages-update/books.ttl>
+ ] ;
+ ] ;
+ .
+
+## ---------------------------------------------------------------
+## TDB dataset with only SPARQL query.
+
+<#service3> rdf:type fuseki:Service ;
+ fuseki:name "tdb" ; # http://host/tdb
+ fuseki:serviceQuery "sparql" ; # SPARQL query service
+ fuseki:dataset <#dataset> ;
+ .
+
+<#dataset> rdf:type tdb:DatasetTDB ;
+ tdb:location "DB" ;
+ # Query timeout on this dataset (milliseconds)
+ ja:context [
+ ja:cxtName "arq:queryTimeout" ;
+ ja:cxtValue "1000"
+ ] ;
+## tdb:unionDefaultGraph true ;
+ .
View
21 src/main/webapp/web.xml → src/main/webapp/WEB-INF/web.xml
@@ -14,13 +14,14 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
<!-- The Fuseki SPARQL servlet -->
<servlet>
- <servlet-name>SPARQL service processor</servlet-name>
- <servlet-class>org.apache.jena.fuseki.http.Servlet</servlet-class>
+ <servlet-name>Fuseki Config Processor</servlet-name>
+ <servlet-class>org.apache.jena.fuseki.servlets.ConfigServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
<!-- Configuration file -->
<init-param>
- <param-name>org.fuseki.rdfserver.config</param-name>
- <param-value>fuseki-config.ttl</param-value>
+ <param-name>org.apache.jena.fuseki.config</param-name>
+ <param-value>config.ttl</param-value>
</init-param>
</servlet>
@@ -84,6 +85,13 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
-->
<!-- Demo service -->
+
+ <servlet-mapping>
+ <servlet-name>Fuseki Config Processor</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!--
<servlet-mapping>
<servlet-name>SPARQL service processor</servlet-name>
<url-pattern>/books</url-pattern>
@@ -98,6 +106,7 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
<servlet-name>SPARQL service processor</servlet-name>
<url-pattern>/sparql/*</url-pattern>
</servlet-mapping>
+ -->
<!-- Joseki
@@ -116,7 +125,7 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
<url-pattern>/update-validator</url-pattern>
</servlet-mapping>
- < ! -- Compatibility -- >
+ < ! - - Compatibility - - >
<servlet-mapping>
<servlet-name>SPARQL 1.1 Query Validator</servlet-name>
@@ -133,7 +142,7 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
<url-pattern>/update/*</url-pattern>
</servlet-mapping>
- <!-- A few utilities -->
+ < ! - - A few utilities - - >
<servlet-mapping>
<servlet-name>Dumper</servlet-name>

No commit comments for this range

Something went wrong with that request. Please try again.