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 2015/04/30 18:39:25 UTC

[2/2] jena git commit: Check for both configuration and name on the command line

Check for both configuration and name on the command line


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

Branch: refs/heads/master
Commit: 02545b777cac93fd4bbbc0049045b2fdf8d892dc
Parents: 59fc670
Author: Andy Seaborne <an...@apache.org>
Authored: Thu Apr 30 17:39:13 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Thu Apr 30 17:39:13 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/fuseki/cmd/FusekiCmd.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/02545b77/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 86132b2..63204a3 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
@@ -19,13 +19,14 @@
 package org.apache.jena.fuseki.cmd ;
 
 import java.util.List ;
+import java.util.Map ;
 
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiLogging ;
 import org.apache.jena.fuseki.build.Template ;
-import org.apache.jena.fuseki.jetty.JettyServerConfig ;
 import org.apache.jena.fuseki.jetty.JettyFuseki ;
+import org.apache.jena.fuseki.jetty.JettyServerConfig ;
 import org.apache.jena.fuseki.server.FusekiEnv ;
 import org.apache.jena.fuseki.server.FusekiServerListener ;
 import org.apache.jena.fuseki.server.ServerInitialConfig ;
@@ -184,6 +185,8 @@ public class FusekiCmd {
                 if ( x > 1 )
                     throw new CmdException("Multiple ways providing a dataset. Only one of --mem, --file, --loc or --desc") ;
             }
+            
+            boolean configPresent = ( x != 0 ) || ( cmdLineDataset.fusekiConfigFile != null ) ;
 
             if ( contains(argMem) ) {
                 log.info("Dataset: in-memory") ;
@@ -218,7 +221,6 @@ public class FusekiCmd {
             if ( contains(argTDB) ) {
                 cmdLineDataset = new ServerInitialConfig() ;
                 cmdLineDataset.templateFile = Template.templateTDBDirFN ;
-
                 String dir = getValue(argTDB) ;
                 cmdLineDataset.params.put(Template.DIR, dir) ;
             }
@@ -230,11 +232,16 @@ public class FusekiCmd {
                 Dataset ds = modDataset.createDataset() ;
                 //cmdLineDataset.dsg = ds.asDatasetGraph() ;
             }
+            
+            if ( configPresent && getPositional().size() == 0 )
+                throw new CmdException("Missing service name") ;
+            if ( !configPresent && getPositional().size() > 0 )
+                throw new CmdException("Service name given but no configuration argument to match") ;
 
             if ( cmdLineDataset != null ) {
                 if ( getPositional().size() > 1 )
                     throw new CmdException("Multiple dataset path names given") ;
-                if ( getPositional().size() != 0 ) {
+                if ( getPositional().size() == 1 ) {
                     cmdLineDataset.datasetPath = getPositionalArg(0) ;
                     if ( cmdLineDataset.datasetPath.length() > 0 && !cmdLineDataset.datasetPath.startsWith("/") )
                         throw new CmdException("Dataset path name must begin with a /: " + cmdLineDataset.datasetPath) ;