EPM Integration Agent API Methods

The EPM Integration Agent provides a number of methods that may be used in scripts to perform actions such as the specification of text in the log file, updates to bind variables and queries, and actions that instruct the EPM Integration Agent to skip the SQL processing step for the case where a special query is used, or a non-SQL data source is used.

The EPM Integration Agent API methods are as follows:

API Method Description Example

logInfo()

Log an info message to the agent process log. This entry is logged to the process log in the EPM_APP_DATA_HOME\logs folder, the job log in the Oracle Enterprise Performance Management Cloud, but not to the local epmagent.log. The log entry is created at the INFO log level.

agentAPI.logInfo("SAMPLE: INFO log message from script")

logError()

Log an error message to the agent process log. This entry is logged to the process log in EPM_APP_DATA_HOME\logs folder, the job log in the EPM Cloud, and also into epmagent.log. The log entry is created at the SEVER log level.

agentAPI.logError("SAMPLE: SEVER log message from script")

setBindVariables()

Use the setBindVariables() method to update the extract query's bind variables. This is applicable only in the befExtract script.

The bind variables must be passed as a java map entry for each variable with variable NAME as key and VALUE.

newBindVar = dict({'PERIOD':'Feb-05', 'LEDGER':'Vision Operations (USA)'})

jmap = java.util.HashMap()

for key in newBindVar.keys(): jmap[key] = newBindVar[key]

agentAPI.setBindVariables(jmap)

getBindVariables()

Use the getBindVariables() method to fetch the bind variables for the extract query. Each bind variable is stored in a map, which uses the keys NAME and VALUE to define the bind variable.

bindVariables = agentAPI.getBindVariables()

for entry in bindVariables.entrySet(): print entry.key, entry.value

updateQuery()

Use the updateQuery()method to update the extract query. This is only applicable in the befExtract script.

agentAPI.updateQuery("SELECT * FROM TDATASEG")

getQuery()

Use the getQuery() method to fetch the query that is passed from EPM Cloud to the EPM Integration Agent during the extract execution call.

print "Printing Query: " + agentAPI.getQuery()

skipAction()

Use the skipAction() method to skip the extract data step, when a custom extract routine is used by the EPM Integration Agent.

Note that the extract execution can be skipped only during the befExtract script.

If you want to provide a data file to upload to the EPM Cloud rather than executing the saved query, a file with the name <process ID>.dat must be saved to the MyData/data folder in time to be uploaded to the EPM Cloud. This means that the file must be saved to this folder in the befExtract, aftExtract, or befUpload scripts.

agentAPI.skipAction('true')

getConnectionDetails()

Use the getConnectionDetails() method to fetch the connection Credential data object from the cloud that is passed from the EPM Cloud to the EPM Integration Agent during the extract execution call.

cred = agentAPI.getConnectionDetails()
url = cred.getJDBCUrl()
user = cred.getUserName()
password = cred.getPassword()
agentAPI.logInfo ("Connection Details: ")
agentAPI.logInfo("URL: " + url)
agentAPI.logInfo('User: ' + user)

setCustomConnection(conn)

Use the setCustomConnection(conn) method to set the custom created connection into the EPM Integration Agent during the extract execution call. The Agent uses this connection to execute. The conn object must be a type 4 JDBC connection and an implementation of java.sql.Connection interface.

This is only applicable in the befExtract and befExport scripts. See sample scripts BefExtract.py and the java CustomEventSample and CustomWribackEvent for more details on usage.

To create a custom connection to an Oracle database:

java.lang.Class.forName("oracle.jdbc.driver.OracleDriver")
conn = java.sql.DriverManager.getConnection('jdbc:oracle:thin:@<host>:<port>:<sid>', '<user/schema name>', '<password>')
agentAPI.setCustomConnection(conn)