org.mule.transport.legstar.config
Class ConfigUtils

java.lang.Object
  extended by org.mule.transport.legstar.config.ConfigUtils

public final class ConfigUtils
extends Object

Helper methods for configuration.


Method Summary
static HostProgram getHostProgram(String propertyFileName)
          A helper to create a hostProgram configuration from a properties file.
static int getInt(Properties props, String key)
          Safe get for integers.
static void loadContainer(Properties props, List<HostContainer> containers, String nameKey, String lengthKey)
          Create a map with container names and associated max size from entries in a property file.
static Properties loadFromPropFile(String propFileName)
          Loads a properties file from classpath into memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadFromPropFile

public static Properties loadFromPropFile(String propFileName)
                                   throws IOException
Loads a properties file from classpath into memory.

Parameters:
propFileName - the properties file name
Returns:
the in-memory properties file
Throws:
IOException - if file cannot be loaded

getInt

public static int getInt(Properties props,
                         String key)
Safe get for integers.

Parameters:
props - a properties set
key - the key to value
Returns:
an integer

getHostProgram

public static HostProgram getHostProgram(String propertyFileName)
                                  throws IOException
A helper to create a hostProgram configuration from a properties file.

Parameters:
propertyFileName - the property file name
Returns:
a configured host program
Throws:
IOException - if properties file cannot be read

loadContainer

public static void loadContainer(Properties props,
                                 List<HostContainer> containers,
                                 String nameKey,
                                 String lengthKey)
Create a map with container names and associated max size from entries in a property file. List of items are expected to be stored as a set of properties suffixed with _n where n in the item rank.

Parameters:
props - program attributes as properties
containers - a list of containers to fill
nameKey - the properties key for container name
lengthKey - the properties key for container size


Copyright © 2013 LegSem. All Rights Reserved.