IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  webmethods system variables

    Posted Tue March 01, 2005 10:39 AM

    Is there a list of system variables that we can we use.

    Thanks


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: webmethods system variables

    Posted Tue March 08, 2005 11:50 AM

    I’ve been using the following simple Java service code to grab all kinds of system variables… is that what you’re asking for?

    //**********************************************************
    
    IDataCursor cursor = pipeline.getCursor();
    
    java.util.Properties properties = System.getProperties();
    
    java.util.Enumeration keys = properties.keys();
    while( keys.hasMoreElements() ) {
    
    String key = ( String ) keys.nextElement();
    IDataUtil.put( cursor, key, properties.get( key ) );
    }
    cursor.destroy();
    

    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 3.  RE: webmethods system variables

    Posted Tue March 08, 2005 04:37 PM

    You can also add to the Integration Server’s properties using the Administrator’s Settings->Extended->Edit Extended Settings function.

    These settings have to begin with “watt.”. I usually use extended settings to point to the location of a properties file used by a specific package.

    This java service will merge the properties from a specified properties file into the System properties for easy retrieval:

    //IMPORTS to be added to the shared tab's imports section
    /****
    *
    * java.util.Properties
    * java.util.Enumeration
    * java.io.*
    *
    /***
    
    IDataCursor idc = pipeline.getCursor();
    String propertyFilePath = null;
    String propertyFileName = null;
    
    try {
    Properties props = new Properties();
    
    if (idc.first("propertyFilePath")) propertyFilePath=(String)idc.getValue();
    if (idc.first("propertyFileName")) propertyFileName=(String)idc.getValue();
    
    if ( (propertyFileName == null) || (propertyFileName == null) ) {
    throw new ServiceException("Property file path and filename must be provided.");
    }
    
    FileInputStream propsFIS = new FileInputStream(propertyFilePath + propertyFileName);	
    
    try {
    props.load(propsFIS);
    propsFIS.close();
    } catch (Exception ex) {
    throw new ServiceException("Error loading property file from " + propertyFilePath + propertyFileName);
    }
    
    //	System.setProperties(props);
    
    int i=0;
    String currPropKey=null;
    String currPropValue=null;
    for (Enumeration propsEnum = props.propertyNames(); propsEnum.hasMoreElements() ;) {
    currPropKey = (String)propsEnum.nextElement();
    currPropValue = props.getProperty(currPropKey);
    System.setProperty(currPropKey, currPropValue);
    System.out.println("Property \"" + currPropKey + "\" merged into system properties with value \"" + currPropValue + "\"");
    i++;
    }
    
    idc.insertAfter("status","Successfully loaded " + i + " properties from " + propertyFileName);
    } catch (java.io.FileNotFoundException fnf) {
    throw new ServiceException("Property file not found:  " + propertyFilePath + propertyFileName);
    } catch (Exception e) {
    throw new ServiceException("Exception occurred loading properties file:  " + propertyFilePath + propertyFileName + " " + e);
    } finally {
    idc.destroy();
    }
    

    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General