Package org.nuiton.util
Class ResourceResolver
java.lang.Object
org.nuiton.util.ResourceResolver
- All Implemented Interfaces:
javax.xml.transform.URIResolver
- Direct Known Subclasses:
FasterCachedResourceResolver
public class ResourceResolver
extends java.lang.Object
implements javax.xml.transform.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
Transformer but not on TransformerFactory.- Author:
- chorlet
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringbaseprotected java.lang.ClassLoaderclle classe loader utilise pour recuperer les resourcesstatic java.util.regex.PatternHREF_PATTERNle pattern de detection d'une uriprotected static java.util.SortedMap<java.lang.String,javax.xml.transform.Source>sourceCacheShared Cache to not search in full classpath at each request.protected static java.util.Set<java.lang.String>unresolvedCacheShared Cache of not local resourcesprotected booleanverbosele niveau de verbosite -
Constructor Summary
Constructors Constructor Description ResourceResolver()ResourceResolver(java.lang.String base) -
Method Summary
Modifier and Type Method Description static voidclearCache()Pour vider le cache partage.protected javax.xml.transform.SourcefindHrefSource(java.lang.String path)protected javax.xml.transform.SourcefindRelativeSource(java.lang.String path)javax.xml.transform.Sourceresolve(java.lang.String href, java.lang.String base)Resolve href on local resource.voidsetCl(java.lang.ClassLoader cl)voidsetVerbose(boolean verbose)
-
Field Details
-
sourceCache
protected static final java.util.SortedMap<java.lang.String,javax.xml.transform.Source> sourceCacheShared Cache to not search in full classpath at each request. -
unresolvedCache
protected static final java.util.Set<java.lang.String> unresolvedCacheShared Cache of not local resources -
HREF_PATTERN
public static final java.util.regex.Pattern HREF_PATTERNle pattern de detection d'une uri -
base
protected java.lang.String base -
verbose
protected boolean verbosele niveau de verbosite -
cl
protected java.lang.ClassLoader clle classe loader utilise pour recuperer les resources
-
-
Constructor Details
-
ResourceResolver
public ResourceResolver() -
ResourceResolver
public ResourceResolver(java.lang.String base)
-
-
Method Details
-
clearCache
public static void clearCache()Pour vider le cache partage. -
resolve
public javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)Resolve href on local resource.- Specified by:
resolvein interfacejavax.xml.transform.URIResolver- Returns:
- null if local resource not found
-
setVerbose
public void setVerbose(boolean verbose) -
setCl
public void setCl(java.lang.ClassLoader cl) -
findHrefSource
protected javax.xml.transform.Source findHrefSource(java.lang.String path) -
findRelativeSource
protected javax.xml.transform.Source findRelativeSource(java.lang.String path)
-