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