com.zeroturnaround.liverebel.util.managedconf
Class PropertiesConfigurationUtil

java.lang.Object
  extended by com.zeroturnaround.liverebel.util.managedconf.PropertiesConfigurationUtil

public class PropertiesConfigurationUtil
extends Object

Helper class for resolving managed properties (sent from LiveRebel Command Center to server)

Author:
Ats Uiboupin

Constructor Summary
PropertiesConfigurationUtil()
           
 
Method Summary
static void addAll(org.apache.commons.configuration.PropertiesConfiguration propsToUpdate, org.apache.commons.configuration.PropertiesConfiguration newProps)
           
static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration()
           
static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration(File sourceFile)
           
static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration(File sourceFile, boolean ignoreIfFileIsMissing)
           
static org.apache.commons.configuration.PropertiesConfiguration getProperties(File first, File... additionalFilesToLoad)
           
static org.apache.commons.configuration.PropertiesConfiguration getPropsOrderedByKey(org.apache.commons.configuration.PropertiesConfiguration unorderedProps)
           
static String getStringContent(org.apache.commons.configuration.PropertiesConfiguration props, String source)
           
static void insertOrUpdate(Map<String,String> props, File file)
           
static
<T> List<T>
toList(Iterator<T> iterator, int estimatedSize)
          XXX: copy from org.apache.commons.collections.IteratorUtils - only generics are added Gets a list based on an iterator.
static Map<String,String> toStringMap(org.apache.commons.configuration.AbstractConfiguration conf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesConfigurationUtil

public PropertiesConfigurationUtil()
Method Detail

createPropertiesConfiguration

public static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration()

createPropertiesConfiguration

public static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration(File sourceFile)

createPropertiesConfiguration

public static org.apache.commons.configuration.PropertiesConfiguration createPropertiesConfiguration(File sourceFile,
                                                                                                     boolean ignoreIfFileIsMissing)

getProperties

public static org.apache.commons.configuration.PropertiesConfiguration getProperties(File first,
                                                                                     File... additionalFilesToLoad)
Parameters:
fileNames - - more important properties files should come later

insertOrUpdate

public static void insertOrUpdate(Map<String,String> props,
                                  File file)
Parameters:
props - - properties to add or update (value should be null if property should be removed).
(Using map instead of PropertiesConfiguration, because propertiesConfiguration.setProperty(key, null) doesn't add key to keySet and hence won't work for removing)

getStringContent

public static String getStringContent(org.apache.commons.configuration.PropertiesConfiguration props,
                                      String source)

toStringMap

public static Map<String,String> toStringMap(org.apache.commons.configuration.AbstractConfiguration conf)

getPropsOrderedByKey

public static org.apache.commons.configuration.PropertiesConfiguration getPropsOrderedByKey(org.apache.commons.configuration.PropertiesConfiguration unorderedProps)

addAll

public static void addAll(org.apache.commons.configuration.PropertiesConfiguration propsToUpdate,
                          org.apache.commons.configuration.PropertiesConfiguration newProps)

toList

public static <T> List<T> toList(Iterator<T> iterator,
                                 int estimatedSize)
XXX: copy from org.apache.commons.collections.IteratorUtils - only generics are added Gets a list based on an iterator.

As the wrapped Iterator is traversed, an ArrayList of its values is created. At the end, the list is returned.

Parameters:
iterator - the iterator to use, not null
estimatedSize - the initial size of the ArrayList
Returns:
a list of the iterator contents
Throws:
NullPointerException - if iterator parameter is null
IllegalArgumentException - if the size is less than 1


Copyright © 2013. All Rights Reserved.