com.atlassian.seraph.util
Class CachedPathMapper

java.lang.Object
  extended by com.atlassian.seraph.util.CachedPathMapper
All Implemented Interfaces:
IPathMapper

public class CachedPathMapper
extends Object
implements IPathMapper

Caches the results of the PathMapper


Constructor Summary
CachedPathMapper()
          Creates a CachedPathMapper object that will cache the results of the get(String) and the getAll(String) calls.
CachedPathMapper(ConcurrentMap<String,String> cacheMap, ConcurrentMap<String,Collection<String>> cacheAllMap)
          Creates a CachedPathMapper object that will use cacheMap to cache the results of the get(String) calls and cacheAllMap to cache the results of the getAll(String) class.
 
Method Summary
 String get(String path)
          Retrieve appropriate key by matching patterns with supplied path.
 Collection<String> getAll(String path)
          Retrieve all mappings which match a supplied path.
 void put(String key, String pattern)
          Add a key and appropriate matching pattern.
 void set(Map<String,String> patterns)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachedPathMapper

public CachedPathMapper()
Creates a CachedPathMapper object that will cache the results of the get(String) and the getAll(String) calls.

Use the passed in maps for caches. The maps must be thread-safe as far as Map.get(Object) calls are concerned as gets may happen concurrently. An access ordered map should be wrapped in a synchronizedMap wrapper.

Parameters:
cacheMap - for caching results of get(String) calls
cacheAllMap - for caching results of getAll(String) calls

CachedPathMapper

public CachedPathMapper(ConcurrentMap<String,String> cacheMap,
                        ConcurrentMap<String,Collection<String>> cacheAllMap)
Creates a CachedPathMapper object that will use cacheMap to cache the results of the get(String) calls and cacheAllMap to cache the results of the getAll(String) class.

Use the passed in maps for caches. The maps must be thread-safe as far as Map.get(Object) calls are concerned as gets may happen concurrently. An access ordered map should be wrapped in a synchronizedMap wrapper.

Parameters:
cacheMap - for caching results of get(String) calls
cacheAllMap - for caching results of getAll(String) calls
Method Detail

get

public String get(String path)
Description copied from interface: IPathMapper
Retrieve appropriate key by matching patterns with supplied path.

Specified by:
get in interface IPathMapper

getAll

public Collection<String> getAll(String path)
Description copied from interface: IPathMapper
Retrieve all mappings which match a supplied path.

Specified by:
getAll in interface IPathMapper

set

public void set(Map<String,String> patterns)

put

public void put(String key,
                String pattern)
Description copied from interface: IPathMapper
Add a key and appropriate matching pattern.

Specified by:
put in interface IPathMapper

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Atlassian. All Rights Reserved.