Package org.nuiton.eugene
Class ResourceResolver
- java.lang.Object
-
- org.nuiton.eugene.ResourceResolver
-
- All Implemented Interfaces:
URIResolver
- Direct Known Subclasses:
FasterCachedResourceResolver
public class ResourceResolver extends Object implements URIResolver
ResourceResolver is a URIResolver for XSL transformation.
Its purpose is to catch the XSL document(...) function call and return a valid data source only if the wanted resource is present in the project resources.
The main goal of ResourceResolver is to retrieve datasources locally, if the wanted resource is not present in project resource then null will be returned.
The resolve function search for the file part of href parameter:- href: http://argouml.org/profiles/uml14/default-uml14.xmi
- file part: default-uml14.xmi.
- eg:
[file part extension]/[file part] - eg:
xmi/default-uml14.xmi
You should assign this ResourceResolver on
Transformerbut not onTransformerFactory.- Author:
- chorlet
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringbaseprotected ClassLoaderclle classe loader utilise pour recuperer les resourcesstatic PatternHREF_PATTERNle pattern de detection d'une uriprotected static SortedMap<String,Source>sourceCacheShared Cache to not search in full classpath at each request.protected static Set<String>unresolvedCacheShared Cache of not local resourcesprotected booleanverbosele niveau de verbosite
-
Constructor Summary
Constructors Constructor Description ResourceResolver()ResourceResolver(String base)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearCache()Pour vider le cache partage.protected SourcefindHrefSource(String path)protected SourcefindRelativeSource(String path)Sourceresolve(String href, String base)Resolve href on local resource.voidsetCl(ClassLoader cl)voidsetVerbose(boolean verbose)
-
-
-
Field Detail
-
HREF_PATTERN
public static final Pattern HREF_PATTERN
le pattern de detection d'une uri
-
sourceCache
protected static final SortedMap<String,Source> sourceCache
Shared Cache to not search in full classpath at each request.
-
unresolvedCache
protected static final Set<String> unresolvedCache
Shared Cache of not local resources
-
base
protected String base
-
verbose
protected boolean verbose
le niveau de verbosite
-
cl
protected ClassLoader cl
le classe loader utilise pour recuperer les resources
-
-
Constructor Detail
-
ResourceResolver
public ResourceResolver()
-
ResourceResolver
public ResourceResolver(String base)
-
-
Method Detail
-
clearCache
public static void clearCache()
Pour vider le cache partage.
-
resolve
public Source resolve(String href, String base)
Resolve href on local resource.- Specified by:
resolvein interfaceURIResolver- Returns:
- null if local resource not found
-
setVerbose
public void setVerbose(boolean verbose)
-
setCl
public void setCl(ClassLoader cl)
-
-