Methods Summary |
---|
private final com.sun.enterprise.config.serverbeans.JmsHost | getJmsHost(com.sun.enterprise.config.ConfigContextEvent cce)
return (JmsHost) cce.getValidationTarget();
|
private boolean | hasIllegalChar(char[] inputCharArr, char[] illegalCharArr)
int inputCharArrLen = inputCharArr.length;
int illegalCharArrLen = illegalCharArr.length;
for (int i=0; i<illegalCharArrLen; i++) {
for (int j=0; j<inputCharArrLen; j++) {
if (inputCharArr[j] == illegalCharArr[i]) {
return true;
}
}
}
return false;
|
private final boolean | isReferencedByParent(com.sun.enterprise.config.ConfigContextEvent cce)
final JmsHost host = getJmsHost(cce);
final JmsService parent = (JmsService) host.parent();
return parent.getDefaultJmsHost() != null && parent.getDefaultJmsHost().equals(host.getName());
|
public com.sun.enterprise.config.serverbeans.validation.Result | validate(com.sun.enterprise.config.ConfigContextEvent cce)
Result result = super.validate(cce);
try {
if (cce.getChoice().equals(StaticTest.DELETE)){
if (isReferencedByParent(cce)){
result.failed(
smh.getLocalString(
getClass().getName() + ".cannotDeleteReferencedJmsHost",
"Jms host (name={0}) can not be removed. It is referenced by its parent jms-service",
new Object[]{getJmsHost(cce).getName()}));
}
} else {
if (cce.getName().equals(ServerTags.ADMIN_USER_NAME)) {
validateAdminUserName((String) cce.getObject(), result);
} else if (cce.getName().equals(ServerTags.ADMIN_PASSWORD)) {
validateAdminUserPassword((String) cce.getObject(), result);
}
}
} catch(Exception e) {
_logger.log(Level.FINE, "domainxmlverifier.exception", e);
}
return result;
|
private void | validateAdminUserName(java.lang.String name, com.sun.enterprise.config.serverbeans.validation.Result result)
if ((name == null) || (name.equals("")) || (name.length() < 1)) {
result.failed(smh.getLocalString(getClass().getName() +
".blankOrNullString",
"Attribute {0} : cannot be null or blank",
new Object[] {ServerTags.ADMIN_USER_NAME}));
return;
}
if (hasIllegalChar(name.toCharArray(), illegalChars)) {
result.failed(smh.getLocalString(getClass().getName() +
".stringHasIllegalChars",
"Attribute {0} cannot have any of illegal characters {1}",
new Object[] {ServerTags.ADMIN_USER_NAME, new String(illegalChars)}));
}
|
private void | validateAdminUserPassword(java.lang.String name, com.sun.enterprise.config.serverbeans.validation.Result result)
if ((name == null) || (name.equals("")) || (name.length() < 1)) {
result.failed(smh.getLocalString(getClass().getName() +
".blankOrNullString",
"Attribute {0} : cannot be null or blank",
new Object[] {ServerTags.ADMIN_PASSWORD}));
return;
}
if (hasIllegalChar(name.toCharArray(), illegalChars)) {
result.failed(smh.getLocalString(getClass().getName() +
".stringHasIllegalChars",
"Attribute {0} cannot have any of illegal characters {1}",
new Object[] {ServerTags.ADMIN_PASSWORD, new String(illegalChars)}));
}
|