org.mule.util
Class PropertiesUtils

java.lang.Object
  extended by org.mule.util.PropertiesUtils

public final class PropertiesUtils
extends java.lang.Object

PropertiesHelper is a utility class for manipulating and filtering property Maps.


Constructor Summary
protected PropertiesUtils()
          Do not instanciate.
 
Method Summary
static java.util.Properties getPropertiesFromQueryString(java.lang.String query)
           
static java.util.Properties getPropertiesFromString(java.lang.String query, char separator)
           
static java.util.Map getPropertiesWithoutPrefix(java.util.Map props, java.lang.String prefix)
           
static void getPropertiesWithPrefix(java.util.Map props, java.lang.String prefix, java.util.Map newProps)
          Will create a map of properties where the names have a prefix Allows the callee to supply the target map so a comparator can be set
static java.util.Properties loadProperties(java.io.InputStream is)
           
static java.util.Properties loadProperties(java.lang.String fileName, java.lang.Class callingClass)
          Read in the properties from a properties file.
static java.util.Properties loadProperties(java.net.URL url)
           
static java.lang.String maskedPropertyValue(java.util.Map.Entry property)
          Returns the String representation of the property value or a masked String if the property key has been registered previously via registerMaskedPropertyName(String).
static java.lang.String propertiesToString(java.util.Map props, boolean newline)
          Deprecated. Use MapUtils.toString(Map, boolean) instead
static void registerMaskedPropertyName(java.lang.String name)
          Register a property name for masking.
static java.lang.String removeNamespacePrefix(java.lang.String eleName)
           
static java.util.Map removeNamespaces(java.util.Map properties)
           
static java.lang.String removeXmlNamespacePrefix(java.lang.String eleName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesUtils

protected PropertiesUtils()
Do not instanciate.

Method Detail

registerMaskedPropertyName

public static void registerMaskedPropertyName(java.lang.String name)
Register a property name for masking. This will prevent certain values from leaking e.g. into debugging output or logfiles.

Parameters:
name - the key of the property to be masked.
Throws:
java.lang.IllegalArgumentException - is name is null or empty.

maskedPropertyValue

public static java.lang.String maskedPropertyValue(java.util.Map.Entry property)
Returns the String representation of the property value or a masked String if the property key has been registered previously via registerMaskedPropertyName(String).

Parameters:
property - a key/value pair
Returns:
String of the property value or a "masked" String that hides the contents, or null if the property, its key or its value is null.

loadProperties

public static java.util.Properties loadProperties(java.lang.String fileName,
                                                  java.lang.Class callingClass)
                                           throws java.io.IOException
Read in the properties from a properties file. The file may be on the file system or the classpath.

Parameters:
fileName - - The name of the properties file
callingClass - - The Class which is calling this method. This is used to determine the classpath.
Returns:
a java.util.Properties object containing the properties.
Throws:
java.io.IOException

loadProperties

public static java.util.Properties loadProperties(java.net.URL url)
                                           throws java.io.IOException
Throws:
java.io.IOException

loadProperties

public static java.util.Properties loadProperties(java.io.InputStream is)
                                           throws java.io.IOException
Throws:
java.io.IOException

removeXmlNamespacePrefix

public static java.lang.String removeXmlNamespacePrefix(java.lang.String eleName)

removeNamespacePrefix

public static java.lang.String removeNamespacePrefix(java.lang.String eleName)

removeNamespaces

public static java.util.Map removeNamespaces(java.util.Map properties)

getPropertiesWithPrefix

public static void getPropertiesWithPrefix(java.util.Map props,
                                           java.lang.String prefix,
                                           java.util.Map newProps)
Will create a map of properties where the names have a prefix Allows the callee to supply the target map so a comparator can be set

Parameters:
props - the source set of properties
prefix - the prefix to filter on
newProps - return map containing the filtered list of properties or an empty map if no properties matched the prefix

getPropertiesWithoutPrefix

public static java.util.Map getPropertiesWithoutPrefix(java.util.Map props,
                                                       java.lang.String prefix)

getPropertiesFromQueryString

public static java.util.Properties getPropertiesFromQueryString(java.lang.String query)

getPropertiesFromString

public static java.util.Properties getPropertiesFromString(java.lang.String query,
                                                           char separator)

propertiesToString

public static java.lang.String propertiesToString(java.util.Map props,
                                                  boolean newline)
Deprecated. Use MapUtils.toString(Map, boolean) instead



Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.