cancel
Showing results for 
Search instead for 
Did you mean: 

Global variables in Java Mapping

Former Member
0 Kudos

Hi,

I have a java mapping function in PI 7.1 that transforms an XML document to a legacy data structure which eventually is written to a flat file. The file name is required to be sequenced for each mapping run. For example,

1. The first message generates FILE_001.dat

2. the second message generates FILE_002.dat

3. the counter resets to 001 after 999.

Due to the complexity of the mapping, I have to use a Java class to map this.

What is the best way possible to achieve this? I wonder this can be achieved using the GlobalContainer, but I am not sure whether I can access this class from within AbstractTransformation class.

Any pointers?

Thanks and best regards,

Kapila

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Kapila,

>Due to the complexity of the mapping, I have to use a Java class to map this. What is the best way possible to achieve this?

Best would be to use the standard and map from source XML to target XML. The target XML should be structured that it can be used in the file adapter to create the flat file. In that case your are more free and you would have the choice to use Message Mapping, what is always the first option. If the mapping case is too complex Java is an alternative.

>I wonder this can be achieved using the GlobalContainer..

GlobalContainer makes no sense in Java Mapping as you anyway have allways the control over each mapped value, Java Objects are accessable during the whole runtime.

Regards,

Udo

Former Member
0 Kudos

Thanks Udo,

Due to the complexity, I have to use Java Mapping class. The question that I am pondering is around maintaining the sequence as the class is called per execution.

I have now a not-so-elegant solution, where I retain the sequence value in the file system that gets updated everytime. This way, I can maintain a lock on the file in the unlikely event that the interface is invoked parallely.

I plan to look at creating a java table on the database to maintain the sequence value using JDBC/JDO. The GlobalContainer is out of the quesion, as far as I see.

Thanks for your input Udo.

Best regards,

Kapila

Answers (0)