Database Reference
In-Depth Information
The second technique is needed for older Essbase versions. It uses an AntBuilder
to call the essmsh executable and run individual commands via the -i command line
option.
String mshExec(String command, List args) {
def ant = new AntBuilder()
ant.exec(executable: "essmsh",
inputstring: command,
outputproperty: "cmdOut", // standard output
errorproperty: "cmdErr", // error output
resultproperty: "cmdExit") { // result code
arg(line: "-l user pass") // the first arg set is essmsh
arguments
arg(line: "-s ess_server") // the second set is more essmsh
arguments
arg(value: "-i") // the third argument is the "read from
input" flag
args.each { a -> // for all the command line arguments
arg(value: a) // add each one to the arguments for the
called script
}
}
def sts = ant.project.properties.cmdExit
if (sts.toInteger() != 0) {
println ant.project.properties.cmdErr
throw new Exception("MaxL script failed with status code
${sts}!")
}
return ant.project.properties.cmdOut
}
List parseMaxLDisplayX(String MaxLOut) {
lines = MaxLOut.tokenize('\n')
rulerLine = lines.findIndexOf{it =~ /^\+-+/}
colWidth = (lines[rulerLine] =~ /^(\+-+)/)[0][1].size()
lineWidth = lines[rulerLine].size()
listOfMaps = []
i = 1
while (lines[rulerLine + i].size() == lineWidth) {
values = [:]
((colWidth + 1)..lineWidth).step(colWidth) {
values[lines[rulerLine - 1][(it - 20)..<it].trim()] =
lines[rulerLine + i][(it - 20)..<it].trim()
}
listOfMaps << values
i++
}
return listOfMaps
}
MaxLOut = mshExec('display database Sample.Basic;',[]) // single
item displayeparseMaxLDisplayX(MaxLOut).each{ println "Sample.Basic
has a data cache of ${it.data_cache_size} bytes!" }
Search WWH ::




Custom Search