// IMPLEMENTATION OF THE HandlerFactory INTERFACE //
//------------------------------------------------//
public Handler createHandler(String hn, String handlertype) {
Handler res = (Handler) handlers.get(hn);
if (res != null) {
return res;
}
if (handlertype == null) {
return null;
}
int i =0;
for(;i<handlerType2className.length
&& !handlerType2className[i][0].equalsIgnoreCase(handlertype); i++);
String handlerClassName;
if (i<handlerType2className.length) {
handlerClassName = handlerType2className[i][1];
} else {
handlerClassName = handlertype;
}
debug("Instanciating the handler '" + hn + "', class name=" + handlerClassName);
try {
res = (Handler) Class.forName(handlerClassName).newInstance();
} catch (Throwable e) {
warn("Impossible to instanciate the handler: name=" + hn
+ ", class name=" + handlerClassName +": " + e.getMessage());
e.printStackTrace(System.err);
return null;
}
res.setAttribute("handlertype", handlertype);
res.setName(hn);
handlers.put(hn, res);
//Calling the listeners
Iterator iterator = monologFactoryListeners.iterator ();
while (iterator.hasNext ()) {
MonologFactoryListener mfl = ((MonologFactoryListener)iterator.next ());