Jedox Integrator Scripting API

image_pdfimage_print

In Jedox Integrator, the use of scripting languages is foreseen in the following components:

  • Function Type Groovy
  • Function Type JavaScript
  • Job type Groovy
  • Job type JavaScript

Besides the functionality of the scripting language, Jedox Integrator provides several classes with additional functionality related to the Jedox Integrator processing. The methods of the different classes are listed below.  Examples for the use of script functions and jobs can be found in the sample Jedox Integrator projects sampleGroovyOlap.xml, sampleGroovyFunction.xml, sampleGroovyJob.xml, and ETLTasks.xml (located in <InstallpathJedoxSuite\tomcat\webapps\etlserver\data\samples>).

Methods of the different classes
Class API
Properties are used in script functions to store values of preceding rows and in script jobs to set variables of job and load executions.
Void clearProperties()
Clears all variables set prior via setProperty(String, String).
String getProjectName()
Gets the name of the Jedox Integrator project.
String getProperty (String name)
Gets the value of a variable set via setProperty(String, String) before.
Source getSource (String name, String format, int size)
Initializes a new processor for access to the data of source if the source is not yet initialized. Otherwise returns an existing processor.
Source initSource (String name)
Initializes a new processor for access to the data of source.
Source initSource (String name, String format, int size)
Initializes a new processor for access to the data of source. Format defines the output of tree-based sources. Size limits the number of rows (default 0).
Boolean isNumeric (String inputData)
Fast test if a given input data is numeric or not.
Void setProperty (String name, String value)
Sets a variable with a given value.
Class API (in jobs only)
These methods can only be used inside of a script job.
State getConnectionMetadata (String name, String selector, Properties metadataProps)
Retrieve metadata information from a connection. The selector defines which information is requested, each connection type has its own selectors (see table below). Additional filter parameters are given as metadata properties.
State getJobState ()
Get the Execution State of the currently running Script Job.
State executeJob (String name)
Starts a job with all properties as variables and waits until the execution is finished. Name specifies the name of the job. Returns an Execution State.
State executeLoad (String name)
Starts a load with all properties as variables and waits until the execution is finished. Name specifies the name of the load. Returns an Execution State.
State testConnection (String name)
Tests a connection with all properties as variables. Name specifies the name of the connection. Returns an Execution State.
State testJob (String name)
Tests a job with all properties as variables. Name specifies the name of the job. Returns an Execution State.
State testLoad (String name)
Tests a load with all properties as variables. Name specifies the name of the load. Returns an Execution State.
State testSource (String name)
Tests a source (an extract or a transform) with all properties as variables. Name specifies the name of the source. Returns an Execution State.
Class API (in functions only)
These methods can only be used inside of a script function.
Int getCalculationCount ()
Gets the number of times a function has been calculated in the source. A calculation of the function is not necessary for identical input values.
Int getRowCount ()
G
ets the current number of the row in the source. This function is deprecated.

 

Class API (Mailer) 

MailUtil
______________
getMailer()
Get the MailUtil utility instance that is used to send custom emails, the configuration for the sender’s email is read from the component Administration of Jedox Web. (See Adjusting the Settings for Email Notifications).

Class MailUtil
 
A utility class to send custom emails. Only the SMTP user/password authentication is supported.

Void
______________
addRecipient(String emailAddress)
Add recipient email (e.g. happy@jedox.com). Several recipients can be added.
Void setSubject(String subject)
Set the email subject text.
Void setMessage(String message)
Set the email body text.
Void addAttachment(String filename)
Add an email attachment (e.g. filename.txt). The path (similar to “File” connection) is relative to the “files” folder under etlserver webapp folder. Several attachments can be added.
Void reset()
Removes the email info, such as to send different mails to different recipients.
Void send()
Send an email; sender configuration is read from the Administration component of Jedox Web; recipients and email configurations are given directly by the user using the previously set methods.

As an example, you can find in sampleGroovyJob the Groovy job SendMail with the following script (located in <InstallpathJedoxSuite\tomcat\webapps\etlserver\data\samples>):

 

Class LOG
With this class a simple data validation can be added to a script function (among other things).

Void debug (Object message)
Adds a debug message to the log of the Jedox Integrator execution
Void error (Object message)
Adds an error message to the log of the Jedox Integrator execution
Void info (Object message)
Adds an info message to the log of the Jedox Integrator execution
Void warn (Object message)
Adds a warning message to the log of the Jedox Integrator execution
Class OLAP
The connection refers to the name of the Jedox connection in the Jedox Integrator project. 
In order to get a complete API on cubes, dimensions and elements, use method getDatabase(). With an object of type IDatabase all methods of the OLAP Java Client-Library (palojlib) are available. Package com.jedox.palojlib.interfaces.IDatabase is automatically imported. See also Java API for Jedox OLAP Server and the Jedox Integrator sample project sampleGroovyOLAP.xml.
IDatabase getDatabase (String connection)
Returns an OLAP database object (com.jedox.palojlib.interfaces.IDatabase). The connection is opened at the end of a Jedox Integrator execution. The connection is closed automatically from Jedox Integrator. See Jedox SDK for a reference of the OLAP Java Client Library.
IConnection getConnection (String connection)
Returns an OLAP connection object (com.jedox.palojlib.interfaces.IConnection). The connection is opened, and at the end of a Jedox Integrator execution the connection is closed automatically from Jedox Integrator. 
Note that for use of methods at the database level, getDatabase() can be used directly without calling this method first.
Boolean cubeConvert (String connection, String cube, int type)
Converts a cube to a different type. Type 0=Normal, Type 4=GPU. Returns true if the conversion has been successful.
Object data (String connection, String cube, String[] coordinates)
Gets the cell value of a Jedox cube. The coordinates are a list of elements for the cube dimensions.
Void erename (String connection, String dimension, String oldName, String newName)
Renames an element of a dimension
Void erename (String connection, String dimension, String[] oldNames, String[] newNames)
Renames multiple elements of a dimension
Boolean saveDatabase (String connection)
Saves the database and all of its cubes in an aggregated form to disk. Returns true if the saving of the database has been successful.
This function is deprecated. Use methods com.jedox.palojlib.interfaces.IDatabase.save() and com.jedox.palojlib.interfaces.ICube.save() instead
Class State
Information about the status of an Jedox Integrator execution can be retrieved.
Boolean isOK ()
Returns true if the execution status is “Completed successfully” or “Completed with Warnings”; otherwise false.
String getStatus ()
Gets the status code of the execution.
Int getWarnings ()
Gets the number of warnings that occurred while executing.
Int getErrors ()
Gets the number of errors that occurred while executing.
String getLog ()
Date getStartDate ()
Gets the start date of the execution.
Date getStopDate ()
Gets the stop date of the execution.
Class Source
Handles a source processor to access to data of extracts and transforms.
Void close ()
Closes the source processor.
String getColumnString (String name)
Returns the value of a column in the current row as a string
Object getColumnValue (String name)
Returns the value of a column in the current row.
Boolean nextRow()
Gets the next row of data from the source processor. Returns false if no more rows are found, otherwise true.

To limit the authorizations of a script on the OS-level side (e.g. access to files and directories), change the OS user for the JedoxSuiteTomcatService, as described in the article Accessing Network Files.

image_pdfimage_print
Was this post helpful?
NoYes (0 rating, 4 votes)
Loading...