net.sf.sparql.benchmarking.options
Class OptionsImpl

java.lang.Object
  extended by net.sf.sparql.benchmarking.options.OptionsImpl
All Implemented Interfaces:
Options
Direct Known Subclasses:
BenchmarkOptions, SoakOptions, StressOptions

public class OptionsImpl
extends Object
implements Options

Implementation of generic options

Author:
rvesse

Field Summary
 
Fields inherited from interface net.sf.sparql.benchmarking.options.Options
DEFAULT_FORMAT_ASK, DEFAULT_FORMAT_GRAPH, DEFAULT_FORMAT_SELECT, DEFAULT_HALT_BEHAVIOUR, DEFAULT_LIMIT, DEFAULT_MAX_DELAY, DEFAULT_PARALLEL_THREADS, DEFAULT_SANITY_CHECKS, DEFAULT_TIMEOUT
 
Constructor Summary
OptionsImpl()
           
 
Method Summary
 void addListener(ProgressListener listener)
          Adds a Progress Listener if it is not already registered
<T extends Options>
T
copy()
          Makes a copy of the options
protected  void copyStandardOptions(OptionsImpl copy)
          Copies standard options across from this instance
 boolean getAllowCompression()
          Gets whether the client will allow the server to return Deflate/GZip compressed responses
 HttpAuthenticator getAuthenticator()
          Gets the HTTP authenticator in use
 String getCustomEndpoint(String name)
          Gets a custom endpoint
 Map<String,String> getCustomEndpoints()
          Gets an unmodifiable copy of the defined custom endpoints
 Map<String,Object> getCustomSettings()
          Gets a map that may be used to get/set custom settings
 Dataset getDataset()
          Gets a dataset that is used for in-memory queries and updates
 ExecutorService getExecutor()
          Gets the in-use executor for running queries and query mixes in threads using the Java concurrent framework
 long getGlobalOrder()
          Gets the Global Run Order
 String getGraphStoreEndpoint()
          Gets the SPARQL graph store protocol endpoint that is in use
 boolean getHaltAny()
          Gets Halt on Any behavior
 HaltBehaviour getHaltBehaviour()
          Gets the Halting Behaviour
 boolean getHaltOnError()
          Gets the Halt on Error behavior
 boolean getHaltOnTimeout()
          Gets the Halt on Timeout behavior
 long getLimit()
          Gets the LIMIT to impose on queries
 List<ProgressListener> getListeners()
          Gets the Progress Listeners registered
 int getMaxDelay()
          Gets the maximum delay between operations
 OperationMixRunner getMixRunner()
          Gets the operation mix runner to use, if null is returned then the default DefaultOperationMixRunner should be used
 boolean getNoCount()
          Gets whether query results are counted or just thrown away
 OperationMix getOperationMix()
          Gets the Query Mix that is used
 OperationRunner getOperationRunner()
          Gets the operation runner to use, if null is returned then the default OperationRunner should be used
 int getParallelThreads()
          Gets the number of parallel threads used for testing
 String getQueryEndpoint()
          Gets the SPARQL query endpoint that is in use
 boolean getRandomizeOrder()
          Gets whether operation order should be randomized
 String getResultsAskFormat()
          Gets the Results format used for operations that make ASK queries
 String getResultsGraphFormat()
          Gets the Results format used for operations that make CONSTRUCT/DESCRIBE queries or that retrieve RDF graphs
 String getResultsSelectFormat()
          Gets the Results format used for operations that make SELECT queries
 int getSanityCheckLevel()
          Gets the Sanity Checking Level
 OperationMix getSetupMix()
          Gets the setup mix to be run, null indicates no setup mix is requested.
 OperationMix getTeardownMix()
          Gets the tear down mix to be run, null indicates no tear down mix is requested.
 int getTimeout()
          Gets the timeout for operations, a zero/negative value indicates no timeout
 String getUpdateEndpoint()
          Gets the SPARQL Update endpoint that is in use
 void removeListener(ProgressListener listener)
          Removes a Progress Listener if it is registered
 void resetGlobalOrder()
          Resets the global run order
 void setAllowCompression(boolean allowed)
          Sets whether the client will allow the server to return Deflate/GZip compressed responses
 void setAuthenticator(HttpAuthenticator authenticator)
          Sets the HTTP authenticator used
 void setCustomEndpoint(String name, String endpoint)
          Sets a custom defined endpoint
 void setDataset(Dataset dataset)
          Sets a dataset to be used for in-memory queries and updates
 void setGraphStoreEndpoint(String endpoint)
          Gets the SPARQL graph store protocol endpoint that is in use
 void setHaltAny(boolean halt)
          Sets Halt on Any behavior, if set to true sets Halt on Error and Halt on Timeout to true as well
 void setHaltBehaviour(HaltBehaviour behaviour)
          Sets the Halting Behaviour
 void setHaltOnError(boolean halt)
          Sets the Halt on Error behavior
 void setHaltOnTimeout(boolean halt)
          Sets the Halt on Timeout behavior
 void setLimit(long limit)
          Sets the LIMIT to impose on queries
 void setMaxDelay(int milliseconds)
          Sets the maximum delay between operations
 void setMixRunner(OperationMixRunner runner)
          Sets the operation mix runner to use, if set to null then the default DefaultOperationMixRunner should be used
 void setNoCount(boolean noCount)
          Sets whether query results are counted or just thrown away
 void setOperationMix(OperationMix queries)
          Sets the Query Mix to use
 void setOperationRunner(OperationRunner runner)
          Sets the operation runner to use, if set to null then the default DefaultOperationRunner should be used
 void setParallelThreads(int threads)
          Sets the number of parallel threads used for testing
 void setQueryEndpoint(String endpoint)
          Sets the SPARQL query endpoint to be used
 void setRandomizeOrder(boolean randomize)
          Sets whether operation order should be randomized
 void setResultsAskFormat(String contentType)
          Sets the Results format to be used for operations that make ASK queries
 void setResultsGraphFormat(String contentType)
          Sets the Results format used for operations that CONSTRUCT/DESCRIBE queries or that retrieve RDF graphs
 void setResultsSelectFormat(String contentType)
          Sets the Results format to be used for operations that make SELECT queries
 void setSanityCheckLevel(int level)
          Sets the Sanity Checking level
 void setSetupMix(OperationMix mix)
          Sets the setup mix that will be run once before testing starts.
 void setTeardownMix(OperationMix mix)
          Sets the tear down mix that will be run once after testing completes successfully.
 void setTimeout(int timeout)
          Sets the timeout for operations, a zero/negative value indicates no timeout
 void setUpdateEndpoint(String endpoint)
          Sets the SPARQL update endpoint that is in use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionsImpl

public OptionsImpl()
Method Detail

addListener

public void addListener(ProgressListener listener)
Description copied from interface: Options
Adds a Progress Listener if it is not already registered

Specified by:
addListener in interface Options
Parameters:
listener - Progress Listener

copy

public <T extends Options> T copy()
Description copied from interface: Options
Makes a copy of the options

While this is guaranteed to take a copy of primitive typed properties there is no guarantee that it takes a copy of reference types so changing some properties will still affect the original options. This method is primarily intended for use in cases where you need to tweak an option without interfering with other consumers of the options which is particularly relevant when running multi-threaded testing.

Specified by:
copy in interface Options
Returns:
Copied options

copyStandardOptions

protected final void copyStandardOptions(OptionsImpl copy)
Copies standard options across from this instance

Primarily intended for use by derived implementations which extend the basic options to make it easier for them to create copies of themselves.

Parameters:
copy - Copy to copy to

getAllowCompression

public boolean getAllowCompression()
Description copied from interface: Options
Gets whether the client will allow the server to return Deflate/GZip compressed responses

Specified by:
getAllowCompression in interface Options
Returns:
Whether Deflate/GZip compression is allowed

getAuthenticator

public HttpAuthenticator getAuthenticator()
Description copied from interface: Options
Gets the HTTP authenticator in use

Specified by:
getAuthenticator in interface Options
Returns:
HTTP authenticator

getCustomEndpoint

public String getCustomEndpoint(String name)
Description copied from interface: Options
Gets a custom endpoint

Specified by:
getCustomEndpoint in interface Options
Parameters:
name - Endpoint name
Returns:
Endpoint URI

getCustomEndpoints

public Map<String,String> getCustomEndpoints()
Description copied from interface: Options
Gets an unmodifiable copy of the defined custom endpoints

Custom endpoints are a more specific form of the Options.getCustomSettings() and provide a slightly more user friendly and type safe interface when the custom setting to be defined has a string value.

Specified by:
getCustomEndpoints in interface Options
Returns:
Map of custom endpoints

getCustomSettings

public Map<String,Object> getCustomSettings()
Description copied from interface: Options
Gets a map that may be used to get/set custom settings

This is provided so custom operations may be created that can share state or that need custom settings to be provided and can't modify/extend the standard Options interface since they want to run with existing standard runners.

Specified by:
getCustomSettings in interface Options
Returns:
Map of custom settings

getDataset

public Dataset getDataset()
Description copied from interface: Options
Gets a dataset that is used for in-memory queries and updates

Specified by:
getDataset in interface Options
Returns:
Dataset

getExecutor

public ExecutorService getExecutor()
Description copied from interface: Options
Gets the in-use executor for running queries and query mixes in threads using the Java concurrent framework

Specified by:
getExecutor in interface Options
Returns:
The Executor Service used to execute tasks

getGlobalOrder

public long getGlobalOrder()
Description copied from interface: Options
Gets the Global Run Order

Called elsewhere so that mix runs and operation runs record what order they were run in

Specified by:
getGlobalOrder in interface Options
Returns:
Global Run Order

getGraphStoreEndpoint

public String getGraphStoreEndpoint()
Description copied from interface: Options
Gets the SPARQL graph store protocol endpoint that is in use

Specified by:
getGraphStoreEndpoint in interface Options
Returns:
SPARQL graph store endpoint URI

getHaltAny

public boolean getHaltAny()
Description copied from interface: Options
Gets Halt on Any behavior

Specified by:
getHaltAny in interface Options
Returns:
Whether any issue causes benchmarking to abort

getHaltBehaviour

public HaltBehaviour getHaltBehaviour()
Description copied from interface: Options
Gets the Halting Behaviour

Specified by:
getHaltBehaviour in interface Options
Returns:
Halting Behaviour

getHaltOnError

public boolean getHaltOnError()
Description copied from interface: Options
Gets the Halt on Error behavior

Specified by:
getHaltOnError in interface Options
Returns:
Whether an error causes benchmarking to abort

getHaltOnTimeout

public boolean getHaltOnTimeout()
Description copied from interface: Options
Gets the Halt on Timeout behavior

Specified by:
getHaltOnTimeout in interface Options
Returns:
Whether a timeout causes benchmarking to abort

getLimit

public long getLimit()
Description copied from interface: Options
Gets the LIMIT to impose on queries

Specified by:
getLimit in interface Options
Returns:
Limit to impose

getListeners

public List<ProgressListener> getListeners()
Description copied from interface: Options
Gets the Progress Listeners registered

Specified by:
getListeners in interface Options
Returns:
Progress Listeners

getMaxDelay

public int getMaxDelay()
Description copied from interface: Options
Gets the maximum delay between operations

Specified by:
getMaxDelay in interface Options
Returns:
Maximum Delay in milliseconds

getMixRunner

public OperationMixRunner getMixRunner()
Description copied from interface: Options
Gets the operation mix runner to use, if null is returned then the default DefaultOperationMixRunner should be used

Specified by:
getMixRunner in interface Options
Returns:
Operation mix runner

getNoCount

public boolean getNoCount()
Description copied from interface: Options
Gets whether query results are counted or just thrown away

Specified by:
getNoCount in interface Options
Returns:
True if results will not be counted

getOperationMix

public OperationMix getOperationMix()
Description copied from interface: Options
Gets the Query Mix that is used

Specified by:
getOperationMix in interface Options
Returns:
Query Mix

getOperationRunner

public OperationRunner getOperationRunner()
Description copied from interface: Options
Gets the operation runner to use, if null is returned then the default OperationRunner should be used

Specified by:
getOperationRunner in interface Options
Returns:
Operation runner

getParallelThreads

public int getParallelThreads()
Description copied from interface: Options
Gets the number of parallel threads used for testing

Specified by:
getParallelThreads in interface Options
Returns:
Number of parallel threads

getQueryEndpoint

public String getQueryEndpoint()
Description copied from interface: Options
Gets the SPARQL query endpoint that is in use

Specified by:
getQueryEndpoint in interface Options
Returns:
SPARQL query endpoint URI

getRandomizeOrder

public boolean getRandomizeOrder()
Description copied from interface: Options
Gets whether operation order should be randomized

Specified by:
getRandomizeOrder in interface Options
Returns:
Whether operation order is random

getResultsAskFormat

public String getResultsAskFormat()
Description copied from interface: Options
Gets the Results format used for operations that make ASK queries

Specified by:
getResultsAskFormat in interface Options
Returns:
MIME Type for ASK results

getResultsGraphFormat

public String getResultsGraphFormat()
Description copied from interface: Options
Gets the Results format used for operations that make CONSTRUCT/DESCRIBE queries or that retrieve RDF graphs

Specified by:
getResultsGraphFormat in interface Options
Returns:
MIME Type for CONSTRUCT/DESCRUBE results and RDF graphs

getResultsSelectFormat

public String getResultsSelectFormat()
Description copied from interface: Options
Gets the Results format used for operations that make SELECT queries

Specified by:
getResultsSelectFormat in interface Options
Returns:
MIME Type for SELECT results

getSanityCheckLevel

public int getSanityCheckLevel()
Description copied from interface: Options
Gets the Sanity Checking Level

Specified by:
getSanityCheckLevel in interface Options
Returns:
Sanity Check Level

getSetupMix

public OperationMix getSetupMix()
Description copied from interface: Options
Gets the setup mix to be run, null indicates no setup mix is requested.

Operations in a setup mix are guaranteed to be run exactly in the order given.

Specified by:
getSetupMix in interface Options
Returns:
Setup mix or null

getTeardownMix

public OperationMix getTeardownMix()
Description copied from interface: Options
Gets the tear down mix to be run, null indicates no tear down mix is requested.

Operations in a tear down mix are guaranteed to be run exactly in the order given.

Specified by:
getTeardownMix in interface Options
Returns:
Tear down mix or null

getTimeout

public int getTimeout()
Description copied from interface: Options
Gets the timeout for operations, a zero/negative value indicates no timeout

Specified by:
getTimeout in interface Options
Returns:
Timeout in seconds

getUpdateEndpoint

public String getUpdateEndpoint()
Description copied from interface: Options
Gets the SPARQL Update endpoint that is in use

Specified by:
getUpdateEndpoint in interface Options
Returns:
SPARQL update endpoint URI

removeListener

public void removeListener(ProgressListener listener)
Description copied from interface: Options
Removes a Progress Listener if it is registered

Specified by:
removeListener in interface Options
Parameters:
listener - Progress Listener

resetGlobalOrder

public void resetGlobalOrder()
Description copied from interface: Options
Resets the global run order

Useful for runners that incorporate warmups into their runs

Specified by:
resetGlobalOrder in interface Options

setAllowCompression

public void setAllowCompression(boolean allowed)
Description copied from interface: Options
Sets whether the client will allow the server to return Deflate/GZip compressed responses

Specified by:
setAllowCompression in interface Options
Parameters:
allowed - Whether Deflate/GZip compression is allowed

setAuthenticator

public void setAuthenticator(HttpAuthenticator authenticator)
Description copied from interface: Options
Sets the HTTP authenticator used

Specified by:
setAuthenticator in interface Options
Parameters:
authenticator - HTTP authenticator

setCustomEndpoint

public void setCustomEndpoint(String name,
                              String endpoint)
Description copied from interface: Options
Sets a custom defined endpoint

Specified by:
setCustomEndpoint in interface Options
Parameters:
name - Name
endpoint - Endpoint URI

setDataset

public void setDataset(Dataset dataset)
Description copied from interface: Options
Sets a dataset to be used for in-memory queries and updates

Specified by:
setDataset in interface Options
Parameters:
dataset - Dataset

setGraphStoreEndpoint

public void setGraphStoreEndpoint(String endpoint)
Description copied from interface: Options
Gets the SPARQL graph store protocol endpoint that is in use

Specified by:
setGraphStoreEndpoint in interface Options

setHaltAny

public void setHaltAny(boolean halt)
Description copied from interface: Options
Sets Halt on Any behavior, if set to true sets Halt on Error and Halt on Timeout to true as well

Specified by:
setHaltAny in interface Options
Parameters:
halt - Whether any issue should cause benchmarking to abort

setHaltBehaviour

public void setHaltBehaviour(HaltBehaviour behaviour)
Description copied from interface: Options
Sets the Halting Behaviour

Specified by:
setHaltBehaviour in interface Options
Parameters:
behaviour - Halting Behaviour

setHaltOnError

public void setHaltOnError(boolean halt)
Description copied from interface: Options
Sets the Halt on Error behavior

Specified by:
setHaltOnError in interface Options
Parameters:
halt - Whether an error should cause benchmarking to abort

setHaltOnTimeout

public void setHaltOnTimeout(boolean halt)
Description copied from interface: Options
Sets the Halt on Timeout behavior

Specified by:
setHaltOnTimeout in interface Options
Parameters:
halt - Whether a timeout should cause benchmarking to abort

setLimit

public void setLimit(long limit)
Description copied from interface: Options
Sets the LIMIT to impose on queries

Values less than or equal to zero mean existing limits are left unchanged, non-zero values will be imposed iff existing limit is greater than the set limit

Specified by:
setLimit in interface Options
Parameters:
limit - Limit to impose

setMaxDelay

public void setMaxDelay(int milliseconds)
Description copied from interface: Options
Sets the maximum delay between operations

Specified by:
setMaxDelay in interface Options
Parameters:
milliseconds - Maximum Delay in milliseconds

setMixRunner

public void setMixRunner(OperationMixRunner runner)
Description copied from interface: Options
Sets the operation mix runner to use, if set to null then the default DefaultOperationMixRunner should be used

Specified by:
setMixRunner in interface Options
Parameters:
runner - Operation mix runner

setNoCount

public void setNoCount(boolean noCount)
Description copied from interface: Options
Sets whether query results are counted or just thrown away

Currently enabling this only applies to SELECT queries as only SELECT queries stream the results currently, future versions of this tool will also stream CONSTRUCT/DESCRIBE results but this is yet to be implemented

Specified by:
setNoCount in interface Options
Parameters:
noCount - Whether query results are counted

setOperationMix

public void setOperationMix(OperationMix queries)
Description copied from interface: Options
Sets the Query Mix to use

Specified by:
setOperationMix in interface Options
Parameters:
queries - Query Mix

setOperationRunner

public void setOperationRunner(OperationRunner runner)
Description copied from interface: Options
Sets the operation runner to use, if set to null then the default DefaultOperationRunner should be used

Specified by:
setOperationRunner in interface Options
Parameters:
runner - Operation runner

setParallelThreads

public void setParallelThreads(int threads)
Description copied from interface: Options
Sets the number of parallel threads used for testing

Specified by:
setParallelThreads in interface Options
Parameters:
threads - Number of Parallel Threads

setQueryEndpoint

public void setQueryEndpoint(String endpoint)
Description copied from interface: Options
Sets the SPARQL query endpoint to be used

Specified by:
setQueryEndpoint in interface Options
Parameters:
endpoint - SPARQL query endpoint URI

setRandomizeOrder

public void setRandomizeOrder(boolean randomize)
Description copied from interface: Options
Sets whether operation order should be randomized

Specified by:
setRandomizeOrder in interface Options
Parameters:
randomize - Whether operation order should be random

setResultsAskFormat

public void setResultsAskFormat(String contentType)
Description copied from interface: Options
Sets the Results format to be used for operations that make ASK queries

Specified by:
setResultsAskFormat in interface Options
Parameters:
contentType - MIME Type for ASK results

setResultsGraphFormat

public void setResultsGraphFormat(String contentType)
Description copied from interface: Options
Sets the Results format used for operations that CONSTRUCT/DESCRIBE queries or that retrieve RDF graphs

Specified by:
setResultsGraphFormat in interface Options
Parameters:
contentType - MIME Type for CONSTRUCT/DESCRIBE results and RDF graphs

setResultsSelectFormat

public void setResultsSelectFormat(String contentType)
Description copied from interface: Options
Sets the Results format to be used for operations that make SELECT queries

Specified by:
setResultsSelectFormat in interface Options
Parameters:
contentType - MIME Type for SELECT results

setSanityCheckLevel

public void setSanityCheckLevel(int level)
Description copied from interface: Options
Sets the Sanity Checking level

Specified by:
setSanityCheckLevel in interface Options
Parameters:
level - Sanity Check Level

setSetupMix

public void setSetupMix(OperationMix mix)
Description copied from interface: Options
Sets the setup mix that will be run once before testing starts.

Operations in a setup mix are guaranteed to be run exactly in the order given.

Specified by:
setSetupMix in interface Options
Parameters:
mix - Setup mix

setTeardownMix

public void setTeardownMix(OperationMix mix)
Description copied from interface: Options
Sets the tear down mix that will be run once after testing completes successfully.

Operations in a tear down mix are guaranteed to be run exactly in the order given.

Specified by:
setTeardownMix in interface Options
Parameters:
mix - Tear down mix

setTimeout

public void setTimeout(int timeout)
Description copied from interface: Options
Sets the timeout for operations, a zero/negative value indicates no timeout

Specified by:
setTimeout in interface Options
Parameters:
timeout - Timeout in seconds

setUpdateEndpoint

public void setUpdateEndpoint(String endpoint)
Description copied from interface: Options
Sets the SPARQL update endpoint that is in use

Specified by:
setUpdateEndpoint in interface Options
Parameters:
endpoint - SPARQL update endpoint URI


Copyright © 2014. All Rights Reserved.