public class QueryPlus extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryPlus.DefaultDependencies
A default implementation of
QueryPlus.Dependencies. |
static interface |
QueryPlus.Dependencies
The Dependencies for QueryPlus.
|
static class |
QueryPlus.DependenciesHelper
The DependenciesHelper provides helper method for constructing
QueryPlus.Dependencies implementations for QueryPlus. |
| Modifier and Type | Field and Description |
|---|---|
protected ExecutionContext |
f_context
The
ExecutionContext that will be passed to Statements. |
protected QueryPlus.Dependencies |
f_dependencies
The
QueryPlus.Dependencies configuring this query session. |
protected StatementExecutor |
f_executor
The
StatementExecutor to use to execute statements. |
| Constructor and Description |
|---|
QueryPlus(QueryPlus.Dependencies dependencies)
Create a QueryPlus instance that uses the specified
QueryPlus.Dependencies. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAlterSessionStatement()
Add the QueryPlus ALTER SESSION statements
|
protected void |
addStatement(AbstractQueryPlusStatementBuilder builder)
Add a new QueryPlus statement.
|
protected void |
ensureGarServer(String sGarFile)
Ensure that a GarServer is running using the GAR file at the location specified in the QueryPlus.Dependencies.
|
protected boolean |
evalLine(String sLine)
Evaluate the given CohQL statement.
|
ExecutionContext |
getExecutionContext()
Return the current
ExecutionContext passed to Statements. |
static InputStream |
getJlineInputStream(PrintWriter writer, InputStream input, boolean fSilent)
Return an instance of jline.ConsoleReaderInputStream object if JLine is present.
|
protected void |
initializeLanguage()
Initialize the
CoherenceQueryLanguage with any QueryPlus Statement extensions. |
static void |
main(String[] asArgs)
The main application for CohQL statement processing.
|
protected boolean |
processFile(String sFileName)
Process the given file of CohQL statements.
|
protected Object |
query(String sQuery)
Process the specified query.
|
void |
repl()
Start a statement processing loop.
|
void |
run()
Run this instance of QueryPlus.
|
protected DefaultCacheServer.GarServer |
startGarServer(File fileGar, String sAppName, String[] asDomainPartition)
Start the cache server on a dedicated daemon thread using the given File reference to a GAR.
|
protected final QueryPlus.Dependencies f_dependencies
QueryPlus.Dependencies configuring this query session.protected final ExecutionContext f_context
ExecutionContext that will be passed to Statements.protected final StatementExecutor f_executor
StatementExecutor to use to execute statements.public QueryPlus(QueryPlus.Dependencies dependencies)
QueryPlus.Dependencies.dependencies - the Dependencies that will control the QueryPlus sessionpublic void run()
public void repl()
protected void ensureGarServer(String sGarFile)
sGarFile - the location of the GAR file or exploded GAR directoryprotected DefaultCacheServer.GarServer startGarServer(File fileGar, String sAppName, String[] asDomainPartition)
DefaultCacheServer.startServerDaemon(java.io.File, String, String[]) and is primarily here so that this method can be stubbed out for unit testing.fileGar - file reference to either a GAR file or a directory containing the contents of the GARsAppName - name to be used for the applicationasDomainPartition - (optional) Domain Partition namesDefaultCacheServer.GarServer startedDefaultCacheServer.startServerDaemon(java.io.File, String)public ExecutionContext getExecutionContext()
ExecutionContext passed to Statements.protected void initializeLanguage()
CoherenceQueryLanguage with any QueryPlus Statement extensions.protected void addStatement(AbstractQueryPlusStatementBuilder builder)
builder - the statement builder to addprotected void addAlterSessionStatement()
protected Object query(String sQuery)
sQuery - a String that represents the queryprotected boolean processFile(String sFileName)
sFileName - the name of the file CohQL containing the statements to executeprotected boolean evalLine(String sLine)
sLine - the CohQL statement String to be evaluatedpublic static InputStream getJlineInputStream(PrintWriter writer, InputStream input, boolean fSilent)
writer - the PrintWriter to write toinput - the InputStream that will provide inputfSilent - if true no message will be displayed if JLine is unavailable.public static void main(String[] asArgs)
asArgs - an array of Strings that represents arguments