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/09/21 10:16:01 UTC

[50/70] [abbrv] [partial] jena git commit: JENA-1597: separate jena-fuseki-webapp module

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/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
deleted file mode 100644
index 0dc540d..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
+++ /dev/null
@@ -1,95 +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 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/e8abcbb6/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
deleted file mode 100644
index 11a428e..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
+++ /dev/null
@@ -1,511 +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 static java.lang.String.format ;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringReader;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
-
-import javax.servlet.http.HttpServletRequest ;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.jena.atlas.RuntimeIOException;
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.json.JsonBuilder ;
-import org.apache.jena.atlas.json.JsonValue ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.atlas.lib.InternalErrorException ;
-import org.apache.jena.atlas.lib.StrUtils ;
-import org.apache.jena.atlas.web.ContentType ;
-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;
-import org.apache.jena.fuseki.system.Upload;
-import org.apache.jena.fuseki.webapp.FusekiSystem;
-import org.apache.jena.fuseki.webapp.SystemState;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.query.Dataset;
-import org.apache.jena.query.ReadWrite;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.riot.* ;
-import org.apache.jena.riot.system.StreamRDF ;
-import org.apache.jena.riot.system.StreamRDFLib ;
-import org.apache.jena.shared.uuid.JenaUUID ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.sparql.core.Quad ;
-import org.apache.jena.sparql.util.FmtUtils ;
-import org.apache.jena.tdb.transaction.DatasetGraphTransaction ;
-import org.apache.jena.update.UpdateAction ;
-import org.apache.jena.update.UpdateFactory ;
-import org.apache.jena.update.UpdateRequest ;
-import org.apache.jena.web.HttpSC ;
-
-public class ActionDatasets extends ActionContainerItem {
-    
-    private static Dataset system = SystemState.getDataset() ;
-    private static DatasetGraphTransaction systemDSG = SystemState.getDatasetGraph() ; 
-    
-    static private Property pServiceName = FusekiVocab.pServiceName ;
-    static private Property pStatus = FusekiVocab.pStatus ;
-
-    private static final String paramDatasetName    = "dbName" ;
-    private static final String paramDatasetType    = "dbType" ;
-    private static final String tDatabaseTDB        = "tdb" ;
-    private static final String tDatabaseTDB2       = "tdb2" ;
-    private static final String tDatabaseMem        = "mem" ;
-
-    public ActionDatasets() { super() ; }
-    
-    // ---- GET : return details of dataset or datasets.
-    @Override
-    protected JsonValue execGetContainer(HttpAction action) { 
-        action.log.info(format("[%d] GET datasets", action.id)) ;
-        JsonBuilder builder = new JsonBuilder() ;
-        builder.startObject("D") ;
-        builder.key(ServerConst.datasets) ;
-        JsonDescription.arrayDatasets(builder, action.getDataAccessPointRegistry());
-        builder.finishObject("D") ;
-        return builder.build() ;
-    }
-
-    @Override
-    protected JsonValue execGetItem(HttpAction action) {
-        action.log.info(format("[%d] GET dataset %s", action.id, action.getDatasetName())) ;
-        JsonBuilder builder = new JsonBuilder() ;
-        DataAccessPoint dsDesc = action.getDataAccessPointRegistry().get(action.getDatasetName()) ;
-        if ( dsDesc == null )
-            ServletOps.errorNotFound("Not found: dataset "+action.getDatasetName());
-        JsonDescription.describe(builder, dsDesc) ;
-        return builder.build() ;
-    }
-    
-    // ---- POST 
-    
-    @Override
-    protected JsonValue execPostContainer(HttpAction action) {
-        JenaUUID uuid = JenaUUID.generate() ;
-        DatasetDescriptionRegistry registry = new DatasetDescriptionRegistry() ;
-        
-        ContentType ct = FusekiLib.getContentType(action) ;
-        
-        boolean hasParams = action.request.getParameterNames().hasMoreElements();
-        
-        if ( ct == null && ! hasParams ) {
-            ServletOps.errorBadRequest("Bad request - Content-Type or both parameters dbName and dbType required");
-            // Or do "GET over POST"
-            //return execGetContainer(action);
-        }
-        
-        boolean committed = false ;
-        // Also acts as a concurrency lock
-        system.begin(ReadWrite.WRITE) ;
-        String systemFileCopy = null ;
-        String configFile = null ;
-            
-        try {
-            // Where to build the templated service/database. 
-            Model model = ModelFactory.createDefaultModel() ;
-            StreamRDF dest = StreamRDFLib.graph(model.getGraph()) ;
-    
-            if ( hasParams || WebContent.isHtmlForm(ct) )
-                assemblerFromForm(action, dest) ;
-            else if ( WebContent.isMultiPartForm(ct) )
-                assemblerFromUpload(action, dest) ;
-            else
-                assemblerFromBody(action, dest) ;
-            
-            // ----
-            // Keep a persistent copy immediately.  This is not used for
-            // anything other than being "for the record".
-            systemFileCopy = FusekiSystem.dirFileArea.resolve(uuid.asString()).toString() ;
-            try ( OutputStream outCopy = IO.openOutputFile(systemFileCopy) ) {
-                RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;
-            }
-            // ----
-
-            // Process configuration.
-            Statement stmt = getOne(model, null, pServiceName, null) ;
-            if ( stmt == null ) {
-                StmtIterator sIter = model.listStatements(null, pServiceName, (RDFNode)null ) ;
-                if ( ! sIter.hasNext() )
-                    ServletOps.errorBadRequest("No name given in description of Fuseki service") ;
-                sIter.next() ;
-                if ( sIter.hasNext() )
-                    ServletOps.errorBadRequest("Multiple names given in description of Fuseki service") ;
-                throw new InternalErrorException("Inconsistent: getOne didn't fail the second time") ;
-            }
-                
-            if ( ! stmt.getObject().isLiteral() )
-                ServletOps.errorBadRequest("Found "+FmtUtils.stringForRDFNode(stmt.getObject())+" : Service names are strings, then used to build the external URI") ;
-
-            Resource subject = stmt.getSubject() ;
-            Literal object = stmt.getObject().asLiteral() ;
-            
-            if ( object.getDatatype() != null && ! object.getDatatype().equals(XSDDatatype.XSDstring) )
-                action.log.warn(format("[%d] Service name '%s' is not a string", action.id, FmtUtils.stringForRDFNode(object)));
-            
-            String datasetPath ;
-            {   // Check the name provided.
-                String datasetName = object.getLexicalForm() ;
-                
-                // ---- Check and canonicalize name.
-                if ( datasetName.isEmpty() )
-                    ServletOps.error(HttpSC.BAD_REQUEST_400, "Empty dataset name") ;
-                if ( StringUtils.isBlank(datasetName) )
-                    ServletOps.error(HttpSC.BAD_REQUEST_400, format("Whitespace dataset name: '%s'", datasetName)) ;
-                if ( datasetName.contains(" ") )
-                    ServletOps.error(HttpSC.BAD_REQUEST_400, format("Bad dataset name (contains spaces) '%s'",datasetName)) ;
-                if ( datasetName.equals("/") )
-                    ServletOps.error(HttpSC.BAD_REQUEST_400, format("Bad dataset name '%s'",datasetName)) ;
-                datasetPath = DataAccessPoint.canonical(datasetName) ;
-            }
-            action.log.info(format("[%d] Create database : name = %s", action.id, datasetPath)) ;
-            // ---- Check whether it already exists 
-            if ( action.getDataAccessPointRegistry().isRegistered(datasetPath) )
-                // And abort.
-                ServletOps.error(HttpSC.CONFLICT_409, "Name already registered "+datasetPath) ;
-            
-            configFile = FusekiSystem.generateConfigurationFilename(datasetPath) ;
-            List<String> existing = FusekiSystem.existingConfigurationFile(datasetPath) ;
-            if ( ! existing.isEmpty() )
-                ServletOps.error(HttpSC.CONFLICT_409, "Configuration file for '"+datasetPath+"' already exists") ;
-
-            // Write to configuration directory.
-            try ( OutputStream outCopy = IO.openOutputFile(configFile) ) {
-                RDFDataMgr.write(outCopy, model, Lang.TURTLE) ;
-            }
-
-            // Currently do nothing with the system database.
-            // In the future ... maybe ...
-//            Model modelSys = system.getNamedModel(gn.getURI()) ;
-//            modelSys.removeAll(null, pStatus, null) ;
-//            modelSys.add(subject, pStatus, FusekiVocab.stateActive) ;
-            
-            // Need to be in Resource space at this point.
-            DataAccessPoint ref = FusekiBuilder.buildDataAccessPoint(subject, registry) ;
-            ref.getDataService().goActive();
-            action.getDataAccessPointRegistry().register(datasetPath, ref) ;
-            action.getResponse().setContentType(WebContent.contentTypeTextPlain); 
-            ServletOps.success(action) ;
-            system.commit();
-            committed = true ;
-            
-        } catch (IOException ex) { IO.exception(ex); }
-        finally { 
-            if ( ! committed ) {
-                if ( systemFileCopy != null ) FileOps.deleteSilent(systemFileCopy);
-                if ( configFile != null ) FileOps.deleteSilent(configFile);
-                system.abort() ; 
-            }
-            system.end() ; 
-        }
-        return null ;
-    }
-
-    @Override
-    protected JsonValue execPostItem(HttpAction action) {
-        String name = action.getDatasetName() ;
-        if ( name == null )
-            name = "''" ;
-        action.log.info(format("[%d] POST dataset %s", action.id, name)) ;
-        
-        if ( action.getDataAccessPoint() == null )
-            ServletOps.errorNotFound("Not found: dataset "+action.getDatasetName());
-        
-        DataService dSrv = action.getDataService() ;
-        if ( dSrv == null )
-            // If not set explicitly, take from DataAccessPoint
-            dSrv = action.getDataAccessPoint().getDataService() ;
-        
-        String s = action.request.getParameter("state") ;
-        if ( s == null || s.isEmpty() )
-            ServletOps.errorBadRequest("No state change given") ;
-
-        // setDatasetState is a transaction on the persistent state of the server. 
-        if ( s.equalsIgnoreCase("active") ) {
-            action.log.info(format("[%d] REBUILD DATASET %s", action.id, name)) ;
-            setDatasetState(name, FusekiVocab.stateActive) ;
-            dSrv.goActive() ; 
-            // DatasetGraph dsg = ???? ;
-            //dSrv.activate(dsg) ; 
-            //dSrv.activate() ;
-        } else if ( s.equalsIgnoreCase("offline") ) {
-            action.log.info(format("[%d] OFFLINE DATASET %s", action.id, name)) ;
-            //DataAccessPoint access = action.getDataAccessPoint() ;
-            //access.goOffline() ;
-            dSrv.goOffline() ;  // Affects the target of the name. 
-            setDatasetState(name, FusekiVocab.stateOffline) ;  
-            //dSrv.offline() ;
-        } else if ( s.equalsIgnoreCase("unlink") ) {
-            action.log.info(format("[%d] UNLINK ACCESS NAME %s", action.id, name)) ;
-            //DataAccessPoint access = action.getDataAccessPoint() ;
-            ServletOps.errorNotImplemented("unlink: dataset"+action.getDatasetName());
-            //access.goOffline() ;
-            // Registry?
-        }
-        else
-            ServletOps.errorBadRequest("State change operation '"+s+"' not recognized");
-        return null ;
-    }
-
-    // ---- DELETE
-    
-    @Override
-    protected void execDeleteItem(HttpAction action) {
-        // Does not exist?
-        String name = action.getDatasetName() ;
-        if ( name == null )
-            name = "" ;
-        action.log.info(format("[%d] DELETE ds=%s", action.id, name)) ;
-
-        if ( ! action.getDataAccessPointRegistry().isRegistered(name) )
-            ServletOps.errorNotFound("No such dataset registered: "+name);
-
-        // This acts as a lock. 
-        systemDSG.begin(ReadWrite.WRITE) ;
-        boolean committed = false ;
-
-        try {
-            // Here, go offline.
-            // Need to reference count operations when they drop to zero
-            // or a timer goes off, we delete the dataset.
-
-            DataAccessPoint ref = action.getDataAccessPointRegistry().get(name) ;
-            
-            // Redo check inside transaction.
-            if ( ref == null )
-                ServletOps.errorNotFound("No such dataset registered: "+name);
-            
-            String filename = name.startsWith("/") ? name.substring(1) : name;
-            List<String> configurationFiles = FusekiSystem.existingConfigurationFile(filename);
-            if  ( configurationFiles.size() != 1 ) {
-                // This should not happen.
-                action.log.warn(format("[%d] There are %d configuration files, not one.", action.id, configurationFiles.size()));
-                ServletOps.errorOccurred(
-                    format(
-                        "There are %d configuration files, not one. Delete not performed; clearup of the filesystem needed.",
-                        action.id, configurationFiles.size()));
-            }
-            
-            String cfgPathname = configurationFiles.get(0);
-            
-            // Delete configuration file.
-            // Once deleted, server restart will not have the database. 
-            FileOps.deleteSilent(cfgPathname);
-
-            // Get before removing.
-            DataService dataService = ref.getDataService();
-            
-            // Make it invisible in this running server.
-            action.getDataAccessPointRegistry().remove(name);
-
-            // Delete the database for real only when it is in the server "run/databases"
-            // area. Don't delete databases that reside elsewhere. We do delete the
-            // configuration file, so the databases will not be associated with the server
-            // anymore.
-            
-            // JENA-1586: Remove from current running Fuseki server.
-
-            boolean isTDB1 = org.apache.jena.tdb.sys.TDBInternal.isTDB1(dataService.getDataset());
-            boolean isTDB2 = org.apache.jena.tdb2.sys.TDBInternal.isTDB2(dataService.getDataset());
-
-            dataService.shutdown();
-            // JENA-1481: Really delete files.
-            if ( ( isTDB1 || isTDB2 ) ) {
-                // Delete databases created by the UI, or the admin operation, which are
-                // in predictable, unshared location on disk.
-                // There may not be any database files, the in-memory case.
-                Path pDatabase = FusekiSystem.dirDatabases.resolve(filename);
-                if ( Files.exists(pDatabase)) {
-                    try {
-                        if ( Files.isSymbolicLink(pDatabase)) {
-                            action.log.info(format("[%d] Database is a symbolic link, not removing files", action.id, pDatabase));
-                        } else {
-                            IO.deleteAll(pDatabase);
-                            action.log.info(format("[%d] Deleted database files %s", action.id, pDatabase));
-                        }
-                    } catch (RuntimeIOException ex) {
-                        action.log.error(format("[%d] Error while deleting database files %s: %s", action.id, pDatabase, ex.getMessage()), ex);
-                        // But we have managed to remove it from the running server, and removed its configuration, so declare victory. 
-                    }
-                }
-            }
-            
-            // -- System database
-            // Find graph associated with this dataset name.
-            // (Statically configured databases aren't in the system database.)
-            Node n = NodeFactory.createLiteral(DataAccessPoint.canonical(name)) ;
-            Quad q = getOne(systemDSG, null, null, pServiceName.asNode(), n) ;
-//            if ( q == null )
-//                ServletOps.errorBadRequest("Failed to find dataset for '"+name+"'");
-            if ( q != null ) {
-                Node gn = q.getGraph() ;
-                //action.log.info("SHUTDOWN NEEDED"); // To ensure it goes away?
-                systemDSG.deleteAny(gn, null, null, null) ;
-            }
-            systemDSG.commit() ;
-            committed = true ;
-            ServletOps.success(action) ;
-        } finally { 
-            if ( ! committed ) systemDSG.abort() ; 
-            systemDSG.end() ; 
-        }
-    }
-
-    private static void assemblerFromBody(HttpAction action, StreamRDF dest) {
-        bodyAsGraph(action, dest) ;
-    }
-
-    private static Map<String, String> dbTypeToTemplate = new HashMap<>();
-    static {
-        dbTypeToTemplate.put(tDatabaseTDB,  Template.templateTDB1_FN);
-        dbTypeToTemplate.put(tDatabaseTDB2, Template.templateTDB2_FN);
-        dbTypeToTemplate.put(tDatabaseMem,  Template.templateTIM_MemFN);
-    }
-    
-    private static void assemblerFromForm(HttpAction action, StreamRDF dest) {
-        String dbType = action.getRequest().getParameter(paramDatasetType) ;
-        String dbName = action.getRequest().getParameter(paramDatasetName) ;
-        if ( StringUtils.isBlank(dbType) || StringUtils.isBlank(dbName) )
-            ServletOps.errorBadRequest("Required parameters: dbName and dbType");
-        
-        Map<String, String> params = new HashMap<>() ;
-        
-        if ( dbName.startsWith("/") )
-            params.put(Template.NAME, dbName.substring(1)) ;
-        else
-            params.put(Template.NAME, dbName) ;
-        FusekiSystem.addGlobals(params); 
-        
-        //action.log.info(format("[%d] Create database : name = %s, type = %s", action.id, dbName, dbType )) ;
-        
-        String template = dbTypeToTemplate.get(dbType.toLowerCase(Locale.ROOT));
-        if ( template == null )
-                ServletOps.errorBadRequest(format("dbType can be only '%s', '%s' or '%s'", tDatabaseTDB, tDatabaseTDB2, tDatabaseMem)) ;
-        
-        String syntax =  TemplateFunctions.templateFile(template, params, Lang.TTL) ;
-        RDFParser.create().source(new StringReader(syntax)).base("http://base/").lang(Lang.TTL).parse(dest);
-    }
-
-    private static void assemblerFromUpload(HttpAction action, StreamRDF dest) {
-        Upload.fileUploadWorker(action, dest);
-    }
-
-    // Persistent state change.
-    private static void setDatasetState(String name, Resource newState) {
-        boolean committed = false ;
-        system.begin(ReadWrite.WRITE) ;
-        try {
-            String dbName = name ;
-            if ( dbName.startsWith("/") )
-                dbName = dbName.substring(1) ;
-            
-            String update =  StrUtils.strjoinNL
-                (FusekiConst.PREFIXES,
-                 "DELETE { GRAPH ?g { ?s fu:status ?state } }",
-                 "INSERT { GRAPH ?g { ?s fu:status "+FmtUtils.stringForRDFNode(newState)+" } }",
-                 "WHERE {",
-                 "   GRAPH ?g { ?s fu:name '"+dbName+"' ; ",
-                 "                 fu:status ?state .",
-                 "   }",
-                 "}"
-                 ) ;
-            UpdateRequest req =  UpdateFactory.create(update) ;
-            UpdateAction.execute(req, system);
-            system.commit();
-            committed = true ;
-        } finally { 
-            if ( ! committed ) system.abort() ; 
-            system.end() ; 
-        }
-    }
-    
-    // ---- Auxiliary functions
-
-    private static Quad getOne(DatasetGraph dsg, Node g, Node s, Node p, Node o) {
-        Iterator<Quad> iter = dsg.findNG(g, s, p, o) ;
-        if ( ! iter.hasNext() )
-            return null ;
-        Quad q = iter.next() ;
-        if ( iter.hasNext() )
-            return null ;
-        return q ;
-    }
-    
-    private static Statement getOne(Model m, Resource s, Property p, RDFNode o) {
-        StmtIterator iter = m.listStatements(s, p, o) ;
-        if ( ! iter.hasNext() )
-            return null ;
-        Statement stmt = iter.next() ;
-        if ( iter.hasNext() )
-            return null ;
-        return stmt ;
-    }
-    
-    // XXX Merge with Upload.incomingData
-    
-    private static void bodyAsGraph(HttpAction action, StreamRDF dest) {
-        HttpServletRequest request = action.request ;
-        String base = ActionLib.wholeRequestURL(request) ;
-        ContentType ct = FusekiLib.getContentType(request) ;
-        Lang lang = RDFLanguages.contentTypeToLang(ct.getContentType()) ;
-        if ( lang == null ) {
-            ServletOps.errorBadRequest("Unknown content type for triples: " + ct) ;
-            return ;
-        }
-        InputStream input = null ;
-        try { input = request.getInputStream() ; } 
-        catch (IOException ex) { IO.exception(ex) ; }
-
-        // Don't log - assemblers are typically small.
-        // Adding this to the log confuses things.
-        // Reserve logging for data uploads. 
-//        long len = request.getContentLengthLong() ;
-//        if ( action.verbose ) {
-//            if ( len >= 0 )
-//                alog.info(format("[%d]   Body: Content-Length=%d, Content-Type=%s, Charset=%s => %s", action.id, len,
-//                                ct.getContentType(), ct.getCharset(), lang.getName())) ;
-//            else
-//                alog.info(format("[%d]   Body: Content-Type=%s, Charset=%s => %s", action.id, ct.getContentType(),
-//                                ct.getCharset(), lang.getName())) ;
-//        }
-        dest.prefix("root", base+"#");
-        ActionLib.parse(action, dest, input, lang, base) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java
deleted file mode 100644
index aeb83f4..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java
+++ /dev/null
@@ -1,60 +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 static org.apache.jena.riot.WebContent.charsetUTF8 ;
-import static org.apache.jena.riot.WebContent.contentTypeTextPlain ;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.fuseki.ctl.ActionCtl;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletOps ;
-
-public class ActionLogs extends ActionCtl
-{
-    public ActionLogs() { super() ; } 
-    
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
-        doCommon(req, resp); 
-    }
-    
-    @Override
-    protected void perform(HttpAction action) {
-        execGet(action) ;
-    }
-
-    protected void execGet(HttpAction action) {
-        try {
-            HttpServletResponse response = action.response ;
-            ServletOutputStream out = response.getOutputStream() ;
-            response.setContentType(contentTypeTextPlain) ;
-            response.setCharacterEncoding(charsetUTF8) ;
-            out.println("Not implemented yet") ;
-            out.println() ; 
-            out.flush() ;
-            ServletOps.success(action);
-        } catch (IOException ex) { ServletOps.errorOccurred(ex) ; }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/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
deleted file mode 100644
index d3c0873..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
+++ /dev/null
@@ -1,117 +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 static org.apache.jena.riot.WebContent.charsetUTF8 ;
-import static org.apache.jena.riot.WebContent.contentTypeJSON ;
-
-import java.io.IOException ;
-
-import javax.servlet.ServletOutputStream ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.json.JSON ;
-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 ;
-
-/** Description of datasets for a server */ 
-public class ActionServerStatus extends ActionCtl
-{
-    public ActionServerStatus() { super() ; }
-    
-    @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) {
-        try {
-            description(action) ;
-            ServletOps.success(action) ;
-        } catch (IOException e) {
-            ServletOps.errorOccurred(e) ;
-        }
-    }
-    
-    private void description(HttpAction action) throws IOException {
-        ServletOutputStream out = action.response.getOutputStream() ;
-        action.response.setContentType(contentTypeJSON);
-        action.response.setCharacterEncoding(charsetUTF8) ;
-        
-        JsonBuilder builder = new JsonBuilder() ; 
-        builder.startObject() ;
-        describeServer(builder, action.request.getLocalPort()) ;
-        describeDatasets(builder, action.getDataAccessPointRegistry()) ;
-        builder.finishObject() ;
-        
-        JsonValue v = builder.build() ;
-        JSON.write(out, v) ;
-        out.println() ; 
-        out.flush() ;
-    }
-
-    private void describeServer(JsonBuilder builder, int requestPort) {
-        String versionStr = Fuseki.VERSION ;
-        String builtDateStr = Fuseki.BUILD_DATE ;
-        if ( versionStr == null || versionStr.startsWith("${") )
-            versionStr = "Development" ;
-        if ( builtDateStr == null || builtDateStr.startsWith("${") )
-            builtDateStr = "Unknown" ;
-
-//        builder
-//            .key(JsonConst.server)
-//            .startObject()
-//            .key(JsonConst.port).value(port)
-//            .finishObject() ;
-//        builder
-//            .key(JsonConst.admin)
-//            .startObject()
-//            .key(JsonConst.port).value(requestPort)
-//            .finishObject() ;
-
-        builder
-            .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(ServerConst.datasets) ;
-        JsonDescription.arrayDatasets(builder, registry);
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/DumpServlet.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/DumpServlet.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/DumpServlet.java
deleted file mode 100644
index c9e679e..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/DumpServlet.java
+++ /dev/null
@@ -1,300 +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.
- */
-
-/** A servlet that dumps its request
- */
-
-// Could be neater - much, much neater!
-package org.apache.jena.fuseki.mgt;
-
-import java.io.BufferedReader ;
-import java.io.IOException ;
-import java.io.PrintWriter ;
-import java.io.StringWriter ;
-import java.util.Date ;
-import java.util.Enumeration ;
-import java.util.Locale ;
-import java.util.Properties ;
-
-import javax.servlet.ServletContext ;
-import javax.servlet.http.Cookie ;
-import javax.servlet.http.HttpServlet ;
-import javax.servlet.http.HttpServletRequest ;
-import javax.servlet.http.HttpServletResponse ;
-
-import org.apache.jena.atlas.io.IO ;
-
-public class DumpServlet extends HttpServlet
-{
-    public DumpServlet() { }
-
-    @Override
-    public void doGet(HttpServletRequest req, HttpServletResponse resp)
-    {
-        try {
-            PrintWriter out = resp.getWriter() ;
-            resp.setContentType("text/html");
-
-            String now = new Date().toString() ;
-
-            // HEAD
-            out.println("<html>") ;
-            out.println("<head>") ;
-            out.println("<Title>Dump @ "+now+"</Title>") ;
-            // Reduce the desire to cache it.
-            out.println("<meta CONTENT=now HTTP-EQUIV=expires>") ;
-            out.println("</head>") ;
-
-            // BODY
-            out.println("<body>") ;
-            out.println("<pre>") ;
-
-            out.println("Dump : "+now);
-            out.println() ;
-            out.println("==== Request");
-            out.println() ;
-            out.print(dumpRequest(req)) ;
-            out.println() ;
-                        
-            out.println(">>>> Body");
-            out.println() ;
-            printBody(out, req) ;
-            out.println("<<<< Body");
-            
-            out.println("==== ServletContext");
-            out.println() ;
-            out.print(dumpServletContext());
-            out.println() ;
-
-            out.println("==== Environment");
-            out.println() ;
-            out.print(dumpEnvironment());
-            out.println() ;
-
-            out.println("</pre>") ;
-
-            out.println("</body>") ;
-            out.println("</html>") ;
-            out.flush() ;
-        } catch (IOException e)
-        { }
-    }
-
-    // This resets the input stream
-
-    static public String dumpRequest(HttpServletRequest req)
-    {
-        try ( StringWriter sw = new StringWriter() ;
-              PrintWriter pw = new PrintWriter(sw) ) {
-            // Standard environment
-            pw.println("Method:                 "+req.getMethod());
-            pw.println("getContentLength:       "+Long.toString(req.getContentLengthLong()));
-            pw.println("getContentType:         "+req.getContentType());
-            pw.println("getRequestURI:          "+req.getRequestURI());
-            pw.println("getRequestURL:          "+req.getRequestURL());
-            pw.println("getContextPath:         "+req.getContextPath());
-            pw.println("getServletPath:         "+req.getServletPath());
-            pw.println("getPathInfo:            "+req.getPathInfo());
-            pw.println("getPathTranslated:      "+req.getPathTranslated());
-            pw.println("getQueryString:         "+req.getQueryString());
-            pw.println("getProtocol:            "+req.getProtocol());
-            pw.println("getScheme:              "+req.getScheme());
-            pw.println("getServerName:          "+req.getServerName());
-            pw.println("getServerPort:          "+req.getServerPort());
-            pw.println("getRemoteUser:          "+req.getRemoteUser());
-            pw.println("getRemoteAddr:          "+req.getRemoteAddr());
-            pw.println("getRemoteHost:          "+req.getRemoteHost());
-            pw.println("getRequestedSessionId:  "+req.getRequestedSessionId());
-            {
-                Cookie c[] = req.getCookies() ;
-                if ( c == null )
-                    pw.println("getCookies:            <none>");
-                else
-                {
-                    for ( int i = 0 ; i < c.length ; i++ )            
-                    {
-                        pw.println("Cookie:        "+c[i].getName());
-                        pw.println("    value:     "+c[i].getValue());
-                        pw.println("    version:   "+c[i].getVersion());
-                        pw.println("    comment:   "+c[i].getComment());
-                        pw.println("    domain:    "+c[i].getDomain());
-                        pw.println("    maxAge:    "+c[i].getMaxAge());
-                        pw.println("    path:      "+c[i].getPath());
-                        pw.println("    secure:    "+c[i].getSecure());
-                        pw.println();
-                    }
-                }
-            }
-            
-            {
-                // To do: create a string for the output so can send to console and return it.
-                Enumeration<String> en = req.getHeaderNames() ;
-
-                for ( ; en.hasMoreElements() ; )
-                {
-                    String name = en.nextElement() ;
-                    String value = req.getHeader(name) ;
-                    pw.println("Head: "+name + " = " + value) ;
-                }
-            }
-            
-            Enumeration<String> en2 = req.getAttributeNames() ;
-            if ( en2.hasMoreElements() )
-                pw.println();
-            for ( ; en2.hasMoreElements() ; )
-            {
-                String name = en2.nextElement() ;
-                String value = req.getAttribute(name).toString() ;
-                pw.println("Attr: "+name + " = " + value) ;
-            }
-
-            // Note that doing this on a form causes the forms content (body) to be read
-            // and parsed as form variables.
-//            en = req.getParameterNames() ;
-//            if ( en.hasMoreElements() )
-//                pw.println();
-//            for ( ; en.hasMoreElements() ; )
-//            {
-//                String name = (String)en.nextElement() ;
-//                String value = req.getParameter(name) ;
-//                pw.println("Param: "+name + " = " + value) ;
-//            }
-
-
-            
-//            MultiMap<String, String> map = WebLib.parseQueryString(req) ;
-//            for ( String name : map.keys() )
-//                for ( String value : map.get(name) )
-//                    pw.println("Param: "+name + " = " + value) ;
-            
-            Enumeration<Locale> en = req.getLocales() ;
-            if ( en.hasMoreElements() )
-                pw.println();
-            for ( ; en.hasMoreElements() ; )
-            {
-                String name = en.nextElement().toString() ;
-                pw.println("Locale: "+name) ;
-            }
-
-            pw.println() ;
-            //printBody(pw, req) ;
-
-            return sw.toString() ;
-        } catch (IOException e) { return null ; }
-    }
-
-    static void printBody(PrintWriter pw, HttpServletRequest req) throws IOException
-    {
-        BufferedReader in = req.getReader() ;
-        if ( req.getContentLength() > 0 )
-            // Need +2 because last line may not have a CR/LF on it.
-            in.mark(req.getContentLength()+2) ;
-        else
-            // This is a dump - try to do something that works, even if inefficient.
-            in.mark(100*1024) ;
-
-        while(true)
-        {
-            String x = in.readLine() ;
-            if ( x == null )
-                break ;
-            x = x.replaceAll("&", "&amp;") ;
-            x = x.replaceAll("<", "&lt;") ;
-            x = x.replaceAll(">", "&gt;") ;
-            pw.println(x) ;
-        }
-        try { in.reset() ; } catch (IOException e) { System.out.println("DumpServlet: Reset of content failed: "+e) ; }
-    }
-    
-    /**
-     * <code>dumpEnvironment</code>
-     * @return String that is the HTML of the System properties as name/value pairs.
-     * The values are with single quotes independent of whether or not the value has
-     * single quotes in it.
-     */
-    static public String dumpEnvironment()
-    {
-        Properties properties = System.getProperties();
-        try ( StringWriter sw = new StringWriter() ;
-            PrintWriter pw = new PrintWriter(sw) ; ) {
-            Enumeration<Object> en = properties.keys();
-            while(en.hasMoreElements())
-            {
-                String key = en.nextElement().toString();
-                pw.println(key+": '"+properties.getProperty(key)+"'");
-            }
-
-            pw.println() ;
-            return sw.toString() ;
-        } catch (IOException e) { IO.exception(e); return null ; }
-    }
-
-    public String dumpServletContext()
-    {
-        try ( StringWriter sw = new StringWriter() ;
-              PrintWriter pw = new PrintWriter(sw) ; ) {
-            ServletContext sc =  getServletContext();
-            pw.println("majorVersion: '"+sc.getMajorVersion()+"'");
-            pw.println("minorVersion: '"+sc.getMinorVersion()+"'");
-            pw.println("contextName:  '"+sc.getServletContextName()+"'");
-            pw.println("servletInfo:  '"+getServletInfo()+"'");
-            pw.println("serverInfo:  '"+sc.getServerInfo()+"'");
-    
-            {
-                Enumeration<String> en = sc.getInitParameterNames();
-                if (en != null) {
-                    pw.println("initParameters: ");
-                    while(en.hasMoreElements())
-                    {
-                        String key = en.nextElement();
-                        pw.println(key+": '"+sc.getInitParameter(key)+"'");
-                    }
-                }
-            }
-            
-            {
-                Enumeration<String> en = sc.getAttributeNames();
-                if (en != null) {
-                    pw.println("attributes: ");
-                    while(en.hasMoreElements())
-                    {
-                        String key = en.nextElement();
-                        pw.println(key+": '"+sc.getAttribute(key)+"'");
-                    }
-                }
-            }
-            pw.println() ;
-         
-             return sw.toString() ;
-        } catch (IOException e) { IO.exception(e); return null ; }
-    }
-
-    
-    @Override
-    public void doPost(HttpServletRequest req, HttpServletResponse resp)
-    {
-        doGet(req, resp) ;
-    }
-
-
-    @Override
-    public String getServletInfo()
-    {
-        return "Dump";
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/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
deleted file mode 100644
index 2af5e44..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
+++ /dev/null
@@ -1,39 +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 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/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
index 9d16b84..4c07c69 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
@@ -33,13 +33,16 @@ public class DataAccessPointRegistry extends Registry<String, DataAccessPoint>
         other.forEach((name, accessPoint)->register(name, accessPoint));
     }
     
-    // Add error checking.
-    public void register(String name, DataAccessPoint accessPt) {
+    // Preferred way to register. Other method for legacy.
+    public void register(DataAccessPoint accessPt) {
+        register(accessPt.getName(), accessPt);
+    }
+    
+    private void register(String name, DataAccessPoint accessPt) {
         if ( isRegistered(name) )
             throw new FusekiException("Already registered: "+name) ;
         super.put(name, accessPt);
     }
-    
     // Debugging
     public void print(String string) {
         System.out.flush() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
index bdc4fff..86cde9c 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataService.java
@@ -36,7 +36,7 @@ import org.apache.jena.sparql.core.DatasetGraph;
 import org.apache.jena.sparql.core.DatasetGraphFactory;
 import org.apache.jena.sparql.core.DatasetGraphReadOnly;
 
-public class DataService { //implements DatasetMXBean {
+public class DataService {
     public static DataService serviceOnlyDataService() {
         return dummy; 
     }
@@ -76,7 +76,6 @@ public class DataService { //implements DatasetMXBean {
         counters.add(CounterName.RequestsBad);
         // Start ACTIVE. Registration controls visibility. 
         goActive();
-
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java
deleted file mode 100644
index e725db1..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java
+++ /dev/null
@@ -1,168 +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.webapp;
-
-import java.nio.file.Path ;
-import java.nio.file.Paths ;
-
-/** 
- * Separate initialization for FUSEKI_HOME and FUSEKI_BASE so that 
- * FusekiLogging can use these values.
- * This code must not touch Jena.  
- * 
- * @see FusekiSystem 
- */ 
-public class FusekiEnv {
-    // Initialization logging happens via stdout/stderr directly.
-    // Fuseki logging is not initialized to avoid going in circles.
-    
-    private static final boolean LogInit         = false ;
-    
-    /** Unused */
-    // public static final String DFT_FUSEKI_HOME = isWindows 
-    //        ? /*What's correct here?*/ "/usr/share/fuseki"
-    //        : "/usr/share/fuseki" ;
-    static final boolean isWindows = determineIfWindows() ;
-    static final String  DFT_FUSEKI_BASE = isWindows ? /* What's correct here? */"/etc/fuseki" : "/etc/fuseki" ;
-    
-    /** Initialization mode, depending on the way Fuseki is started:
-        <ul>
-        <li>{@code WAR} - Running as a WAR file.</li>
-        <li>{@code EMBEDDED}</li>
-        <li>{@code STANDALONE} - Running as the standalone server in Jetty</li>
-        <li>{@code TEST} - Running inside maven/JUnit and as the standalone server</li>
-        <li>{@code UNSET} - Initial state.</li>
-        </ul>
-        <p> 
-        If at server initialization, the MODE is UNSET, then assume WAR setup.
-        A WAR file does not have the opportunity to set the mode.
-        <p>
-        TEST:  (better to set FUSEKI_HOME, FUSEKI_BASE from the test environment</li>
-    */
-    public enum INIT {
-        // Default values of FUSEKI_HOME, and FUSEKI_BASE. 
-        WAR         (null, "/etc/fuseki") , 
-        EMBEDDED    (null, null) ,
-        STANDALONE  (".", "run") ,
-        TEST        ("src/main/webapp", "target/run") ,
-        UNSET       (null, null) ;
-        
-        final String dftFusekiHome ;
-        final String dftFusekiBase ;
-        
-        INIT(String home, String base) {
-            this.dftFusekiHome = home ;
-            this.dftFusekiBase = base ;
-        }
-    }
-    
-    public static INIT mode = INIT.UNSET ;
-    
-    /** Root of the Fuseki installation for fixed files. 
-     *  This may be null (e.g. running inside a web application container) */ 
-    public static Path FUSEKI_HOME = null ;
-    
-    /** Root of the varying files in this deployment. Often $FUSEKI_HOME/run.
-     * This is not null - it may be /etc/fuseki, which must be writable.
-     */ 
-    public static Path FUSEKI_BASE = null ;
-    
-    // Copied from SystemTDB to avoid dependency.
-    // This code must not touch Jena.  
-    private static boolean determineIfWindows() {
-        String s = System.getProperty("os.name") ;
-        if ( s == null )
-            return false ;
-        return s.startsWith("Windows ") ;
-    }
- 
-    public static final String   ENV_runArea     = "run" ;
-    private static boolean       initialized     = false ;
-    
-    /** Initialize the server : standalone and WAR versions : not embedded */
-    public static synchronized void setEnvironment() {
-        if ( initialized )
-            return ;
-        resetEnvironment();
-    }
-    
-    /** Reset environment - use with care and before server start up */ 
-    public static synchronized void resetEnvironment() {
-        initialized = true ;
-        logInit("FusekiEnv:Start: ENV_FUSEKI_HOME = %s : ENV_FUSEKI_BASE = %s : MODE = %s", FUSEKI_HOME, FUSEKI_BASE, mode) ;
-        
-        if ( mode == null || mode == INIT.UNSET )
-            mode = INIT.WAR ;
-
-        if ( FUSEKI_HOME == null ) {
-            // Make absolute
-            String x1 = getenv("FUSEKI_HOME") ;
-            if ( x1 == null )
-                x1 = mode.dftFusekiHome ;
-            if ( x1 != null )
-                FUSEKI_HOME = Paths.get(x1) ;
-        }
-
-        if ( FUSEKI_BASE == null ) {
-            String x2 = getenv("FUSEKI_BASE") ;
-            if ( x2 == null )
-                x2 = mode.dftFusekiBase ;
-            if ( x2 != null )
-                FUSEKI_BASE = Paths.get(x2) ;
-            else {
-                if ( FUSEKI_HOME != null )
-                    FUSEKI_BASE = FUSEKI_HOME.resolve(ENV_runArea) ;
-                else {
-                    // This is bad - there should have been a default by now.
-                    logInitError("Can't find a setting for FUSEKI_BASE - guessing wildy") ;
-                    // Neither FUSEKI_HOME nor FUSEKI_BASE set.
-                    FUSEKI_BASE = Paths.get(DFT_FUSEKI_BASE) ;
-                }
-            }
-        }
-
-        if ( FUSEKI_HOME != null )
-            FUSEKI_HOME = FUSEKI_HOME.toAbsolutePath() ;
-
-        FUSEKI_BASE = FUSEKI_BASE.toAbsolutePath() ;
-
-        logInit("FusekiEnv:Finish: ENV_FUSEKI_HOME = %s : ENV_FUSEKI_BASE = %s", FUSEKI_HOME, FUSEKI_BASE) ;
-    }
-    
-    private static void logInit(String fmt, Object ... args) {
-        if ( LogInit ) {
-            System.out.printf(fmt, args) ; 
-            System.out.println() ;
-        }
-    }
-    
-    private static void logInitError(String fmt, Object ... args) {
-        System.err.printf(fmt, args) ; 
-        System.err.println() ;
-    }
-
-    /** Get environment variable value (maybe in system properties) */
-    public static String getenv(String name) {
-        String x = System.getenv(name) ;
-        if ( x == null )
-            x = System.getProperty(name) ;
-        return x ;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java
deleted file mode 100644
index 6d3d889..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java
+++ /dev/null
@@ -1,54 +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.webapp;
-
-import javax.servlet.ServletContextEvent ;
-import javax.servlet.ServletContextListener ;
-
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.sys.JenaSystem ;
-
-/** Setup the environment and logging.
- *  Runs before the {@link ShiroEnvironmentLoader}.
- *  The main configuration happens in {@link FusekiServerListener} which runs after {@link ShiroEnvironmentLoader}.
- */
-public class FusekiServerEnvironmentInit implements ServletContextListener {
-
-    public FusekiServerEnvironmentInit() { }
-    
-    @Override
-    public void contextInitialized(ServletContextEvent sce) {
-        // These two do not touch Jena.
-        FusekiEnv.setEnvironment() ;
-        FusekiLogging.setLogging(FusekiEnv.FUSEKI_BASE);
-        JenaSystem.init() ;
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent sce) {
-        // Stop handling requests.
-        
-        // ActionService uses DataAccessPointRegistry to map URI to services (DataAccessPoint)
-        
-        // DataService -> DataService
-//        DataAccessPointRegistry.shutdown() ;
-//        DatasetDescriptionRegistry.reset() ;
-        JenaSystem.shutdown(); 
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java
deleted file mode 100644
index 8c1b5fe..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java
+++ /dev/null
@@ -1,107 +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.webapp;
-
-import javax.servlet.ServletContext ;
-import javax.servlet.ServletContextEvent ;
-import javax.servlet.ServletContextListener ;
-
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry;
-import org.apache.jena.fuseki.server.FusekiInfo;
-import org.apache.jena.fuseki.server.FusekiInitialConfig;
-import org.apache.jena.fuseki.servlets.ServiceDispatchRegistry;
-import org.apache.jena.tdb.StoreConnection ;
-
-/** Setup configuration.
- * The order is controlled by {@code web.xml}:
- * <ul>
- * <li>{@link FusekiServerEnvironmentInit}
- * <li>{@link ShiroEnvironmentLoader}
- * <li>{@link FusekiServerListener}, the main configuration
- * </ul>
- */
-
-public class FusekiServerListener implements ServletContextListener {
-
-    public FusekiServerListener() { }
-    
-    public static FusekiInitialConfig initialSetup = null ;
-
-    private boolean initialized = false ;
-
-    @Override
-    public void contextInitialized(ServletContextEvent sce) {
-        ServletContext servletContext = sce.getServletContext() ;
-        String x = servletContext.getContextPath() ;
-        if ( ! x.isEmpty() ) 
-            Fuseki.configLog.info("Context path = "+x) ;
-        serverInitialization(servletContext) ;
-    }
-
-    @Override
-    public void contextDestroyed(ServletContextEvent sce) {
-//        DataAccessPointRegistry.get().forEach((key, dap) -> {
-//            ??
-//        }) ;
-        // But in flight-transactions?
-        StoreConnection.reset();
-    }
-
-    private synchronized void serverInitialization(ServletContext servletContext) {
-        if ( initialized )
-            return ;
-        initialized = true ;
-
-        ServiceDispatchRegistry serviceDispatchRegistry = new ServiceDispatchRegistry(true);
-        ServiceDispatchRegistry.set(servletContext, serviceDispatchRegistry);
-        DataAccessPointRegistry dataAccessPointRegistry = new DataAccessPointRegistry() ;
-        DataAccessPointRegistry.set(servletContext, dataAccessPointRegistry);
-        
-        try {
-            FusekiSystem.formatBaseArea() ; 
-            if ( ! FusekiSystem.serverInitialized ) {
-                Fuseki.serverLog.error("Failed to initialize : Server not running") ;
-                return ;
-            }
-            
-            // The command line code sets initialSetup.
-            // In a non-commandline startup, initialSetup is null. 
-            if ( initialSetup == null ) {
-                initialSetup = new FusekiInitialConfig() ;
-                String cfg = FusekiEnv.FUSEKI_BASE.resolve(FusekiSystem.DFT_CONFIG).toAbsolutePath().toString() ;
-                initialSetup.fusekiServerConfigFile = cfg ;
-            }
-
-            if ( initialSetup == null ) {
-                Fuseki.serverLog.error("No configuration") ;
-                throw new FusekiException("No configuration") ;
-            }                
-            Fuseki.setVerbose(servletContext, initialSetup.verbose);
-            FusekiSystem.initializeDataAccessPoints(dataAccessPointRegistry,
-                                                    initialSetup, FusekiSystem.dirConfiguration.toString()) ;
-        } catch (Throwable th) { 
-            Fuseki.serverLog.error("Exception in initialization: {}", th.getMessage()) ;
-            throw th ;
-        }
-        FusekiInfo.info(initialSetup, dataAccessPointRegistry);
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/jena/blob/e8abcbb6/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiSystem.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiSystem.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiSystem.java
deleted file mode 100644
index 5e3b467..0000000
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/webapp/FusekiSystem.java
+++ /dev/null
@@ -1,459 +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.webapp;
-
-import static java.lang.String.format ;
-
-import java.io.File ;
-import java.io.IOException ;
-import java.io.InputStream ;
-import java.io.StringReader ;
-import java.net.URL ;
-import java.nio.file.DirectoryStream ;
-import java.nio.file.Files ;
-import java.nio.file.Path ;
-import java.nio.file.StandardCopyOption ;
-import java.util.* ;
-
-import jena.cmd.CmdException ;
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.atlas.lib.InternalErrorException ;
-import org.apache.jena.fuseki.Fuseki ;
-import org.apache.jena.fuseki.FusekiConfigException ;
-import org.apache.jena.fuseki.build.* ;
-import org.apache.jena.fuseki.server.*;
-import org.apache.jena.fuseki.servlets.HttpAction ;
-import org.apache.jena.fuseki.servlets.ServletOps ;
-import org.apache.jena.rdf.model.* ;
-import org.apache.jena.riot.Lang ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.sparql.core.assembler.AssemblerUtils;
-import org.apache.jena.tdb.sys.Names ;
-
-public class FusekiSystem
-{
-    // Initialization of FUSEKI_HOME and FUSEKI_BASE is done in FusekiEnv.setEnvironment()
-    // so that the code is independent of any logging.  FusekiLogging can use
-    // initialized values of FUSEKI_BASE while looking forlog4j configuration.
-    
-    /* * Root of the Fuseki installation for fixed files. 
-     * This may be null (e.g. running inside a web application container) */ 
-    //public static Path FUSEKI_HOME = null ;
-    
-    /* * Root of the varying files in this deployment. Often $FUSEKI_HOME/run.
-     * This is not null - it may be /etc/fuseki, which must be writable.
-     */ 
-    //public static Path FUSEKI_BASE = null ;
-    
-    // Relative names of directories in the FUSEKI_BASE area.
-    public static final String     runArea                  = FusekiEnv.ENV_runArea ;
-    public static final String     databasesLocationBase    = "databases" ;
-    // Place to put Lucene text and spatial indexes.
-    //private static final String        databaseIndexesDir       = "indexes" ;
-      
-    public static final String     backupDirNameBase        = "backups" ;
-    public static final String     configDirNameBase        = "configuration" ;
-    public static final String     logsNameBase             = "logs" ;
-    public static final String     systemDatabaseNameBase   = "system" ;
-    public static final String     systemFileAreaBase       = "system_files" ;
-    public static final String     templatesNameBase        = "templates" ;
-    // This name is in web.xml as well.
-    public static final String     DFT_SHIRO_INI            = "shiro.ini" ; 
-    // In FUSEKI_BASE
-    public static final String     DFT_CONFIG               = "config.ttl" ;
-    
-    /** Directory for TDB databases - this is known to the assembler templates */
-    public static Path        dirDatabases       = null ;
-    
-    /** Directory for writing backups */
-    public static Path        dirBackups         = null ;
-
-    /** Directory for assembler files */
-    public static Path        dirConfiguration   = null ;
-    
-    /** Directory for assembler files */
-    public static Path        dirLogs            = null ;
-
-    /** Directory for system database */
-    public static Path        dirSystemDatabase  = null ;
-
-    /** Directory for files uploaded (e.g upload assembler descriptions); not data uploads. */
-    public static Path        dirFileArea        = null ;
-    
-    /** Directory for assembler files */
-    public static Path        dirTemplates       = null ;
-
-    private static boolean    initialized        = false ;
-    // Marks the end of successful initialization.
-    /*package*/static boolean serverInitialized  = false ;
-
-    /*package*/ synchronized static void formatBaseArea() {
-        if ( initialized )
-            return ;
-        initialized = true ;
-        try {
-            FusekiEnv.setEnvironment() ;
-            Path FUSEKI_HOME = FusekiEnv.FUSEKI_HOME ;
-            Path FUSEKI_BASE = FusekiEnv.FUSEKI_BASE ;
-            
-            Fuseki.init() ;
-            Fuseki.configLog.info("FUSEKI_HOME="+ ((FUSEKI_HOME==null) ? "unset" : FUSEKI_HOME.toString())) ;
-            Fuseki.configLog.info("FUSEKI_BASE="+FUSEKI_BASE.toString());
-
-            // ----  Check FUSEKI_HOME and FUSEKI_BASE
-            // If FUSEKI_HOME exists, it may be FUSEKI_BASE.
-
-            if ( FUSEKI_HOME != null ) {
-                if ( ! Files.isDirectory(FUSEKI_HOME) )
-                    throw new FusekiConfigException("FUSEKI_HOME is not a directory: "+FUSEKI_HOME) ;
-                if ( ! Files.isReadable(FUSEKI_HOME) )
-                    throw new FusekiConfigException("FUSEKI_HOME is not readable: "+FUSEKI_HOME) ;
-            }
-
-            if ( Files.exists(FUSEKI_BASE) ) {
-                if ( ! Files.isDirectory(FUSEKI_BASE) )
-                    throw new FusekiConfigException("FUSEKI_BASE is not a directory: "+FUSEKI_BASE) ;
-                if ( ! Files.isWritable(FUSEKI_BASE) )
-                    throw new FusekiConfigException("FUSEKI_BASE is not writable: "+FUSEKI_BASE) ;
-            } else {
-                ensureDir(FUSEKI_BASE);
-            }
-
-            // Ensure FUSEKI_BASE has the assumed directories.
-            dirTemplates        = writeableDirectory(FUSEKI_BASE, templatesNameBase) ;
-            dirDatabases        = writeableDirectory(FUSEKI_BASE, databasesLocationBase) ;
-            dirBackups          = writeableDirectory(FUSEKI_BASE, backupDirNameBase) ;
-            dirConfiguration    = writeableDirectory(FUSEKI_BASE, configDirNameBase) ;
-            dirLogs             = writeableDirectory(FUSEKI_BASE, logsNameBase) ;
-            dirSystemDatabase   = writeableDirectory(FUSEKI_BASE, systemDatabaseNameBase) ;
-            dirFileArea         = writeableDirectory(FUSEKI_BASE, systemFileAreaBase) ;
-            //Possible intercept point
-
-            // ---- Initialize with files.
-
-            if ( Files.isRegularFile(FUSEKI_BASE) ) 
-                throw new FusekiConfigException("FUSEKI_BASE exists but is a file") ;
-
-            // Copy missing files into FUSEKI_BASE
-            copyFileIfMissing(null, DFT_SHIRO_INI, FUSEKI_BASE) ;
-            copyFileIfMissing(null, DFT_CONFIG, FUSEKI_BASE) ;
-            for ( String n : Template.templateNames ) {
-                copyFileIfMissing(null, n, FUSEKI_BASE) ;
-            }
-
-            serverInitialized = true ;
-        } catch (RuntimeException ex) {
-            Fuseki.serverLog.error("Exception in server initialization", ex) ;
-            throw ex ;
-        }
-    }
-    
-    /** Copy a file from src to dst under name fn.
-     * If src is null, try as a classpath resource
-     * @param src   Source directory, or null meaning use java resource. 
-     * @param fn    File name, a relative path.
-     * @param dst   Destination directory.
-     * 
-     */
-    private static void copyFileIfMissing(Path src, String fn, Path dst) {
-        
-        Path dstFile = dst.resolve(fn) ;
-        if ( Files.exists(dstFile) )
-            return ;
-        
-        // fn may be a path.
-        if ( src != null ) {
-            try {
-                Files.copy(src.resolve(fn), dstFile, StandardCopyOption.COPY_ATTRIBUTES) ;
-            } catch (IOException e) {
-                IO.exception("Failed to copy file "+src.resolve(fn), e);
-                e.printStackTrace();
-            }
-        } else {
-            copyFileFromResource(fn, dstFile);
-        }
-    }
-    
-    public static void copyFileFromResource(String fn, Path dstFile) {
-        try {
-            // Get from the file from area "org/apache/jena/fuseki/server"  (our package)
-            URL url = FusekiSystem.class.getResource(fn) ;
-            if ( url == null )
-                throw new FusekiConfigException("Failed to find resource '"+fn+"'") ; 
-            InputStream in = url.openStream() ;
-            Files.copy(in, dstFile) ;
-        }
-        catch (IOException e) {
-            IO.exception("Failed to copy file from resource: "+fn, e);
-            e.printStackTrace();
-        }
-    }
-
-    public static void initializeDataAccessPoints(DataAccessPointRegistry registry, FusekiInitialConfig initialSetup, String configDir) {
-        List<DataAccessPoint> configFileDBs = initServerConfiguration(initialSetup) ;
-        List<DataAccessPoint> directoryDBs =  FusekiConfig.readConfigurationDirectory(configDir) ;
-        List<DataAccessPoint> systemDBs =     FusekiConfig.readSystemDatabase(SystemState.getDataset()) ;
-        
-        List<DataAccessPoint> datapoints = new ArrayList<>() ;
-        datapoints.addAll(configFileDBs) ;
-        datapoints.addAll(directoryDBs) ;
-        datapoints.addAll(systemDBs) ;
-        
-        // Having found them, set them all running.
-        enable(registry, datapoints);
-    }
-
-    private static void enable(DataAccessPointRegistry registry, List<DataAccessPoint> datapoints) {
-        for ( DataAccessPoint dap : datapoints ) {
-            Fuseki.configLog.info("Register: "+dap.getName()) ;
-            dap.getDataService().goActive();
-            registry.register(dap.getName(), dap);
-        }
-    }
-
-    private static List<DataAccessPoint> initServerConfiguration(FusekiInitialConfig params) { 
-        // Has a side effect of global context setting
-        // when processing a config file.
-        // Compatibility.
-        
-        List<DataAccessPoint> datasets = new ArrayList<>();
-        if ( params == null )
-            return datasets ;
-
-        if ( params.fusekiCmdLineConfigFile != null ) {
-            List<DataAccessPoint> confDatasets = processServerConfigFile(params.fusekiCmdLineConfigFile) ;
-            datasets.addAll(confDatasets) ;
-        }
-        else if ( params.fusekiServerConfigFile != null ) {
-            List<DataAccessPoint> confDatasets = processServerConfigFile(params.fusekiServerConfigFile) ;
-            datasets.addAll(confDatasets) ;
-        }
-        else if ( params.dsg != null ) {
-            DataAccessPoint dap = datasetDefaultConfiguration(params.datasetPath, params.dsg, params.allowUpdate) ;
-            datasets.add(dap) ;
-        } else if ( params.argTemplateFile != null ) {
-            DataAccessPoint dap = configFromTemplate(params.argTemplateFile, params.datasetPath, params.allowUpdate, params.params) ;
-            datasets.add(dap) ;
-        }
-        // No datasets is valid.
-        return datasets ;
-    }
-    
-    private static List<DataAccessPoint> processServerConfigFile(String configFilename) {
-        if ( ! FileOps.exists(configFilename) ) {
-            Fuseki.configLog.warn("Configuration file '" + configFilename+"' does not exist") ;
-            return Collections.emptyList(); 
-        }
-        Fuseki.configLog.info("Configuration file: " + configFilename) ;
-        //return FusekiConfig.readServerConfigFile(configFilename);
-        Model model = AssemblerUtils.readAssemblerFile(configFilename) ;
-        if ( model.size() == 0 )
-            return Collections.emptyList() ;
-        FusekiConfig.processServerConfig(model);
-        return FusekiConfig.servicesAndDatasets(model) ;
-    }
-    
-    private static DataAccessPoint configFromTemplate(String templateFile, String datasetPath, 
-                                                      boolean allowUpdate, Map<String, String> params) {
-        DatasetDescriptionRegistry registry = new DatasetDescriptionRegistry() ; 
-        // ---- Setup
-        if ( params == null ) {
-            params = new HashMap<>() ;
-            params.put(Template.NAME, datasetPath) ;
-        } else {
-            if ( ! params.containsKey(Template.NAME) ) {
-                Fuseki.configLog.warn("No NAME found in template parameters (added)") ;
-                params.put(Template.NAME, datasetPath) ;   
-            }
-        }
-        //-- Logging
-        Fuseki.configLog.info("Template file: " + templateFile) ;
-        String dir = params.get(Template.DIR) ;
-        if ( dir != null ) {
-            if ( Objects.equals(dir, Names.memName) ) {
-                Fuseki.configLog.info("TDB dataset: in-memory") ;
-            } else {
-                if ( !FileOps.exists(dir) )
-                    throw new CmdException("Directory not found: " + dir) ;
-                Fuseki.configLog.info("TDB dataset: directory=" + dir) ;
-            }
-        }
-        //-- Logging
-        
-        datasetPath = DataAccessPoint.canonical(datasetPath) ;
-        
-        // DRY -- ActionDatasets (and others?)
-        addGlobals(params); 
-
-        String str = TemplateFunctions.templateFile(templateFile, params, Lang.TTL) ;
-        Lang lang = RDFLanguages.filenameToLang(str, Lang.TTL) ;
-        StringReader sr =  new StringReader(str) ;
-        Model model = ModelFactory.createDefaultModel() ;
-        RDFDataMgr.read(model, sr, datasetPath, lang);
-        
-        // ---- DataAccessPoint
-        Statement stmt = getOne(model, null, FusekiVocab.pServiceName, null) ;
-        if ( stmt == null ) {
-            StmtIterator sIter = model.listStatements(null, FusekiVocab.pServiceName, (RDFNode)null ) ;
-            if ( ! sIter.hasNext() )
-                ServletOps.errorBadRequest("No name given in description of Fuseki service") ;
-            sIter.next() ;
-            if ( sIter.hasNext() )
-                ServletOps.errorBadRequest("Multiple names given in description of Fuseki service") ;
-            throw new InternalErrorException("Inconsistent: getOne didn't fail the second time") ;
-        }
-        Resource subject = stmt.getSubject() ;
-        if ( ! allowUpdate ) {
-            // Opportunity for more sophisticated "read-only" mode.
-            //  1 - clean model, remove "fu:serviceUpdate", "fu:serviceUpload", "fu:serviceReadGraphStore", "fu:serviceReadWriteGraphStore"
-            //  2 - set a flag on DataAccessPoint
-        }
-        DataAccessPoint dap = FusekiBuilder.buildDataAccessPoint(subject, registry) ;
-        return dap ;
-    }
-    
-    public static void addGlobals(Map<String, String> params) {
-        if ( params == null ) {
-            Fuseki.configLog.warn("FusekiServer.addGlobals : params is null", new Throwable()) ;
-            return ;
-        }
-        
-        if ( ! params.containsKey("FUSEKI_BASE") )
-            params.put("FUSEKI_BASE", pathStringOrElse(FusekiEnv.FUSEKI_BASE, "unset")) ;
-        if ( ! params.containsKey("FUSEKI_HOME") )
-            params.put("FUSEKI_HOME", pathStringOrElse(FusekiEnv.FUSEKI_HOME, "unset")) ;
-    }
-
-    private static String pathStringOrElse(Path path, String dft) {
-        if ( path == null )
-            return dft ;
-        return path.toString() ;
-    }
-    
-    // DRY -- ActionDatasets (and others?)
-    private static Statement getOne(Model m, Resource s, Property p, RDFNode o) {
-        StmtIterator iter = m.listStatements(s, p, o) ;
-        if ( ! iter.hasNext() )
-            return null ;
-        Statement stmt = iter.next() ;
-        if ( iter.hasNext() )
-            return null ;
-        return stmt ;
-    }
-    
-    private static DataAccessPoint datasetDefaultConfiguration( String name, DatasetGraph dsg, boolean allowUpdate) {
-        name = DataAccessPoint.canonical(name) ;
-        DataService ds = FusekiBuilder.buildDataServiceStd(dsg, allowUpdate) ;
-        DataAccessPoint dap = new DataAccessPoint(name, ds) ;
-        return dap ;
-    }
-    
-    // ---- Helpers
-
-    /** Ensure a directory exists, creating it if necessary.
-     */
-    private static void ensureDir(Path directory) {
-        File dir = directory.toFile() ;
-        if ( ! dir.exists() ) {
-            boolean b = dir.mkdirs() ;
-            if ( ! b )
-                throw new FusekiConfigException("Failed to create directory: "+directory) ;
-        }
-        else if ( ! dir.isDirectory())
-            throw new FusekiConfigException("Not a directory: "+directory) ;
-    }
-
-    private static void mustExist(Path directory) {
-        File dir = directory.toFile() ;
-        if ( ! dir.exists() )
-            throw new FusekiConfigException("Does not exist: "+directory) ; 
-        if ( ! dir.isDirectory())
-            throw new FusekiConfigException("Not a directory: "+directory) ;
-    }
-    
-    private static boolean emptyDir(Path dir) {
-        return dir.toFile().list().length <= 2 ;
-    }
-    
-    private static boolean exists(Path directory) {
-        File dir = directory.toFile() ;
-        return dir.exists() ;
-    }
-
-    private static Path writeableDirectory(Path root , String relName ) {
-        Path p = makePath(root, relName) ;
-        ensureDir(p);
-        if ( ! Files.isWritable(p) )
-            throw new FusekiConfigException("Not writable: "+p) ;
-        return p ;
-    }
-    
-    private static Path makePath(Path root , String relName ) {
-        Path path = root.resolve(relName) ;
-        // Must exist
-//        try { path = path.toRealPath() ; }
-//        catch (IOException e) { IO.exception(e) ; }
-        return path ;
-    }
-
-    /**
-     * Dataset set name to configuration file name. Return a configuration file name -
-     * existing one or ".ttl" form if new
-     */
-    public static String datasetNameToConfigurationFile(HttpAction action, String dsName) {
-        List<String> existing = existingConfigurationFile(dsName) ;
-        if ( ! existing.isEmpty() ) {
-            if ( existing.size() > 1 ) {
-                action.log.warn(format("[%d] Multiple existing configuration files for %s : %s",
-                                       action.id, dsName, existing));
-                ServletOps.errorBadRequest("Multiple existing configuration files for "+dsName);
-                return null ;
-            }
-            return existing.get(0).toString() ;
-        }
-        
-        return generateConfigurationFilename(dsName) ;
-    }
-
-    /** New configuration file name - absiolute filename */
-    public static String generateConfigurationFilename(String dsName) {
-        String filename = dsName ;
-        // Without "/"
-        if ( filename.startsWith("/"))
-            filename = filename.substring(1) ;
-        Path p = FusekiSystem.dirConfiguration.resolve(filename+".ttl") ;
-        return p.toString();
-    }
-
-    /** Return the filenames of all matching files in the configuration directory (absolute paths returned ). */  
-    public static List<String> existingConfigurationFile(String baseFilename) {
-        try { 
-            List<String> paths = new ArrayList<>() ;
-            try (DirectoryStream<Path> stream = Files.newDirectoryStream(FusekiSystem.dirConfiguration, baseFilename+".*") ) {
-                stream.forEach((p)-> paths.add(FusekiSystem.dirConfiguration.resolve(p).toString() ));
-            }
-            return paths ;
-        } catch (IOException ex) {
-            throw new InternalErrorException("Failed to read configuration directory "+FusekiSystem.dirConfiguration) ;
-        }
-    }
-}