AppServDELImplpublic class AppServDELImpl extends Object implements com.sun.enterprise.deployment.backend.DeploymentEventListenerThis class listens to the deploy/undeploy events. On deploy, it
investigates the deployment descriptors for web services. If
web services exist, the application or stand alone module is
demarcated persistently. This cache is used to discover the
deployed web services artifacts in the repository. This removes
the need to read all the deployment descriptors in the repository.
On un-deploy, the information, if any, in the cache is removed. |
Fields Summary |
---|
private static Logger | _logger |
Constructors Summary |
---|
public AppServDELImpl()Default constructor.
|
Methods Summary |
---|
public void | notifyDeploymentEvent(com.sun.enterprise.deployment.backend.DeploymentEvent event)Listens to DEPLOY and UNDEPLOY events. On deploy, the
cache is updated if the application or stand alone
module has web services in it. For application, the ejb and web
bundles with web services are identified. On un-deploy, the
application or stand alone module is removed from cache.
try {
DeploymentEventInfo info = null;
if (event !=null) {
info = event.getEventInfo();
}
Application rootDD = null;
DeploymentRequest dr = null;
if (info != null) {
rootDD = info.getApplicationDescriptor();
dr = info.getDeploymentRequest();
}
CacheMgr mgr = CacheMgr.getInstance();
// post deploy event
if ((event != null)
&& (event.getEventType()==DeploymentEvent.POST_DEPLOY)) {
// if an ejb module
if (dr.isEjbModule()) {
Set ws = rootDD.getWebServiceDescriptors();
if ((ws != null) && !ws.isEmpty()) {
mgr.addEjbModule(dr.getName());
mgr.save();
}
// if a web module
} else if (dr.isWebModule()) {
Set ws = rootDD.getWebServiceDescriptors();
if ((ws != null) && !ws.isEmpty()) {
mgr.addWebModule(dr.getName());
mgr.save();
}
// if application
} else if (dr.isApplication()) {
List ejb = new ArrayList();
Set ejbBundles = rootDD.getEjbBundleDescriptors();
for (Iterator iter=ejbBundles.iterator(); iter.hasNext();) {
BundleDescriptor bd = (BundleDescriptor) iter.next();
WebServicesDescriptor wsDD = bd.getWebServices();
if (wsDD.hasWebServices()) {
// ejb bundle has web services
ejb.add(bd.getModuleDescriptor().getArchiveUri());
}
}
List web = new ArrayList();
Set webBundles = rootDD.getWebBundleDescriptors();
for (Iterator iter=webBundles.iterator(); iter.hasNext();) {
BundleDescriptor bd = (BundleDescriptor) iter.next();
WebServicesDescriptor wsDD = bd.getWebServices();
if (wsDD.hasWebServices()) {
// web bundle has web services
web.add(bd.getModuleDescriptor().getArchiveUri());
}
}
if ( (!ejb.isEmpty()) || (!web.isEmpty()) ) {
mgr.addJ2eeApplication(dr.getName(), ejb, web);
mgr.save();
}
}
WebServiceMgrBackEnd.getManager().removeFromCache(dr.getName());
// post undeploy event and pre deploy event
} else if ((event != null)
&& (event.getEventType()==DeploymentEvent.POST_UNDEPLOY ||
event.getEventType()==DeploymentEvent.PRE_DEPLOY)) {
// removes the app entry from cache
if (dr.isEjbModule()) {
mgr.removeEjbModule(dr.getName());
mgr.save();
} else if (dr.isWebModule()) {
mgr.removeWebModule(dr.getName());
mgr.save();
} else if (dr.isApplication()) {
mgr.removeJ2eeApplication(dr.getName());
mgr.save();
}
WebServiceMgrBackEnd.getManager().removeFromCache(dr.getName());
}
} catch (Exception e) {
_logger.log(Level.FINE, "Error in deployment event listener", e);
}
|
|