in core/src/main/java/org/apache/commons/jelly/JellyContext.java [469:516]
public TagLibrary getTagLibrary(String namespaceURI) {
// use my own mapping first, so that namespaceURIs can
// be redefined inside child contexts...
Object answer = taglibs.get(namespaceURI);
if ( answer == null && parent != null ) {
answer = parent.getTagLibrary( namespaceURI );
}
if ( answer instanceof TagLibrary ) {
return (TagLibrary) answer;
}
else if ( answer instanceof String ) {
String className = (String) answer;
Class theClass = null;
try {
theClass = getClassLoader().loadClass(className);
}
catch (ClassNotFoundException e) {
log.error("Could not find the class: " + className, e);
}
if ( theClass != null ) {
try {
Object object = theClass.getConstructor().newInstance();
if (object instanceof TagLibrary) {
taglibs.put(namespaceURI, object);
return (TagLibrary) object;
}
else {
log.error(
"The tag library object mapped to: "
+ namespaceURI
+ " is not a TagLibrary. Object = "
+ object);
}
}
catch (Exception e) {
log.error(
"Could not instantiate instance of class: " + className + ". Reason: " + e,
e);
}
}
}
return null;
}