Methods Summary |
---|
java.lang.String | getClassName()
return this.className;
|
int | getLoadOrder()
return this.loadOrder;
|
java.lang.String | getName()
return this.name;
|
java.util.Properties | getProperties()
return this.props;
|
public java.lang.String | getStatus()return status of this lifecycle module as a string
return statusMsg;
|
private java.net.URL[] | getURLs()
return ClassLoaderUtils.getUrlsFromClasspath(this.classpath);
|
java.lang.String | getclasspath()
return this.classpath;
|
boolean | isFatal()
return isFatal;
|
LifecycleListener | loadServerLifecycle()
ClassLoader classLoader = ctx.getLifecycleParentClassLoader();
try {
if (this.classpath != null) {
URL[] urls = getURLs();
if (urls != null) {
StringBuffer sb = new StringBuffer(128);
for(int i=0;i<urls.length;i++) {
sb.append(urls[i].toString());
}
if (_isTraceEnabled)
_logger.fine("Lifecycle module = " + getName() +
" has classpath URLs = " + sb.toString());
}
this.urlClassLoader = new URLClassLoader(urls, classLoader);
classLoader = this.urlClassLoader;
}
Class cl = Class.forName(className, true, classLoader);
slcl = (LifecycleListener) cl.newInstance();
} catch (Exception ee) {
String msg = _rb.getString("lifecyclemodule.load_exception");
Object[] params = { this.name, ee.toString() };
msg = MessageFormat.format(msg, params);
_logger.log(Level.WARNING, msg);
}
return slcl;
|
public void | onInitialization(com.sun.enterprise.server.ServerContext context)
postEvent(LifecycleEvent.INIT_EVENT, props, null);
|
public void | onReady(com.sun.enterprise.server.ServerContext context)
postEvent(LifecycleEvent.READY_EVENT, null, ctx.getInvocationManager());
|
public void | onShutdown()
postEvent(LifecycleEvent.SHUTDOWN_EVENT, null, ctx.getInvocationManager());
|
public void | onStartup(com.sun.enterprise.server.ServerContext context, org.apache.catalina.Context invContext)
/** create a ComponentInvocation for this module during startup;
* as otherwise during Initialization ServerContext is not fully
* established.
*/
lcmInvocation = new ComponentInvocation(slcl, invContext);
postEvent(LifecycleEvent.STARTUP_EVENT, null, ctx.getInvocationManager());
|
public void | onTermination()
postEvent(LifecycleEvent.TERMINATION_EVENT, null, ctx.getInvocationManager());
// clear the ComponentInvocation for this module
lcmInvocation = null;
|
private void | postEvent(int eventType, java.lang.Object data, com.sun.enterprise.InvocationManager invMgr)
if (slcl == null) {
if (isFatal) {
String msg = _rb.getString("lifecyclemodule.loadExceptionIsFatal");
Object[] params = { this.name };
msg = MessageFormat.format(msg, params);
throw new ServerLifecycleException(msg);
}
return;
}
if (urlClassLoader != null)
setClassLoader();
if (invMgr != null)
preInvoke(invMgr);
LifecycleEvent slcEvent= new LifecycleEvent(this, eventType, data, this.leContext);
try {
slcl.handleEvent(slcEvent);
} catch (ServerLifecycleException sle) {
String msg = _rb.getString("lifecyclemodule.event_ServerLifecycleException");
Object[] params = { this.name };
msg = MessageFormat.format(msg, params);
_logger.log(Level.WARNING, msg, sle);
if (isFatal)
throw sle;
} catch (Exception ee) {
String msg = _rb.getString("lifecyclemodule.event_Exception");
Object[] params = { this.name };
msg = MessageFormat.format(msg, params);
_logger.log(Level.WARNING, msg, ee);
if (isFatal) {
throw new ServerLifecycleException(_rb.getString("lifecyclemodule.event_exceptionIsFatal"), ee);
}
} finally {
if (invMgr != null)
postInvoke(invMgr);
}
|
private void | postInvoke(com.sun.enterprise.InvocationManager invMgr)
try {
invMgr.postInvoke(lcmInvocation);
} catch (InvocationException ie) {
String msg = _rb.getString("lifecyclemodule.postInvoke_exception");
Object[] params = { this.name };
msg = MessageFormat.format(msg, params);
throw new ServerLifecycleException(msg, ie);
}
|
private void | preInvoke(com.sun.enterprise.InvocationManager invMgr)
try {
invMgr.preInvoke(lcmInvocation);
} catch (InvocationException ie) {
String msg = _rb.getString("lifecyclemodule.preInvoke_exception");
Object[] params = { this.name };
msg = MessageFormat.format(msg, params);
throw new ServerLifecycleException(msg, ie);
}
|
private void | setClassLoader()
// set the common class loader as the thread context class loader
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
Thread.currentThread().setContextClassLoader(urlClassLoader);
return null;
}
}
);
|
void | setClasspath(java.lang.String classpath)
this.classpath = classpath;
|
void | setIsFatal(boolean isFatal)
this.isFatal = isFatal;
|
void | setLoadOrder(int loadOrder)
this.loadOrder = loadOrder;
|
void | setProperty(java.lang.String name, java.lang.String value)
props.put(name, value);
|
public java.lang.String | toString()
return "Server LifecycleListener support";
|