Vous êtes sur la page 1sur 6

Configuring Java Transformation Settings

2010 Informatica
Abstract
You can configure the Java transformation settings to import third-party and custom Java packages. This article describes
how to configure the Java tranformation settings and set a classpath when you import third-party or custom java packages
into the transformation.

Supported Versions
PowerCenter 8.6.x - 9.0.1

Table of Contents
Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Business Problem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Importing Java Packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Configuring the Classpath. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Configuring Classpath for PowerCenter Integration Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Configuring the Classpath for the PowerCenter Client. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Adding JAR or Class File Directory to the Classpath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Overview
A Java transformation provides a native programming interface to define transformation functionality with the Java
programming language. You can use a Java transformation to define simple or moderately complex transformation
functionality without advanced knowledge of the Java programming language or without using an external Java development
environment.

You can configure Java transformation settings to import third-party and custom Java packages. To import the third-party
and custom java packages in JAR files or classes, set the classpath for the JAR file in Java transformation settings. You set
the classpath in the PowerCenter Integration Service node and the PowerCenter Client.

You can configure Java transformation settings to set the classpath for third-party and custom Java packages and to enable
high precision for Decimal datatypes. You can write Java code using the code entry tabs to import Java packages, write
helper code, define Java expressions, and write Java code that defines transformation behavior for specific transformation
events.

Business Problem
ABC is an insurance company that provides group insurance to corporations. When an employee insured under a group
policy applies for a claim, the company wants to verify eligibility of the person claiming insurance money. ABC has a static
table in the database which includes information about all employees covered under a group policy. The data mainly
includes corporate insurance ID, first name, last name, date of birth, and gender.

The following sample data shows the content of a source file:


Corp Insurance ID First Name Last Name DOB(YYYYMMDD) Gender
C100 James Davis 19801208 M
C100 Elaine Smith 19711228 F
C200 Naresh Thiagarajan 19690101 M
C200 Geetha Srivastava 19650225 F
C200 Shankar Parmar 19650315 M
C300 Dan Miller 19750512 M

2
Corp Insurance ID First Name Last Name DOB(YYYYMMDD) Gender
C300 Joanne Thomas 19730312 F
C300 Joanne Bullington 19780115 F
C300 Sandra Jones 19840211 F
C400 Geetha Thomas 19650316 F
C500 Tom Kelly 19840314 M
C600 Betty Johnson 19850314 F
C600 Dave Moore 19770917 M
C600 Frank White 19790211 M

The insurance company ABC provides an Insurance ID to each client company. All the insured employees of the client
company are assigned a Corporate Insurance ID. ABC can track details of insured employees of the client companies
through Corporate Insurance ID.

For example, XYZ Company is a client of ABC and has a Corporate Insurance ID C300. Joanne Thomas, an employee of
XYZ has filed claim for an insurance amount of $1,000.

ABC verifies the eligibility of Joanne Thomas to receive the money using a Java transformation on the database. The
transformation performs a search in the database for Joanne Thomas. The search starts from the Corporate Insurance ID
C300 which returns four rows. The transformation further narrows the result with the looping technique that searches the
resulting four rows based on other columns such as First Name, Last Name, and Date of Birth.

The search continues until one or no row is returned as an output. If the transformation returns a row, the claimant is eligible
to claim the money. If the transformation does not return a row, the claimant is not eligible to claim money.

Importing Java Packages


Use the Import Packages tab to import third-party Java packages, built-in Java packages, or custom Java packages for
Java transformations. After you import Java packages, configure the transformation.

Complete the following steps to import Java packages used in the business problem:

1. Create the custom Java package ABC_emp_UseCase that includes the classes that you require to search the
database.
2. Create the ABC_emp_UseCase.jar file that includes the ABC_emp_UseCase package.

3
3. Create the Java transformation in the Designer and import the package from the Import Packages tab.

Configuring the Classpath


When you import custom Java packages, set the classpath for the PowerCenter Client and the PowerCenter Integration
Service to each JAR file or class file directory associated with the Java package. On UNIX, use a colon to separate
classpath entries. On Windows, use a semicolon to separate classpath entries. The JAR or class files must be accessible on
the PowerCenter Client and the PowerCenter Integration Service node.

Configuring Classpath for PowerCenter Integration Service


You can add JAR files or class file directories to the PowerCenter Integration Service classpath. To set the classpath on the
PowerCenter Integration Service node, complete one of the following tasks:

Configure the Java Classpath session property. Set the classpath using the Java Classpath session property. This
classpath applies to the session.
Configure the CLASSPATH environment variable. Set the CLASSPATH environment variable on the PowerCenter
Integration Service node. Restart the PowerCenter Integration Service after you set the environment variable.
Configure the Java SDK Classpath. Configure the Java SDK Classpath on the Processes tab of the PowerCenter
Integration Service properties in the Administration Console. This setting applies to all sessions that run on the
PowerCenter Integration Service.
The following figure shows the Java SDK classpath setting for ABC_emp_UseCase.jar:

4
Configuring Classpath for the PowerCenter Integration Service on UNIX
In the UNIX C shell environment, enter the following syntax:
setenv CLASSPATH <classpath>

In the UNIX Bourne shell environment, enter the following syntax:


CLASSPATH = <classpath>workflows

Configuring Classpath for the PowerCenter Integration Service on Windows


Enter the CLASSPATH environment variable and set the value to the default classpath.

Configuring the Classpath for the PowerCenter Client


You can add JAR files or class file directories to the PowerCenter Client classpath. To set the classpath for the machine
where the PowerCenter Client runs, complete one of the following tasks:

Configure the CLASSPATH environment variable. Set the CLASSPATH environment variable on the PowerCenter
Client machine. The setting applies to all java processes that run on the machine.
Configure the Java transformation settings. Set the classpath in the Java transformation settings. This applies to
sessions that include this Java transformation. The PowerCenter Client includes files in the classpath when you
compile the java code.

To transform the ABC client database, import ABC_emp_UseCase package and define the package in
ABC_emp_UseCase.jar file. You must add the ABC_emp_UseCase.jar file to the classpath before you compile the Java
code for the Java transformation.

5
Adding JAR or Class File Directory to the Classpath
1. Click the Settings link on the Java Code tab.
The Settings dialog box appears.
2. Click Browse to select the JAR file or class file directory for the imported package.

3. Click Add, and then click OK.


The JAR file or class file directory appears in the list of JAR file and class file directories for the transformation.
4. To remove a JAR file or class file directory, select the JAR file or class file directory and click Remove.

Output
The Java transformation displays the following output:
Corp Insurance ID First Name Last Name DOB(YYYYMMDD) Gender
C300 Joanne Thomas 19730312 F

The output indicates that Joanne Thomas is insured under the group policy issued by ABC.

Author
Shilpa Bhat
Technical Writer

Vous aimerez peut-être aussi