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 2018/08/31 12:04:56 UTC

[06/27] jena git commit: JENA-1585: Refactoring webapp code to separate from the core server.

JENA-1585: Refactoring webapp code to separate from the core server.


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/06f59125
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/06f59125
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/06f59125

Branch: refs/heads/master
Commit: 06f59125002992a13160fbc0d855ee819f035816
Parents: 6265664
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Aug 23 16:32:48 2018 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Aug 23 17:15:05 2018 +0100

----------------------------------------------------------------------
 .../jena/fuseki/build/FusekiBuildLib.java       |   5 +-
 .../apache/jena/fuseki/build/FusekiConfig.java  |   3 +-
 .../apache/jena/fuseki/build/FusekiConst.java   |  41 +++
 .../org/apache/jena/fuseki/cmd/FusekiCmd.java   |   1 -
 .../org/apache/jena/fuseki/cmd/JettyFuseki.java | 325 +++++++++++++++++++
 .../apache/jena/fuseki/ctl/ActionAsyncTask.java |   1 -
 .../apache/jena/fuseki/ctl/ActionBackup.java    |  65 ----
 .../jena/fuseki/ctl/ActionBackupList.java       |  94 ------
 .../org/apache/jena/fuseki/ctl/ActionItem.java  |  46 +++
 .../org/apache/jena/fuseki/ctl/ActionStats.java |  11 +-
 .../apache/jena/fuseki/ctl/JsonDescription.java |  73 +++++
 .../org/apache/jena/fuseki/ctl/TaskBase.java    |   4 +-
 .../apache/jena/fuseki/jetty/JettyFuseki.java   | 325 -------------------
 .../apache/jena/fuseki/mgt/ActionBackup.java    |  68 ++++
 .../jena/fuseki/mgt/ActionBackupList.java       |  95 ++++++
 .../apache/jena/fuseki/mgt/ActionDatasets.java  |   7 +-
 .../org/apache/jena/fuseki/mgt/ActionItem.java  |  46 ---
 .../jena/fuseki/mgt/ActionServerStatus.java     |  12 +-
 .../apache/jena/fuseki/mgt/JsonDescription.java |  72 ----
 .../org/apache/jena/fuseki/mgt/MgtConst.java    |  52 ---
 .../java/org/apache/jena/fuseki/mgt/MgtJMX.java |  61 ----
 .../apache/jena/fuseki/mgt/ServerMgtConst.java  |  39 +++
 .../apache/jena/fuseki/mgt/ServiceMXBean.java   |  32 --
 .../apache/jena/fuseki/server/ServerConst.java  |  41 +++
 .../apache/jena/fuseki/webapp/SystemState.java  |  16 -
 .../src/main/webapp/WEB-INF/web.xml             |   4 +-
 .../src/main/webapp/js/app/controllers/.svnkeep |   0
 .../src/main/webapp/js/app/layouts/.svnkeep     |   0
 .../src/main/webapp/js/app/routers/.svnkeep     |   0
 .../src/main/webapp/js/app/views/.svnkeep       |   0
 .../java/org/apache/jena/fuseki/ServerCtl.java  |   2 +-
 .../java/org/apache/jena/fuseki/TestAdmin.java  |  19 +-
 32 files changed, 763 insertions(+), 797 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiBuildLib.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiBuildLib.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiBuildLib.java
index e71edce..a964c9d 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiBuildLib.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiBuildLib.java
@@ -19,7 +19,6 @@
 package org.apache.jena.fuseki.build;
 
 import org.apache.jena.fuseki.FusekiConfigException;
-import org.apache.jena.fuseki.webapp.SystemState;
 import org.apache.jena.query.* ;
 import org.apache.jena.rdf.model.Literal ;
 import org.apache.jena.rdf.model.Model ;
@@ -55,7 +54,7 @@ public class FusekiBuildLib {
     }
 
     public static ResultSet query(String string, Model m, String varName, RDFNode value) {
-        Query query = QueryFactory.create(SystemState.PREFIXES + string) ;
+        Query query = QueryFactory.create(FusekiConst.PREFIXES + string) ;
         QuerySolutionMap initValues = null ;
         if ( varName != null )
             initValues = querySolution(varName, value) ;
@@ -65,7 +64,7 @@ public class FusekiBuildLib {
     }
 
     public static ResultSet query(String string, Dataset ds, String varName, RDFNode value) {
-        Query query = QueryFactory.create(SystemState.PREFIXES + string) ;
+        Query query = QueryFactory.create(FusekiConst.PREFIXES + string) ;
         QuerySolutionMap initValues = null ;
         if ( varName != null )
             initValues = querySolution(varName, value) ;

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
index 7919099..9673cfa 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
@@ -38,7 +38,6 @@ import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiConfigException ;
 import org.apache.jena.fuseki.server.* ;
-import org.apache.jena.fuseki.webapp.SystemState;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.query.QuerySolution ;
 import org.apache.jena.query.ReadWrite ;
@@ -202,7 +201,7 @@ public class FusekiConfig {
     public static List<DataAccessPoint> readSystemDatabase(Dataset ds) {
         DatasetDescriptionRegistry dsDescMap = new DatasetDescriptionRegistry() ;
         String qs = StrUtils.strjoinNL
-            (SystemState.PREFIXES ,
+            (FusekiConst.PREFIXES ,
              "SELECT * {" ,
              "  GRAPH ?g {",
              "     ?s fu:name ?name ;" ,

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConst.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConst.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConst.java
new file mode 100644
index 0000000..3e75555
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConst.java
@@ -0,0 +1,41 @@
+/*
+ * 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.build;
+
+import org.apache.jena.atlas.lib.StrUtils;
+
+/** Internal constants */
+public class FusekiConst {
+
+    public static String PREFIXES = StrUtils.strjoinNL
+    ("BASE            <http://example/base#>",
+     "PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>",
+     "PREFIX fu:      <http://jena.apache.org/fuseki#>",
+     "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 sdb:     <http://jena.hpl.hp.com/2007/sdb#>",
+     "PREFIX list:    <http://jena.apache.org/ARQ/list#>",
+     "PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>",
+     "PREFIX apf:     <http://jena.apache.org/ARQ/property#>",
+     "PREFIX afn:     <http://jena.apache.org/ARQ/function#>",
+     "") ;
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
index 9fd5075..e62b118 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
@@ -30,7 +30,6 @@ import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiException;
 import org.apache.jena.fuseki.build.Template ;
-import org.apache.jena.fuseki.jetty.JettyFuseki ;
 import org.apache.jena.fuseki.jetty.JettyServerConfig ;
 import org.apache.jena.fuseki.server.FusekiInitialConfig ;
 import org.apache.jena.fuseki.system.FusekiLogging;

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/JettyFuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/JettyFuseki.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/JettyFuseki.java
new file mode 100644
index 0000000..29608d0
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/JettyFuseki.java
@@ -0,0 +1,325 @@
+/*
+ * 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.cmd ;
+
+import static java.lang.String.format ;
+import static org.apache.jena.fuseki.Fuseki.serverLog ;
+
+import java.io.FileInputStream ;
+
+import javax.servlet.ServletContext ;
+
+import org.apache.jena.atlas.lib.DateTimeUtils ;
+import org.apache.jena.atlas.lib.FileOps ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.FusekiException ;
+import org.apache.jena.fuseki.jetty.FusekiErrorHandler;
+import org.apache.jena.fuseki.jetty.JettyServerConfig;
+import org.apache.jena.fuseki.server.DataAccessPointRegistry ;
+import org.apache.jena.fuseki.webapp.FusekiEnv;
+import org.eclipse.jetty.security.* ;
+import org.eclipse.jetty.security.authentication.BasicAuthenticator ;
+import org.eclipse.jetty.server.HttpConnectionFactory ;
+import org.eclipse.jetty.server.Server ;
+import org.eclipse.jetty.server.ServerConnector ;
+import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker ;
+import org.eclipse.jetty.server.handler.ContextHandler ;
+import org.eclipse.jetty.server.handler.gzip.GzipHandler ;
+import org.eclipse.jetty.servlet.ServletContextHandler ;
+import org.eclipse.jetty.util.security.Constraint ;
+import org.eclipse.jetty.webapp.WebAppContext ;
+import org.eclipse.jetty.xml.XmlConfiguration ;
+
+/** Standalone full server, not run as a WAR file.
+ * Used in testing and development.
+ * 
+ * SPARQLServer is the Jena server instance which wraps/utilizes 
+ * {@link org.eclipse.jetty.server.Server}. This class provides
+ * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and 
+ * {@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.jetty.JettyServerConfig}.
+ */
+public class JettyFuseki {
+    // Jetty specific.
+    // This class is becoming less important - it now sets up a Jetty server for in-process use
+    // either for the command line in development  
+    // and in testing but not direct webapp deployments. 
+    static { Fuseki.init() ; }
+
+    public static JettyFuseki  instance    = null ;
+
+    private ServerConnector serverConnector = null ;
+    // If a separate ...
+    private ServerConnector mgtConnector    = null ;
+    
+    private JettyServerConfig serverConfig ;
+
+    // The jetty server.
+    
+    private Server              server         = null ;
+    private ServletContext      servletContext = null ;
+    
+    // webapp setup - standard maven layout
+    public static       String contextpath     = "/" ;
+    // Standalone jar
+    public static final String resourceBase1   = "webapp" ;
+    // Development
+    public static final String resourceBase2   = "src/main/webapp" ;
+
+    /**
+     * Default setup which requires a {@link org.apache.jena.fuseki.jetty.JettyServerConfig}
+     * object as input.  We use this config to pass in the command line arguments for dataset, 
+     * name etc. 
+     * @param config
+     */
+    
+    public static void initializeServer(JettyServerConfig config) {
+        instance = new JettyFuseki(config) ;
+    }
+    
+    private JettyFuseki(JettyServerConfig config) {
+        this.serverConfig = config ;
+        buildServerWebapp(serverConfig.contextPath, serverConfig.jettyConfigFile) ;
+        if ( mgtConnector == null )
+            mgtConnector = serverConnector ;
+
+        if ( config.enableCompression ) {
+            GzipHandler gzipHandler = new GzipHandler();
+            gzipHandler.setHandler(server.getHandler());
+            server.setHandler(gzipHandler); 
+        }
+    }
+
+    /**
+     * Initialize the {@link JettyFuseki} instance.
+     */
+    public void start() {
+        
+        String version = Fuseki.VERSION ;
+        String buildDate = Fuseki.BUILD_DATE ;
+        
+        if ( version != null && version.equals("${project.version}") )
+            version = null ;
+        if ( buildDate != null && buildDate.equals("${build.time.xsd}") )
+            buildDate = DateTimeUtils.nowAsXSDDateTimeString() ;
+        
+        if ( version != null ) {
+            if ( Fuseki.developmentMode && buildDate != null )
+                serverLog.info(format("%s %s %s", Fuseki.NAME, version, buildDate)) ;
+            else
+                serverLog.info(format("%s %s", Fuseki.NAME, version)) ;
+        }
+        // This does not get set usefully for Jetty as we use it.
+        // String jettyVersion = org.eclipse.jetty.server.Server.getVersion() ;
+        // serverLog.info(format("Jetty %s",jettyVersion)) ;
+        
+        String host = serverConnector.getHost() ;
+        if ( host != null )
+            serverLog.info("Incoming connections limited to " + host) ;
+
+        try {
+            server.start() ;
+        } catch (java.net.BindException ex) {
+            serverLog.error("SPARQLServer (port="+serverConnector.getPort()+"): Failed to start server: " + ex.getMessage()) ;
+            throw new FusekiException("BindException: port="+serverConnector.getPort()+": Failed to start server: " + ex.getMessage(), ex) ;
+        } catch (Exception ex) {
+            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex) ;
+            throw new FusekiException("Failed to start server: " + ex.getMessage(), ex) ;
+        }
+        String now = DateTimeUtils.nowAsString() ;
+        serverLog.info(format("Started %s on port %d", now, serverConnector.getPort())) ;
+    }
+
+    /**
+     * Sync with the {@link JettyFuseki} instance.
+     * Returns only if the server exits cleanly 
+     */
+    public void join() {
+        try {
+            server.join() ;
+        } catch (InterruptedException ex) { }
+    }
+
+        /**
+     * Stop the {@link JettyFuseki} instance.
+     */
+    public void stop() {
+        String now = DateTimeUtils.nowAsString() ;
+        serverLog.info(format("Stopped %s on port %d", now, serverConnector.getPort())) ;
+        try {
+            server.stop() ;
+        } catch (Exception ex) {
+            Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex) ;
+        }
+    }
+
+    public static WebAppContext createWebApp(String contextPath) {
+        FusekiEnv.setEnvironment();
+        WebAppContext webapp = new WebAppContext();
+        webapp.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
+
+        // Hunt for the webapp for the standalone jar (or development system). 
+        // Note that Path FUSEKI_HOME is not initialized until the webapp starts
+        // so it is not available here.
+
+        String resourceBase3 = null ;
+        String resourceBase4 = null ;
+        if ( FusekiEnv.FUSEKI_HOME != null ) {
+            String HOME = FusekiEnv.FUSEKI_HOME.toString() ;
+            resourceBase3 = HOME+"/"+resourceBase1 ;
+            resourceBase4 = HOME+"/"+resourceBase2 ;
+        }
+
+        String resourceBase = tryResourceBase(resourceBase1, null) ;
+        resourceBase = tryResourceBase(resourceBase2, resourceBase) ;
+        resourceBase = tryResourceBase(resourceBase3, resourceBase) ;
+        resourceBase = tryResourceBase(resourceBase4, resourceBase) ;
+
+        if ( resourceBase == null ) {
+            if ( resourceBase3 == null )
+                Fuseki.serverLog.error("Can't find resourceBase (tried "+resourceBase1+" and "+resourceBase2+")") ;
+            else
+                Fuseki.serverLog.error("Can't find resourceBase (tried "+resourceBase1+", "+resourceBase2+", "+resourceBase3+" and "+resourceBase4+")") ;
+            Fuseki.serverLog.error("Failed to start") ;
+            throw new FusekiException("Failed to start") ;
+        }
+
+        webapp.setDescriptor(resourceBase+"/WEB-INF/web.xml");
+        webapp.setResourceBase(resourceBase);
+        webapp.setContextPath(contextPath);
+
+        //-- Jetty setup for the ServletContext logger.
+        // The name of the Jetty-allocated slf4j/log4j logger is
+        // the display name or, if null, the context path name.   
+        // It is set, without checking for a previous call of setLogger in "doStart"
+        // which happens during server startup. 
+        // This the name of the ServletContext logger as well
+        webapp.setDisplayName(Fuseki.servletRequestLogName);  
+        webapp.setParentLoaderPriority(true);  // Normal Java classloader behaviour.
+        webapp.setErrorHandler(new FusekiErrorHandler()) ;
+        return webapp ;
+    }
+
+    public static String getenv(String name) {
+        String x = System.getenv(name) ;
+        if ( x == null )
+            x = System.getProperty(name) ;
+        return x ;
+    }
+    
+    public DataAccessPointRegistry getDataAccessPointRegistry() {
+        return DataAccessPointRegistry.get(servletContext) ;
+    }
+
+    private static String tryResourceBase(String maybeResourceBase, String currentResourceBase) {
+        if ( currentResourceBase != null )
+            return currentResourceBase ;
+        if ( maybeResourceBase != null && FileOps.exists(maybeResourceBase) )
+            return maybeResourceBase ;
+        return currentResourceBase ;
+    }
+    
+    private void buildServerWebapp(String contextPath, String jettyConfig) {
+        if ( jettyConfig != null )
+            // --jetty-config=jetty-fuseki.xml
+            // for detailed configuration of the server using Jetty features.
+            configServer(jettyConfig) ;
+        else
+            defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
+
+        WebAppContext webapp = createWebApp(contextPath) ;
+        if ( false /*enable symbolic links */ ) {
+            // See http://www.eclipse.org/jetty/documentation/current/serving-aliased-files.html
+            // Record what would be needed:
+            // 1 - Allow all symbolic links without checking
+            webapp.addAliasCheck(new ContextHandler.ApproveAliases());
+            // 2 - Check links are to valid resources. But default for Unix?
+            webapp.addAliasCheck(new AllowSymLinkAliasChecker()) ;
+        }
+        servletContext = webapp.getServletContext() ;
+        server.setHandler(webapp) ;
+        // Replaced by Shiro.
+        if ( jettyConfig == null && serverConfig.authConfigFile != null )
+            security(webapp, serverConfig.authConfigFile) ;
+    }
+    
+    // This is now provided by Shiro.
+    private static void security(ServletContextHandler context, String authfile) {
+        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", authfile) ;
+        loginService.setIdentityService(identService) ;
+
+        securityHandler.setLoginService(loginService) ;
+        securityHandler.setAuthenticator(new BasicAuthenticator()) ;
+
+        context.setSecurityHandler(securityHandler) ;
+
+        serverLog.debug("Basic Auth Configuration = " + authfile) ;
+    }
+
+    private void configServer(String jettyConfig) {
+        try {
+            serverLog.info("Jetty server config file = " + jettyConfig) ;
+            server = new Server() ;
+            XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
+            configuration.configure(server) ;
+            serverConnector = (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 void defaultServerConfig(int port, boolean loopback) {
+        server = new Server() ;
+        HttpConnectionFactory f1 = new HttpConnectionFactory() ;
+        // Some people do try very large operations ... really, should use POST.
+        f1.getHttpConfiguration().setRequestHeaderSize(512 * 1024);
+        f1.getHttpConfiguration().setOutputBufferSize(5 * 1024 * 1024) ;
+        // Do not add "Server: Jetty(....) when not a development system.
+        if ( ! Fuseki.outputJettyServerHeader )
+            f1.getHttpConfiguration().setSendServerVersion(false) ;
+
+        // https is better done with a Jetty configuration file
+        // because there are several things to configure. 
+        // See "examples/fuseki-jetty-https.xml"
+
+        ServerConnector connector = new ServerConnector(server, f1) ;
+        connector.setPort(port) ;
+        server.addConnector(connector);
+        if ( loopback )
+            connector.setHost("localhost");
+        serverConnector = connector ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionAsyncTask.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionAsyncTask.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionAsyncTask.java
index 5c3ec01..4310c6f 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionAsyncTask.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionAsyncTask.java
@@ -22,7 +22,6 @@ import org.apache.jena.atlas.json.JsonValue ;
 import org.apache.jena.atlas.lib.InternalErrorException ;
 import org.apache.jena.fuseki.async.AsyncPool ;
 import org.apache.jena.fuseki.async.AsyncTask ;
-import org.apache.jena.fuseki.mgt.ActionItem;
 import org.apache.jena.fuseki.servlets.HttpAction ;
 import org.apache.jena.fuseki.servlets.ServletOps ;
 

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackup.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackup.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackup.java
deleted file mode 100644
index b83c736..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackup.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.ctl;
-
-import static java.lang.String.format ;
-
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletOps ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-public class ActionBackup extends ActionAsyncTask
-{
-    public ActionBackup() { super() ; }
-
-    @Override
-    protected Runnable createRunnable(HttpAction action) {
-        String name = action.getDatasetName() ;
-        if ( name == null ) {
-            action.log.error("Null for dataset name in item request") ;  
-            ServletOps.errorOccurred("Null for dataset name in item request");
-            return null ;
-        }
-        
-        action.log.info(format("[%d] Backup dataset %s", action.id, name)) ;
-        return new BackupTask(action) ;
-    }
-
-    static class BackupTask extends TaskBase {
-        static private Logger log = LoggerFactory.getLogger("Backup") ;
-        
-        public BackupTask(HttpAction action) {
-            super(action) ;
-        }
-
-        @Override
-        public void run() {
-            try {
-                String backupFilename = Backup.chooseFileName(datasetName) ;
-                log.info(format("[%d] >>>> Start backup %s -> %s", actionId, datasetName, backupFilename)) ;
-                Backup.backup(transactional, dataset, backupFilename) ;
-                log.info(format("[%d] <<<< Finish backup %s -> %s", actionId, datasetName, backupFilename)) ;
-            } catch (Exception ex) {
-                log.info(format("[%d] **** Exception in backup", actionId), ex) ;
-            }
-        }
-    }
-}
-    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackupList.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackupList.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackupList.java
deleted file mode 100644
index 509408e..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionBackupList.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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.ctl;
-
-import static java.lang.String.format ;
-
-import java.io.File ;
-import java.io.IOException ;
-import java.nio.file.DirectoryStream ;
-import java.nio.file.Files ;
-import java.nio.file.Path ;
-import java.util.ArrayList ;
-import java.util.List ;
-import java.util.stream.Collectors ;
-
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.json.JsonBuilder ;
-import org.apache.jena.atlas.json.JsonValue ;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletOps ;
-import org.apache.jena.fuseki.webapp.FusekiSystem;
-
-/**
- * A JSON API to list all the backups in the backup directory
- */
-public class ActionBackupList extends ActionCtl {
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp);
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp);
-    }
-
-    @Override
-    protected void perform(HttpAction action) {
-        JsonValue result = description(action) ;
-        ServletOps.setNoCache(action.response) ;
-        ServletOps.sendJsonReponse(action, result);
-    }
-        
-    private static DirectoryStream.Filter<Path> filterVisibleFiles = (entry) -> {
-        File f = entry.toFile() ;
-        return f.isFile() && !f.isHidden() ;
-    } ;
-
-    private JsonValue description(HttpAction action) {
-        if ( ! Files.isDirectory(FusekiSystem.dirBackups) )
-            ServletOps.errorOccurred(format("[%d] Backup area '%s' is not a directory", action.id, FusekiSystem.dirBackups)) ;
-        
-        List<Path> paths = new ArrayList<>() ;
-        try (DirectoryStream<Path> stream = Files.newDirectoryStream(FusekiSystem.dirBackups, filterVisibleFiles)) {
-            stream.forEach(paths::add) ;
-        } catch (IOException ex) {
-            action.log.error(format("[%d] Backup file list :: IOException :: %s", action.id, ex.getMessage())) ;
-            ServletOps.errorOccurred(ex);
-        }
-
-        List<String> fileNames = paths.stream().map((p)->p.getFileName().toString()).sorted().collect(Collectors.toList()) ;
-
-        JsonBuilder builder = new JsonBuilder() ;
-        builder.startObject("top") ;
-        builder.key("backups") ;
-
-        builder.startArray() ;
-        fileNames.forEach(builder::value) ;
-        builder.finishArray() ;
-
-        builder.finishObject("top") ;
-        return builder.build() ; 
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionItem.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionItem.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionItem.java
new file mode 100644
index 0000000..ea015e5
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionItem.java
@@ -0,0 +1,46 @@
+/**
+ * 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.ctl;
+
+import org.apache.jena.atlas.json.JsonValue ;
+import org.apache.jena.fuseki.ctl.ActionContainerItem;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.apache.jena.fuseki.servlets.ServletOps;
+import org.apache.jena.web.HttpSC ;
+
+/** Action on items in a container, but not the container itself */ 
+public abstract class ActionItem extends ActionContainerItem
+{
+    public ActionItem() { super() ; }
+    
+    @Override
+    final
+    protected JsonValue execGetContainer(HttpAction action) {
+        ServletOps.error(HttpSC.METHOD_NOT_ALLOWED_405) ;
+        return null ;
+    }
+
+    @Override
+    final
+    protected JsonValue execPostContainer(HttpAction action) {
+        ServletOps.error(HttpSC.METHOD_NOT_ALLOWED_405) ;
+        return null ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionStats.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionStats.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionStats.java
index dacd151..f9ab32f 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionStats.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionStats.java
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletResponse ;
 import org.apache.jena.atlas.json.JsonBuilder ;
 import org.apache.jena.atlas.json.JsonObject ;
 import org.apache.jena.atlas.json.JsonValue ;
-import org.apache.jena.fuseki.mgt.MgtConst;
 import org.apache.jena.fuseki.server.* ;
 import org.apache.jena.fuseki.servlets.HttpAction ;
 
@@ -50,7 +49,7 @@ public class ActionStats extends ActionContainerItem
     public static JsonObject generateStats(DataAccessPointRegistry registry) {
         JsonBuilder builder = new JsonBuilder() ;
         builder.startObject("top") ;
-        builder.key(MgtConst.datasets) ;
+        builder.key(ServerConst.datasets) ;
         builder.startObject("datasets") ;
         registry.forEach((name, access)->statsDataset(builder, access));
         builder.finishObject("datasets") ;
@@ -66,7 +65,7 @@ public class ActionStats extends ActionContainerItem
         String datasetPath = DataAccessPoint.canonical(action.getDatasetName()) ;
         builder.startObject("TOP") ;
         
-        builder.key(MgtConst.datasets) ;
+        builder.key(ServerConst.datasets) ;
         builder.startObject("datasets") ;
         statsDataset(builder, datasetPath, action.getDataAccessPointRegistry()) ;
         builder.finishObject("datasets") ;
@@ -96,7 +95,7 @@ public class ActionStats extends ActionContainerItem
         builder.key(CounterName.RequestsGood.getName()).value(dSrv.getCounters().value(CounterName.RequestsGood)) ;
         builder.key(CounterName.RequestsBad.getName()).value(dSrv.getCounters().value(CounterName.RequestsBad)) ;
         
-        builder.key(MgtConst.endpoints).startObject("endpoints") ;
+        builder.key(ServerConst.endpoints).startObject("endpoints") ;
         
         for ( Operation operName : dSrv.getOperations() ) {
             List<Endpoint> endpoints = access.getDataService().getEndpoints(operName) ;
@@ -107,8 +106,8 @@ public class ActionStats extends ActionContainerItem
                 builder.startObject() ;
                 
                 operationCounters(builder, endpoint);
-                builder.key(MgtConst.operation).value(operName.getName()) ;
-                builder.key(MgtConst.description).value(operName.getDescription());
+                builder.key(ServerConst.operation).value(operName.getName()) ;
+                builder.key(ServerConst.description).value(operName.getDescription());
                 
                 builder.finishObject() ;
             }

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/JsonDescription.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/JsonDescription.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/JsonDescription.java
new file mode 100644
index 0000000..d4d4ad5
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/JsonDescription.java
@@ -0,0 +1,73 @@
+/**
+ * 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.ctl;
+
+import java.util.List ;
+
+import org.apache.jena.atlas.json.JsonBuilder ;
+import org.apache.jena.fuseki.server.DataAccessPoint ;
+import org.apache.jena.fuseki.server.DataAccessPointRegistry ;
+import org.apache.jena.fuseki.server.Endpoint ;
+import org.apache.jena.fuseki.server.Operation ;
+import org.apache.jena.fuseki.server.ServerConst;
+
+/** Create a description of a service */
+public class JsonDescription {
+    
+    public static void arrayDatasets(JsonBuilder builder, DataAccessPointRegistry registry) {
+        builder.startArray() ;
+        for ( String ds : registry.keys() ) {
+            DataAccessPoint access = registry.get(ds) ;
+            JsonDescription.describe(builder, access) ;
+        }
+        builder.finishArray() ;
+    }
+    
+    public static void describe(JsonBuilder builder, DataAccessPoint access) {
+        builder.startObject() ;
+        builder.key(ServerConst.dsName).value(access.getName()) ;
+        
+        builder.key(ServerConst.dsState).value(access.getDataService().isAcceptingRequests()) ;
+        
+        builder.key(ServerConst.dsService) ;
+        builder.startArray() ;
+        
+        for ( Operation operation : access.getDataService().getOperations() ) {
+            List<Endpoint> endpoints = access.getDataService().getEndpoints(operation) ;
+            describe(builder, operation, endpoints) ;
+        }
+        builder.finishArray() ;
+        builder.finishObject() ;
+    }
+    
+    private static void describe(JsonBuilder builder, Operation operation, List<Endpoint> endpoints) {
+        builder.startObject() ;
+        
+        builder.key(ServerConst.srvType).value(operation.getName()) ;
+        builder.key(ServerConst.srvDescription).value(operation.getDescription()) ;
+        builder.key(ServerConst.srvEndpoints) ;
+        builder.startArray() ;
+        for ( Endpoint endpoint : endpoints )
+            builder.value(endpoint.getEndpoint()) ;
+        builder.finishArray() ;
+
+        builder.finishObject() ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/TaskBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/TaskBase.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/TaskBase.java
index f885839..8b73a98 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/TaskBase.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/TaskBase.java
@@ -22,10 +22,10 @@ import org.apache.jena.fuseki.servlets.HttpAction ;
 import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.Transactional ;
 
-/** Base of async tasks - this caries some useful information around, leaving the
+/** Base of async tasks - this carries some useful information around, leaving the
  * implementation of Callable.run() to the specific task.
  */
-abstract class TaskBase implements Runnable {
+public abstract class TaskBase implements Runnable {
     public final long actionId ;
     public final DatasetGraph dataset ;
     public final String datasetName ;

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/jetty/JettyFuseki.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/jetty/JettyFuseki.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/jetty/JettyFuseki.java
deleted file mode 100644
index aa1340b..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/jetty/JettyFuseki.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * 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.jetty ;
-
-import static java.lang.String.format ;
-import static org.apache.jena.fuseki.Fuseki.serverLog ;
-
-import java.io.FileInputStream ;
-
-import javax.servlet.ServletContext ;
-
-import org.apache.jena.atlas.lib.DateTimeUtils ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.FusekiException ;
-import org.apache.jena.fuseki.mgt.MgtJMX ;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry ;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.eclipse.jetty.security.* ;
-import org.eclipse.jetty.security.authentication.BasicAuthenticator ;
-import org.eclipse.jetty.server.HttpConnectionFactory ;
-import org.eclipse.jetty.server.Server ;
-import org.eclipse.jetty.server.ServerConnector ;
-import org.eclipse.jetty.server.handler.AllowSymLinkAliasChecker ;
-import org.eclipse.jetty.server.handler.ContextHandler ;
-import org.eclipse.jetty.server.handler.gzip.GzipHandler ;
-import org.eclipse.jetty.servlet.ServletContextHandler ;
-import org.eclipse.jetty.util.security.Constraint ;
-import org.eclipse.jetty.webapp.WebAppContext ;
-import org.eclipse.jetty.xml.XmlConfiguration ;
-
-/** Standalone server, not run as a WAR file.
- * Used in testing and development.
- * 
- * SPARQLServer is the Jena server instance which wraps/utilizes 
- * {@link org.eclipse.jetty.server.Server}. This class provides
- * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and 
- * {@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.jetty.JettyServerConfig}.
- */
-public class JettyFuseki {
-    // Jetty specific.
-    // This class is becoming less important - it now sets up a Jetty server for in-process use
-    // either for the command line in development  
-    // and in testing but not direct webapp deployments. 
-    static { Fuseki.init() ; }
-
-    public static JettyFuseki  instance    = null ;
-
-    private ServerConnector serverConnector = null ;
-    // If a separate ...
-    private ServerConnector mgtConnector    = null ;
-    
-    private JettyServerConfig serverConfig ;
-
-    // The jetty server.
-    
-    private Server              server         = null ;
-    private ServletContext      servletContext = null ;
-    
-    // webapp setup - standard maven layout
-    public static       String contextpath     = "/" ;
-    // Standalone jar
-    public static final String resourceBase1   = "webapp" ;
-    // Development
-    public static final String resourceBase2   = "src/main/webapp" ;
-
-    /**
-     * Default setup which requires a {@link org.apache.jena.fuseki.jetty.JettyServerConfig}
-     * object as input.  We use this config to pass in the command line arguments for dataset, 
-     * name etc. 
-     * @param config
-     */
-    
-    public static void initializeServer(JettyServerConfig config) {
-        instance = new JettyFuseki(config) ;
-    }
-    
-    private JettyFuseki(JettyServerConfig config) {
-        this.serverConfig = config ;
-        buildServerWebapp(serverConfig.contextPath, serverConfig.jettyConfigFile) ;
-        if ( mgtConnector == null )
-            mgtConnector = serverConnector ;
-
-        if ( config.enableCompression ) {
-            GzipHandler gzipHandler = new GzipHandler();
-            gzipHandler.setHandler(server.getHandler());
-            server.setHandler(gzipHandler); 
-        }
-    }
-
-    /**
-     * Initialize the {@link JettyFuseki} instance.
-     */
-    public void start() {
-        
-        String version = Fuseki.VERSION ;
-        String buildDate = Fuseki.BUILD_DATE ;
-        
-        if ( version != null && version.equals("${project.version}") )
-            version = null ;
-        if ( buildDate != null && buildDate.equals("${build.time.xsd}") )
-            buildDate = DateTimeUtils.nowAsXSDDateTimeString() ;
-        
-        if ( version != null ) {
-            if ( Fuseki.developmentMode && buildDate != null )
-                serverLog.info(format("%s %s %s", Fuseki.NAME, version, buildDate)) ;
-            else
-                serverLog.info(format("%s %s", Fuseki.NAME, version)) ;
-        }
-        // This does not get set usefully for Jetty as we use it.
-        // String jettyVersion = org.eclipse.jetty.server.Server.getVersion() ;
-        // serverLog.info(format("Jetty %s",jettyVersion)) ;
-        
-        String host = serverConnector.getHost() ;
-        if ( host != null )
-            serverLog.info("Incoming connections limited to " + host) ;
-
-        try {
-            server.start() ;
-        } catch (java.net.BindException ex) {
-            serverLog.error("SPARQLServer (port="+serverConnector.getPort()+"): Failed to start server: " + ex.getMessage()) ;
-            throw new FusekiException("BindException: port="+serverConnector.getPort()+": Failed to start server: " + ex.getMessage(), ex) ;
-        } catch (Exception ex) {
-            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex) ;
-            throw new FusekiException("Failed to start server: " + ex.getMessage(), ex) ;
-        }
-        String now = DateTimeUtils.nowAsString() ;
-        serverLog.info(format("Started %s on port %d", now, serverConnector.getPort())) ;
-    }
-
-    /**
-     * Sync with the {@link JettyFuseki} instance.
-     * Returns only if the server exits cleanly 
-     */
-    public void join() {
-        try {
-            server.join() ;
-        } catch (InterruptedException ex) { }
-    }
-
-        /**
-     * Stop the {@link JettyFuseki} instance.
-     */
-    public void stop() {
-        String now = DateTimeUtils.nowAsString() ;
-        serverLog.info(format("Stopped %s on port %d", now, serverConnector.getPort())) ;
-        try {
-            server.stop() ;
-        } catch (Exception ex) {
-            Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex) ;
-        }
-        MgtJMX.removeJMX() ;
-    }
-
-    public static WebAppContext createWebApp(String contextPath) {
-        FusekiEnv.setEnvironment();
-        WebAppContext webapp = new WebAppContext();
-        webapp.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;
-
-        // Hunt for the webapp for the standalone jar (or development system). 
-        // Note that Path FUSEKI_HOME is not initialized until the webapp starts
-        // so it is not available here.
-
-        String resourceBase3 = null ;
-        String resourceBase4 = null ;
-        if ( FusekiEnv.FUSEKI_HOME != null ) {
-            String HOME = FusekiEnv.FUSEKI_HOME.toString() ;
-            resourceBase3 = HOME+"/"+resourceBase1 ;
-            resourceBase4 = HOME+"/"+resourceBase2 ;
-        }
-
-        String resourceBase = tryResourceBase(resourceBase1, null) ;
-        resourceBase = tryResourceBase(resourceBase2, resourceBase) ;
-        resourceBase = tryResourceBase(resourceBase3, resourceBase) ;
-        resourceBase = tryResourceBase(resourceBase4, resourceBase) ;
-
-        if ( resourceBase == null ) {
-            if ( resourceBase3 == null )
-                Fuseki.serverLog.error("Can't find resourceBase (tried "+resourceBase1+" and "+resourceBase2+")") ;
-            else
-                Fuseki.serverLog.error("Can't find resourceBase (tried "+resourceBase1+", "+resourceBase2+", "+resourceBase3+" and "+resourceBase4+")") ;
-            Fuseki.serverLog.error("Failed to start") ;
-            throw new FusekiException("Failed to start") ;
-        }
-
-        webapp.setDescriptor(resourceBase+"/WEB-INF/web.xml");
-        webapp.setResourceBase(resourceBase);
-        webapp.setContextPath(contextPath);
-
-        //-- Jetty setup for the ServletContext logger.
-        // The name of the Jetty-allocated slf4j/log4j logger is
-        // the display name or, if null, the context path name.   
-        // It is set, without checking for a previous call of setLogger in "doStart"
-        // which happens during server startup. 
-        // This the name of the ServletContext logger as well
-        webapp.setDisplayName(Fuseki.servletRequestLogName);  
-        webapp.setParentLoaderPriority(true);  // Normal Java classloader behaviour.
-        webapp.setErrorHandler(new FusekiErrorHandler()) ;
-        return webapp ;
-    }
-
-    public static String getenv(String name) {
-        String x = System.getenv(name) ;
-        if ( x == null )
-            x = System.getProperty(name) ;
-        return x ;
-    }
-    
-    public DataAccessPointRegistry getDataAccessPointRegistry() {
-        return DataAccessPointRegistry.get(servletContext) ;
-    }
-
-    private static String tryResourceBase(String maybeResourceBase, String currentResourceBase) {
-        if ( currentResourceBase != null )
-            return currentResourceBase ;
-        if ( maybeResourceBase != null && FileOps.exists(maybeResourceBase) )
-            return maybeResourceBase ;
-        return currentResourceBase ;
-    }
-    
-    private void buildServerWebapp(String contextPath, String jettyConfig) {
-        if ( jettyConfig != null )
-            // --jetty-config=jetty-fuseki.xml
-            // for detailed configuration of the server using Jetty features.
-            configServer(jettyConfig) ;
-        else
-            defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
-
-        WebAppContext webapp = createWebApp(contextPath) ;
-        if ( false /*enable symbolic links */ ) {
-            // See http://www.eclipse.org/jetty/documentation/current/serving-aliased-files.html
-            // Record what would be needed:
-            // 1 - Allow all symbolic links without checking
-            webapp.addAliasCheck(new ContextHandler.ApproveAliases());
-            // 2 - Check links are to valid resources. But default for Unix?
-            webapp.addAliasCheck(new AllowSymLinkAliasChecker()) ;
-        }
-        servletContext = webapp.getServletContext() ;
-        server.setHandler(webapp) ;
-        // Replaced by Shiro.
-        if ( jettyConfig == null && serverConfig.authConfigFile != null )
-            security(webapp, serverConfig.authConfigFile) ;
-    }
-    
-    // This is now provided by Shiro.
-    private static void security(ServletContextHandler context, String authfile) {
-        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", authfile) ;
-        loginService.setIdentityService(identService) ;
-
-        securityHandler.setLoginService(loginService) ;
-        securityHandler.setAuthenticator(new BasicAuthenticator()) ;
-
-        context.setSecurityHandler(securityHandler) ;
-
-        serverLog.debug("Basic Auth Configuration = " + authfile) ;
-    }
-
-    private void configServer(String jettyConfig) {
-        try {
-            serverLog.info("Jetty server config file = " + jettyConfig) ;
-            server = new Server() ;
-            XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
-            configuration.configure(server) ;
-            serverConnector = (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 void defaultServerConfig(int port, boolean loopback) {
-        server = new Server() ;
-        HttpConnectionFactory f1 = new HttpConnectionFactory() ;
-        // Some people do try very large operations ... really, should use POST.
-        f1.getHttpConfiguration().setRequestHeaderSize(512 * 1024);
-        f1.getHttpConfiguration().setOutputBufferSize(5 * 1024 * 1024) ;
-        // Do not add "Server: Jetty(....) when not a development system.
-        if ( ! Fuseki.outputJettyServerHeader )
-            f1.getHttpConfiguration().setSendServerVersion(false) ;
-
-        // https is better done with a Jetty configuration file
-        // because there are several things to configure. 
-        // See "examples/fuseki-jetty-https.xml"
-
-        ServerConnector connector = new ServerConnector(server, f1) ;
-        connector.setPort(port) ;
-        server.addConnector(connector);
-        if ( loopback )
-            connector.setHost("localhost");
-        serverConnector = connector ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
new file mode 100644
index 0000000..55ab7d7
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
@@ -0,0 +1,68 @@
+/**
+ * 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.mgt;
+
+import static java.lang.String.format ;
+
+import org.apache.jena.fuseki.ctl.ActionAsyncTask;
+import org.apache.jena.fuseki.ctl.Backup;
+import org.apache.jena.fuseki.ctl.TaskBase;
+import org.apache.jena.fuseki.servlets.HttpAction ;
+import org.apache.jena.fuseki.servlets.ServletOps ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+
+public class ActionBackup extends ActionAsyncTask
+{
+    public ActionBackup() { super() ; }
+
+    @Override
+    protected Runnable createRunnable(HttpAction action) {
+        String name = action.getDatasetName() ;
+        if ( name == null ) {
+            action.log.error("Null for dataset name in item request") ;  
+            ServletOps.errorOccurred("Null for dataset name in item request");
+            return null ;
+        }
+        
+        action.log.info(format("[%d] Backup dataset %s", action.id, name)) ;
+        return new BackupTask(action) ;
+    }
+
+    static class BackupTask extends TaskBase {
+        static private Logger log = LoggerFactory.getLogger("Backup") ;
+        
+        public BackupTask(HttpAction action) {
+            super(action) ;
+        }
+
+        @Override
+        public void run() {
+            try {
+                String backupFilename = Backup.chooseFileName(datasetName) ;
+                log.info(format("[%d] >>>> Start backup %s -> %s", actionId, datasetName, backupFilename)) ;
+                Backup.backup(transactional, dataset, backupFilename) ;
+                log.info(format("[%d] <<<< Finish backup %s -> %s", actionId, datasetName, backupFilename)) ;
+            } catch (Exception ex) {
+                log.info(format("[%d] **** Exception in backup", actionId), ex) ;
+            }
+        }
+    }
+}
+    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
new file mode 100644
index 0000000..0dc540d
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
@@ -0,0 +1,95 @@
+/**
+ * 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.mgt;
+
+import static java.lang.String.format ;
+
+import java.io.File ;
+import java.io.IOException ;
+import java.nio.file.DirectoryStream ;
+import java.nio.file.Files ;
+import java.nio.file.Path ;
+import java.util.ArrayList ;
+import java.util.List ;
+import java.util.stream.Collectors ;
+
+import javax.servlet.http.HttpServletRequest ;
+import javax.servlet.http.HttpServletResponse ;
+
+import org.apache.jena.atlas.json.JsonBuilder ;
+import org.apache.jena.atlas.json.JsonValue ;
+import org.apache.jena.fuseki.ctl.ActionCtl;
+import org.apache.jena.fuseki.servlets.HttpAction ;
+import org.apache.jena.fuseki.servlets.ServletOps ;
+import org.apache.jena.fuseki.webapp.FusekiSystem;
+
+/**
+ * A JSON API to list all the backups in the backup directory
+ */
+public class ActionBackupList extends ActionCtl {
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
+        doCommon(req, resp);
+    }
+
+    @Override
+    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
+        doCommon(req, resp);
+    }
+
+    @Override
+    protected void perform(HttpAction action) {
+        JsonValue result = description(action) ;
+        ServletOps.setNoCache(action.response) ;
+        ServletOps.sendJsonReponse(action, result);
+    }
+        
+    private static DirectoryStream.Filter<Path> filterVisibleFiles = (entry) -> {
+        File f = entry.toFile() ;
+        return f.isFile() && !f.isHidden() ;
+    } ;
+
+    private JsonValue description(HttpAction action) {
+        if ( ! Files.isDirectory(FusekiSystem.dirBackups) )
+            ServletOps.errorOccurred(format("[%d] Backup area '%s' is not a directory", action.id, FusekiSystem.dirBackups)) ;
+        
+        List<Path> paths = new ArrayList<>() ;
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(FusekiSystem.dirBackups, filterVisibleFiles)) {
+            stream.forEach(paths::add) ;
+        } catch (IOException ex) {
+            action.log.error(format("[%d] Backup file list :: IOException :: %s", action.id, ex.getMessage())) ;
+            ServletOps.errorOccurred(ex);
+        }
+
+        List<String> fileNames = paths.stream().map((p)->p.getFileName().toString()).sorted().collect(Collectors.toList()) ;
+
+        JsonBuilder builder = new JsonBuilder() ;
+        builder.startObject("top") ;
+        builder.key("backups") ;
+
+        builder.startArray() ;
+        fileNames.forEach(builder::value) ;
+        builder.finishArray() ;
+
+        builder.finishObject("top") ;
+        return builder.build() ; 
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
index 229726a..79b6d13 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
@@ -43,12 +43,15 @@ import org.apache.jena.datatypes.xsd.XSDDatatype ;
 import org.apache.jena.fuseki.FusekiLib ;
 import org.apache.jena.fuseki.build.DatasetDescriptionRegistry;
 import org.apache.jena.fuseki.build.FusekiBuilder;
+import org.apache.jena.fuseki.build.FusekiConst;
 import org.apache.jena.fuseki.build.Template;
 import org.apache.jena.fuseki.build.TemplateFunctions;
 import org.apache.jena.fuseki.ctl.ActionContainerItem;
+import org.apache.jena.fuseki.ctl.JsonDescription;
 import org.apache.jena.fuseki.server.DataAccessPoint;
 import org.apache.jena.fuseki.server.DataService;
 import org.apache.jena.fuseki.server.FusekiVocab;
+import org.apache.jena.fuseki.server.ServerConst;
 import org.apache.jena.fuseki.servlets.ActionLib;
 import org.apache.jena.fuseki.servlets.HttpAction;
 import org.apache.jena.fuseki.servlets.ServletOps;
@@ -95,7 +98,7 @@ public class ActionDatasets extends ActionContainerItem {
         action.log.info(format("[%d] GET datasets", action.id)) ;
         JsonBuilder builder = new JsonBuilder() ;
         builder.startObject("D") ;
-        builder.key(MgtConst.datasets) ;
+        builder.key(ServerConst.datasets) ;
         JsonDescription.arrayDatasets(builder, action.getDataAccessPointRegistry());
         builder.finishObject("D") ;
         return builder.build() ;
@@ -434,7 +437,7 @@ public class ActionDatasets extends ActionContainerItem {
                 dbName = dbName.substring(1) ;
             
             String update =  StrUtils.strjoinNL
-                (SystemState.PREFIXES,
+                (FusekiConst.PREFIXES,
                  "DELETE { GRAPH ?g { ?s fu:status ?state } }",
                  "INSERT { GRAPH ?g { ?s fu:status "+FmtUtils.stringForRDFNode(newState)+" } }",
                  "WHERE {",

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionItem.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionItem.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionItem.java
deleted file mode 100644
index 3308880..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionItem.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.mgt;
-
-import org.apache.jena.atlas.json.JsonValue ;
-import org.apache.jena.fuseki.ctl.ActionContainerItem;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletOps ;
-import org.apache.jena.web.HttpSC ;
-
-/** Action on items in a container, but not the container itself */ 
-public abstract class ActionItem extends ActionContainerItem
-{
-    public ActionItem() { super() ; }
-    
-    @Override
-    final
-    protected JsonValue execGetContainer(HttpAction action) {
-        ServletOps.error(HttpSC.METHOD_NOT_ALLOWED_405) ;
-        return null ;
-    }
-
-    @Override
-    final
-    protected JsonValue execPostContainer(HttpAction action) {
-        ServletOps.error(HttpSC.METHOD_NOT_ALLOWED_405) ;
-        return null ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
index 3e060cd..d3c0873 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
@@ -32,7 +32,9 @@ import org.apache.jena.atlas.json.JsonBuilder ;
 import org.apache.jena.atlas.json.JsonValue ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.ctl.ActionCtl;
+import org.apache.jena.fuseki.ctl.JsonDescription;
 import org.apache.jena.fuseki.server.DataAccessPointRegistry ;
+import org.apache.jena.fuseki.server.ServerConst;
 import org.apache.jena.fuseki.servlets.HttpAction ;
 import org.apache.jena.fuseki.servlets.ServletOps ;
 
@@ -98,16 +100,16 @@ public class ActionServerStatus extends ActionCtl
 //            .finishObject() ;
 
         builder
-            .key(MgtConst.version).value(versionStr)
-            .key(MgtConst.built).value(builtDateStr)
-            .key(MgtConst.startDT).value(Fuseki.serverStartedAt())
-            .key(MgtConst.uptime).value(Fuseki.serverUptimeSeconds())
+            .key(ServerMgtConst.version).value(versionStr)
+            .key(ServerMgtConst.built).value(builtDateStr)
+            .key(ServerMgtConst.startDT).value(Fuseki.serverStartedAt())
+            .key(ServerMgtConst.uptime).value(Fuseki.serverUptimeSeconds())
             ;
             
     }
 
     private void describeDatasets(JsonBuilder builder, DataAccessPointRegistry registry) {
-        builder.key(MgtConst.datasets) ;
+        builder.key(ServerConst.datasets) ;
         JsonDescription.arrayDatasets(builder, registry);
     }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
deleted file mode 100644
index 749aa3e..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/JsonDescription.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.mgt;
-
-import java.util.List ;
-
-import org.apache.jena.atlas.json.JsonBuilder ;
-import org.apache.jena.fuseki.server.DataAccessPoint ;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry ;
-import org.apache.jena.fuseki.server.Endpoint ;
-import org.apache.jena.fuseki.server.Operation ;
-
-/** Create a description of a service */
-public class JsonDescription {
-    
-    public static void arrayDatasets(JsonBuilder builder, DataAccessPointRegistry registry) {
-        builder.startArray() ;
-        for ( String ds : registry.keys() ) {
-            DataAccessPoint access = registry.get(ds) ;
-            JsonDescription.describe(builder, access) ;
-        }
-        builder.finishArray() ;
-    }
-    
-    public static void describe(JsonBuilder builder, DataAccessPoint access) {
-        builder.startObject() ;
-        builder.key(MgtConst.dsName).value(access.getName()) ;
-        
-        builder.key(MgtConst.dsState).value(access.getDataService().isAcceptingRequests()) ;
-        
-        builder.key(MgtConst.dsService) ;
-        builder.startArray() ;
-        
-        for ( Operation operation : access.getDataService().getOperations() ) {
-            List<Endpoint> endpoints = access.getDataService().getEndpoints(operation) ;
-            describe(builder, operation, endpoints) ;
-        }
-        builder.finishArray() ;
-        builder.finishObject() ;
-    }
-    
-    private static void describe(JsonBuilder builder, Operation operation, List<Endpoint> endpoints) {
-        builder.startObject() ;
-        
-        builder.key(MgtConst.srvType).value(operation.getName()) ;
-        builder.key(MgtConst.srvDescription).value(operation.getDescription()) ;
-        builder.key(MgtConst.srvEndpoints) ;
-        builder.startArray() ;
-        for ( Endpoint endpoint : endpoints )
-            builder.value(endpoint.getEndpoint()) ;
-        builder.finishArray() ;
-
-        builder.finishObject() ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtConst.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtConst.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtConst.java
deleted file mode 100644
index 2659313..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtConst.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.mgt;
-
-/** Various constants used in the admin functions */ 
-public class MgtConst {
-    public static final String  opDump          = "dump" ;  
-    public static final String  opPing          = "ping" ;
-    
-    public static final String  opStats         = "stats" ;  
-    public static final String  opDatasets      = "datasets" ;
-    public static final String  opListBackups   = "backups-list" ;
-    public static final String  opServer        = "server" ;
-    
-    // JSON constants
-    public static final String datasets         = "datasets" ;
-    public static final String uptime           = "uptime" ;
-    public static final String startDT          = "startDateTime" ;
-    public static final String server           = "server" ;
-    public static final String port             = "port" ;
-    public static final String hostname         = "hostname" ;
-    public static final String admin            = "admin" ;
-    public static final String version          = "version" ;
-    public static final String built            = "built" ;
-    public static final String services         = "services" ;
-    public static final String operation        = "operation" ;
-    public static final String description      = "description" ;
-    public static final String endpoints        = "endpoints" ;
-    public static final String dsName           = "ds.name" ;
-    public static final String dsState          = "ds.state" ;
-    public static final String dsService        = "ds.services" ;
-    public static final String srvType          = "srv.type" ;
-    public static final String srvDescription   = "srv.description" ;
-    public static final String srvEndpoints     = "srv.endpoints" ;
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtJMX.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtJMX.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtJMX.java
deleted file mode 100644
index f9023fe..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/MgtJMX.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.mgt ;
-
-
-public class MgtJMX
-{
-  public static void removeJMX() {  }
-    
-//    public static void addJMX() {
-//        DatasetRegistry registry = DatasetRegistry.get() ;
-//        for (String ds : registry.keys()) {
-//            DataAccessPoint dsRef = registry.get(ds) ;
-//            addJMX(dsRef) ;
-//        }
-//    }
-//
-//    private static void addJMX(DataAccessPoint dapt) {
-//        String x = datasetNames ;
-//        // if ( x.startsWith("/") )
-//        // x = x.substring(1) ;
-//        ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x, dapt) ;
-//        // For all endpoints
-//        for (ServiceRef sRef : dapt.getServiceRefs()) {
-//            ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name, sRef) ;
-//        }
-//    }
-//
-//    public static void removeJMX() {
-//        DatasetRegistry registry = DatasetRegistry.get() ;
-//        for (String ds : registry.keys()) {
-//            DataAccessPoint ref = registry.get(ds) ;
-//            removeJMX(ref) ;
-//        }
-//    }
-//
-//    private static void removeJMX(DatasetRef dsRef) {
-//        String x = dsRef.getName() ;
-//        ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x) ;
-//        for (ServiceRef sRef : dsRef.getServiceRefs()) {
-//            ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name) ;
-//        }
-//    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
new file mode 100644
index 0000000..2af5e44
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
@@ -0,0 +1,39 @@
+/*
+ * 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.mgt;
+
+/**
+ * Various constants used in the management API functions and JSON responses in the
+ * webapp/full server.
+ */
+public class ServerMgtConst {
+    public static final String  opDatasets      = "datasets" ;
+    public static final String  opListBackups   = "backups-list" ;
+    public static final String  opServer        = "server" ;
+    
+    public static final String uptime           = "uptime" ;
+    public static final String startDT          = "startDateTime" ;
+//    public static final String server           = "server" ;
+//    public static final String port             = "port" ;
+    public static final String hostname         = "hostname" ;
+    public static final String admin            = "admin" ;
+    public static final String version          = "version" ;
+    public static final String built            = "built" ;
+    public static final String services         = "services" ;
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServiceMXBean.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServiceMXBean.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServiceMXBean.java
deleted file mode 100644
index 72ce3a3..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServiceMXBean.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.mgt;
-
-public interface ServiceMXBean
-{
-    String getName() ;
-    
-    long getRequests() ;
-    long getRequestsGood() ;
-    long getRequestsBad() ;
-    
-//    void enable() ;
-//    void disable() ;
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/ServerConst.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/ServerConst.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/ServerConst.java
new file mode 100644
index 0000000..f8b0f91
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/ServerConst.java
@@ -0,0 +1,41 @@
+/**
+ * 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;
+
+/** Various constants used in the API functions and JSON responses. */ 
+public class ServerConst {
+    // Location under /$/
+    public static final String  opDump          = "dump" ;  
+    public static final String  opPing          = "ping" ;
+    public static final String  opStats         = "stats" ;
+    
+//    // JSON constants
+    public static final String datasets         = "datasets" ;
+    public static final String operation        = "operation" ;
+    public static final String description      = "description" ;
+    public static final String endpoints        = "endpoints" ;
+
+    public static final String dsName           = "ds.name" ;
+    public static final String dsState          = "ds.state" ;
+    public static final String dsService        = "ds.services" ;
+    public static final String srvType          = "srv.type" ;
+    public static final String srvDescription   = "srv.description" ;
+    public static final String srvEndpoints     = "srv.endpoints" ;
+
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/06f59125/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
index ada2f28..c5431a2 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
@@ -19,7 +19,6 @@
 package org.apache.jena.fuseki.webapp;
 
 import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.tdb.StoreConnection ;
@@ -93,20 +92,5 @@ public class SystemState {
         dsg     = (DatasetGraphTransaction)(dataset.asDatasetGraph()) ;
         dsg.getContext().set(TDB.symUnionDefaultGraph, false) ;
     }
-    
-    public static String PREFIXES = StrUtils.strjoinNL
-        ("BASE            <http://example/base#>",
-         "PREFIX ja:      <http://jena.hpl.hp.com/2005/11/Assembler#>",
-         "PREFIX fu:      <http://jena.apache.org/fuseki#>",
-         "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 sdb:     <http://jena.hpl.hp.com/2007/sdb#>",
-         "PREFIX list:    <http://jena.apache.org/ARQ/list#>",
-         "PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>",
-         "PREFIX apf:     <http://jena.apache.org/ARQ/property#>",
-         "PREFIX afn:     <http://jena.apache.org/ARQ/function#>",
-         "") ;
 }