Methods Summary |
---|
public void | containerEvent(ContainerEvent event)
if(_logger.isLoggable(Level.FINEST)) {
_logger.log(Level.FINEST,"ContainerEvent: " +
event.getType() + "," +
event.getContainer() + "," +
event.getData());
}
String type = event.getType();
try {
if (ContainerEvent.AFTER_LISTENER_INSTANTIATED.equals(type)
|| ContainerEvent.BEFORE_FILTER_INITIALIZED.equals(type)) {
preInvoke((Context) event.getContainer());
injectInstance(event);
postInvoke((Context) event.getContainer());
}
if (beforeEvents.contains(type)) {
preInvoke((Context) event.getContainer());
} else if (afterEvents.contains(type)) {
postInvoke((Context) event.getContainer());
}
} catch (Exception ex) {
String msg = _logger.getResourceBundle().getString(
"web_server.excep_handle_event");
msg = MessageFormat.format(msg, new Object[] { type });
throw new RuntimeException(msg, ex);
} finally {
if (type.equals(ContainerEvent.AFTER_FILTER_DESTROYED)) {
preDestroy(event);
}
}
|
private void | injectInstance(ContainerEvent event)
JndiNameEnvironment desc = (JndiNameEnvironment)
Switch.getSwitch().getDescriptorFor(
(Context) event.getContainer());
if( desc != null ) {
injectionMgr.injectInstance(event.getData(), desc);
}
|
private void | postInvoke(Context ctx)
ComponentInvocation inv = new ComponentInvocation();
inv.instance = null;
inv.container = ctx;
if (im == null) {
im = Switch.getSwitch().getInvocationManager();
}
im.postInvoke(inv);
|
private void | preDestroy(ContainerEvent event)Invokes preDestroy on the instance embedded in the given ContainerEvent.
try {
JndiNameEnvironment desc = (JndiNameEnvironment)
Switch.getSwitch().getDescriptorFor(
(Context) event.getContainer());
if( desc != null ) {
injectionMgr.invokeInstancePreDestroy(event.getData(), desc);
}
} catch (InjectionException ie) {
_logger.log(Level.SEVERE,
"web_server.excep_handle_after_event",
ie);
}
|
private void | preInvoke(Context ctx)
ComponentInvocation inv = new ComponentInvocation();
inv.instance = null;
inv.container = ctx;
if (im == null) {
im = Switch.getSwitch().getInvocationManager();
}
im.preInvoke(inv);
|