Package com.tangosol.coherence.dslquery
Class ExecutionContext
java.lang.Object
com.tangosol.coherence.dslquery.ExecutionContext
Instances of this context are passed to
Statement
s to allow
commands to discern execution conditions, altering their behavior / result
as needed. In addition, commands may wish to alter the execution conditions
or hold state across executions; the latter is possible via getResourceRegistry()
.- Since:
- Coherence 12.2.1
- Author:
- jk 2014.07.10
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ResourceRegistry
TheResourceRegistry
used to store various resources used by queries managed by this context.protected ConfigurableCacheFactory
TheConfigurableCacheFactory
to use to access caches.protected Cluster
TheCluster
to use to access services.protected StatementExecutor
TheStatementExecutor
to use to execute statements.protected boolean
Flag that controls whether we except Map, and List as literals.protected boolean
A flag that enables sanity checking.protected boolean
A flag indicating whether the query session is running in silent mode.protected boolean
A flag indicating when true that CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or when false that errors will be logged and statement processing will continue.protected boolean
Flag that indicates tracing mode.protected CoherenceQueryLanguage
TheCoherenceQueryLanguage
to use.protected BufferedReader
The reader to use to get user input.protected Session
TheSession
to use for cache access.protected String
String to use for Title that heads each result displayed.protected com.oracle.coherence.common.util.Duration
The number of milli-seconds to wait for aStatement
to execute before timing out.protected PrintWriter
ThePrintWriter
that can be used by commands to display output. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Return the currentCluster
to be used by commands executed under this context.Return an instance ofCoherenceQueryLanguage
to be used by commands.Return theBufferedReader
that can be used to obtain user input, typically fromSystem.in
.Return theResourceRegistry
that may be used to register ad-hoc resources with this context as a way to maintain state between different command executions.Return the currentSession
that will be used by commands executed under this context.Return theStatementExecutor
to use to parse and execute statements.com.oracle.coherence.common.util.Duration
Obtain the number of mill-seconds to wait for aStatement
to execute before timing out.getTitle()
Return the String to use for title that heads each result.Return thePrintWriter
that can be used by commands to display output.instantiateParser
(Reader reader) boolean
Return whether "Extended Language" features are enabled.boolean
Return whether sanity checking should be enabled when executing commands.boolean
isSilent()
Return true if the current query session is running in silent mode.boolean
Return the flag indicating whether CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or whether errors should be logged and statement processing continue.boolean
Return whether trace to display output when executing commands.void
Deprecated.void
setCluster
(Cluster cluster) Set the currentCluster
to be used by commands executed under this context.void
Set theCoherenceQueryLanguage
that will be used by commands.void
setExtendedLanguage
(boolean fExtendedLanguage) Set whether "Extended Language" features are enabled.void
setReader
(BufferedReader reader) Set theBufferedReader
that should be used to obtain user input.void
setSanityCheckingEnabled
(boolean fSanity) Set whether sanity checking is enabled when executing commands.void
setSession
(Session session) Set theSession
that will be used by commands executed under this context.void
setSilentMode
(boolean fSilent) Set the flag indicating that the QueryPlus session is running in silent mode.void
setStatementExecutor
(StatementExecutor executor) Set theStatementExecutor
to use to parse and execute statements.void
setStopOnError
(boolean fStopOnError) Set the flag indicating whether CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or whether errors should be logged and statement processing continue.void
setTimeout
(com.oracle.coherence.common.util.Duration timeout) Set theDuration
to wait for aStatement
to execute before timing out.void
Set the title that will be displayed as the results heading.void
setTraceEnabled
(boolean fTrace) Set whether to display trace output when executing commands.void
setWriter
(PrintWriter writer) Set thePrintWriter
that can be used by commands to display output.
-
Field Details
-
f_resourceRegistry
TheResourceRegistry
used to store various resources used by queries managed by this context. -
m_cacheFactory
TheConfigurableCacheFactory
to use to access caches. -
m_session
TheSession
to use for cache access. -
m_cluster
TheCluster
to use to access services. -
m_fTrace
protected boolean m_fTraceFlag that indicates tracing mode. -
m_fSanity
protected boolean m_fSanityA flag that enables sanity checking. -
m_fExtendedLanguage
protected boolean m_fExtendedLanguageFlag that controls whether we except Map, and List as literals. This gives a json like feel to the language. -
m_language
TheCoherenceQueryLanguage
to use. -
m_writer
ThePrintWriter
that can be used by commands to display output. -
m_fStopOnError
protected boolean m_fStopOnErrorA flag indicating when true that CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or when false that errors will be logged and statement processing will continue. -
m_sTitle
String to use for Title that heads each result displayed. -
m_executor
TheStatementExecutor
to use to execute statements. -
m_fSilent
protected boolean m_fSilentA flag indicating whether the query session is running in silent mode. -
m_reader
The reader to use to get user input. -
m_timeout
protected com.oracle.coherence.common.util.Duration m_timeoutThe number of milli-seconds to wait for aStatement
to execute before timing out.
-
-
Constructor Details
-
ExecutionContext
public ExecutionContext()Construct an ExecutionContext.
-
-
Method Details
-
getResourceRegistry
Return theResourceRegistry
that may be used to register ad-hoc resources with this context as a way to maintain state between different command executions.- Returns:
- the ResourceRegistry that may be used to register ad-hoc resources
-
setCacheFactory
Deprecated.Set the currentConfigurableCacheFactory
to be used by commands executed under this context.- Parameters:
ccf
- the ConfigurableCacheFactory to be used by commands executed with this context
-
getCacheFactory
Deprecated.usegetSession()
Return the currentConfigurableCacheFactory
to be used by commands executed under this context. If aSession
has already been set before aConfigurableCacheFactory
has been specified, this method may returnnull
when called.- Returns:
- the current ConfigurableCacheFactory
-
getSession
Return the currentSession
that will be used by commands executed under this context.- Returns:
- the current
Session
that will be used by commands executed under this context - Since:
- 20.12.1
-
setSession
Set theSession
that will be used by commands executed under this context.- Parameters:
session
- theSession
- Since:
- 20.12.1
-
setCluster
Set the currentCluster
to be used by commands executed under this context.- Parameters:
cluster
- the Cluster to be used by commands executed with this context
-
getCluster
Return the currentCluster
to be used by commands executed under this context.- Returns:
- the current Cluster
-
setCoherenceQueryLanguage
Set theCoherenceQueryLanguage
that will be used by commands.- Parameters:
language
- the CoherenceQueryLanguage to be used by commands
-
getCoherenceQueryLanguage
Return an instance ofCoherenceQueryLanguage
to be used by commands.- Returns:
- the instance of CoherenceQueryLanguage to be used by commands
-
setTraceEnabled
public void setTraceEnabled(boolean fTrace) Set whether to display trace output when executing commands.- Parameters:
fTrace
- whether to display trace output when executing commands
-
isTraceEnabled
public boolean isTraceEnabled()Return whether trace to display output when executing commands.- Returns:
- true if trace is enabled, otherwise returns false
-
setSanityCheckingEnabled
public void setSanityCheckingEnabled(boolean fSanity) Set whether sanity checking is enabled when executing commands.- Parameters:
fSanity
- whether sanity checking is enabled when executing commands
-
isSanityChecking
public boolean isSanityChecking()Return whether sanity checking should be enabled when executing commands.- Returns:
- whether sanity checking should be enabled when executing commands
-
setExtendedLanguage
public void setExtendedLanguage(boolean fExtendedLanguage) Set whether "Extended Language" features are enabled.- Parameters:
fExtendedLanguage
- whether "Extended Language" features are enabled
-
isExtendedLanguageEnabled
public boolean isExtendedLanguageEnabled()Return whether "Extended Language" features are enabled.- Returns:
- whether "Extended Language" features are enabled
-
setWriter
Set thePrintWriter
that can be used by commands to display output.- Parameters:
writer
- the PrintWriter that can be used by commands to display output
-
getWriter
Return thePrintWriter
that can be used by commands to display output.- Returns:
- the PrintWriter that can be used by commands to display output
-
isStopOnError
public boolean isStopOnError()Return the flag indicating whether CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or whether errors should be logged and statement processing continue.- Returns:
- true if statement processing should stop when errors occur.
-
setStopOnError
public void setStopOnError(boolean fStopOnError) Set the flag indicating whether CohQL should stop processing multiple statements if an error occurs (for example when processing a file), or whether errors should be logged and statement processing continue.- Parameters:
fStopOnError
- true if statement processing should stop when errors occur
-
setTitle
Set the title that will be displayed as the results heading.- Parameters:
sTitle
- the title that will be displayed as the results heading
-
getTitle
Return the String to use for title that heads each result.- Returns:
- the String to use for title that heads each result
-
setStatementExecutor
Set theStatementExecutor
to use to parse and execute statements.- Parameters:
executor
- the StatementExecutor to use
-
getStatementExecutor
Return theStatementExecutor
to use to parse and execute statements.- Returns:
- the StatementExecutor to use to parse and execute statements
-
instantiateParser
Instantiate an instance of anOPParser
to parse the CohQL statements provided by the specifiedReader
.- Parameters:
reader
- theReader
containing the statements to execute- Returns:
- an instance of an OPParser to parse the CohQL statements
-
isSilent
public boolean isSilent()Return true if the current query session is running in silent mode.- Returns:
- true if the current session is running in silent mode
-
setSilentMode
public void setSilentMode(boolean fSilent) Set the flag indicating that the QueryPlus session is running in silent mode.- Parameters:
fSilent
- true to indicate that the QueryPlus session is running in silent mode.
-
getReader
Return theBufferedReader
that can be used to obtain user input, typically fromSystem.in
.- Returns:
- Return the BufferedReader that can be used to obtain user input
-
setReader
Set theBufferedReader
that should be used to obtain user input.- Parameters:
reader
- the BufferedReader to use to obtain user input
-
getTimeout
public com.oracle.coherence.common.util.Duration getTimeout()Obtain the number of mill-seconds to wait for aStatement
to execute before timing out.- Returns:
- the number of mill-seconds to wait for a
Statement
to execute before timing out
-
setTimeout
public void setTimeout(com.oracle.coherence.common.util.Duration timeout) Set theDuration
to wait for aStatement
to execute before timing out.- Parameters:
timeout
- the timeout duration- Throws:
IllegalArgumentException
- if the timeout value is null
-
getSession()