james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject cvs commit: james-server/src/java/org/apache/james/util XMLResources.java
Date Sat, 20 Mar 2004 17:29:30 GMT
noel        2004/03/20 09:29:30

  Modified:    src/java/org/apache/james/util Tag: branch_2_1_fcs
                        XMLResources.java
  Log:
  corrected javadocs.  added static util method to expose the ${...} style string parameter
replacement we use (should probably move to another utility class).
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.4   +21 -11    james-server/src/java/org/apache/james/util/Attic/XMLResources.java
  
  Index: XMLResources.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/util/Attic/XMLResources.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- XMLResources.java	15 Mar 2004 03:54:22 -0000	1.1.2.3
  +++ XMLResources.java	20 Mar 2004 17:29:30 -0000	1.1.2.4
  @@ -169,13 +169,13 @@
           for ( int i = 0; i < resCount; i++ ) {
               // See if this needs to be processed (is default or product specific)
               Element resElement = (Element)(resDefs.item(i));
  -            String resDb = resElement.getAttribute("for");
  +            String resSelect = resElement.getAttribute("for");
               Map resMap;
  -            if ( resDb.equals("")) {
  +            if ( resSelect.equals("")) {
                   // default
                   resMap = defaultStrings;
               }
  -            else if (resDb.equals(selectTag) ) {
  +            else if (resSelect.equals(selectTag) ) {
                   // Specific to this product
                   resMap = selectTagStrings;
               }
  @@ -231,9 +231,9 @@
        * expressions to use.
        *
        * @param select the String to be checked
  -     * @param dbMatchersElement the XML element containing the database type information
  +     * @param matchersElement the XML element containing selector patterns
        *
  -     * @return the type of database to which James is connected
  +     * @return the selector tag that will be used to select custom resources
        *
        */
       private String match(String select, Element matchersElement)
  @@ -268,9 +268,9 @@
        * @param replace the string to replace with
        * @return the substituted string
        */
  -    private String substituteSubString( String input, 
  -                                        String find,
  -                                        String replace )
  +    static private String substituteSubString( String input, 
  +                                               String find,
  +                                               String replace )
       {
           int find_length = find.length();
           int replace_length = replace.length();
  @@ -328,8 +328,7 @@
       }
   
       /**
  -     * Returns a named string for the specified connection, replacing
  -     * parameters with the values set.
  +     * Returns a named string, replacing parameters with the values set.
        * 
        * @param name          the name of the String resource required.
        * @param parameters    a map of parameters (name-value string pairs) which are
  @@ -338,8 +337,19 @@
        */
       public String getString(String name, Map parameters)
       {
  -        String str = getString(name);
  +        return replaceParameters(getString(name), parameters);
  +    }
   
  +    /**
  +     * Returns a named string, replacing parameters with the values set.
  +     * 
  +     * @param name          the name of the String resource required.
  +     * @param parameters    a map of parameters (name-value string pairs) which are
  +     *                      replaced where found in the input strings
  +     * @return the requested resource
  +     */
  +    static public String replaceParameters(String str, Map parameters)
  +    {
           // Do parameter replacements for this string resource.
           Iterator paramNames = parameters.keySet().iterator();
           while ( paramNames.hasNext() ) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message