Package com.tangosol.coherence.dslquery
Class ExecutionContext
- java.lang.Object
- 
- com.tangosol.coherence.dslquery.ExecutionContext
 
- 
 public class ExecutionContext extends Object Instances of this context are passed toStatements 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 viagetResourceRegistry().- Since:
- Coherence 12.2.1
- Author:
- jk 2014.07.10
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected ResourceRegistryf_resourceRegistryTheResourceRegistryused to store various resources used by queries managed by this context.protected ConfigurableCacheFactorym_cacheFactoryTheConfigurableCacheFactoryto use to access caches.protected Clusterm_clusterTheClusterto use to access services.protected StatementExecutorm_executorTheStatementExecutorto use to execute statements.protected booleanm_fExtendedLanguageFlag that controls whether we except Map, and List as literals.protected booleanm_fSanityA flag that enables sanity checking.protected booleanm_fSilentA flag indicating whether the query session is running in silent mode.protected booleanm_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.protected booleanm_fTraceFlag that indicates tracing mode.protected CoherenceQueryLanguagem_languageTheCoherenceQueryLanguageto use.protected BufferedReaderm_readerThe reader to use to get user input.protected Sessionm_sessionTheSessionto use for cache access.protected Stringm_sTitleString to use for Title that heads each result displayed.protected com.oracle.coherence.common.util.Durationm_timeoutThe number of milli-seconds to wait for aStatementto execute before timing out.protected PrintWriterm_writerThePrintWriterthat can be used by commands to display output.
 - 
Constructor SummaryConstructors Constructor Description ExecutionContext()Construct an ExecutionContext.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConfigurableCacheFactorygetCacheFactory()Deprecated.usegetSession()ClustergetCluster()Return the currentClusterto be used by commands executed under this context.CoherenceQueryLanguagegetCoherenceQueryLanguage()Return an instance ofCoherenceQueryLanguageto be used by commands.BufferedReadergetReader()Return theBufferedReaderthat can be used to obtain user input, typically fromSystem.in.ResourceRegistrygetResourceRegistry()Return theResourceRegistrythat may be used to register ad-hoc resources with this context as a way to maintain state between different command executions.SessiongetSession()Return the currentSessionthat will be used by commands executed under this context.StatementExecutorgetStatementExecutor()Return theStatementExecutorto use to parse and execute statements.com.oracle.coherence.common.util.DurationgetTimeout()Obtain the number of mill-seconds to wait for aStatementto execute before timing out.StringgetTitle()Return the String to use for title that heads each result.PrintWritergetWriter()Return thePrintWriterthat can be used by commands to display output.OPParserinstantiateParser(Reader reader)booleanisExtendedLanguageEnabled()Return whether "Extended Language" features are enabled.booleanisSanityChecking()Return whether sanity checking should be enabled when executing commands.booleanisSilent()Return true if the current query session is running in silent mode.booleanisStopOnError()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.booleanisTraceEnabled()Return whether trace to display output when executing commands.voidsetCacheFactory(ConfigurableCacheFactory ccf)Deprecated.voidsetCluster(Cluster cluster)Set the currentClusterto be used by commands executed under this context.voidsetCoherenceQueryLanguage(CoherenceQueryLanguage language)Set theCoherenceQueryLanguagethat will be used by commands.voidsetExtendedLanguage(boolean fExtendedLanguage)Set whether "Extended Language" features are enabled.voidsetReader(BufferedReader reader)Set theBufferedReaderthat should be used to obtain user input.voidsetSanityCheckingEnabled(boolean fSanity)Set whether sanity checking is enabled when executing commands.voidsetSession(Session session)Set theSessionthat will be used by commands executed under this context.voidsetSilentMode(boolean fSilent)Set the flag indicating that the QueryPlus session is running in silent mode.voidsetStatementExecutor(StatementExecutor executor)Set theStatementExecutorto use to parse and execute statements.voidsetStopOnError(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.voidsetTimeout(com.oracle.coherence.common.util.Duration timeout)Set theDurationto wait for aStatementto execute before timing out.voidsetTitle(String sTitle)Set the title that will be displayed as the results heading.voidsetTraceEnabled(boolean fTrace)Set whether to display trace output when executing commands.voidsetWriter(PrintWriter writer)Set thePrintWriterthat can be used by commands to display output.
 
- 
- 
- 
Field Detail- 
f_resourceRegistryprotected final ResourceRegistry f_resourceRegistry TheResourceRegistryused to store various resources used by queries managed by this context.
 - 
m_cacheFactoryprotected ConfigurableCacheFactory m_cacheFactory TheConfigurableCacheFactoryto use to access caches.
 - 
m_fTraceprotected boolean m_fTrace Flag that indicates tracing mode.
 - 
m_fSanityprotected boolean m_fSanity A flag that enables sanity checking.
 - 
m_fExtendedLanguageprotected boolean m_fExtendedLanguage Flag that controls whether we except Map, and List as literals. This gives a json like feel to the language.
 - 
m_languageprotected CoherenceQueryLanguage m_language TheCoherenceQueryLanguageto use.
 - 
m_writerprotected PrintWriter m_writer ThePrintWriterthat can be used by commands to display output.
 - 
m_fStopOnErrorprotected 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.
 - 
m_sTitleprotected String m_sTitle String to use for Title that heads each result displayed.
 - 
m_executorprotected StatementExecutor m_executor TheStatementExecutorto use to execute statements.
 - 
m_fSilentprotected boolean m_fSilent A flag indicating whether the query session is running in silent mode.
 - 
m_readerprotected BufferedReader m_reader The reader to use to get user input.
 - 
m_timeoutprotected com.oracle.coherence.common.util.Duration m_timeout The number of milli-seconds to wait for aStatementto execute before timing out.
 
- 
 - 
Method Detail- 
getResourceRegistrypublic ResourceRegistry getResourceRegistry() Return theResourceRegistrythat 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 public void setCacheFactory(ConfigurableCacheFactory ccf) Deprecated.Set the currentConfigurableCacheFactoryto be used by commands executed under this context.- Parameters:
- ccf- the ConfigurableCacheFactory to be used by commands executed with this context
 
 - 
getCacheFactory@Deprecated public ConfigurableCacheFactory getCacheFactory() Deprecated.usegetSession()Return the currentConfigurableCacheFactoryto be used by commands executed under this context. If aSessionhas already been set before aConfigurableCacheFactoryhas been specified, this method may returnnullwhen called.- Returns:
- the current ConfigurableCacheFactory
 
 - 
getSessionpublic Session getSession() Return the currentSessionthat will be used by commands executed under this context.- Returns:
- the current Sessionthat will be used by commands executed under this context
- Since:
- 20.12.1
 
 - 
setSessionpublic void setSession(Session session) Set theSessionthat will be used by commands executed under this context.- Parameters:
- session- the- Session
- Since:
- 20.12.1
 
 - 
setClusterpublic void setCluster(Cluster cluster) Set the currentClusterto be used by commands executed under this context.- Parameters:
- cluster- the Cluster to be used by commands executed with this context
 
 - 
getClusterpublic Cluster getCluster() Return the currentClusterto be used by commands executed under this context.- Returns:
- the current Cluster
 
 - 
setCoherenceQueryLanguagepublic void setCoherenceQueryLanguage(CoherenceQueryLanguage language) Set theCoherenceQueryLanguagethat will be used by commands.- Parameters:
- language- the CoherenceQueryLanguage to be used by commands
 
 - 
getCoherenceQueryLanguagepublic CoherenceQueryLanguage getCoherenceQueryLanguage() Return an instance ofCoherenceQueryLanguageto be used by commands.- Returns:
- the instance of CoherenceQueryLanguage to be used by commands
 
 - 
setTraceEnabledpublic void setTraceEnabled(boolean fTrace) Set whether to display trace output when executing commands.- Parameters:
- fTrace- whether to display trace output when executing commands
 
 - 
isTraceEnabledpublic boolean isTraceEnabled() Return whether trace to display output when executing commands.- Returns:
- true if trace is enabled, otherwise returns false
 
 - 
setSanityCheckingEnabledpublic void setSanityCheckingEnabled(boolean fSanity) Set whether sanity checking is enabled when executing commands.- Parameters:
- fSanity- whether sanity checking is enabled when executing commands
 
 - 
isSanityCheckingpublic boolean isSanityChecking() Return whether sanity checking should be enabled when executing commands.- Returns:
- whether sanity checking should be enabled when executing commands
 
 - 
setExtendedLanguagepublic void setExtendedLanguage(boolean fExtendedLanguage) Set whether "Extended Language" features are enabled.- Parameters:
- fExtendedLanguage- whether "Extended Language" features are enabled
 
 - 
isExtendedLanguageEnabledpublic boolean isExtendedLanguageEnabled() Return whether "Extended Language" features are enabled.- Returns:
- whether "Extended Language" features are enabled
 
 - 
setWriterpublic void setWriter(PrintWriter writer) Set thePrintWriterthat can be used by commands to display output.- Parameters:
- writer- the PrintWriter that can be used by commands to display output
 
 - 
getWriterpublic PrintWriter getWriter() Return thePrintWriterthat can be used by commands to display output.- Returns:
- the PrintWriter that can be used by commands to display output
 
 - 
isStopOnErrorpublic 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.
 
 - 
setStopOnErrorpublic 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
 
 - 
setTitlepublic void setTitle(String sTitle) Set the title that will be displayed as the results heading.- Parameters:
- sTitle- the title that will be displayed as the results heading
 
 - 
getTitlepublic String getTitle() Return the String to use for title that heads each result.- Returns:
- the String to use for title that heads each result
 
 - 
setStatementExecutorpublic void setStatementExecutor(StatementExecutor executor) Set theStatementExecutorto use to parse and execute statements.- Parameters:
- executor- the StatementExecutor to use
 
 - 
getStatementExecutorpublic StatementExecutor getStatementExecutor() Return theStatementExecutorto use to parse and execute statements.- Returns:
- the StatementExecutor to use to parse and execute statements
 
 - 
instantiateParserpublic OPParser instantiateParser(Reader reader) Instantiate an instance of anOPParserto parse the CohQL statements provided by the specifiedReader.- Parameters:
- reader- the- Readercontaining the statements to execute
- Returns:
- an instance of an OPParser to parse the CohQL statements
 
 - 
isSilentpublic 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
 
 - 
setSilentModepublic 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.
 
 - 
getReaderpublic BufferedReader getReader() Return theBufferedReaderthat can be used to obtain user input, typically fromSystem.in.- Returns:
- Return the BufferedReader that can be used to obtain user input
 
 - 
setReaderpublic void setReader(BufferedReader reader) Set theBufferedReaderthat should be used to obtain user input.- Parameters:
- reader- the BufferedReader to use to obtain user input
 
 - 
getTimeoutpublic com.oracle.coherence.common.util.Duration getTimeout() Obtain the number of mill-seconds to wait for aStatementto execute before timing out.- Returns:
- the number of mill-seconds to wait for a Statementto execute before timing out
 
 - 
setTimeoutpublic void setTimeout(com.oracle.coherence.common.util.Duration timeout) Set theDurationto wait for aStatementto execute before timing out.- Parameters:
- timeout- the timeout duration
- Throws:
- IllegalArgumentException- if the timeout value is null
 
 
- 
 
-