public class CmdRunner extends Object
TODO: describe how to use this class.
Modifier and Type | Class and Description |
---|---|
protected static class |
CmdRunner.Options |
Constructor and Description |
---|
CmdRunner(CmdRunner.Options options,
PrintWriter out)
Creates a
CmdRunner . |
Modifier and Type | Method and Description |
---|---|
protected static void |
appendCube(StringBuilder buf) |
protected static void |
appendEcho(StringBuilder buf) |
protected static void |
appendError(StringBuilder buf) |
protected static void |
appendExit(StringBuilder buf) |
protected static void |
appendExpr(StringBuilder buf) |
protected static void |
appendFile(StringBuilder buf) |
protected static void |
appendFunc(StringBuilder buf) |
protected static void |
appendIndent(StringBuilder buf,
int i) |
protected static void |
appendList(StringBuilder buf) |
protected static void |
appendLog(StringBuilder buf) |
protected static void |
appendParam(StringBuilder buf) |
protected static void |
appendSet(StringBuilder buf) |
protected void |
commandLoop(boolean interactive) |
protected void |
commandLoop(File file) |
protected void |
commandLoop(Reader in,
boolean interactive)
The Command Loop where lines are read from the InputStream and
interpreted.
|
protected void |
commandLoop(String mdxCmd,
boolean interactive) |
protected void |
debug(String msg) |
String |
execute(String queryString)
Executes a query and returns the result as a string.
|
protected String |
executeCube(String mdxCmd) |
void |
executeCubeCommand(String cubename,
String command,
StringBuilder buf) |
protected String |
executeEcho(String mdxCmd) |
protected String |
executeError(String mdxCmd) |
protected String |
executeExpr(String mdxCmd) |
protected String |
executeFile(String mdxCmd) |
protected String |
executeFunc(String mdxCmd) |
protected static String |
executeHelp(String mdxCmd) |
protected String |
executeList(String mdxCmd) |
protected String |
executeLog(String mdxCmd) |
protected String |
executeMdxCmd(String mdxCmd) |
protected String |
executeParam(String mdxCmd) |
protected String |
executeSet(String mdxCmd) |
protected static String |
getCatalogURLProperty() |
Connection |
getConnection()
Gets a connection to Mondrian.
|
Connection |
getConnection(boolean fresh)
Gets a Mondrian connection, creating a new one if fresh is true.
|
String |
getConnectString() |
String |
getConnectString(boolean fresh) |
protected static String |
getConnectStringProperty() |
Cube |
getCube(String name) |
Cube[] |
getCubes() |
protected static String |
getJdbcDriversProperty() |
protected static String |
getJdbcPasswordProperty() |
protected static String |
getJdbcURLProperty() |
protected static String |
getJdbcUserProperty() |
protected static int |
getLine(Reader reader,
StringBuilder line)
Read the next line of input.
|
org.olap4j.OlapConnection |
getOlapConnection()
Gets an olap4j connection, creating a new one if fresh is true.
|
long |
getQueryTime() |
boolean |
getTimeQueries() |
long |
getTotalQueryTime() |
String |
highCardToString(Result result)
Converts a
Result object to a string printing to standard
output directly, without buffering. |
static boolean |
isParam(String name) |
static boolean |
isProperty(String propertyName) |
void |
listCubeAttribues(String name,
StringBuilder buf) |
void |
listCubeName(StringBuilder buf) |
static void |
listParam(String name,
StringBuilder buf) |
static void |
listParameterNameValues(StringBuilder buf) |
static void |
listPropertiesAll(StringBuilder buf) |
static void |
listProperty(String propertyName,
StringBuilder buf) |
static void |
listPropertyNames(StringBuilder buf) |
void |
loadParameter(Query query,
Parameter param) |
void |
loadParameters(Query query) |
protected static void |
loadPropertiesFromFile(String propFile) |
static void |
main(String[] args) |
void |
makeConnectString() |
void |
noCubeCaching() |
mondrian.tui.CmdRunner.Expr |
parseParameter(String value) |
protected void |
printQueryTime() |
protected void |
printResults(String resultString) |
protected void |
processSoapXmla(File file,
int validateXmlaResponse)
This is called to process a file containing XMLA as the contents
of SOAP xml.
|
protected void |
processXmla(File file,
int validateXmlaResponce)
This is called to process a file containing XMLA xml.
|
protected static int |
readBlock(Reader reader,
StringBuilder line,
int offset,
String startDelim,
String endDelim,
boolean allowEscape,
boolean addToBuf,
StringBuilder buf,
int i)
Start of a delimted block, read all of it even if it spans
more than one line adding each line's
|
protected static String |
readLine(Reader reader,
boolean inMdxCmd)
Gather up a line ending in '\n' or EOF.
|
protected static int |
readString(Reader reader,
StringBuilder line,
int offset,
StringBuilder buf,
int i)
Start of a string, read all of it even if it spans
more than one line adding each line's
|
protected String |
reExecuteMdxCmd() |
Result |
runQuery(String queryString,
boolean loadParams)
Executes a query and returns the result.
|
<T> T |
runQuery(String queryString,
Util.Functor1<T,org.olap4j.CellSet> f)
Executes a query and processes the result using a callback.
|
void |
setCubeAttribute(String cubename,
String name,
String value,
StringBuilder buf) |
static void |
setParameter(String name,
String value) |
static boolean |
setProperty(String name,
String value) |
void |
setTimeQueries(boolean timeQueries) |
String |
toString(Result result)
Converts a
Result object to a string |
protected static void |
usage(String msg,
PrintStream out)
Prints a usage message.
|
public CmdRunner(CmdRunner.Options options, PrintWriter out)
CmdRunner
.options
- Option set, or null to use default optionsout
- Output writer, or null to use System.out
.public void setTimeQueries(boolean timeQueries)
public boolean getTimeQueries()
public long getQueryTime()
public long getTotalQueryTime()
public void noCubeCaching()
public static void listPropertyNames(StringBuilder buf)
public static void listPropertiesAll(StringBuilder buf)
public static void listProperty(String propertyName, StringBuilder buf)
public static boolean isProperty(String propertyName)
public void loadParameters(Query query)
public mondrian.tui.CmdRunner.Expr parseParameter(String value)
public static void listParameterNameValues(StringBuilder buf)
public static void listParam(String name, StringBuilder buf)
public static boolean isParam(String name)
public Cube[] getCubes()
public void listCubeName(StringBuilder buf)
public void listCubeAttribues(String name, StringBuilder buf)
public void executeCubeCommand(String cubename, String command, StringBuilder buf)
public void setCubeAttribute(String cubename, String name, String value, StringBuilder buf)
public String execute(String queryString)
queryString
- MDX query textpublic Result runQuery(String queryString, boolean loadParams)
queryString
- MDX query textResult
objectpublic <T> T runQuery(String queryString, Util.Functor1<T,org.olap4j.CellSet> f)
queryString
- MDX query textpublic String toString(Result result)
Result
object to a stringpublic String highCardToString(Result result)
Result
object to a string printing to standard
output directly, without buffering.public void makeConnectString()
public Connection getConnection()
Connection
public Connection getConnection(boolean fresh)
public org.olap4j.OlapConnection getOlapConnection() throws SQLException
SQLException
public String getConnectString()
public String getConnectString(boolean fresh)
protected void debug(String msg)
protected static String getConnectStringProperty()
protected static String getJdbcURLProperty()
protected static String getJdbcUserProperty()
protected static String getJdbcPasswordProperty()
protected static String getCatalogURLProperty()
protected static String getJdbcDriversProperty()
protected void commandLoop(boolean interactive) throws IOException
IOException
protected void commandLoop(File file) throws IOException
IOException
protected void commandLoop(String mdxCmd, boolean interactive) throws IOException
IOException
protected void commandLoop(Reader in, boolean interactive)
in
- Input reader (preferably buffered)interactive
- Whether the session is interactiveprotected void printResults(String resultString)
protected void printQueryTime()
protected static String readLine(Reader reader, boolean inMdxCmd) throws IOException
IOException
protected static int getLine(Reader reader, StringBuilder line) throws IOException
IOException
protected static int readString(Reader reader, StringBuilder line, int offset, StringBuilder buf, int i) throws IOException
IOException
protected static int readBlock(Reader reader, StringBuilder line, int offset, String startDelim, String endDelim, boolean allowEscape, boolean addToBuf, StringBuilder buf, int i) throws IOException
IOException
protected void processSoapXmla(File file, int validateXmlaResponse) throws Exception
Exception
protected void processXmla(File file, int validateXmlaResponce) throws Exception
Exception
protected static void appendIndent(StringBuilder buf, int i)
protected static void appendSet(StringBuilder buf)
protected static void appendLog(StringBuilder buf)
protected static void appendFile(StringBuilder buf)
protected static void appendList(StringBuilder buf)
protected static void appendFunc(StringBuilder buf)
protected static void appendParam(StringBuilder buf)
protected static void appendCube(StringBuilder buf)
protected static void appendError(StringBuilder buf)
protected static void appendEcho(StringBuilder buf)
protected static void appendExpr(StringBuilder buf)
protected static void appendExit(StringBuilder buf)
protected String reExecuteMdxCmd()
protected static void loadPropertiesFromFile(String propFile) throws IOException
IOException
protected static void usage(String msg, PrintStream out)
msg
- Prefix to the messageout
- Output streamCopyright © 2018 Hitachi Vantara. All rights reserved.