* implementation. The constructor of the instantiated Wrapper
* will have been called, but no properties will have been set.
*/
public Wrapper createWrapper() {
Wrapper wrapper = null;
if (wrapperClass != null) {
try {
wrapper = (Wrapper) wrapperClass.newInstance();
} catch (Throwable t) {
log.error("createWrapper", t);
return (null);
}
} else {
wrapper = new StandardWrapper();
}
synchronized (instanceListeners) {
for (int i = 0; i < instanceListeners.length; i++) {
try {
Class clazz = Class.forName(instanceListeners[i]);
InstanceListener listener =
(InstanceListener) clazz.newInstance();
wrapper.addInstanceListener(listener);
} catch (Throwable t) {
log.error("createWrapper", t);
return (null);
}
}
}
synchronized (wrapperLifecycles) {
for (int i = 0; i < wrapperLifecycles.length; i++) {
try {
Class clazz = Class.forName(wrapperLifecycles[i]);
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
if (wrapper instanceof Lifecycle)
((Lifecycle) wrapper).addLifecycleListener(listener);
} catch (Throwable t) {
log.error("createWrapper", t);
return (null);
}
}
}
synchronized (wrapperListeners) {
for (int i = 0; i < wrapperListeners.length; i++) {
try {
Class clazz = Class.forName(wrapperListeners[i]);
ContainerListener listener =
(ContainerListener) clazz.newInstance();
wrapper.addContainerListener(listener);
} catch (Throwable t) {
log.error("createWrapper", t);
return (null);
}
}