Professional Documents
Culture Documents
Todays Episode:
Get Your gap
Groovy On
Scripting solutions
have a coverage
Groovy bridges the gap
How-To:
Install Groovy
Write a Groovy program
Navigate the Java API
Do things you do with MaxL
Do things you cant do with MaxL
essmsh / EAS
No branching / looping, no
interaction
Redirect output to files, parse
Perl / Python*
Full logic, limited Essbase
interaction
Capture Maxl output, parse
API Programs
* not
(no longer)
essmsh / EAS
No branching / looping, no
interaction
API Programs
* not
File
String
Array, List
Map
Optional parentheses
This, too!
add(x,y) { x + y }
Operator overloading
order.leftShift(item)
becomes order
<< item
becomes if(args)
GStrings
Ranges
or (1..5).each{println
'Hi')
Currying
Fix the value of some parameters instead of hard-coding or passing the same value over and over
java.io.BufferedReader;
java.io.FileNotFoundException;
java.io.FileReader;
java.io.IOException;
Automatic imports
No class wrapper
No main method
Automatic resource handling
Iteration with eachLine + closure
Checked exception conversion
(Also optional parentheses, optional
semicolons)
Groovy in Summary
Java compatible (syntax/JVM) dynamic language
Eases many of the pains associated with Java
Adds many (many, many) powerful features to Java
Fun to write (like Perl)
Easy to read (totally NOT like Perl)
What Java-script would be if the name wasn't already taken Thomas Duff,
Amazon Top 100 reviewer
Its awesome
IEssOlapServer
.getApplication
IEssOlapApplication
.getCube
IEssCube
.getOutline
.getMember
.openMemberSelection
.associateAttributeMember / .disassociateAttributeMember
.findMember(s) / .findAlias
.moveMember
IEssMember
.createChildMember
.delete
.getChildMembers
IEssMemberSelection
.executeQuery
.getMembers
Load data
Load metadata
Run calcs
Assign access
Create/modify filters
Export data
Get server/app/db info
Kill sessions
Create partitions
Unlock objects
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Sort members
By name
By alias
By data value (!)
Audit attributes
com.essbase.api.base.*
com.essbase.api.datasource.*
com.essbase.api.metadata.*
com.essbase.api.session.*
Elvis operator
Powerful array sorting with closure
Looping with each again
write self-documenting code, and where you can not, comment generously
panic
copy and paste from JAPI samples too much
Early exits (unfinished code, errors, deliberate bailouts) may cause problems on the Essbase server
Resources may remain locked or processes hung
JAPI code should always clean up after itself
2.
3.
http://groovy.codehaus.org/Download
6.
7.
Ex: C:\glassfishv3\jdk
4.
5.
http://www.oracle.com/technetwork/java/javaee/downloads/index.html
I use the JDK / EE / Glassfish bundle
Ex: C:\Groovy\Groovy-1.8.0
groovy --version
groovysh
groovyconsole
Groovy Recipies
Lots of practical advice and real world use cases
The source of many of my examples
* on the client machine for embedded mode, on the APS server in APS mode
Its a
Groovy, Groovy, Groovy, Groovy
World
Please Fill Out Your Evaluations
Joe Aultman