Database Reference
In-Depth Information
exact type of every variable and object, informing the compiler about all these types,
and managing conversions between them. not many have been willing to brave these
waters just to better manage their nightly batch processes.
having looked at all our options, we still do not have the right solution. We have
established that nothing short of API development can give us the abilities we need for
the highest level of Essbase automation, yet for most of us, this seems a bridge too far.
We need a solution that makes the plunge into API development much less scary. We
need something that can leverage Java, its abundance of available libraries, its army of
programmers, and its ubiquity while loosening its syntax requirements, changing its
inability to run as a scripting language, and altering its static typing system.
groovy is the answer to these needs. This chapter showcases the groovy language as the
best choice for automating an Essbase environment. It would be impossible to teach the
whole language here, so we will have to narrowly focus on its power, flexibility, ease of use,
and integration with Java. In particular, we want to show how it both is and is not the same
as Java development, how it takes Java and makes it more expressive, powerful, easy, and
fun. The idea is to get you excited, get you convinced, get you started, and then get you out
in the world learning the language in full. our approach will be to show you the language
in action first, then explain what we have shown you. With that in mind, we will build a
functional program that executes commands against Essbase, then step back a bit for a
broader view of groovy, its place in the world, and the features it offers us as Essbase devel-
opers. After that, we will go over several examples of how to do common automation tasks.
This chapter is meant to offer a streamlined path to JAPI development, which is appropriate for the automation tasks that
tie our Essbase environments together. Nothing here should be taken to contradict or detract from the previous chapter.
There, the focus is on detailed information about the JAPI, demonstrated with pure, unpretentious Java. Here, we simplify
and smooth over the JAPI as much as we can with fancy-pants Groovy. While much of our focus is on Groovy's advantages
over Java, Groovy's intent is explicitly to be very Java-friendly. We, therefore, house no ill will toward Java.
9.3 how to make an outline extraCtor in seven easy steps
Because example can often be the most powerful way to learn, let's dive straight into
some serious code and showcase the power of the scripting solution we have chosen. We
will start at square one and, layering in standard groovy features and Java API calls,
very quickly we will create a solution to a common need that faces Essbase administra-
tors everywhere. I do expect the reader to have a certain familiarity with programming
concepts like variables and methods, but knowledge of any particular language is not
assumed. hopefully, each step will be small enough that the code and concepts intro-
duced along the way will come in easily digestible chunks, so that by the end, every
reader will be able to at least roughly understand what is going on in the final program.
This example, I think, is pretty impressive. With barely 30 lines of code, we will have an
outline extractor that walks through an application and outputs the outlines of all of its
databases in xmL format. With that bold promise, let's get down to business.
9.3.1 Step One: Saying Hello
First, we will need to know how to produce any kind of output, so we will write the
traditional first program we always write when we start out with a new language. This
is the entire program:
println 'Hello, World!'
Search WWH ::




Custom Search