cancel
Showing results for 
Search instead for 
Did you mean: 

Global Container in Java Class of Interface Mapping

Former Member
0 Kudos

I have written a Java Class that implements the StreamTransformation interface for use in an Interface Mapping. I would like to cache information read from a file between message processing calls of this mapping.

It appears that maybe the GlobalContainer object can be used to perform this caching. How do I access the GlobalContainer object from a class that implements StreamTransformation?

The examples all show container.getGlobalContainer() method call to get access to this object. However container is not a variable in this interface. Any ideas on how to do this?

Thanks,

Jay

Accepted Solutions (0)

Answers (2)

Answers (2)

bhavesh_kantilal
Active Contributor
0 Kudos

Jay,

What sergio has told is absoultely correct.

But, FYI, please take a look at Stefan Grube's reply in tis thread,

<i><b>The mapping program is a class derived from the interface GlobalContainer. So you can use the methods of GlobalContainer all the time during the mapping program.</b></i>

Regards

Bhavesh

stefan_grube
Active Contributor
0 Kudos

> The mapping program is a class derived from the

> interface GlobalContainer. So you can use the methods

> of GlobalContainer all the time during the mapping

> program.

Hi Bhavesh,

This is only valid for a mapping programm created by the graphical mapping tool.

In a Java mapping this is not the case.

Regards

Stefan

Former Member
0 Kudos

Hi Jay,

if you want to link data from different messages you must use BPM, you cannot do this with GlobalContainer because it is instantiated at the begin of the mapping and is flushed at the end of the mapping (e.g. graphical mapping).

2 files for the same scenario will use 2 different instances of the same message mapping program and they will not share the container.

The container is shared inside the same instance of the mapping program.

So it is shared for example between two UDF in the same mapping

So if you are using Java mapping you do not need to use the global container, you can use an Object to store data, but keep in mind that all this data will be lost at the end of the mapping.

Hope it helps,

Kind Regards,

Sergio