try {
ConfigBean bean = getTRBean(event, takeOld);
if ( bean instanceof TransformationRule ) {
TransformationRule tr = (TransformationRule) bean;
String appId = getApplicationId(tr);
WebServiceConfigImpl wsc = new WebServiceConfigImpl (
(WebServiceEndpoint) tr.parent());
TransformHandler trh = new TransformHandler( wsc , appId);
Filter f = trh.getFilter(appId, wsc);
TransformFilter tf = null;
if ( f != null) {
tf = (TransformFilter) f;
}
ConfigBean newBean = getTRBean(event, false);
WebServiceConfigImpl nwsc = null;
if ( newBean == null) {
if ( ! isRemove) {
// only remove operation can not have
// new element in the new config context
throw new AdminEventListenerException();
} else {
nwsc = wsc;
}
} else {
nwsc = new WebServiceConfigImpl(
(WebServiceEndpoint) newBean.parent());
}
if ( tf == null) {
// create new filter to handle transformation
tf = (TransformFilter) trh.registerFilter(wsc);
} else {
if ( isRemove) {
String applyTo = tr.getApplyTo();
if ( applyTo.equals(Constants.BOTH) ||
applyTo.equals(Constants.REQUEST)) {
com.sun.enterprise.admin.wsmgmt.config.spi.TransformationRule[] rtrs =
nwsc.getRequestTransformationRule();
tf.resetRequestChain( pruneList( rtrs,
tr.getName()));
}
if ( applyTo.equals(Constants.BOTH) ||
applyTo.equals(Constants.RESPONSE)) {
com.sun.enterprise.admin.wsmgmt.config.spi.TransformationRule[] rtrs =
nwsc.getResponseTransformationRule();
tf.resetResponseChain( pruneList( rtrs,
tr.getName()));
}
} else {
tf.resetRequestChain(
nwsc.getRequestTransformationRule());
tf.resetResponseChain(
nwsc.getResponseTransformationRule());
}
}
}
} catch (Exception e) {