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 2013/12/23 20:57:30 UTC
svn commit: r1553196 [1/2] - in /jena/branches/jena-fuseki-new-ui: ./ bin/
pages/admin/ src-dev/dev/ src/main/java/org/apache/jena/fuseki/
src/main/java/org/apache/jena/fuseki/mgt/
src/main/java/org/apache/jena/fuseki/server/ src/main/java/org/apache/j...
Author: andy
Date: Mon Dec 23 19:57:29 2013
New Revision: 1553196
URL: http://svn.apache.org/r1553196
Log:
Move dataset building into webapp context listener.
Added:
jena/branches/jena-fuseki-new-ui/classpath-jetty-8.1.11
jena/branches/jena-fuseki-new-ui/classpath-jetty-9.1.0
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerInitialConfig.java
Removed:
jena/branches/jena-fuseki-new-ui/bin/
jena/branches/jena-fuseki-new-ui/src-dev/dev/DevFuseki.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/MgtCmdServlet.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/MgtFunctions.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocity.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/servlets/SimpleVelocityServlet.java
Modified:
jena/branches/jena-fuseki-new-ui/pages/admin/data-management.html
jena/branches/jena-fuseki-new-ui/pom.xml
jena/branches/jena-fuseki-new-ui/src-dev/dev/PROJECT.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ActionDescription.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/ServerTest.java
jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/TestAuth.java
jena/branches/jena-fuseki-new-ui/war-web.xml
Added: jena/branches/jena-fuseki-new-ui/classpath-jetty-8.1.11
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/classpath-jetty-8.1.11?rev=1553196&view=auto
==============================================================================
--- jena/branches/jena-fuseki-new-ui/classpath-jetty-8.1.11 (added)
+++ jena/branches/jena-fuseki-new-ui/classpath-jetty-8.1.11 Mon Dec 23 19:57:29 2013
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry excluding="org/apache/jena/fuseki/fuseki-properties.xml|META-INF/NOTICE|META-INF/LICENSE|META-INF/DEPENDENCIES|**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src-dev"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/1.0.1-SNAPSHOT/jena-iri-1.0.1-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/1.0.1-SNAPSHOT/jena-iri-1.0.1-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar" sourcepath="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.2.3/httpcore-4.2.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.2.3/httpcore-4.2.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar" sourcepath="M2_REPO/junit/junit/4.11/junit-4.11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar" sourcepath="M2_REPO/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-server/8.1.11.v20130520/jetty-server-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-server/8.1.11.v20130520/jetty-server-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.jar" sourcepath="M2_REPO/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-continuation/8.1.11.v20130520/jetty-continuation-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-continuation/8.1.11.v20130520/jetty-continuation-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-http/8.1.11.v20130520/jetty-http-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-http/8.1.11.v20130520/jetty-http-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-io/8.1.11.v20130520/jetty-io-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-io/8.1.11.v20130520/jetty-io-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-util/8.1.11.v20130520/jetty-util-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-util/8.1.11.v20130520/jetty-util-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-servlet/8.1.11.v20130520/jetty-servlet-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-servlet/8.1.11.v20130520/jetty-servlet-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-security/8.1.11.v20130520/jetty-security-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-security/8.1.11.v20130520/jetty-security-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-servlets/8.1.11.v20130520/jetty-servlets-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-servlets/8.1.11.v20130520/jetty-servlets-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-client/8.1.11.v20130520/jetty-client-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-client/8.1.11.v20130520/jetty-client-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-xml/8.1.11.v20130520/jetty-xml-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-xml/8.1.11.v20130520/jetty-xml-8.1.11.v20130520-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-webapp/8.1.11.v20130520/jetty-webapp-8.1.11.v20130520.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-webapp/8.1.11.v20130520/jetty-webapp-8.1.11.v20130520-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/apache/velocity/velocity/1.7/velocity-1.7.jar" sourcepath="M2_REPO/org/apache/velocity/velocity/1.7/velocity-1.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4-sources.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-arq"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-tdb"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-text"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
Added: jena/branches/jena-fuseki-new-ui/classpath-jetty-9.1.0
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/classpath-jetty-9.1.0?rev=1553196&view=auto
==============================================================================
--- jena/branches/jena-fuseki-new-ui/classpath-jetty-9.1.0 (added)
+++ jena/branches/jena-fuseki-new-ui/classpath-jetty-9.1.0 Mon Dec 23 19:57:29 2013
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry excluding="org/apache/jena/fuseki/fuseki-properties.xml|META-INF/NOTICE|META-INF/LICENSE|META-INF/DEPENDENCIES|**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src-dev"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/1.0.1-SNAPSHOT/jena-iri-1.0.1-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/jena/jena-iri/1.0.1-SNAPSHOT/jena-iri-1.0.1-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar" sourcepath="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.2.2/httpclient-4.2.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.2.3/httpcore-4.2.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.2.3/httpcore-4.2.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar" sourcepath="M2_REPO/junit/junit/4.11/junit-4.11-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2.jar" sourcepath="M2_REPO/commons-fileupload/commons-fileupload/1.2.2/commons-fileupload-1.2.2-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-xml/9.1.0.v20131115/jetty-xml-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-xml/9.1.0.v20131115/jetty-xml-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-webapp/9.1.0.v20131115/jetty-webapp-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-webapp/9.1.0.v20131115/jetty-webapp-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-servlet/9.1.0.v20131115/jetty-servlet-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-servlet/9.1.0.v20131115/jetty-servlet-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-security/9.1.0.v20131115/jetty-security-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-security/9.1.0.v20131115/jetty-security-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-server/9.1.0.v20131115/jetty-server-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-server/9.1.0.v20131115/jetty-server-9.1.0.v20131115-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar" sourcepath="javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-servlets/9.1.0.v20131115/jetty-servlets-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-servlets/9.1.0.v20131115/jetty-servlets-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-continuation/9.1.0.v20131115/jetty-continuation-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-continuation/9.1.0.v20131115/jetty-continuation-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-http/9.1.0.v20131115/jetty-http-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-http/9.1.0.v20131115/jetty-http-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-io/9.1.0.v20131115/jetty-io-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-io/9.1.0.v20131115/jetty-io-9.1.0.v20131115-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/eclipse/jetty/jetty-util/9.1.0.v20131115/jetty-util-9.1.0.v20131115.jar" sourcepath="M2_REPO/org/eclipse/jetty/jetty-util/9.1.0.v20131115/jetty-util-9.1.0.v20131115-sources.jar"/>
+
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.4/jcl-over-slf4j-1.6.4-sources.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-arq"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-tdb"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jena-text"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
Modified: jena/branches/jena-fuseki-new-ui/pages/admin/data-management.html
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pages/admin/data-management.html?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pages/admin/data-management.html (original)
+++ jena/branches/jena-fuseki-new-ui/pages/admin/data-management.html Mon Dec 23 19:57:29 2013
@@ -80,7 +80,7 @@
</ul>
</small>
- <form action="/$/datasets" method="post" role="form">
+ <form action="../$/datasets" method="post" role="form">
<div class="form-group">
<label for="inputDatabase">Database Name</label>
@@ -106,7 +106,7 @@
<hr/>
<h2>Create database (from Assembler Description)</h2>
<!-- From assembler -->
- <form action="/$/datasets" enctype="multipart/form-data" method="post" role="form">
+ <form action="../$/datasets" enctype="multipart/form-data" method="post" role="form">
<div class="form-group">
Database assembler description file: <input type="file" name="UNSET" size="40"><br/>
</div>
Modified: jena/branches/jena-fuseki-new-ui/pom.xml
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/pom.xml?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/pom.xml (original)
+++ jena/branches/jena-fuseki-new-ui/pom.xml Mon Dec 23 19:57:29 2013
@@ -77,7 +77,6 @@
<!-- Switch to webapp deployment first -->
<!--<ver.jetty>9.1.0.v20131115</ver.jetty>-->
<ver.jetty>8.1.11.v20130520</ver.jetty>
- <ver.velocity>1.7</ver.velocity>
<ver.commons-fileupload>1.2.2</ver.commons-fileupload>
</properties>
@@ -170,12 +169,6 @@
</dependency>
<dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.7</version>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${ver.slf4j}</version>
Modified: jena/branches/jena-fuseki-new-ui/src-dev/dev/PROJECT.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src-dev/dev/PROJECT.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src-dev/dev/PROJECT.java (original)
+++ jena/branches/jena-fuseki-new-ui/src-dev/dev/PROJECT.java Mon Dec 23 19:57:29 2013
@@ -25,31 +25,26 @@ public class PROJECT {
// DEFs
// Webapp-ization
- // Validators
+ // Shiro - security.
+ // Initialize in webapp. See FusekiCmd.exec
+ // Need server wide configuration - ARQ context setting.
+ // ContextPath
+ // Fuseki.configure/defaultConfiguration
+
+ // 1/ have command line insert direct into the DatasetRegistry?
+ // 2/
+
// All TODO and XXX
// Configuration and startup.
// Change to using a real webapp.
- // WebContent.ctXYZ for each WebContent.contentTypeXYZ
-
// txn and nonTxn server set up for tests.
// Enables, disable R/RW on SPARQL_UberServlet(renamed) and quads operations.
// Need a switch on whether quadding is support and whether it's RW or not.
- // Remove all direct naming (put in separate servlet if ever needed)
- // last place : SPARQL_UberServlet
-
// Document (write/update) all protocol modes.
- // TESTS
-
- // JENA-201 - WAR Fuseki.
- // WEB.xml
- // ContextPath in uber dispatch.
- // FusekiServletContextListener
-
- // SPARQLServer.start kicks FusekiServletContextListener which could then do the main initialization.
// The whole X_Config thing
// Check compression enabled for UberServlet
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java Mon Dec 23 19:57:29 2013
@@ -187,44 +187,44 @@ public class Fuseki {
private static Server jettyServer ;
private static Server mgtJettyServer ;
- /**
- * set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer}
- * instance.
- */
- public static void setServer(SPARQLServer _server) {
- server = _server ;
- }
-
- /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
- public static SPARQLServer getServer() {
- return server ;
- }
-
- /**
- * set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer}
- * instance.
- */
- public static void setJettyServer(Server _server) {
- jettyServer = _server ;
- }
-
- /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
- public static Server getJettyServer() {
- return jettyServer ;
- }
-
- /**
- * set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer}
- * instance.
- */
- public static void setJettyMgtServer(Server _server) {
- mgtJettyServer = _server ;
- }
-
- /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
- public static Server getJettyMgtServer() {
- return mgtJettyServer ;
- }
+// /**
+// * set/specify the {@link SPARQLServer}
+// * instance.
+// */
+// public static void setServer(SPARQLServer _server) {
+// server = _server ;
+// }
+//
+// /** get the {@link SPARQLServer} instance. */
+// public static SPARQLServer getServer() {
+// return server ;
+// }
+//
+// /**
+// * set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer}
+// * instance.
+// */
+// public static void setJettyServer(Server _server) {
+// jettyServer = _server ;
+// }
+//
+// /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
+// public static Server getJettyServer() {
+// return jettyServer ;
+// }
+//
+// /**
+// * set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer}
+// * instance.
+// */
+// public static void setJettyMgtServer(Server _server) {
+// mgtJettyServer = _server ;
+// }
+//
+// /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
+// public static Server getJettyMgtServer() {
+// return mgtJettyServer ;
+// }
// Force a call to init.
static {
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java Mon Dec 23 19:57:29 2013
@@ -18,28 +18,24 @@
package org.apache.jena.fuseki ;
-import static org.apache.jena.fuseki.Fuseki.serverLog ;
-
import java.io.File ;
import java.io.InputStream ;
import java.util.List ;
import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.DS ;
import org.apache.jena.atlas.lib.FileOps ;
import org.apache.jena.atlas.lib.Lib ;
import org.apache.jena.atlas.lib.StrUtils ;
import org.apache.jena.atlas.logging.LogCtl ;
import org.apache.jena.fuseki.mgt.ManagementServer ;
-import org.apache.jena.fuseki.server.DatasetRef ;
-import org.apache.jena.fuseki.server.FusekiConfig ;
+import org.apache.jena.fuseki.server.FusekiServletContextListener ;
import org.apache.jena.fuseki.server.SPARQLServer ;
import org.apache.jena.fuseki.server.ServerConfig ;
+import org.apache.jena.fuseki.server.ServerInitialConfig ;
import org.apache.jena.riot.Lang ;
import org.apache.jena.riot.RDFDataMgr ;
import org.apache.jena.riot.RDFLanguages ;
import org.apache.jena.riot.SysRIOT ;
-import org.eclipse.jetty.server.Server ;
import org.eclipse.jetty.servlet.ServletContextHandler ;
import org.slf4j.Logger ;
import arq.cmd.CmdException ;
@@ -49,7 +45,6 @@ import arq.cmdline.ModDatasetAssembler ;
import com.hp.hpl.jena.query.ARQ ;
import com.hp.hpl.jena.query.Dataset ;
-import com.hp.hpl.jena.sparql.core.DatasetGraph ;
import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
import com.hp.hpl.jena.tdb.TDB ;
import com.hp.hpl.jena.tdb.TDBFactory ;
@@ -59,34 +54,36 @@ import com.hp.hpl.jena.tdb.transaction.T
public class FusekiCmd extends CmdARQ {
private static String log4Jsetup = StrUtils.strjoinNL
("## Plain output to stdout",
- "log4j.appender.jena.plain=org.apache.log4j.ConsoleAppender",
- "log4j.appender.jena.plain.target=System.out",
- "log4j.appender.jena.plain.layout=org.apache.log4j.PatternLayout",
- "log4j.appender.jena.plain.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n",
+ "log4j.appender.jena.plainstdout=org.apache.log4j.ConsoleAppender",
+ "log4j.appender.jena.plainstdout.target=System.out",
+ "log4j.appender.jena.plainstdout.layout=org.apache.log4j.PatternLayout",
+ "log4j.appender.jena.plainstdout.layout.ConversionPattern=%d{HH:mm:ss} %-10c{1} %-5p %m%n",
- "## Plain output with level, to stderr",
- "log4j.appender.jena.plainlevel=org.apache.log4j.ConsoleAppender",
- "log4j.appender.jena.plainlevel.target=System.err",
- "log4j.appender.jena.plainlevel.layout=org.apache.log4j.PatternLayout",
- "log4j.appender.jena.plainlevel.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n",
+ "## Plain output to stderr",
+ "log4j.appender.jena.plainstderr=org.apache.log4j.ConsoleAppender",
+ "log4j.appender.jena.plainstderr.target=System.err",
+ "log4j.appender.jena.plainstderr.layout=org.apache.log4j.PatternLayout",
+ "log4j.appender.jena.plainstderr.layout.ConversionPattern=%d{HH:mm:ss} %-10c{1} %-5p %m%n",
- "## Everything", "log4j.rootLogger=INFO, jena.plain",
+ "## Everything",
+ "log4j.rootLogger=INFO, jena.plainstdout",
"log4j.logger.com.hp.hpl.jena=WARN",
"log4j.logger.org.openjena=WARN",
"log4j.logger.org.apache.jena=WARN",
"# System logs.",
- "log4j.logger."+Fuseki.serverLogName+"=INFO",
- "log4j.logger."+Fuseki.requestLogName+"=INFO",
- "log4j.logger."+Fuseki.adminLogName+"=INFO",
- "log4j.logger."+Fuseki.validationLogName+"=INFO",
+ "log4j.logger." + Fuseki.serverLogName + "=INFO",
+ "log4j.logger." + Fuseki.requestLogName + "=INFO",
+ "log4j.logger." + Fuseki.adminLogName + "=INFO",
+ "log4j.logger." + Fuseki.validationLogName + "=INFO",
+ "log4j.logger." + Fuseki.configLogName + "=INFO",
"log4j.logger.org.apache.jena.tdb.loader=INFO",
"log4j.logger.org.eclipse.jetty=ERROR" ,
"## Parser output",
"log4j.additivity" + SysRIOT.riotLoggerName + "=false",
- "log4j.logger." + SysRIOT.riotLoggerName + "=INFO, jena.plainlevel"
+ "log4j.logger." + SysRIOT.riotLoggerName + "=INFO, jena.plainstdout"
) ;
// Set logging.
@@ -170,24 +167,41 @@ public class FusekiCmd extends CmdARQ {
new FusekiCmd(argv).mainRun() ;
}
- static class ServerParams { // == ServerConfig?
- public int port = 3030 ;
- public int mgtPort = -1 ;
- public boolean listenLocal = false ;
-
- public DatasetGraph dsg = null ;
- public String datasetPath = null ;
- public boolean allowUpdate = false ;
+// /** Port to run the server service on */
+// public int port ;
+// /** Port for the management interface : -1 for no management interface */
+// public int mgtPort ;
+// /** Port for the pages UI : this can be the same as the services port. */
+// public int pagesPort ;
+// /** Jetty config file - if null, use the built-in configuration of Jetty */
+// public String jettyConfigFile = null ;
+// /** Listen only on the loopback (localhost) interface */
+// public boolean loopback = false ;
+// /** The local directory for serving the static pages */
+// public String pages ;
+// /** Enable Accept-Encoding compression. Set to false by default.*/
+// public boolean enableCompression = false ;
+//
+// /** Enable additional logging */
+// public boolean verboseLogging = false ;
+// /**
+// * Authentication config file used to setup Jetty Basic auth, if a Jetty config file was set this is ignored since Jetty config allows much more complex auth methods to be implemented
+// */
+// public String authConfigFile ;
- public String fusekiConfigFile = null ;
- public boolean enableCompression = true ;
- public String jettyConfigFile = null ;
- public String authConfigFile = null ;
- public String homeDir = null ;
- public String pagesDir = null ;
- public String staticContentDir = null ; // After adjusting.
+ public String homeDir = null ;
+ private ServerConfig jettyServerConfig = new ServerConfig() ;
+ {
+ jettyServerConfig.port = 3030 ;
+ jettyServerConfig.mgtPort = 3031 ;
+ jettyServerConfig.pagesPort = jettyServerConfig.port ;
+ jettyServerConfig.jettyConfigFile = null ;
+ jettyServerConfig.pages = Fuseki.PagesStatic ;
+ jettyServerConfig.enableCompression = true ;
+ jettyServerConfig.verboseLogging = false ;
}
- private ServerParams cmdLineParams = new ServerParams() ;
+
+ private ServerInitialConfig cmdLineDataset = new ServerInitialConfig() ;
public FusekiCmd(String... argv) {
super(argv) ;
@@ -217,7 +231,7 @@ public class FusekiCmd extends CmdARQ {
add(argHome, "--home=DIR", "Root of Fuseki installation (overrides environment variable FUSEKI_HOME)") ;
add(argGZip, "--gzip=on|off", "Enable GZip compression (HTTP Accept-Encoding) if request header set") ;
- add(argUber) ;
+ //add(argUber) ;
// add(argGSP) ;
super.modVersion.addClass(TDB.class) ;
@@ -236,12 +250,14 @@ public class FusekiCmd extends CmdARQ {
int x = 0 ;
Logger log = Fuseki.serverLog ;
- ServerParams params = cmdLineParams ;
-
+
if ( contains(argFusekiConfig) )
- params.fusekiConfigFile = getValue(argFusekiConfig) ;
+ cmdLineDataset.fusekiConfigFile = getValue(argFusekiConfig) ;
ArgDecl assemblerDescDecl = new ArgDecl(ArgDecl.HasValue, "desc", "dataset") ;
+
+ // ---- Datasets
+
if ( contains(argMem) )
x++ ;
if ( contains(argFile) )
@@ -253,10 +269,9 @@ public class FusekiCmd extends CmdARQ {
if ( contains(argMemTDB) )
x++ ;
- if ( params.fusekiConfigFile != null ) {
+ if ( cmdLineDataset.fusekiConfigFile != null ) {
if ( x > 1 )
- throw new CmdException(
- "Dataset specificed on the command line and also a configuration file specificed.") ;
+ throw new CmdException("Dataset specified on the command line and also a configuration file specified.") ;
} else {
if ( x == 0 )
throw new CmdException("Required: either --config=FILE or one of --mem, --file, --loc or --desc") ;
@@ -264,11 +279,12 @@ public class FusekiCmd extends CmdARQ {
if ( contains(argMem) ) {
log.info("Dataset: in-memory") ;
- params.dsg = DatasetGraphFactory.createMem() ;
+ cmdLineDataset = new ServerInitialConfig() ;
+ cmdLineDataset.dsg = DatasetGraphFactory.createMem() ;
}
+
if ( contains(argFile) ) {
- params.dsg = DatasetGraphFactory.createMem() ;
- // replace by RiotLoader after ARQ refresh.
+ cmdLineDataset.dsg = DatasetGraphFactory.createMem() ;
String filename = getValue(argFile) ;
log.info("Dataset: in-memory: load file: " + filename) ;
if ( !FileOps.exists(filename) )
@@ -280,14 +296,15 @@ public class FusekiCmd extends CmdARQ {
InputStream input = IO.openFile(filename) ;
if ( RDFLanguages.isQuads(language) )
- RDFDataMgr.read(params.dsg, filename) ;
+ RDFDataMgr.read(cmdLineDataset.dsg, filename) ;
else
- RDFDataMgr.read(params.dsg.getDefaultGraph(), filename) ;
+ RDFDataMgr.read(cmdLineDataset.dsg.getDefaultGraph(), filename) ;
}
if ( contains(argMemTDB) ) {
log.info("TDB dataset: in-memory") ;
- params.dsg = TDBFactory.createDatasetGraph() ;
+ cmdLineDataset = new ServerInitialConfig() ;
+ cmdLineDataset.dsg = TDBFactory.createDatasetGraph() ;
}
if ( contains(argTDB) ) {
@@ -300,28 +317,34 @@ public class FusekiCmd extends CmdARQ {
throw new CmdException("Directory not found: " + dir) ;
log.info("TDB dataset: directory=" + dir) ;
}
- params.dsg = TDBFactory.createDatasetGraph(dir) ;
+ cmdLineDataset = new ServerInitialConfig() ;
+ cmdLineDataset.dsg = TDBFactory.createDatasetGraph(dir) ;
}
// Otherwise
if ( contains(assemblerDescDecl) ) {
log.info("Dataset from assembler") ;
Dataset ds = modDataset.createDataset() ;
- if ( ds != null )
- params.dsg = ds.asDatasetGraph() ;
+ cmdLineDataset.dsg = ds.asDatasetGraph() ;
}
- if ( contains(argFusekiConfig) ) {
- if ( params.dsg != null )
- throw new CmdException(
- "Dataset specificed on the command line and also a configuration file specificed.") ;
- params.fusekiConfigFile = getValue(argFusekiConfig) ;
+ if ( cmdLineDataset.dsg != null ) {
+ if ( getPositional().size() == 0 )
+ throw new CmdException("No dataset path name given") ;
+ if ( getPositional().size() > 1 )
+ throw new CmdException("Multiple dataset path names given") ;
+ cmdLineDataset.datasetPath = getPositionalArg(0) ;
+ if ( cmdLineDataset.datasetPath.length() > 0 && !cmdLineDataset.datasetPath.startsWith("/") )
+ throw new CmdException("Dataset path name must begin with a /: " + cmdLineDataset.datasetPath) ;
+
+ cmdLineDataset.allowUpdate = contains(argAllowUpdate) ;
}
+ // ---- Jetty server
if ( contains(argPort) ) {
String portStr = getValue(argPort) ;
try {
- params.port = Integer.parseInt(portStr) ;
+ jettyServerConfig.port = Integer.parseInt(portStr) ;
} catch (NumberFormatException ex) {
throw new CmdException(argPort.getKeyName() + " : bad port number: " + portStr) ;
}
@@ -330,29 +353,14 @@ public class FusekiCmd extends CmdARQ {
if ( contains(argMgtPort) ) {
String mgtPortStr = getValue(argMgtPort) ;
try {
- params.mgtPort = Integer.parseInt(mgtPortStr) ;
+ jettyServerConfig.mgtPort = Integer.parseInt(mgtPortStr) ;
} catch (NumberFormatException ex) {
throw new CmdException(argMgtPort.getKeyName() + " : bad port number: " + mgtPortStr) ;
}
}
if ( contains(argLocalhost) )
- params.listenLocal = true ;
-
- if ( params.fusekiConfigFile == null && params.dsg == null )
- throw new CmdException("No dataset defined and no configuration file: " + argUsage) ;
-
- if ( params.dsg != null ) {
- if ( getPositional().size() == 0 )
- throw new CmdException("No dataset path name given") ;
- if ( getPositional().size() > 1 )
- throw new CmdException("Multiple dataset path names given") ;
- params.datasetPath = getPositionalArg(0) ;
- if ( params.datasetPath.length() > 0 && !params.datasetPath.startsWith("/") )
- throw new CmdException("Dataset path name must begin with a /: " + params.datasetPath) ;
-
- params.allowUpdate = contains(argAllowUpdate) ;
- }
+ jettyServerConfig.loopback = true ;
if ( contains(argTimeout) ) {
String str = getValue(argTimeout) ;
@@ -360,35 +368,32 @@ public class FusekiCmd extends CmdARQ {
}
if ( contains(argJettyConfig) ) {
- params.jettyConfigFile = getValue(argJettyConfig) ;
- if ( !FileOps.exists(params.jettyConfigFile) )
- throw new CmdException("No such file: " + params.jettyConfigFile) ;
+ jettyServerConfig.jettyConfigFile = getValue(argJettyConfig) ;
+ if ( !FileOps.exists(jettyServerConfig.jettyConfigFile) )
+ throw new CmdException("No such file: " + jettyServerConfig.jettyConfigFile) ;
}
if ( contains(argBasicAuth) ) {
- params.authConfigFile = getValue(argBasicAuth) ;
- if ( !FileOps.exists(params.authConfigFile) )
- throw new CmdException("No such file: " + params.authConfigFile) ;
+ jettyServerConfig.authConfigFile = getValue(argBasicAuth) ;
+ if ( !FileOps.exists(jettyServerConfig.authConfigFile) )
+ throw new CmdException("No such file: " + jettyServerConfig.authConfigFile) ;
}
if ( contains(argHome) ) {
List<String> args = super.getValues(argHome) ;
- params.homeDir = args.get(args.size() - 1) ;
+ homeDir = args.get(args.size() - 1) ;
}
if ( contains(argPages) ) {
List<String> args = super.getValues(argPages) ;
- params.pagesDir = args.get(args.size() - 1) ;
+ jettyServerConfig.pages = args.get(args.size() - 1) ;
}
if ( contains(argGZip) ) {
if ( !hasValueOfTrue(argGZip) && !hasValueOfFalse(argGZip) )
throw new CmdException(argGZip.getNames().get(0) + ": Not understood: " + getValue(argGZip)) ;
- params.enableCompression = super.hasValueOfTrue(argGZip) ;
+ jettyServerConfig.enableCompression = super.hasValueOfTrue(argGZip) ;
}
-
- if ( contains(argUber) )
- Fuseki.configLog.info("Dynamic dispatch is now the only mode: --uber is not needed" );
}
private static String sort_out_dir(String path) {
@@ -401,136 +406,85 @@ public class FusekiCmd extends CmdARQ {
@Override
protected void exec() {
Fuseki.init() ;
- ServerParams params = cmdLineParams ;
- params = clean(params) ;
- initializeServer(params) ;
- //initializeSystem(params) ;
-
+ FusekiServletContextListener.initialSetup = cmdLineDataset ;
+ // For standalone, command line use ...
+ SPARQLServer server = initializeServer(jettyServerConfig) ;
+ // Not needed for webapp version.
+ //initializeManagement(server, params);
+ server.start() ;
+ try { server.getServer().join() ; }
+ catch (Exception ex) {}
+ System.exit(0) ;
}
- private ServerParams clean(ServerParams params) {
- if ( params.homeDir == null ) {
+ private String pagesDir(String pages) {
+ if ( homeDir == null ) {
if ( System.getenv(Fuseki.FusekiHomeEnv) != null )
- params.homeDir = System.getenv(Fuseki.FusekiHomeEnv) ;
+ homeDir = System.getenv(Fuseki.FusekiHomeEnv) ;
else
- params.homeDir = "." ;
+ homeDir = "." ;
}
- params.homeDir = sort_out_dir(params.homeDir) ;
- Fuseki.configLog.info("Home Directory: " + FileOps.fullDirectoryPath(params.homeDir)) ;
- if ( !FileOps.exists(params.homeDir) )
- Fuseki.configLog.warn("No such directory for Fuseki home: " + params.homeDir) ;
+ homeDir = sort_out_dir(homeDir) ;
+ Fuseki.configLog.info("Home Directory: " + FileOps.fullDirectoryPath(homeDir)) ;
+ if ( !FileOps.exists(homeDir) )
+ Fuseki.configLog.warn("No such directory for Fuseki home: " + homeDir) ;
- params.staticContentDir = params.pagesDir ;
- if ( params.staticContentDir == null )
- params.staticContentDir = params.homeDir + Fuseki.PagesStatic ;
+ if ( pages == null )
+ pages = homeDir + Fuseki.PagesStatic ;
- Fuseki.configLog.debug("Static Content Directory: " + FileOps.fullDirectoryPath(params.staticContentDir)) ;
+ Fuseki.configLog.debug("Static Content Directory: " + FileOps.fullDirectoryPath(pages)) ;
- if ( !FileOps.exists(params.staticContentDir) ) {
- Fuseki.configLog.warn("No such directory for static content: "
- + FileOps.fullDirectoryPath(params.staticContentDir)) ;
+ if ( !FileOps.exists(pages) ) {
+ Fuseki.configLog.warn("No such directory for static content: "+ FileOps.fullDirectoryPath(pages)) ;
Fuseki.configLog.warn("You may need to set the --pages or --home option to configure static content correctly") ;
}
-
- if ( params.jettyConfigFile != null )
- Fuseki.configLog.info("Jetty configuration: " + params.jettyConfigFile) ;
-
- return params ;
+ return pages ;
}
-
- private void initializeServer(ServerParams params) {
- List<DatasetRef> cmdLineDatasets ;
-
- if ( params.fusekiConfigFile != null ) {
- Fuseki.configLog.info("Configuration file: " + params.fusekiConfigFile) ;
- cmdLineDatasets = FusekiConfig.configure(params.fusekiConfigFile) ;
- } else
- cmdLineDatasets = FusekiConfig.defaultConfiguration(params.datasetPath, params.dsg, params.allowUpdate, params.listenLocal) ;
-
- List<DatasetRef> additionalDatasets = FusekiConfig.additional() ;
-
-
- ServerConfig serverConfig = new ServerConfig() ;
- // Default values
- serverConfig.port = 3030 ;
- serverConfig.mgtPort = 3031 ;
- serverConfig.pagesPort = serverConfig.port ;
- serverConfig.jettyConfigFile = null ;
- serverConfig.pages = Fuseki.PagesStatic ;
- serverConfig.enableCompression = true ;
- serverConfig.verboseLogging = false ;
-
- //
- serverConfig.datasets = DS.list() ;
- serverConfig.datasets.addAll(cmdLineDatasets) ;
- serverConfig.datasets.addAll(additionalDatasets) ;
-
- serverConfig.port = params.port ;
- serverConfig.pages = params.staticContentDir ;
- serverConfig.mgtPort = params.mgtPort ;
- serverConfig.pagesPort = params.port ;
- serverConfig.loopback = params.listenLocal ;
- serverConfig.enableCompression = params.enableCompression ;
- serverConfig.jettyConfigFile = params.jettyConfigFile ;
- serverConfig.authConfigFile = params.authConfigFile ;
- serverConfig.verboseLogging = (super.isVerbose() || super.isDebug()) ;
+ private SPARQLServer initializeServer(ServerConfig serverConfig) {
+// ServerConfig serverConfig = new ServerConfig() ;
+// // Default values
+// serverConfig.port = 3030 ;
+// serverConfig.mgtPort = 3031 ;
+// serverConfig.pagesPort = serverConfig.port ;
+// serverConfig.jettyConfigFile = null ;
+// serverConfig.pages = Fuseki.PagesStatic ;
+// serverConfig.enableCompression = true ;
+// serverConfig.verboseLogging = false ;
+//
+// serverConfig.port = params.port ;
+// serverConfig.pages = params.pages ;
+// serverConfig.mgtPort = params.mgtPort ;
+// serverConfig.pagesPort = params.port ;
+// serverConfig.loopback = params.loopback ;
+// serverConfig.enableCompression = params.enableCompression ;
+// serverConfig.jettyConfigFile = params.jettyConfigFile ;
+// serverConfig.authConfigFile = params.authConfigFile ;
+// serverConfig.verboseLogging = (super.isVerbose() || super.isDebug()) ;
SPARQLServer server = new SPARQLServer(serverConfig) ;
- X_Config.configureDatasets(serverConfig.datasets);
- // Temporary?
- Fuseki.setServer(server) ;
+ return server ;
+ }
- Server mgtServer = null ;
- // mgtPort = -1 means no management functions.
-
+ private void initializeManagement(SPARQLServer server, ServerConfig params) {
if ( params.mgtPort > 0 && params.mgtPort != params.port ) {
+ ServletContextHandler context = ManagementServer.addManagementServer(server, params.mgtPort) ;
+ Fuseki.configLog.warn("**** Management services on different port **** Ignored ****") ;
Fuseki.configLog.info("Management services on port " + params.mgtPort) ;
- mgtServer = ManagementServer.createManagementServer(params.mgtPort) ;
- ServletContextHandler context = (ServletContextHandler)mgtServer.getHandler() ;
ManagementServer.addServerFunctions(context, "/$/") ;
ManagementServer.addAdminFunctions(context, "/$/") ;
-
- try {
- mgtServer.start() ;
- } catch (java.net.BindException ex) {
- serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage()) ;
- System.exit(1) ;
- } catch (Exception ex) {
- serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage(), ex) ;
- System.exit(1) ;
- }
+ return ;
}
-
+
if ( params.mgtPort == 0 || params.mgtPort == params.port ) {
- // TODO Temporary!
- mgtServer = server.getServer() ;
ServletContextHandler context = (ServletContextHandler)server.getServer().getHandler() ;
ManagementServer.addServerFunctions(context, "/$/") ;
ManagementServer.addAdminFunctions(context, "/$/") ;
}
- // Temporary?
- Fuseki.setJettyMgtServer(mgtServer) ;
- Fuseki.setJettyServer(server.getServer()) ;
-
- server.start() ;
- try {
- server.getServer().join() ;
- } catch (Exception ex) {}
-
- if ( mgtServer != null ) {
- try {
- mgtServer.stop() ;
- } catch (Exception e) {
- serverLog.warn("Failed to cleanly stop the management server", e) ;
- }
- }
- System.exit(0) ;
}
-
@Override
protected String getCommandName() {
return "fuseki" ;
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ActionDescription.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ActionDescription.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ActionDescription.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ActionDescription.java Mon Dec 23 19:57:29 2013
@@ -32,9 +32,9 @@ import org.apache.jena.atlas.json.JsonBu
import org.apache.jena.atlas.json.JsonValue ;
import org.apache.jena.fuseki.Fuseki ;
import org.apache.jena.fuseki.server.DatasetRegistry ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
import org.apache.jena.fuseki.servlets.HttpAction ;
import org.apache.jena.fuseki.servlets.ServletOps ;
-import org.eclipse.jetty.server.Server ;
/** Description of datasets for a server */
public class ActionDescription extends ActionCtl
@@ -79,22 +79,18 @@ public class ActionDescription extends A
.key("server")
.startObject()
//.key("hostname").value(req.getLocalName())
- .key("port").value(port(Fuseki.getJettyServer()))
+ .key("port").value(SPARQLServer.instance.getServerPort())
.finishObject() ;
builder
.key("admin")
.startObject()
//.key("hostname").value(req.getLocalName())
- .key("port").value(port(Fuseki.getJettyMgtServer()))
+ .key("port").value(SPARQLServer.instance.getMgtPort())
.finishObject() ;
builder
.key("version").value(Fuseki.VERSION) ;
}
- private int port(Server jettyServer) {
- return jettyServer.getConnectors()[0].getPort() ;
- }
-
private void describeDataset(JsonBuilder builder) {
builder.key("datasets") ;
JsonDescription.arrayDatasets(builder, DatasetRegistry.get());
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java Mon Dec 23 19:57:29 2013
@@ -20,54 +20,51 @@ package org.apache.jena.fuseki.mgt;
import static org.apache.jena.fuseki.Fuseki.serverLog ;
-import java.util.List ;
-
import javax.servlet.http.HttpServlet ;
import org.apache.jena.fuseki.Fuseki ;
import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.server.FusekiErrorHandler ;
+import org.apache.jena.fuseki.server.SPARQLServer ;
import org.eclipse.jetty.server.Connector ;
import org.eclipse.jetty.server.Server ;
-import org.eclipse.jetty.server.nio.SelectChannelConnector ;
+import org.eclipse.jetty.server.nio.BlockingChannelConnector ;
import org.eclipse.jetty.servlet.ServletContextHandler ;
import org.eclipse.jetty.servlet.ServletHolder ;
public class ManagementServer
{
- /** Create but do not initialize */
- public static Server createManagementServer(int mgtPort)
- {
- // Separate Jetty server
- Server server = new Server() ;
-
-// BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
-// bcConnector.setUseDirectBuffers(false) ;
-// Connector connector = bcConnector ;
-
- Connector connector = new SelectChannelConnector() ;
- // Ignore idle time.
- // If set, then if this goes off, it keeps going off and you get a lot of log messages.
+ public static ServletContextHandler addManagementServer(SPARQLServer server, int port) {
+ Server jettyServer = server.getServer() ;
+ BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
+ // bcConnector.setUseDirectBuffers(false) ;
+
+ Connector connector = bcConnector ;
connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this goes off.
- connector.setPort(mgtPort);
- server.addConnector(connector) ;
-
- ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
- context.setErrorHandler(new FusekiErrorHandler()) ;
- server.setHandler(context);
- return server ;
- }
+ //if ( loopback )
+ if ( true )
+ connector.setHost("localhost");
+ connector.setPort(port) ;
+ // Some people do try very large operations ...
+ connector.setRequestHeaderSize(64 * 1024) ;
+ connector.setRequestBufferSize(5 * 1024 * 1024) ;
+ connector.setResponseBufferSize(5 * 1024 * 1024) ;
+ jettyServer.addConnector(connector);
+ ServletContextHandler context = new ServletContextHandler() ;
+ jettyServer.setHandler(context) ;
+ return context ;
+ }
+
public static void addServerFunctions(ServletContextHandler context, String base) {
Fuseki.serverLog.info("Adding server information functions") ;
if ( !base.endsWith("/" ) )
base = base + "/" ;
if ( !base.startsWith("/"))
throw new FusekiException("Base URI does not start with a '/'") ;
- // Dump request
- addServlet(context, new DumpServlet(), base+"dump") ; // XXX Remove.?
- addServlet(context, new ActionDescription(), base+"status") ;
- addServlet(context, new ActionPing(), base+"ping") ;
+
+ addServlet(context, new DumpServlet(), base+MgtConst.opDump) ; // XXX Remove.?
+ addServlet(context, new ActionDescription(), base+MgtConst.opStatus) ;
+ addServlet(context, new ActionPing(), base+MgtConst.opPing) ;
}
public static void addAdminFunctions(ServletContextHandler context, String base) {
@@ -75,36 +72,17 @@ public class ManagementServer
if ( !base.endsWith("/" ) )
base = base + "/" ;
if ( !base.startsWith("/"))
- throw new FusekiException("Base URI does nto start with a '/'") ;
- addServlet(context, new MgtCmdServlet(), base+"mgt") ; // XXX Old - remove.
- addServlet(context, new ActionStats(), base+"stats/*") ; // "/abc/*" covers ".../abc" as well.
- addServlet(context, new ActionDatasets(), base+"datasets/*") ;
- }
-
- // SHARE
- private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet, List<String> pathSpecs)
- {
- for ( String pathSpec : pathSpecs )
- {
- if ( pathSpec.endsWith("/") )
- pathSpec = pathSpec.substring(0, pathSpec.length()-1) ;
- if ( pathSpec.startsWith("/") )
- pathSpec = pathSpec.substring(1, pathSpec.length()) ;
- addServlet(context, servlet, datasetPath+"/"+pathSpec) ;
- }
- }
-
- private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec)
- {
- ServletHolder holder = new ServletHolder(servlet) ;
- addServlet(context, holder, pathSpec) ;
+ throw new FusekiException("Base URI does not start with a '/'") ;
+
+ addServlet(context, new ActionStats(), base+MgtConst.opStats+"/*") ; // "/abc/*" covers ".../abc" as well.
+ addServlet(context, new ActionDatasets(), base+MgtConst.opDatasets+"/*") ;
}
- private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec)
+ public static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec)
{
+ ServletHolder holder = new ServletHolder(servlet) ;
serverLog.debug("Add servlet @ "+pathSpec) ;
context.addServlet(holder, pathSpec) ;
}
-
}
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiConfig.java Mon Dec 23 19:57:29 2013
@@ -53,26 +53,16 @@ public class FusekiConfig {
Fuseki.init() ;
}
- // MASSIVE AMOUNT OF CODE TIDYING NEEDED
- // The datastructure that captures a servers configuration.
-
- // Server port
- int port ;
- // Management command port - -1 for none.
- int mgtPort ;
- List<DatasetRef> datasets = null ;
-
private static Logger log = Fuseki.configLog ;
- public static List<DatasetRef> defaultConfiguration(String datasetPath, DatasetGraph dsg,
- boolean allowUpdate, boolean listenLocal) {
+ public static List<DatasetRef> defaultConfiguration(ServerInitialConfig params) {
DatasetRef dbDesc = new DatasetRef() ;
- dbDesc.name = DatasetRef.canocialDatasetPath(datasetPath) ;
- dbDesc.dataset = dsg ;
+ dbDesc.name = DatasetRef.canocialDatasetPath(params.datasetPath) ;
+ dbDesc.dataset = params.dsg ;
dbDesc.query.endpoints.add(HttpNames.ServiceQuery) ;
dbDesc.query.endpoints.add(HttpNames.ServiceQueryAlt) ;
- if ( allowUpdate ) {
+ if ( params.allowUpdate ) {
dbDesc.update.endpoints.add(HttpNames.ServiceUpdate) ;
dbDesc.upload.endpoints.add(HttpNames.ServiceUpload) ;
dbDesc.readWriteGraphStore.endpoints.add(HttpNames.ServiceData) ;
@@ -345,7 +335,7 @@ public class FusekiConfig {
QuerySolution soln = rs.next() ;
String epName = soln.getLiteral("ep").getLexicalForm() ;
service.endpoints.add(epName) ;
- log.info(" " + label + " = /" + name + "/" + epName) ;
+ log.info(" " + label + " = " + name + "/" + epName) ;
}
}
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/FusekiServletContextListener.java Mon Dec 23 19:57:29 2013
@@ -18,34 +18,33 @@
package org.apache.jena.fuseki.server;
+import java.util.List ;
+
import javax.servlet.ServletContext ;
import javax.servlet.ServletContextEvent ;
import javax.servlet.ServletContextListener ;
+import org.apache.jena.atlas.lib.DS ;
import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.X_Config ;
import org.slf4j.Logger ;
public class FusekiServletContextListener implements ServletContextListener {
private static Logger confLog = Fuseki.configLog ;
- // This could do the initialization.
- private final SPARQLServer sparqlServer ;
-
- // Embedded version.
- public FusekiServletContextListener(SPARQLServer sparqlServer) {
- this.sparqlServer = sparqlServer ;
+ public FusekiServletContextListener() {
+ confLog.info("FusekiServletContextListener") ;
}
-
- // web.xml version.
- public FusekiServletContextListener() { sparqlServer = null ; }
+ public static ServerInitialConfig initialSetup = null ;
+
+ // --- later: Play the "hunt the config files" game
// Default.
static public String rootDirectory = "/usr/share/fuseki" ;
-// static public String staticContentDir = rootDirectory + "/pages" ;
static public String configurationFile = rootDirectory + "/config-fuseki.ttl" ;
-
- static public ServerConfig serverConfig = null ;
- static Boolean initialized = false ;
+ // ----
+
+ private Boolean initialized = false ;
@Override
public void contextInitialized(ServletContextEvent sce) {
@@ -57,7 +56,7 @@ public class FusekiServletContextListene
@Override
public void contextDestroyed(ServletContextEvent sce) {}
- public static void init() {
+ public void init() {
if ( initialized )
return ;
synchronized(initialized)
@@ -66,8 +65,30 @@ public class FusekiServletContextListene
return ;
initialized = true ;
Fuseki.init() ;
-
+
+ if ( initialSetup != null ) {
+ List<DatasetRef> datasets = findDatasets(initialSetup) ;
+ List<DatasetRef> additionalDatasets = FusekiConfig.additional() ;
+ datasets.addAll(additionalDatasets) ;
+ X_Config.configureDatasets(datasets);
+ }
+ }
+ }
+
+ private static List<DatasetRef> findDatasets(ServerInitialConfig params) {
+ // Has a side effect of global context setting.
+
+ List<DatasetRef> datasets = DS.list() ;
+
+ if ( params.fusekiConfigFile != null ) {
+ Fuseki.configLog.info("Configuration file: " + params.fusekiConfigFile) ;
+ List<DatasetRef> cmdLineDatasets = FusekiConfig.configure(params.fusekiConfigFile) ;
+ datasets.addAll(cmdLineDatasets) ;
+ } else {
+ List<DatasetRef> cmdLineDatasets = FusekiConfig.defaultConfiguration(params) ;
+ datasets.addAll(cmdLineDatasets) ;
}
+ return datasets ;
}
}
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java Mon Dec 23 19:57:29 2013
@@ -27,7 +27,6 @@ import java.util.EnumSet ;
import java.util.List ;
import javax.servlet.DispatcherType ;
-import javax.servlet.http.HttpServlet ;
import org.apache.jena.atlas.lib.NotImplemented ;
import org.apache.jena.fuseki.Fuseki ;
@@ -39,11 +38,8 @@ import org.eclipse.jetty.security.authen
import org.eclipse.jetty.server.Connector ;
import org.eclipse.jetty.server.Server ;
import org.eclipse.jetty.server.nio.BlockingChannelConnector ;
-import org.eclipse.jetty.servlet.DefaultServlet ;
import org.eclipse.jetty.servlet.FilterHolder ;
import org.eclipse.jetty.servlet.ServletContextHandler ;
-import org.eclipse.jetty.servlet.ServletHolder ;
-import org.eclipse.jetty.servlets.GzipFilter ;
import org.eclipse.jetty.util.security.Constraint ;
import org.eclipse.jetty.webapp.WebAppContext ;
import org.eclipse.jetty.xml.XmlConfiguration ;
@@ -57,13 +53,18 @@ import com.hp.hpl.jena.sparql.util.Utils
* {@link org.eclipse.jetty.server.Server#stop()} commands as well as obtaining
* instances of the server and server configuration. Finally we can obtain
* instances of {@link org.apache.jena.fuseki.server.ServerConfig}.
- *
*/
public class SPARQLServer {
static {
Fuseki.init() ;
}
+ // Temporarary
+ public static SPARQLServer instance = null ;
+
+ private Connector serverConnector = null ;
+ private Connector mgtConnector = null ;
+
private ServerConfig serverConfig ;
private Server server = null ;
@@ -90,6 +91,9 @@ public class SPARQLServer {
EnumSet<DispatcherType> es = EnumSet.allOf(DispatcherType.class) ;
context.addFilter(f, "/*", es);
}
+
+ instance = this ;
+ mgtConnector = serverConnector ;
// Datasets not initialized yet.
}
@@ -139,9 +143,17 @@ public class SPARQLServer {
public Server getServer() {
return server ;
}
-
- public int getPort() {
- return server.getConnectors()[0].getPort() ;
+
+ public int getServerPort() {
+ return serverConnector.getPort() ;
+ }
+
+ public int getMgtPort() {
+ return mgtConnector.getPort() ;
+ }
+
+ public void setMgtConnector(Connector connector) {
+ mgtConnector = connector ;
}
/**
@@ -153,23 +165,22 @@ public class SPARQLServer {
}
private ServletContextHandler buildServerWebapp(String jettyConfig, boolean enableCompression) {
- if ( jettyConfig != null ) {
+ if ( jettyConfig != null )
// --jetty-config=jetty-fuseki.xml
// for detailed configuration of the server using Jetty features.
- server = configServer(jettyConfig) ;
- } else
- server = defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
+ configServer(jettyConfig) ;
+ else
+ defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
WebAppContext context = new WebAppContext();
context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
context.setDescriptor("war-web.xml");
context.setResourceBase("pages");
context.setContextPath("/");
- context.setParentLoaderPriority(true);
+ context.setParentLoaderPriority(true); // Normal Java classloader behaviour.
context.setErrorHandler(new FusekiErrorHandler()) ;
- context.addEventListener(new FusekiServletContextListener(this));
server.setHandler(context) ;
-
+
// XXX Security
if ( jettyConfig == null && serverConfig.authConfigFile != null )
security(context, serverConfig.authConfigFile) ;
@@ -177,12 +188,10 @@ public class SPARQLServer {
return context ;
}
-
private ServletContextHandler buildServer(String jettyConfig, boolean enableCompression) {
throw new NotImplemented("Use the webapps setup") ;
}
-
private static void security(ServletContextHandler context, String authfile) {
Constraint constraint = new Constraint() ;
constraint.setName(Constraint.__BASIC_AUTH) ;
@@ -210,133 +219,24 @@ public class SPARQLServer {
serverLog.debug("Basic Auth Configuration = " + authfile) ;
}
-
-// private ServletContextHandler buildServer(String jettyConfig, boolean enableCompression) {
-// if ( jettyConfig != null ) {
-// // --jetty-config=jetty-fuseki.xml
-// // for detailed configuration of the server using Jetty features.
-// server = configServer(jettyConfig) ;
-// } else
-// server = defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
-//
-// // Keep the server to a maximum number of threads.
-// // server.setThreadPool(new QueuedThreadPool(ThreadPoolSize)) ;
-//
-// ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS) ;
-// context.setErrorHandler(new FusekiErrorHandler()) ;
-// context.addEventListener(new FusekiServletContextListener(this));
-// // Increase form size.
-// context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
-// // Constants. Add RDF types.
-// MimeTypes mt = new MimeTypes() ;
-// mt.addMimeMapping("rdf", contentTypeRDFXML + ";charset=utf-8") ;
-// mt.addMimeMapping("ttl", contentTypeTurtle + ";charset=utf-8") ;
-// mt.addMimeMapping("nt", contentTypeNTriples + ";charset=utf-8") ;
-// mt.addMimeMapping("nq", contentTypeNQuads + ";charset=utf-8") ;
-// mt.addMimeMapping("trig", contentTypeTriG + ";charset=utf-8") ;
-// // mt.addMimeMapping("tpl", "text/html;charset=utf-8") ;
-// context.setMimeTypes(mt) ;
-//
-// // Wire up authentication if appropriate
-// // XXX Use Shiro and web.xml
-// if ( jettyConfig == null && serverConfig.authConfigFile != null ) {
-// Constraint constraint = new Constraint() ;
-// constraint.setName(Constraint.__BASIC_AUTH) ;
-// constraint.setRoles(new String[]{"fuseki"}) ;
-// constraint.setAuthenticate(true) ;
-//
-// ConstraintMapping mapping = new ConstraintMapping() ;
-// mapping.setConstraint(constraint) ;
-// mapping.setPathSpec("/*") ;
-//
-// IdentityService identService = new DefaultIdentityService() ;
-//
-// ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ;
-// securityHandler.addConstraintMapping(mapping) ;
-// securityHandler.setIdentityService(identService) ;
-//
-// HashLoginService loginService = new HashLoginService("Fuseki Authentication", serverConfig.authConfigFile) ;
-// loginService.setIdentityService(identService) ;
-//
-// securityHandler.setLoginService(loginService) ;
-// securityHandler.setAuthenticator(new BasicAuthenticator()) ;
-//
-// context.setSecurityHandler(securityHandler) ;
-//
-// serverLog.debug("Basic Auth Configuration = " + serverConfig.authConfigFile) ;
-// }
-//
-// server.setHandler(context) ;
-//
-// serverLog.debug("Pages = " + serverConfig.pages) ;
-//
-// boolean installServices = true ;
-//
-// String validationRoot = "/validate" ;
-//
-// // Should all services be /_/.... or some such?
-//
-// if ( installServices ) {
-// // TODO Respect port.
-// if ( serverConfig.pagesPort != serverConfig.port )
-// serverLog.warn("Not supported yet - pages on a different port to services") ;
-//
-// String base = serverConfig.pages ;
-// Map<String, Object> data = new HashMap<String, Object>() ;
-// data.put("mgt", new MgtFunctions()) ;
-// SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ;
-// addServlet(context, templateEngine, "*.tpl", false) ;
-// }
-//
-// if ( installServices ) {
-// // Validators
-// HttpServlet validateQuery = new QueryValidator() ;
-// HttpServlet validateUpdate = new UpdateValidator() ;
-//
-// HttpServlet validateData = new DataValidator() ;
-// HttpServlet validateIRI = new IRIValidator() ;
-//
-// HttpServlet generalQueryService = new SPARQL_QueryGeneral() ;
-//
-// addServlet(context, validateQuery, validationRoot + "/query", false) ;
-// addServlet(context, validateUpdate, validationRoot + "/update", false) ;
-// addServlet(context, validateData, validationRoot + "/data", false) ;
-// addServlet(context, validateIRI, validationRoot + "/iri", false) ;
-//
-// // general query processor.
-// addServlet(context, generalQueryService, HttpNames.ServiceGeneralQuery, enableCompression) ;
-// }
-//
-// if ( installServices ) {
-// String[] files = {"fuseki.html", "index.html"} ;
-// context.setWelcomeFiles(files) ;
-// addContent(context, "/", serverConfig.pages) ;
-// }
-//
-// return context ;
-// }
- private static Server configServer(String jettyConfig) {
+ private void configServer(String jettyConfig) {
try {
serverLog.info("Jetty server config file = " + jettyConfig) ;
- Server server = new Server() ;
+ server = new Server() ;
XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
configuration.configure(server) ;
- return server ;
+ serverConnector = server.getConnectors()[0] ;
} catch (Exception ex) {
serverLog.error("SPARQLServer: Failed to configure server: " + ex.getMessage(), ex) ;
throw new FusekiException("Failed to configure a server using configuration file '" + jettyConfig + "'") ;
}
}
- private static Server defaultServerConfig(int port, boolean loopback) {
+ private void defaultServerConfig(int port, boolean loopback) {
// Server, with one NIO-based connector, large input buffer size (for
// long URLs, POSTed forms (queries, updates)).
- Server server = new Server() ;
-
- // Using "= new SelectChannelConnector() ;" on Darwin (OS/X) causes
- // problems
- // with initialization not seen (thread scheduling?) in Joseki.
+ server = new Server() ;
// BlockingChannelConnector is better for pumping large responses back
// but there have been observed problems with DirectMemory allocation
@@ -360,63 +260,6 @@ public class SPARQLServer {
connector.setRequestBufferSize(5 * 1024 * 1024) ;
connector.setResponseBufferSize(5 * 1024 * 1024) ;
server.addConnector(connector) ;
- return server ;
- }
-
- private static void addContent(ServletContextHandler context, String pathSpec, String pages) {
- DefaultServlet staticServlet = new DefaultServlet() ;
- ServletHolder staticContent = new ServletHolder(staticServlet) ;
- staticContent.setInitParameter("resourceBase", pages) ;
-
- // Note we set GZip to false for static content because the Jetty
- // DefaultServlet has
- // a built-in GZip capability that is better for static content than the
- // mechanism the
- // GzipFilter uses for dynamic content
- 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) {
- for (String pathSpec : pathSpecs) {
- if ( pathSpec.equals("") ) {
- // "" is special -- add as "base" and "base/"
- addServlet(context, servlet, datasetPath + "/", enableCompression) ;
- addServlet(context, servlet, datasetPath, enableCompression) ;
- continue ;
- }
-
- if ( pathSpec.endsWith("/") )
- pathSpec = pathSpec.substring(0, pathSpec.length() - 1) ;
- if ( pathSpec.startsWith("/") )
- pathSpec = pathSpec.substring(1, pathSpec.length()) ;
- addServlet(context, servlet, datasetPath + "/" + pathSpec, enableCompression) ;
- }
- }
-
- private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec,
- boolean enableCompression) {
- ServletHolder holder = new ServletHolder(servlet) ;
- addServlet(context, holder, pathSpec, enableCompression) ;
- }
-
- private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec,
- boolean enableCompression) {
- if ( serverLog.isDebugEnabled() ) {
- if ( enableCompression )
- serverLog.debug("Add servlet @ " + pathSpec + " (with gzip)") ;
- else
- serverLog.debug("Add servlet @ " + pathSpec) ;
- }
- context.addServlet(holder, pathSpec) ;
-
- if ( enableCompression )
- context.addFilter(GzipFilter.class, pathSpec, EnumSet.allOf(DispatcherType.class)) ;
+ serverConnector = connector ;
}
}
Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerConfig.java Mon Dec 23 19:57:29 2013
@@ -18,7 +18,6 @@
package org.apache.jena.fuseki.server;
-import java.util.List ;
/** This represents a configuration of a SPARQL server.
*/
@@ -39,8 +38,6 @@ public class ServerConfig
public boolean loopback = false ;
/** The local directory for serving the static pages */
public String pages ;
- /** The list of datasets */
- public List<DatasetRef> datasets ;
/** Enable Accept-Encoding compression. Set to false by default.*/
public boolean enableCompression = false ;
Added: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerInitialConfig.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerInitialConfig.java?rev=1553196&view=auto
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerInitialConfig.java (added)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/server/ServerInitialConfig.java Mon Dec 23 19:57:29 2013
@@ -0,0 +1,29 @@
+/**
+ * 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 com.hp.hpl.jena.sparql.core.DatasetGraph ;
+
+/** Dataset setup (command line, config file) for a dataset (or several if config file) */
+public class ServerInitialConfig {
+ public DatasetGraph dsg = null ;
+ public String datasetPath = null ;
+ public boolean allowUpdate = false ;
+ public String fusekiConfigFile = null ;
+}
Modified: jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/ServerTest.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/ServerTest.java?rev=1553196&r1=1553195&r2=1553196&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/ServerTest.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/test/java/org/apache/jena/fuseki/ServerTest.java Mon Dec 23 19:57:29 2013
@@ -16,14 +16,12 @@
* limitations under the License.
*/
-package org.apache.jena.fuseki;
+package org.apache.jena.fuseki ;
import java.util.Collection ;
import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.fuseki.mgt.ManagementServer ;
import org.apache.jena.fuseki.server.* ;
-import org.eclipse.jetty.servlet.ServletContextHandler ;
import com.hp.hpl.jena.graph.Graph ;
import com.hp.hpl.jena.graph.Node ;
@@ -40,109 +38,109 @@ import com.hp.hpl.jena.update.Update ;
import com.hp.hpl.jena.update.UpdateExecutionFactory ;
import com.hp.hpl.jena.update.UpdateProcessor ;
-/** Manage a server for testing.
- * Example for one server per test suite:
+/**
+ * Manage a server for testing. Example for one server per test suite:
+ *
* <pre>
- \@BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
- \@AfterClass public static void afterClass() { ServerTest.freeServer() ; }
- \@Before public void beforeTest() { ServerTest.resetServer() ; }
- </pre>
+ * \@BeforeClass public static void beforeClass() { ServerTest.allocServer() ; }
+ * \@AfterClass public static void afterClass() { ServerTest.freeServer() ; }
+ * \@Before public void beforeTest() { ServerTest.resetServer() ; }
+ * </pre>
*/
-public class ServerTest
-{
+public class ServerTest {
// Abstraction that runs a SPARQL server for tests.
-
- public static final int port = 3535 ;
- public static final String urlRoot = "http://localhost:"+port+"/" ;
- public static final String datasetPath = "/dataset" ;
- public static final String urlDataset = "http://localhost:"+port+datasetPath ;
- public static final String serviceUpdate = urlDataset+"/update" ;
- public static final String serviceQuery = urlDataset+"/query" ;
- public static final String serviceREST = urlDataset+"/data" ;
-
- public static final String gn1 = "http://graph/1" ;
- public static final String gn2 = "http://graph/2" ;
- public static final String gn99 = "http://graph/99" ;
-
- public static final Node n1 = NodeFactory.createURI("http://graph/1") ;
- public static final Node n2 = NodeFactory.createURI("http://graph/2") ;
- public static final Node n99 = NodeFactory.createURI("http://graph/99") ;
-
- public static final Graph graph1 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 1)))") ;
- public static final Graph graph2 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 2)))") ;
-
- public static final Model model1 = ModelFactory.createModelForGraph(graph1) ;
- public static final Model model2 = ModelFactory.createModelForGraph(graph2) ;
-
- private static SPARQLServer server = null ;
-
+
+ public static final int port = 3535 ;
+ public static final String urlRoot = "http://localhost:" + port + "/" ;
+ public static final String datasetPath = "/dataset" ;
+ public static final String urlDataset = "http://localhost:" + port + datasetPath ;
+ public static final String serviceUpdate = urlDataset + "/update" ;
+ public static final String serviceQuery = urlDataset + "/query" ;
+ public static final String serviceREST = urlDataset + "/data" ;
+
+ public static final String gn1 = "http://graph/1" ;
+ public static final String gn2 = "http://graph/2" ;
+ public static final String gn99 = "http://graph/99" ;
+
+ public static final Node n1 = NodeFactory.createURI("http://graph/1") ;
+ public static final Node n2 = NodeFactory.createURI("http://graph/2") ;
+ public static final Node n99 = NodeFactory.createURI("http://graph/99") ;
+
+ public static final Graph graph1 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 1)))") ;
+ public static final Graph graph2 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 2)))") ;
+
+ public static final Model model1 = ModelFactory.createModelForGraph(graph1) ;
+ public static final Model model2 = ModelFactory.createModelForGraph(graph2) ;
+
+ private static SPARQLServer server = null ;
+
// reference count of start/stop server
- private static int countServer = 0 ;
-
+ private static int countServer = 0 ;
+
// This will cause there to be one server over all tests.
- // Must be after initialization of counters
- //static { allocServer() ; }
+ // Must be after initialization of counters
+ // static { allocServer() ; }
- static public void allocServer()
- {
+ static public void allocServer() {
if ( countServer == 0 )
setupServer() ;
countServer++ ;
}
-
- static public void freeServer()
- {
+
+ static public void freeServer() {
if ( countServer >= 0 ) {
- countServer -- ;
+ countServer-- ;
if ( countServer == 0 )
teardownServer() ;
}
}
+
+ protected static void setupServer() {
+ setupServer(null) ;
+ }
- protected static void setupServer()
- {
+ protected static void setupServer(String authConfigFile) {
SystemState.location = Location.mem() ;
SystemState.init$() ;
- DatasetGraph dsg = DatasetGraphFactory.createMem() ;
- // This must agree with ServerTest
- ServerConfig config = make(dsg, true, true) ;
- server = new SPARQLServer(config) ;
- X_Config.configureDatasets(config.datasets) ;
- ServletContextHandler context = (ServletContextHandler)server.getServer().getHandler() ;
- ManagementServer.addServerFunctions(context, "/$/") ;
- ManagementServer.addAdminFunctions(context, "/$/") ;
+ ServerInitialConfig params = new ServerInitialConfig() ;
+ DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+ params.dsg = dsg ;
+ params.datasetPath = ServerTest.datasetPath ;
+ params.allowUpdate = true ;
+ FusekiServletContextListener.initialSetup = params ;
+ ServerConfig config = make(true, true) ;
+ config.authConfigFile = authConfigFile ;
+ server = new SPARQLServer(config) ;
server.start() ;
}
-
- public static ServerConfig make(DatasetGraph dsg, boolean allowUpdate, boolean listenLocal) {
+
+ public static ServerConfig make(boolean allowUpdate, boolean listenLocal) {
ServerConfig config = new ServerConfig() ;
// Avoid any persistent record.
- config.datasets = FusekiConfig.defaultConfiguration(ServerTest.datasetPath, dsg, allowUpdate, listenLocal) ;
config.port = ServerTest.port ;
config.mgtPort = ServerTest.port ;
config.pagesPort = ServerTest.port ;
- config.loopback = false ;
+ config.loopback = listenLocal ;
config.jettyConfigFile = null ;
config.pages = Fuseki.PagesStatic ;
config.enableCompression = true ;
config.verboseLogging = false ;
return config ;
}
-
+
protected static void teardownServer() {
if ( server != null )
server.stop() ;
server = null ;
// Clear out the registry.
Collection<String> keys = Iter.toList(DatasetRegistry.get().keys()) ;
- for ( String k : keys )
- DatasetRegistry.get().remove(k);
+ for (String k : keys)
+ DatasetRegistry.get().remove(k) ;
}
-
- public static void resetServer()
- {
+
+ public static void resetServer() {
Update clearRequest = new UpdateDrop(Target.ALL) ;
UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, ServerTest.serviceUpdate) ;
proc.execute() ;