CFG file access (*.cfg , *.ini, *.xml)

Just want to know if WM has any utility to access a CFG (cfg,ini or xml). I want to define a configuration file but if I do-it in an xml file, i need to create a record definition. That means each time I’m adding a key/value, I need to reload the record def.
Is this the only way???

There is nothing like in Windows reading an ini file or the equivalent?


What we did is using a regular Java property file, put that into the config directory. And then we have one Java service to read the property file (java.util.Properties) and keep it in a static variable.

We have another Java service, which will take the property name, and return the property value by look up the properties static variable.

Hope this helps.

You can use a properties file, which is very much like a Windows ini file.

You’d create Java services and use the java.util.Properties class to access properties. Here’s one way it could be done.

Service: loadProperties
Input: filename (string)
Output: props (object)

  1. Retrieve filename from pipeline.
  2. Create new java.util.Properties object.
  3. Call Properties.load(filename)
  4. Place the properties object in the pipeline.

Service: getProperty
Input: props (object), key (string)
Output: value (string)

  1. Retrieve props from pipeline, casting to Properties type.
  2. Retrieve key from pipeline.
  3. Call props.getProperty(key)
  4. Place returned value in the pipeline.

Another poster said they used a static var to hold the properties object. This is unnecessary (you can pass it around in the pipeline) and may cause multi-tasking issues (e.g. the property file that was last loaded would be used for all flows).

Hope this helps.

On, I’ve uploaded an example package that shows how to read properties from a properties file. It should be reviewed and posted by the webmaster some time today. The package implements the steps I outlined in my other post.

Thanks a lot both of you. This forum is realy good and people reply with accurate answers!!