WebServiceEndpointEventListenerImplpublic class WebServiceEndpointEventListenerImpl extends Object implements com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEventListenerListener impl to handle web-service-endpoint element events. |
Methods Summary |
---|
private java.lang.String | getApplicationId(com.sun.enterprise.config.serverbeans.WebServiceEndpoint bean)Returns application registration name for this endpoing.
String name = null;
if (bean != null) {
ConfigBean parent = (ConfigBean) bean.parent();
if (parent instanceof J2eeApplication) {
J2eeApplication app = (J2eeApplication) parent;
name = app.getName();
} else if (parent instanceof WebModule) {
WebModule wm = (WebModule) parent;
name = wm.getName();
} else if (parent instanceof EjbModule) {
EjbModule em = (EjbModule) parent;
name = em.getName();
}
}
return name;
| private com.sun.enterprise.config.ConfigBean | getWSEPBean(com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEvent event, boolean old)Returns the web-service-endpoint config bean for this event.
if (event == null) {
throw new IllegalArgumentException();
}
ConfigBean bean = null;
ConfigContext ctx = null;
String xpath = event.getElementXPath();
if (old) {
ctx = event.getOldConfigContext();
} else {
ctx = event.getConfigContext();
}
if (ctx != null) {
bean = ctx.exactLookup(xpath);
}
return bean;
| public void | handleCreate(com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEvent event)Handles element additions.
try {
ConfigBean bean = getWSEPBean(event, false);
if (bean instanceof WebServiceEndpoint) {
WebServiceEndpoint wsep = (WebServiceEndpoint) bean;
int historySize = 25;
String epName = wsep.getName();
String appId = getApplicationId(wsep);
String hs = wsep.getMaxHistorySize();
if (hs != null) {
historySize = Integer.parseInt(hs);
}
// monitoring level
String newMonitoring = wsep.getMonitoring();
if ("HIGH".equalsIgnoreCase(newMonitoring)) {
// enables message trace for this endpoint
MessageTraceMgr traceMgr = MessageTraceMgr.getInstance();
traceMgr.enable(appId, epName, historySize);
}
AppServWSMonitorLifeCycleProvider aplifeProv =
new AppServWSMonitorLifeCycleProvider();
aplifeProv.reconfigureMonitoring(wsep, appId,
MonitoringLevel.instance("OFF"),
MonitoringLevel.instance(wsep.getMonitoring()));
}
} catch (Exception e) {
throw new AdminEventListenerException(e);
}
| public void | handleDelete(com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEvent event)Handles web-service-endpoint element removal.
try {
ConfigBean bean = getWSEPBean(event, true);
if (bean instanceof WebServiceEndpoint) {
WebServiceEndpoint wsep = (WebServiceEndpoint) bean;
String epName = wsep.getName();
String appId = getApplicationId(wsep);
// disables message trace for this endpoint
MessageTraceMgr traceMgr = MessageTraceMgr.getInstance();
traceMgr.disable(appId, epName);
AppServWSMonitorLifeCycleProvider aplifeProv =
new AppServWSMonitorLifeCycleProvider();
aplifeProv.reconfigureMonitoring(wsep, appId,
MonitoringLevel.instance(wsep.getMonitoring()),
MonitoringLevel.instance("OFF"));
}
} catch (Exception e) {
throw new AdminEventListenerException(e);
}
| public void | handleUpdate(com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEvent event)Handles web-service-endpoint element modification
(attributes/properties values changed).
try {
// set message in history size
ConfigBean bean = getWSEPBean(event, false);
if (bean instanceof WebServiceEndpoint) {
WebServiceEndpoint wsep = (WebServiceEndpoint) bean;
WebServiceEndpoint oWsep =
(WebServiceEndpoint) getWSEPBean(event, true);
// monitoring level
String newMonitoring = wsep.getMonitoring();
String oldMonitoring = oWsep.getMonitoring();
// history size
int historySize = 25;
// end point name
String epName = wsep.getName();
String hs = wsep.getMaxHistorySize();
if (hs != null) {
historySize = Integer.parseInt(hs);
}
// application id
String appId = getApplicationId(wsep);
// message trace manager
MessageTraceMgr traceMgr = MessageTraceMgr.getInstance();
// monitoring level changed
if ( (newMonitoring != null) && (oldMonitoring != null)
&& (!newMonitoring.equals(oldMonitoring)) ) {
// monitoring level is changed to HIGH
if ("HIGH".equalsIgnoreCase(newMonitoring)) {
traceMgr.enable(appId, epName, historySize);
// monitoirng level is changed from HIGH to LOW or OFF
} else if ("HIGH".equalsIgnoreCase(oldMonitoring)) {
traceMgr.disable(appId, epName);
}
} else {
// old history size
String oldHs = oWsep.getMaxHistorySize();
int oldHistorySize = 0;
if (oldHs != null) {
oldHistorySize = Integer.parseInt(oldHs);
}
// history size has changed and monitoring level is HIGH
if ((historySize != oldHistorySize)
&& ("HIGH".equalsIgnoreCase(newMonitoring))) {
traceMgr.setMessageHistorySize(appId, epName,
historySize);
}
}
AppServWSMonitorLifeCycleProvider aplifeProv =
new AppServWSMonitorLifeCycleProvider();
aplifeProv.reconfigureMonitoring(wsep, appId,
MonitoringLevel.instance(oldMonitoring),
MonitoringLevel.instance(newMonitoring));
// Check for jbiEnabled Flag
boolean jbiEnabledFlag = wsep.isJbiEnabled();
boolean oldJbiEnabledSetting =oWsep.isJbiEnabled();
if(jbiEnabledFlag != oldJbiEnabledSetting) {
String endpointURI = WebServiceMgrBackEnd.getManager().
getEndpointURI(getApplicationId(wsep) + "#" + epName);
if(endpointURI != null && (ServiceEngineRtObjectFactory.getInstance().getFacade() != null)) {
ServiceEngineRtObjectFactory.getInstance().
getFacade().handleWebServiceEndpointEvent(
endpointURI,jbiEnabledFlag);
}
}
}
} catch (Exception e) {
throw new AdminEventListenerException(e);
}
|
|