org.apache.james.util
Class XMLResources

java.lang.Object
  extended by org.apache.james.util.XMLResources

public class XMLResources
extends java.lang.Object


Constructor Summary
XMLResources()
           
 
Method Summary
 java.lang.String getString(java.lang.String name)
          Returns a named string for the specified key.
 java.lang.String getString(java.lang.String name, boolean required)
          Returns a named string for the specified key.
 java.lang.String getString(java.lang.String name, java.util.Map parameters)
          Returns a named string, replacing parameters with the values set in a Map.
 java.lang.String getString(java.lang.String name, java.util.Map parameters, boolean required)
          Returns a named string, replacing parameters with the values set in a Map.
 void init(java.io.File xmlFile, java.lang.String group, java.lang.String select, java.util.Map configParameters)
          Configures an XMLResources object to provide string statements from a file.
static java.lang.String replaceParameters(java.lang.String str, java.util.Map parameters)
          Returns a named string, replacing parameters with the values set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLResources

public XMLResources()
Method Detail

init

public void init(java.io.File xmlFile,
                 java.lang.String group,
                 java.lang.String select,
                 java.util.Map configParameters)
          throws java.lang.Exception
Configures an XMLResources object to provide string statements from a file. Parameters encoded as $(parameter} in the input file are replace by values from the parameters Map, if the named parameter exists. Parameter values may also be specified in the resourceSection element.

Parameters:
xmlFile - the input file containing the string definitions
group - xml element containing the strings to be used
select - if customized elements exist for this value, use them instead of the default
configParameters - a map of parameters (name-value string pairs) which are replaced where found in the input strings
Throws:
java.lang.Exception

getString

public java.lang.String getString(java.lang.String name)
Returns a named string for the specified key.

Parameters:
name - the name of the String resource required.
Returns:
the requested resource

getString

public java.lang.String getString(java.lang.String name,
                                  boolean required)
Returns a named string for the specified key.

Parameters:
name - the name of the String resource required.
required - true if the resource is required
Returns:
the requested resource
Throws:
ConfigurationException - if a required resource cannot be found.

getString

public java.lang.String getString(java.lang.String name,
                                  java.util.Map parameters)
Returns a named string, replacing parameters with the values set in a Map.

Parameters:
name - the name of the String resource required.
parameters - a map of parameters (name-value string pairs) which are replaced where found in the input strings
Returns:
the requested resource

getString

public java.lang.String getString(java.lang.String name,
                                  java.util.Map parameters,
                                  boolean required)
Returns a named string, replacing parameters with the values set in a Map.

Parameters:
name - the name of the String resource required.
parameters - a map of parameters (name-value string pairs) which are replaced where found in the input strings
Returns:
the requested resource

replaceParameters

public static java.lang.String replaceParameters(java.lang.String str,
                                                 java.util.Map parameters)
Returns a named string, replacing parameters with the values set.

Parameters:
name - the name of the String resource required.
parameters - a map of parameters (name-value string pairs) which are replaced where found in the input strings
Returns:
the requested resource


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.