// sourcembean
//String sourceMbean = null;
String sourceMbeanObjName = null;
String sourceMbeanName = null;
for( int i = 0; i < properties.length; i++ ){
ElementProperty property = properties[i];
String propertyName = property.getName( ).toLowerCase( );
if (propertyName.equals(PROPERTY_NOTIFICATION_SOURCE_OBJ_NAME)) {
sourceMbeanObjName = property.getValue();
} else if (propertyName.equals(PROPERTY_NOTIFICATION_SOURCEMBEAN)) {
sourceMbeanName = property.getValue();
}
}
if (sourceMbeanName == null && sourceMbeanObjName == null) {
throw new IllegalArgumentException(
sm.getString("selfmgmt_event.invalid_event_property","sourceMBean","notification"));
}
String sourceMbean = null;
if(sourceMbeanObjName != null) {
//final String serverNameVal = System.getProperty("com.sun.aas.instanceName");
Pattern pat = Pattern.compile("\\$\\{instance.name\\}");
Matcher m = pat.matcher(sourceMbeanObjName);
if(m.find()) {
sourceMbean = m.replaceAll(instanceName);
} else {
sourceMbean = sourceMbeanObjName;
}
} else if(sourceMbeanName != null) {
sourceMbean = ManagementRulesMBeanHelper.getObjName(sourceMbeanName);
}
/*if (!(sourceMbean.endsWith(",server=" + instanceName))) {
sourceMbean = sourceMbean + ",server=" + instanceName;
}*/
try {
ObjectName oName = new ObjectName(sourceMbean);
return new NotificationEvent(oName, description);
} catch (MalformedObjectNameException ex) {
throw new IllegalArgumentException(
sm.getString("selfmgmt_event.invalid_event_property","sourceMBean","notification"));
}