Cognos Component
Introduction
This document describes how to automate Cognos reports. It runs via the Central Server with Redwood Script using an internal Library. Note that there is no official Cognos connector within the product, the created solution is a consulting solution which has proven to work but is not covered in Redwood support. It is possible that customer specific changes must be made and if additional content is useful in this document you can contact Redwood Product Management with the required changes so this can be centralized.
Requirements
note
As this is not a public download Redwood cannot distribute this file. It is also version sensitive so it has to be requested from the customer.
The following requirements should be gathered to have a quick implementation.
- Access to Cognos to see which reports to run (define parameters / Report Path)
- Cognos Server name and port
- Cognos user, namespace (optional) and password
- Cognos/IBM SDK provided by the customer
- Redwood Library code (included in this document)
- The central Redwood server needs to be able to access the Cognos server on the specified port.
- The secure gateway needs to be able to access the Cognos server on the specified port.
Configure the Cognos connection
note
As we cannot distribute the IBM SDK we cannot create an export (.car) with the code as this will create a compile error
Create the Library
- Create a Redwood Library called: Custom_Cognos
- Add below code in the Source tab
- Adjust the highlighted code with your info or use the parameters in the process definition. The password can be clear text here, set as password in a parameter or if it is not set and empty a Credential can be used (info below).
- Upload the IBM SDK .jar files received from the customer in the JAR tab. An example of the .jar files to be uploaded (but can be version specific):
activation.jar
commons-logging-1.1.jar
commons-discovery-0.2.jar
commons-logging-adapters-1.1.jar
commcommons-logging-api-1.1.jar
dom4j-1.6.1.jar
axen-1.1.1.jar
axrpc.jar
stl.jar
og4j-1.2.8.jar
mail.jar
saaj.jar
serializer.jar
standard.jar
estIBMFakeTrustSocketFactory.jar
wsdl4j-1.5.1.jar
xalan.jar
axis.jar
axisCognosClient.jar
String host = getParameterDefault("Cognos_Host", "HostHere");
String port = getParameterDefault("Cognos_Port", "PortHere");
String user = getParameterDefault("Cognos_Username", "UserHere");
if (StringUtils.isEmptyOrNull(user))
{
throw new RuntimeException("No username supplied to connect to " + host + ":" + port);
}
String password = getParameterDefault("Cognos_Password", "PwdHere");
String namespace = getParameterDefault("Cognos_Namespace", "AAA BBB");
Library source, adapt host, port, username password and namespace.
Create the Process Definition
This.car
file contains templates for step 2 and 3 You have to fill in the library and uncomment the code:
- Create a Process Definition to run Cognos Reports
1.Type: Redwood Script
1.Library: Custom_Cognos
1.Source, see below.
- Create Parameters and groups
- Cognos Report group
- Cognos_ReportPath
Example:/content/package[@name='SMT Sales Analysis']/folder[@name='Reports']/folder[@name='Spring']/folder[@name='1 Under Development']/report[@name='Cognos 10 UAT Test Report']
- Cognos_OutputFormat – Available types
- spreadsheetML
- … To be added
Optionally you can create a Connection group to define connection details on process level instead of in the library (or make this by default and keep it empty) - Cognos_Host
- Cognos_Port
- Cognos_Namespace
- Cognos_Username
- Cognos_Password (flag as password or create credential!)
In case of report parameters you can create a Report Parameter group and add the parameters here
- Ideally you should set the Default Output Format in the Options tab to the output type of the report.
import com.redwood.scheduler.custom.cognos.CognosReport;
{
new CognosReport().runReport();
}
Source of process definition that runs reports.
- Create a Process Definition to get Cognos report parameters
If you run this Process against a report it will show you which additional parameters should be used in the process. Use the same parameters as in the run report Process Definition. - Optionally create a Redwood credential to store the password. Don’t forget to make it externally available:
import com.redwood.scheduler.custom.cognos.CognosReport;
{
new CognosReport().readParameters();
}
Source of process definition that retrieves the report.
The output:
In this example you need to create the parameters period and year in the Process Definition: