com.atlassian.seraph.util
Class PathMapper

java.lang.Object
  extended bycom.atlassian.seraph.util.PathMapper
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CachedPathMapper

public class PathMapper
extends java.lang.Object
implements java.io.Serializable

The PathMapper is used to map file patterns to keys, and find an approriate key for a given file path. The pattern rules are consistent with those defined in the Servlet 2.3 API on the whole. Wildcard patterns are also supported, using any combination of * and ?.

Example

PathMapper pm = new PathMapper();

pm.put("one","/");
pm.put("two","/mydir/*");
pm.put("three","*.xml");
pm.put("four","/myexactfile.html");
pm.put("five","/*\/admin/*.??ml");

String result1 = pm.get("/mydir/myfile.xml"); // returns "two";
String result2 = pm.get("/mydir/otherdir/admin/myfile.html"); // returns "five";

Version:
$Revision: 654 $
Author:
Joe Walnes, Mike Cannon-Brookes, Hani Suleiman
See Also:
Serialized Form

Constructor Summary
PathMapper()
           
 
Method Summary
 java.lang.String get(java.lang.String path)
          Retrieve appropriate key by matching patterns with supplied path.
 java.util.Collection getAll(java.lang.String path)
          Retrieve all mappings which match a supplied path.
 void put(java.lang.String key, java.lang.String pattern)
          Add a key and appropriate matching pattern.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PathMapper

public PathMapper()
Method Detail

put

public void put(java.lang.String key,
                java.lang.String pattern)
Add a key and appropriate matching pattern.


get

public java.lang.String get(java.lang.String path)
Retrieve appropriate key by matching patterns with supplied path.


getAll

public java.util.Collection getAll(java.lang.String path)
Retrieve all mappings which match a supplied path.


toString

public java.lang.String toString()


Copyright © 2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.