Global Container in Java Class of Interface Mapping

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

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

Similar Messages

  • Calling Java class in XSLT mapping

    Hi,
    how can we call a java class in XSLT mapping..
    thanks
    guna

    This is a good one too:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffbbf72
    Found this one helpfull too
    http://www.cafeconleche.org/books/xmljava/chapters/ch17s03.html
    Christof

  • Mapping data model to java classes and Interface.

    Need help in mappning my data model into java classes;
    Here are some of the details:
    Table, Poll:
    PollID int
    PollName varchar
    BusinessUnit varchar
    DisplaySchemeID int // reference to DisplayScheme table.
    Table, DisplayScheme
    DisplaySchemeID
    DisplaySchemeName
    etc
    Table, URL
    UrlID
    UrlName
    UrlDesc
    Table, PollURL
    PollURLID
    PollID
    UrlID
    PublishDate
    etc
    Table, Tag
    TagID
    TagName
    PollID
    So, a POLL is associate with a DisplayScheme.
    A Poll can have many URLs and a URL can be associate with many Polls , mapped in the PollURL table.
    and same is the situation with tags.
    Essentially I want to learn how to do one to many mappning and many to many mapping.
    Also to add, since I plan to use Ibatis for OR mapping.
    So I should a Parameter call to map for creaint a Poll. And to create a poll the form submitted will have:
    - PollName
    - URLs ( multiple )
    - one display scheme.
    - Tags ( many )
    So if you can show how to write a DAO createPoll method, then it would be great.
    Not sure if am asking a lot, but this would be a great example to move forward.

    The below is the sample DAO Class.
    For your case, you have to create your own PollBean with getters and setters and just pass the object to the method
    public int create(Connection con, ProjectBean projectBean) throws SQLException {
              int result = 0;
              String insertQuery = " INSERT INTO" +
                        " M_PROJECT(" +
                        " PROJECT_ID," +
                        " PROJECT_NAME," +
                        " PROJECT_DESCRIPTION) " +
                        " VALUES(?,?,?,?)";          
              initPrepareStmt(con, insertQuery);
              setString(projectBean.getProjectID());
              setString(projectBean.getProjectName());
              if(projectBean.getProjectDescription().equals("")){
                   setString(" ");
              }else{
                   setString(projectBean.getProjectDescription());
              result = executeUpdate();          
         return result;
         }

  • How to Transport Java Classes used in Mapping?

    Hi XI experts,
    Within the development of one message mapping, some external  java classes are imported and used in my UDF(user defined function). My question is: how will these external java classes be transported to the QA/PRD system? If I choose to use the file system transport method, do I have to manually find these jar files and transport them separately?
    Any comments or suggestions are highly appreciated.
    Thanks in advance
    Luis

    Hi Luis,
    Normally Mapping programs and External Jars are used in XI using Imported Archive. So this Imported archive once activated will become part of your SWCV and can be transported automatically with the SWCV.
    You dont have to worry about transporting it seperately, it will be avilable once you transport your SWCV using File system transport.
    Hope this helps,
    Regards,
    Ananth

  • Java Class vs Interface

    Hi,
    I have a question regarding Java class & interface. I know how to use them and the difference between a class and an interface, but I don't know WHEN I shall create an interface instead of a class? Does someone can help me out? Thank you.
    Svenson

    One reason to use interfaces: Create interfaces when you want to say "Look @ me! I r teh ubar Javanazi. Abstract classes r ghey lolz."
    Another reason: If you want to define what a set of classes should do, but not how they should go about doing it.
    Another reason: To highlight and emphasize the commonalities between a set of classes (ie, interfaces with purely polymorphic intentions)
    Another reason: Humans and monkeys are subsets of Primates. however, there is no one animal named a "Primate," it merely defines a set of behaviors and characteristics. In other words, there is no direct instance of Primate, so it is an interface.

  • Mapping Tracing in Java Section of Message Mapping

    Hi,
    Is it possible to get the Mapping Trace Object in the JAVA SECTION of the Message Mapping?
    To access the<a href="http://help.sap.com/saphelp_nw04/helpdata/en/c8/98e7d5c1620642973565ea3dd319d1/content.htm">Mapping Trace Object</a>, we need the instance of the <a href="http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm">Container Object</a>. SAP help says, Container Object is made available to every User Defined Function .
    What we need is how can we get the current instance of the Container Object in the JAVA Section of Message Mapping. Any ideas?
    Regards,
    Bhavesh

    Hi Bhavesh,
    It seems you can access global container from any part of Graphical mapping.
    According to Access StreamTransformation values in Java initialisation section:
    <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>
    Plz refer the link to the related thread.
    Regards,
    Ananth

  • Replace Java Class?

    Hi to all of yours.
    Standard Java classes, like File, OutputStream and such and such, are included in every Java distribution.
    I have a .jar library which uses them, for example FileOutputStream. I load this library with an URLClassLoader.
    What I want to achive is that the library uses a class defined by myself instead of FileOutputStream. This class will have the same signature and methods, of course.
    This sounds strange, but consider the following: the library I use (3rd party) creates a pile of files with stuff in them on the hard disk. However, I dont want these files to be on the hd, but in memory instead. Therefore I created some sort of "virtual file system" with streams and all sorts of gimicks.
    I dont want to replace FileOutputStream permanently, just within the ClassLoader used to load that jar.
    First idea was to override the loadClass method to return my class whenever "java.io.FileOutputStream" is requested.
    Well, this works for normal classes, but these "basic" java classes (as I said, like File, FileOutputStream and so on..) are not requested from the classloader but somehow already "known".
    Can someone either tell me how to achieve my goal of replacing them dynamically or at least point me some links where i can get information on how the class-retrieving process of the "basic" java classes is done or could be influenced?
    Thanks a million,
    Thomas.

    Hey
    You need to add a parameter to exchange profile before you can see ABAP-class in Interface mapping,please follow the below steps:
    Go to http://<host:port>/exchangeProfile in internet explorer
    Expand IntegrationBuilder ->IntegrationBuilder.Repository->click on com.sap.aii.repository.mapping.additionaltypes link ,then on right hand side just type
    R3_ABAP|Abap-class in i/o field. and save.
    You may need to restart Java engine for this take effect.
    Thanks
    Aamir
    Edited by: Aamir Suhail on Aug 5, 2009 1:02 PM
    Edited by: Aamir Suhail on Aug 5, 2009 1:02 PM

  • Help finding JAR files containing a specific class

    I Need to find the JAR file containing the java class/type com.sap.engine.frame.ServiceException
    <i><b>Frank</b></i>

    Hi Frank,
    The easiest solution will be searching for class names in Windows search like: Search for files *.jar and contains text xyz.class.
    If you find a particular jar then open it using WinZip and you can locate the class file.
    Regards,
    Ananth

  • Refresh Java Objects From Toplink Map

    To add a many to many relationship to my toplink map, I added a field in my .java class like this:
        /**Map addressCollection <-> com.goyman.Akira.model.Address
             * @associates <{com.goyman.Akira.model.Address}>
        private List addressCollection;Then, the addressCollection map appeared in my toplink descriptor, I mapped it correctly, and now I want to know if I have to manualy write the accessor and collection management method (like addAddress...) or if something automated exists.
    Regards
    Kuon

    Relationships will be automatically managed for you by TopLink but you may want to write accessors and add/removeAddress to use these methods in your business logic.
    Hope this helps.
    Anuj

  • Where find java classes corresponding to message mapping and interfaces ?

    Hi
    Forum,
    when i create my objects in Repository, like Message interface and messgae mapping, correspoding to them, java class in created,  where can i see these java classes in the XI's file system,

    Hi sudeep,
    During the installation of Xi we select a database.So all the objetcs and related things that we create in IR and ID will be saved in the database only.I dont know how to check the .class file for each object...
    Check these weblogs from sravya where she has given you the table names where the IR and ID objects are stored:
    /people/sravya.talanki2/blog/2007/01/11/ripping-off-sap-xi-stack-133sharing-the-goodies-of-abap-api146s
    /people/sravya.talanki2/blog/2005/12/02/sxicache--ripped-off
    /people/sravya.talanki2/blog/2006/12/28/skelton-of-mapping-runtime-in-sap-xi
    regards
    BILL

  • 'class' or 'interface' expected_Error while activating mapping

    Hi All,
    I am getting this error while activating a mapping that has UDF's.
    The UDF is a very simple one and there is nothing wrong with the arguments, syntax or anything in the UDF. But it simply won't activate.
    <b>usr/sap/XD1/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map61cac6300a2c11dc88597a0eca04c2f3/source/com/sap/xi/tf/_MM_EMATRIXtoSAP_MaterialMaster_.java:843: 'class' or 'interface' expected public String simplemap$(String firstarg,String secondarg,Container container){ ^
    /usr/sap/XD1/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map61cac6300a2c11dc88597a0eca04c2f3/source/com/sap/xi/tf/_MM_EMATRIXtoSAP_MaterialMaster_.java:879: 'class' or 'interface' expected } ^
    /usr/sap/XD1/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map61cac6300a2c11dc88597a0eca04c2f3/source/com/sap/xi/tf/_MM_EMATRIXtoSAP_MaterialMaster_.java:880: 'class' or 'interface' expected ^</b>
    Any ideas?
    Thank you,
    Regards,
    Balaji.

    Hi Balaji,
    Even I got the same problem when i tried to create UDF and I was unable to rectify the error .However It got solved when used the following piece of Code of
    SAP XI Lookup API: the Killer
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    just copy paste the RFC look up code in ur UDF,modify the import export parameter and get it executed.
    Regards
    Ashwin M
    Reward if helpful

  • Java doc for container ,global container.

    Hi ,
    Can somebody tell where I can get the javadoc for container and global container.
    THnks

    Hi,
    You can view the the source code also provided if you have proper Decompiler tools.
    I have used a tool to open <b>aii_mt_rt.jar</b> and found the following for <b>Global Container</b>.
    Global container:
    package com.sap.aii.mappingtool.tf3.rt;
    import java.util.Map;
    public interface GlobalContainer
        public void setParameter(String string, Object object);
        public Object getParameter(String string);
        public Map getParameters();
    For Container:
    package com.sap.aii.mappingtool.tf.rt;
    import com.sap.aii.mapping.api.AbstractTrace;
    public interface Container
        public Object getParameter(String string);
        public void setParameter(String string, Object object);
        public AbstractTrace getTrace();
        public GlobalContainer getGlobalContainer();
    Hope this helps.
    Regards,
    Ananth

  • XSLT Mapping with Java class not working in Integration Repository

    Hi,
    I have an XSLT mapping program with Java enhancement and I was able to successfully tested it in Stylus Studio. However, when I imported the Java class and the xslt program in Enterprise Service Builder and tested it, my program does not compile.
    Here is the error message: "Transformer Configuration Exception occurred when loading XSLT mapping_temp.xsl; details: Could not compile stylesheet".
    My java program is in a zip file containing SOAPHeaderHandler.java and SOAPHeaderhandler.class. My Java has a package com.nga.xslt.
    Here is the declaration of my Java class in the XSLT: xmlns:javamap="java:com.nga.xslt.SOAPHeaderHandler"
    It seems that it could not read the java class. Can you please advice what is wrong?

    Hi ,
    select XMLTOOLKIT option in Operation mapping and execute it.
    I am not sure we can call java program in XSLT Program,but alternative is copy the code and use it in XSLT mapping it self,that means your XSLT program will become with JAVA extensions.
    then in Operation mapping level select SAPXMLTOOL kit option and execute it. i hope it will work. if it is not working then you have deploy some JAXP files on server,because the way execution of XSLT Mpaping program got changed,like when eve you executing XSLT with extnasions( if you are not using XMLTOOL kit option) then you have to use latest version of JAXP.JDK files.
    Regards,
    Raj

  • Synchronized method in a java class used by many interfaces

    My interface (idoc to file) is using a java class, which has one method that reads a table from a central database and after doing some calculations updates it.
    (The interface instantiate the class inside a user-defined function and calls the method there.)
    The problem is that if somebody sends 100 idocs at the same time, there can be a “dirty read”, I mean, a read just before other interface updates the table.
    We want the following:
    Interface 1:
    -          Read counter from the table (counter = 5 )
    -          Increment counter (counter = 6)
    -          Update table with that counter (table with counter = 6)
    Interface 2:
    -          Read counter from the table (counter = 6 )
    -          Increment counter (counter = 7)
    -          Update table with that counter (table with counter = 7)
    RESULT: The table has the counter = 7
    But what is happening is the following:
    -          Interface 1 reads (counter = 5)
    -          Interface 2 reads (counter = 5)
    -          Interface 1 increments counter (counter = 6)
    -          Interface 2 increments counter (counter = 6)
    -          Interface 1 updates table (table with counter = 6)
    -          Interface 2 updates table (table with counter = 6)
    RESULT: The table has the counter = 6 (WRONG)
    I made the method synchronized. What I was expecting was that only one interface (i1) could enter the method (read the table and update it) while other interfaces running at the same time would have to wait until i1 finished that method.
    My first test indicates that's not happening. Can anybody help me to find a solution?

    Hi Bhavesh,
    If the QOS is EOIO this means that the integration engine manage the call to the mapping program (and all the other blocks) inside an "internal" synchronized method.
    So this means that in this case you do not need to manage the queued access (synchronization) inside your custom java code because it is already enveloped in a queued block by XI.
    The problem that Jorge had can be easily reproduced using the sample code that follows:
    <b>class Synch Object</b>
    import java.util.Date;
    public class SynchObject {
         String strName;
         public SynchObject(String strName){
              this.strName = strName;
         public synchronized void syncWrite(String strCaller) throws InterruptedException{
              Date now;
              now = new Date();
              System.out.println("-- " + now.toLocaleString() + " " + strCaller + " entering syncWrite of " + strName);
              System.out.flush();
              Thread.sleep(1000);
              now = new Date();
              System.out.println("-- " + now.toLocaleString() + " syncWrite of " + strName + " called by " + strCaller );
              System.out.flush();
              Thread.sleep(1000);
              now = new Date();
              System.out.println("-- " + now.toLocaleString() + " " + strCaller + " leaving syncWrite of " + strName);
              System.out.println("");
              System.out.flush();
    <b>class Caller</b>
    public class Caller implements Runnable {
         String strName;
         SynchObject target;
         int intMax;
         public Caller(String strName, SynchObject target, int intMax) {
              this.strName = strName;
              this.target = target;
              this.intMax = intMax;
         public void run() {
              for(int i=0; i<intMax;i++)
                   try {
                        target.syncWrite(strName);
                   } catch (InterruptedException e) {
                        e.printStackTrace();
    <b>class Workbench</b>
    public class Workbench {
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              SynchObject sObj1 = new SynchObject("syncObj1");
              SynchObject sObj2 = new SynchObject("syncObj2");
              Caller c1 = new Caller("caller1",sObj1,2);
              Caller c2 = new Caller("caller2",sObj1,2); '[*CHANGE*]
              Thread ct1 = new Thread(c1);
              Thread ct2 = new Thread(c2);
              ct1.start();
              ct2.start();
    Run the workbench class to see what happen when setting QOS EOIO (the synch object is the same).
    To see instead what happen now (missing synchronization) you have to change in Workbench class the statement
    Caller c2 = new Caller("caller2",sObj1,2); '[*CHANGE*]
    with
    Caller c2 = new Caller("caller2",sObj2,2); '[*CHANGE*]
    The reason is that every instance of the mapping program declare a new instance of the "Synchronized object" so the calls are synchronized inside the same mapping program but not between several mapping program.
    Hope this give you a better idea on this problems with java synchronization, but if you have further doubts (I know it's a little bit tricky ) feel free to ask.
    Kind Regards,
    Sergio

  • Getting Java mapping errors when testing my Interface mapping

    Hi,
    I'm trying to test my interface mapping from IR, I keep getting these exceptions. All I'm doing in my interface mapping is I have two mapping programs a XSLT mapping with java helper functions with the XSL and a message mapping. In the test it pass thru the XSLT mapping but fails at Message mapping and throws the following exception. Any help on this is really appreciated.
    10:03:26 Start of test
    Call XSLT processor with stylsheet com/earthlink/xi/mapping/xmlc_to_crm_resp.xsl.
    START APPLICATION TRACE ***
    Response:
    0
    END APPLICATION TRACE ***
    Returned form XSLT processor.
    Call method execute of the application Java mapping com.sap.xi.tf._MM_XMLC_RESP_
    Error during appliction Java mapping com/sap/xi/tf/_MM_XMLC_RESP_
    java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:73) at com.sap.aii.ibrep.server.mapping.ibrun.RepSequenceMapping.execute(RepSequenceMapping.java:54) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.transform(MapServiceRemoteObjectImpl0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    10:03:26 End of test

    Joe,
    most likely your XSLT is outputting a not well-formed XML message.
    Remove message mapping from the mapping list and execute it again, to check output.
    Also, for mapping debugging in java enhanced function inside XSLT mappings, use the following:
    1st, you need to pass the "inputparam" parameter from the XSLT runtime to the Java function (it needs to be one of the input parameters for the executed java function).
    In the Java code itself, implement the following code:
    AbstractTrace trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
    trace.addInfo("Log your message here!");
    where <i>param</i> is the input parameter refering to the <i>inputparam</i> from XSLT.
    The AbstractTrace and StreamTransformationConstants classes can be found in the aii_map_api.jar file (used in Java mappings).
    Regards,
    Henrique.

Maybe you are looking for

  • Unable to read Cookies from Browser

    Hi All, The following is the scenario: Portal 1 We have intranet portal which is developed using ASP.NET and upon successful authentication a cookie(logged-in user) is created in the browser. Portal 2 We have another portal(running on Apache tomcat)

  • Payment advice print 2 copies

    Hi All, When I run payment run, I will have payment advice printed from program RFFOUS_C. The requirement is to have 2 copies of each page created. How to do that ? Thanks, -M-

  • Order Value will be exceeded Msg No. F5373

    Hi, "Downpayment should not be more than PO Value(Base Amount)" for this in OBA5 instead of W message i put it as a E message. Now, while making downpayment F-48 system is not accepting more than PO value (Base Amount), but we need to make downpaymen

  • Set name of JFrame in Netbeans

    Hi, I am using the GUI builder in netbeans to create my application. This means that all the components are created in InitComponents() and I cannot access these components to change them. What I need to be able to do is to give my JFrame a name so t

  • SM 59

    Hi I have to configure ALE for Inbound. Do i need to config. SM59 (RFC destination for Inbound). cos i am receving not sending.? Aryan