* ObjectName must match this pattern: <p/>
* domain:j2eeType=WebModule,name=MyName,J2EEServer=MyServer,J2EEApplication=MyApplication
*/
private void verifyObjectName(ObjectName objectName) {
if (objectName.isPattern()) {
throw new InvalidObjectNameException(
"ObjectName can not be a pattern", objectName);
}
Hashtable keyPropertyList = objectName.getKeyPropertyList();
if (!NameFactory.WEB_MODULE.equals(keyPropertyList.get("j2eeType"))) {
throw new InvalidObjectNameException(
"WebModule object name j2eeType property must be 'WebModule'",
objectName);
}
if (!keyPropertyList.containsKey(NameFactory.J2EE_NAME)) {
throw new InvalidObjectNameException(
"WebModule object must contain a name property", objectName);
}
if (!keyPropertyList.containsKey(NameFactory.J2EE_SERVER)) {
throw new InvalidObjectNameException(
"WebModule object name must contain a J2EEServer property",
objectName);
}
if (!keyPropertyList.containsKey(NameFactory.J2EE_APPLICATION)) {
throw new InvalidObjectNameException(
"WebModule object name must contain a J2EEApplication property",
objectName);
}
if (keyPropertyList.size() != 4) {
throw new InvalidObjectNameException(
"WebModule object name can only have j2eeType, name, J2EEApplication, and J2EEServer properties",
objectName);
}
}