IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Where to set Java Properties files?

    Posted 04/14/16 09:58 PM

    Originally posted by: johnxp


    Hi, anyone can help me on this:

    I am using java class in JEXIT, in the java class I need to access properties files to get some config values.

    I want to know how to set the properties files in WTX/dtx.ini.

    Thanks for your help.

     


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  Re: Where to set Java Properties files?

    Posted 04/15/16 05:18 AM

    Originally posted by: johnxp


    I tried to put properties file in %WTX8.3_Home%\extjar, it's working.

    But don't know how to change the settings.

     


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 3.  Re: Where to set Java Properties files?

    Posted 04/15/16 02:37 PM

    Originally posted by: paul.brett


    Change what settings?  The location of the properties file?

    Thank-you.

    Paul.

    Follow me on Twitter


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 4.  Re: Where to set Java Properties files?

    Posted 04/15/16 11:00 PM

    Originally posted by: johnxp


    Yes, the location of the properties file.


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange


  • 5.  Re: Where to set Java Properties files?

    Posted 04/18/16 08:48 AM

    Originally posted by: paul.brett


    Here I have some Java code:

    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.Properties;
    
    public class Test1 {
    
            public Test1() {             
            }
    
            public String getConfigProp(String propitem) {
    
                    Properties prop = new Properties();
                    InputStream input = null;
    
                    try {
    
                            input = new FileInputStream("config.properties");
    
                            // load a properties file
                            prop.load(input);
    
                    } catch (IOException ex) {
                            ex.printStackTrace();
                    } finally {
                            if (input != null) {
                                    try {
                                            input.close();
                                    } catch (IOException e) {
                                            e.printStackTrace();
                                    }
                            }
                    }
    
                    String retprop = prop.getProperty(propitem);
                    return retprop;
            }
    
    }
    

    ...and my map call

     

    =VALID(JEXIT("Test1", "getConfigProp","abc"), FAIL(LASTERRORMSG()))
    

    ...which in turn loads from the config.properties file stored in the same location as the map.

    Without a path hard-coded into the java code, this is the default behaviour.

    Does this answer your question?

    Thank-you.

    Paul.

    Follow me on Twitter


    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 6.  Re: Where to set Java Properties files?

    Posted 04/18/16 08:54 AM
      |   view attached

    Originally posted by: paul.brett


    My example.

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender

    Attachment(s)

    zip
    ReadProperties.zip   10 KB 1 version