public class ExecutionContext extends Object
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()
.Modifier and Type | Field and Description |
---|---|
protected ResourceRegistry |
f_resourceRegistry
The
ResourceRegistry used to store various resources
used by queries managed by this context. |
protected ConfigurableCacheFactory |
m_cacheFactory
The
ConfigurableCacheFactory to use to access caches. |
protected Cluster |
m_cluster
The
Cluster to use to access services. |
protected StatementExecutor |
m_executor
The
StatementExecutor to use to execute statements. |
protected boolean |
m_fExtendedLanguage
Flag that controls whether we except Map, and List as literals.
|
protected boolean |
m_fSanity
A flag that enables sanity checking.
|
protected boolean |
m_fSilent
A flag indicating whether the query session is running in silent mode.
|
protected boolean |
m_fStopOnError
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 |
m_fTrace
Flag that indicates tracing mode.
|
protected CoherenceQueryLanguage |
m_language
The
CoherenceQueryLanguage to use. |
protected BufferedReader |
m_reader
The reader to use to get user input.
|
protected String |
m_sTitle
String to use for Title that heads each result displayed.
|
protected com.oracle.coherence.common.util.Duration |
m_timeout
The number of milli-seconds to wait for a
Statement to execute
before timing out. |
protected PrintWriter |
m_writer
The
PrintWriter that can be used by commands to display output. |
Constructor and Description |
---|
ExecutionContext()
Construct an ExecutionContext.
|
Modifier and Type | Method and Description |
---|---|
ConfigurableCacheFactory |
getCacheFactory()
Return the current
ConfigurableCacheFactory to be used
by commands executed under this context. |
Cluster |
getCluster()
Return the current
Cluster to be used
by commands executed under this context. |
CoherenceQueryLanguage |
getCoherenceQueryLanguage()
Return an instance of
CoherenceQueryLanguage to be
used by commands. |
BufferedReader |
getReader()
Return the
BufferedReader that can be used to obtain user input,
typically from System.in . |
ResourceRegistry |
getResourceRegistry()
Return the
ResourceRegistry that may be used to register
ad-hoc resources with this context as a way to maintain state between
different command executions. |
StatementExecutor |
getStatementExecutor()
Return the
StatementExecutor to use to parse and
execute statements. |
com.oracle.coherence.common.util.Duration |
getTimeout()
Obtain the number of mill-seconds to wait for a
Statement to execute
before timing out. |
String |
getTitle()
Return the String to use for title that heads each result.
|
PrintWriter |
getWriter()
Return the
PrintWriter that can be used by commands to display output. |
OPParser |
instantiateParser(Reader reader)
|
boolean |
isExtendedLanguageEnabled()
Return whether "Extended Language" features are enabled.
|
boolean |
isSanityChecking()
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 |
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.
|
boolean |
isTraceEnabled()
Return whether trace to display output when executing commands.
|
void |
setCacheFactory(ConfigurableCacheFactory ccf)
Set the current
ConfigurableCacheFactory to be used by commands
executed under this context. |
void |
setCluster(Cluster cluster)
Set the current
Cluster to be used by commands
executed under this context. |
void |
setCoherenceQueryLanguage(CoherenceQueryLanguage language)
Set the
CoherenceQueryLanguage that will be used by commands. |
void |
setExtendedLanguage(boolean fExtendedLanguage)
Set whether "Extended Language" features are enabled.
|
void |
setReader(BufferedReader reader)
Set the
BufferedReader that should be used to obtain user input. |
void |
setSanityCheckingEnabled(boolean fSanity)
Set whether sanity checking is enabled when executing commands.
|
void |
setSilentMode(boolean fSilent)
Set the flag indicating that the QueryPlus session is running
in silent mode.
|
void |
setStatementExecutor(StatementExecutor executor)
Set the
StatementExecutor 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 the
Duration to wait for a Statement to execute
before timing out. |
void |
setTitle(String sTitle)
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 the
PrintWriter that can be used by commands to display output. |
protected final ResourceRegistry f_resourceRegistry
ResourceRegistry
used to store various resources
used by queries managed by this context.protected ConfigurableCacheFactory m_cacheFactory
ConfigurableCacheFactory
to use to access caches.protected boolean m_fTrace
protected boolean m_fSanity
protected boolean m_fExtendedLanguage
protected CoherenceQueryLanguage m_language
CoherenceQueryLanguage
to use.protected PrintWriter m_writer
PrintWriter
that can be used by commands to display output.protected boolean m_fStopOnError
protected String m_sTitle
protected StatementExecutor m_executor
StatementExecutor
to use to execute statements.protected boolean m_fSilent
protected BufferedReader m_reader
protected com.oracle.coherence.common.util.Duration m_timeout
Statement
to execute
before timing out.public ResourceRegistry getResourceRegistry()
ResourceRegistry
that may be used to register
ad-hoc resources with this context as a way to maintain state between
different command executions.public void setCacheFactory(ConfigurableCacheFactory ccf)
ConfigurableCacheFactory
to be used by commands
executed under this context.ccf
- the ConfigurableCacheFactory to be used by commands
executed with this contextpublic ConfigurableCacheFactory getCacheFactory()
ConfigurableCacheFactory
to be used
by commands executed under this context.public void setCluster(Cluster cluster)
Cluster
to be used by commands
executed under this context.cluster
- the Cluster to be used by commands
executed with this contextpublic Cluster getCluster()
Cluster
to be used
by commands executed under this context.public void setCoherenceQueryLanguage(CoherenceQueryLanguage language)
CoherenceQueryLanguage
that will be used by commands.language
- the CoherenceQueryLanguage to be used by commandspublic CoherenceQueryLanguage getCoherenceQueryLanguage()
CoherenceQueryLanguage
to be
used by commands.public void setTraceEnabled(boolean fTrace)
fTrace
- whether to display trace output when executing commandspublic boolean isTraceEnabled()
public void setSanityCheckingEnabled(boolean fSanity)
fSanity
- whether sanity checking is enabled when executing commandspublic boolean isSanityChecking()
public void setExtendedLanguage(boolean fExtendedLanguage)
fExtendedLanguage
- whether "Extended Language" features are enabledpublic boolean isExtendedLanguageEnabled()
public void setWriter(PrintWriter writer)
PrintWriter
that can be used by commands to display output.writer
- the PrintWriter that can be used by commands to display outputpublic PrintWriter getWriter()
PrintWriter
that can be used by commands to display output.public boolean isStopOnError()
public void setStopOnError(boolean fStopOnError)
fStopOnError
- true if statement processing should stop when
errors occurpublic void setTitle(String sTitle)
sTitle
- the title that will be displayed as the
results headingpublic String getTitle()
public void setStatementExecutor(StatementExecutor executor)
StatementExecutor
to use to parse and
execute statements.executor
- the StatementExecutor to usepublic StatementExecutor getStatementExecutor()
StatementExecutor
to use to parse and
execute statements.public OPParser instantiateParser(Reader reader)
OPParser
to parse
the CohQL statements provided by the specified Reader
.reader
- the Reader
containing the statements to executepublic boolean isSilent()
public void setSilentMode(boolean fSilent)
fSilent
- true to indicate that the QueryPlus session is
running in silent mode.public BufferedReader getReader()
BufferedReader
that can be used to obtain user input,
typically from System.in
.public void setReader(BufferedReader reader)
BufferedReader
that should be used to obtain user input.reader
- the BufferedReader to use to obtain user inputpublic com.oracle.coherence.common.util.Duration getTimeout()
Statement
to execute
before timing out.Statement
to execute
before timing outpublic void setTimeout(com.oracle.coherence.common.util.Duration timeout)
Duration
to wait for a Statement
to execute
before timing out.timeout
- the timeout durationIllegalArgumentException
- if the timeout value is null