Package arq.cmd

Examples of arq.cmd.CmdException


        }
       
        Lang lang = selectLang(filename, RDFLanguages.NQUADS)
        LangHandler handler = dispatch.get(lang) ;
        if ( handler == null )
            throw new CmdException("Undefined language: "+lang) ;
       
        // If multiple files, choose the overall labels.
        if ( langHandlerOverall == null )
            langHandlerOverall = handler ;
        else
View Full Code Here


    @Override
    protected void processModulesAndArgs()
    {
        if ( ! contains(argRDFS) )
            throw new CmdException("Required argument missing: --"+argRDFS.getKeyName()) ;
        String fn = getValue(argRDFS) ;
        vocab = FileManager.get().loadModel(fn) ;
    }
View Full Code Here

        if ( contains(argMemTDB) ) x++ ;

        if ( fusekiConfigFile != null )
        {
            if ( x > 1 )
                throw new CmdException("Dataset specificed on the command line and also a configuration file specificed.") ;
        }
        else
        {
            if ( x == 0 )
                throw new CmdException("Required: either --config=FILE or one of --mem, --file, --loc or --desc") ;
        }

       
        TDB.setOptimizerWarningFlag(false) ;
        // Don't get TDB batch commits.
        // This is slower but less memory hungry.
        TransactionManager.QueueBatchSize = 0 ;
       
        if ( contains(argMem) )
        {
            log.info("Dataset: in-memory") ;
            dsg = DatasetGraphFactory.createMem() ;
        }
        if ( contains(argFile) )
        {
            dsg = DatasetGraphFactory.createMem() ;
            // replace by RiotLoader after ARQ refresh.
            String filename = getValue(argFile) ;
            log.info("Dataset: in-memory: load file: "+filename) ;
            if ( ! FileOps.exists(filename) )
                throw new CmdException("File not found: "+filename) ;

            Lang language = RDFLanguages.filenameToLang(filename) ;
            if ( language == null )
                throw new CmdException("Can't guess language for file: "+filename) ;
            InputStream input = IO.openFile(filename) ;
           
            if ( RDFLanguages.isQuads(language) )
                RDFDataMgr.read(dsg, filename) ;
            else
                RDFDataMgr.read(dsg.getDefaultGraph(), filename) ;
        }
       
        if ( contains(argMemTDB) )
        {
            log.info("TDB dataset: in-memory") ;
            dsg = TDBFactory.createDatasetGraph() ;
        }
       
        if ( contains(argTDB) )
        {
            String dir = getValue(argTDB) ;
            log.info("TDB dataset: directory="+dir) ;
            if ( ! FileOps.exists(dir) )
                throw new CmdException("Directory not found: "+dir) ;
            dsg = TDBFactory.createDatasetGraph(dir) ;
        }
       
        // Otherwise
        if ( contains(assemblerDescDecl) )
        {
            log.info("Dataset from assembler") ;
            Dataset ds = modDataset.createDataset() ;
            if ( ds != null )
                dsg = ds.asDatasetGraph() ;
        }
       
        if ( contains(argFusekiConfig) )
        {
            if ( dsg != null )
                throw new CmdException("Dataset specificed on the command line and also a configuration file specificed.") ;
            fusekiConfigFile = getValue(argFusekiConfig) ;
        }
       
        if ( contains(argPort) )
        {
            String portStr = getValue(argPort) ;
            try {
                port = Integer.parseInt(portStr) ;
            } catch (NumberFormatException ex)
            {
                throw new CmdException(argPort.getKeyName()+" : bad port number: "+portStr) ;
            }
        }
       
        if ( contains(argMgtPort) )
        {
            String mgtPortStr = getValue(argMgtPort) ;
            try {
                mgtPort = Integer.parseInt(mgtPortStr) ;
            } catch (NumberFormatException ex)
            {
                throw new CmdException(argMgtPort.getKeyName()+" : bad port number: "+mgtPortStr) ;
            }
        }

        if ( contains(argHost) )
        {
          clientHost = getValue(argHost);
          try {
            InetAddress.getByName(clientHost);
          } catch (UnknownHostException e) {
            throw new CmdException("unknown host name");
          }
        }
           
        if ( fusekiConfigFile == null && dsg == null )
            throw new CmdException("No dataset defined and no configuration file: "+argUsage) ;
       
        if ( dsg != null )
        {
            if ( getPositional().size() == 0 )
                throw new CmdException("No dataset path name given") ;
            if ( getPositional().size() > )
                throw new CmdException("Multiple dataset path names given") ;
            datasetPath = getPositionalArg(0) ;
            if ( datasetPath.length() > 0 && ! datasetPath.startsWith("/") )
                throw new CmdException("Dataset path name must begin with a /: "+datasetPath) ;
           
            allowUpdate = contains(argAllowUpdate) ;
        }
       
        if ( contains(argTimeout) )
        {
            String str = getValue(argTimeout) ;
            ARQ.getContext().set(ARQ.queryTimeout, str) ;
        }
       
        if ( contains(argJettyConfig) )
        {
            jettyConfigFile = getValue(argJettyConfig) ;
            if ( !FileOps.exists(jettyConfigFile) )
                throw new CmdException("No such file: : "+jettyConfigFile) ;
        }
       
        if ( contains(argHome) )
        {
           List<String> args = super.getValues(argHome) ;
           homeDir = args.get(args.size()-1) ;
        }
       
        if ( contains(argPages) )
        {
           List<String> args = super.getValues(argPages) ;
           pagesDir = args.get(args.size()-1) ;
        }

        if ( contains(argGZip) )
        {
            if ( ! hasValueOfTrue(argGZip) && ! hasValueOfFalse(argGZip) )
                throw new CmdException(argGZip.getNames().get(0)+": Not understood: "+getValue(argGZip)) ;
            enableCompression = super.hasValueOfTrue(argGZip) ;
        }
       
        if ( contains(argUber) )
            SPARQLServer.überServlet = true ;
View Full Code Here

            String[] x = getValue(argRepeat).split(",") ;
            if ( x.length == 1 )
            {
                try { repeatCount = Integer.parseInt(x[0]) ; }
                catch (NumberFormatException ex)
                { throw new CmdException("Can't parse "+x[0]+" in arg "+getValue(argRepeat)+" as an integer") ; }
               
            }
            else if ( x.length == 2 )
            {
                try { warmupCount = Integer.parseInt(x[0]) ; }
                catch (NumberFormatException ex)
                { throw new CmdException("Can't parse "+x[0]+" in arg "+getValue(argRepeat)+" as an integer") ; }
                try { repeatCount = Integer.parseInt(x[1]) ; }
                catch (NumberFormatException ex)
                { throw new CmdException("Can't parse "+x[1]+" in arg "+getValue(argRepeat)+" as an integer") ; }
            }
            else
                throw new CmdException("Wrong format for repeat count: "+getValue(argRepeat)) ;
        }
        if ( isVerbose() )
            ARQ.getContext().setTrue(ARQ.symLogExec) ;
       
        if ( hasArg(argExplain) )
            ARQ.setExecutionLogging(Explain.InfoLevel.ALL) ;
       
        if ( hasArg(argOptimize) )
        {
            String x1 = getValue(argOptimize) ;
            if ( hasValueOfTrue(argOptimize) || x1.equalsIgnoreCase("on") || x1.equalsIgnoreCase("yes") )
                queryOptimization = true ;
            else if ( hasValueOfFalse(argOptimize) || x1.equalsIgnoreCase("off") || x1.equalsIgnoreCase("no") )
                queryOptimization = false ;
            else throw new CmdException("Optimization flag must be true/false/on/off/yes/no. Found: "+getValue(argOptimize)) ;
        }
    }
View Full Code Here

            ex.printStackTrace(System.err) ;
        }
        catch (QueryException qEx)
        {
            //System.err.println(qEx.getMessage()) ;
            throw new CmdException("Query Exeception", qEx) ;
        }
        catch (JenaException ex) { throw ex ; }
        catch (CmdException ex) { throw ex ; }
        catch (Exception ex)
        {
            throw new CmdException("Exception", ex) ;
        }
    }   
View Full Code Here

   
    @Override
    protected void processModulesAndArgs()
    {
        if ( ! hasPositional() )
            throw new CmdException("No manifest file") ;
        createEarlReport = contains(earlDecl) ;
    }
View Full Code Here

        super.processModulesAndArgs() ;
       
        if ( contains(queryDecl) || contains(dataDecl) || contains(resultDecl) )
        {
            if ( ! ( contains(queryDecl) && contains(dataDecl) && contains(resultDecl) ) )
                throw new CmdException("Must give query, data and result to run a single test") ;
           
            String query = getValue(queryDecl) ;
            String data = getValue(dataDecl) ;
            String result = getValue(resultDecl) ;
           
            suite = ScriptTestSuiteFactory.make(query, data, result) ;
        }
        else if ( contains(allDecl) )
        {
            execAllTests = true ;
        }
        else if ( contains(wgDecl) )
        {
            execDAWGTests = true ;
        }
        else
        {
            // OK - running a manifest
           
            if ( ! hasPositional() )
                throw new CmdException("No manifest file") ;

            testfile = getPositionalArg(0) ;
            createEarlReport = contains(earlDecl) ;
        }
    }
View Full Code Here

  @Override
  public void processArgs(CmdArgModule cmdLine) {
    if ( cmdLine.contains(argDest) ) {
      dest = cmdLine.getValue(argDest) ;
        } else {
          throw new CmdException("No destination output file! Please add '--dest=file' in the program arguements") ;
        }
  }
View Full Code Here

        }
       
        Lang lang = selectLang(filename, ct, RDFLanguages.NQUADS)
        LangHandler handler = dispatch.get(lang) ;
        if ( handler == null )
            throw new CmdException("Undefined language: "+lang) ;
       
        // If multiple files, choose the overall labels.
        if ( langHandlerOverall == null )
            langHandlerOverall = handler ;
        else
View Full Code Here

        if ( cmdLine.contains(argBase) )
        {
            baseIRI = cmdLine.getValue(argBase) ;
            IRI iri = IRIResolver.resolveIRI(baseIRI) ;
            if ( iri.hasViolation(false) )
                throw new CmdException("Bad base IRI: "+baseIRI) ;
            if ( ! iri.isAbsolute() )
                throw new CmdException("Base IRI must be an absolute IRI: "+baseIRI) ;
        }
       
        if ( cmdLine.contains(argStop) )
            stopOnBadTerm = true ;
       
View Full Code Here

TOP

Related Classes of arq.cmd.CmdException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.