Kaleidoscope 2009 Top 5 Essbase CDF's (S605)
I am about to present at Kaleidoscope 2009 and thought I should do a blog about the session so that if anyone missed the session or fell asleep they could get the information they need. Before I start I need to give credit to Mike and Toufic for sharing their code with my and thanks to Mike for helping me get up to speed on CDF's
A CDF or custom defined function is any java class written so that is can interact with the Essbase calculator.
Data, metadata or both can be passed from the calculator to the CDF.
Data or metadata be returned to the calculator.
The CDF can call any outside Java process.
Basically if it can be done it Java it can be run in an Essbase Calculation.
What are the Ways I can run a CDF?
Register a Function.
Static methods can be registered with Essbase so they can be run in a calculation script as if they were a native function. You also want to do this is the person creating the calculation script will not be the same person who developed the function. The registered function is then run in a calculation script like any other Essbase calculator function. Here are some docs on registering functions http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_techref/maxl/ddl/cdf/examples/register.htm
This command will run a ‘Main’ method in a java class by calling it in a calculation script like this RUNJAVA somejavaclass “Parameters String []";
Most CDF’s should and can be written to support both methods and in many cases you may need both to support the function. For instance if you have a system you want to log into and then pass a bunch of data or Essbase and then log out. You might use RUNJAVA at the top of the script to do the login and then use a function to get the data and then use RUNJAVA to logout at the end. This way you do not have to log into the system over and over again as you pull in data. I show the use of both methods in my blog entry on integrating Twitter with Essbase. http://essbaselabs.blogspot.com/2009/05/ashton-kutcher-can-now-get-my-essbase.html
Create the JAR file and make sure it does what you want.
Copy the JAR file or files and any related files like properties files to the Essbase server in the directory $HYPERION_HOME /products/Essbase/EssbaseServer/java/udf For new installations this folder may not exist and you may need to create it.
Modify the file udf.policy and grant the appropriate permissions if needed $HYPERION_HOME /products/Essbase/EssbaseServer/java/udf.policy For Example:
grant codeBase "file:${essbase.java.home}/essbase.jar" {
permission java.security.AllPermission;
Register the function if needed.
You should follow the same rules and syntax as a standard Java Policy file and always error on the side of more secure.
CDF are loaded when the server starts and changes to the JAR file will require that you stop and start the server.
You can view an application log to see the your function loaded correctly.
[Thu May 07 12:54:02 2009]Local/Sample///Info(1200445)
External [GLOBAL] function [@JechoString] registered OK
Beyond all the geeky coding stuff is some cool and really functional CDF's and instead of doing a top 5 specific list I have broken them down into the top 5 CDF categories and many of the categories have more than 1 useful function.
Data Functions - Functions like these allow a developer to get at data not normally accessible to Essbase. In the example I provided (see below) I go after stock data from a free Yahoo http quote service. This concept can be applied to any number of web service or internal systems.
Essbase Java API based functions - Ever wanted at add a member while doing a calculation, well you can you just need to put the correct files in place and call the Essbase JAVA API in your CDF. The sky is the limit with the JAPI and I include moving data from one cube to another and creating substitution variables but if you can do it in the JAPI you can do it in a CDF.
J-Alert - Ever wanted to know the progress of your calculation with out having to check the logs? If so this function is perfect! It can send emails with various content at any point in the process.
String Functions are ideal for debugging your calculation scripts and enhancing. Things like string concatenation that are difficult in the Essbase are a breeze with these functions.
J-Export - This has got the be the most asked about CDF in the field and among internal teams. This allows you to do exports of targeted data to various output types and it does it all screaming fast!