org.apache.james.rrt.lib
Class RecipientRewriteTableUtil

java.lang.Object
  extended by org.apache.james.rrt.lib.RecipientRewriteTableUtil

public class RecipientRewriteTableUtil
extends Object

This helper class contains methods for the RecipientRewriteTable implementations


Field Summary
static String QUERY
           
 
Method Summary
static String CollectionToMapping(Collection<String> map)
          Convert a Collection which holds mappings to a raw mapping String
static Collection<String> getMappings(String rawMapping)
          Deprecated. Use mappingToCollection(String rawMapping)
static String getSeparator(String targetString)
          Returns the character used to delineate multiple addresses.
static String getTargetString(String user, String domain, Map<String,String> mappings)
          Returns the real recipient given a virtual username and domain.
static Map<String,String> getXMLMappings(String mapping)
          Returns a Map which contains the mappings
static ArrayList<String> mappingToCollection(String rawMapping)
          Convert a raw mapping String to a Collection
static String regexMap(org.apache.mailet.MailAddress address, String targetString)
          Processes regex virtual user mapping If a mapped target string begins with the prefix regex:, it must be formatted as regex::, e.g., regex:(.*)@(.*):${1}@tld
static String replaceParameters(String str, Map<String,String> 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
 

Field Detail

QUERY

public static String QUERY
Method Detail

regexMap

public static String regexMap(org.apache.mailet.MailAddress address,
                              String targetString)
Processes regex virtual user mapping If a mapped target string begins with the prefix regex:, it must be formatted as regex::, e.g., regex:(.*)@(.*):${1}@tld

Parameters:
address - the MailAddress to be mapped
targetString - a String specifying the mapping
Throws:
MalformedPatternException

replaceParameters

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

Parameters:
str - 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

getTargetString

public static String getTargetString(String user,
                                     String domain,
                                     Map<String,String> mappings)
Returns the real recipient given a virtual username and domain.

Parameters:
user - the virtual user
domain - the virtual domain
Returns:
the real recipient address, or null if no mapping exists

getSeparator

public static String getSeparator(String targetString)
Returns the character used to delineate multiple addresses.

Parameters:
targetString - the string to parse
Returns:
the character to tokenize on

getXMLMappings

public static Map<String,String> getXMLMappings(String mapping)
Returns a Map which contains the mappings

Parameters:
mapping - A String which contains a list of mappings
Returns:
Map which contains the mappings

getMappings

public static Collection<String> getMappings(String rawMapping)
Deprecated. Use mappingToCollection(String rawMapping)

Return a Collection which holds the extracted mappings of the given String

Parameters:
rawMapping -

mappingToCollection

public static ArrayList<String> mappingToCollection(String rawMapping)
Convert a raw mapping String to a Collection

Parameters:
rawMapping - the mapping String
Returns:
map a collection which holds all mappings

CollectionToMapping

public static String CollectionToMapping(Collection<String> map)
Convert a Collection which holds mappings to a raw mapping String

Parameters:
map - the Collection
Returns:
mapping the mapping String


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.