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() > 1 )
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 ;