}
// Initialize the ValidPasswordQuerySpecification object and a list of statuses, and a ValidPassword for the response
//ValidPasswordQuerySpecification querySpec = new ValidPasswordQuerySpecification();
PasswordValidationQuerySpecification querySpec;
Vector validationStatuses = new Vector();
PasswordValidation validPassword = new PasswordValidation();
try {
querySpec = (PasswordValidationQuerySpecification)getAppConfig().getObject("ValidPasswordQuerySpecification.v1_0");
querySpec.buildObjectFromInput(eQuerySpec);
String candidate = querySpec.getCandidatePassword();
logger.info("[PasswordValidationRequestCommand] Password to validate is: "+candidate);
validPassword.setCandidatePassword(candidate);
validPassword.setIdentifier(querySpec.getIdentifier());
// Here's where the validation occurs
for (int i=0;i<validationRules.size();i++) {
logger.info("[PasswordValidationRequestCommand] Running rule "+i+"...");
PasswordValidationRule rule=(PasswordValidationRule)validationRules.get(i);
ValidationStatus status=rule.validate(querySpec);
if (status!=null) {
logger.info("[PasswordValidationRequestCommand] Candidate password "+candidate
+" violates rule "+i+", "+rule.getClass().getName());
validationStatuses.add(status);
}
}
// check for rule violation. If none, return validation status 0
if (validationStatuses.size()==0) {
validationStatuses.add(noViolation);
}
// add ValidationStatuses to ValidPassword
validPassword.setValidationStatus(validationStatuses);
} catch (EnterpriseLayoutException ele) {
logger.fatal("[PasswordValidationRequestCommand] Error building PasswordValidationQuerySpecification " +
"object from Query object: The exception is: " + ele.getMessage());
String errType = "application";
String errCode = "OpenEAI-1015";
String errDesc = "EnterpriseLayoutException thrown during PasswordValidationQuerySpecification build.";
logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
ArrayList errors = new ArrayList();
errors.add(buildError(errType, errCode, errDesc));
String replyContents =
buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
return getMessage(msg, replyContents);
} catch (EnterpriseFieldException efe) {
logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
+ efe.getMessage());
String errType = "application";
String errCode = "OpenEAI-1016";
String errDesc = "EnterpriseFieldException thrown during address build.";
logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
ArrayList errors = new ArrayList();
errors.add(buildError(errType, errCode, errDesc));
String replyContents =
buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
return getMessage(msg, replyContents);
} catch (PasswordValidationException e) {
logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
+ e.getMessage());
String errType = "application";
String errCode = "OpenEAI-1017";
String errDesc = "PasswordValidationException thrown during address build.";
logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
ArrayList errors = new ArrayList();
errors.add(buildError(errType, errCode, errDesc));
String replyContents =
buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
return getMessage(msg, replyContents);
} catch (EnterpriseConfigurationObjectException e) {
logger.fatal("[PasswordValidationRequestCommand] Password validation processing error. The exception is: "
+ e.getMessage());
String errType = "application";
String errCode = "OpenEAI-1018";
String errDesc = "PasswordValidationException thrown during password query spec build.";
logger.fatal("[PasswordValidationRequestCommand] " + errDesc);
logger.fatal("Message sent in is: \n" + getMessageBody(inDoc));
ArrayList errors = new ArrayList();
errors.add(buildError(errType, errCode, errDesc));
String replyContents =
buildReplyDocumentWithErrors(eControlArea, localResponseDoc, errors);
return getMessage(msg, replyContents);
}
// Serialize the ValidPassord and place it into the reply.
String replyContents = null;
try {
localResponseDoc.getRootElement().getChild("DataArea").removeContent();
localResponseDoc.getRootElement().getChild("DataArea")
.addContent((Element)validPassword.buildOutputFromObject());
replyContents = buildReplyDocument(eControlArea, localResponseDoc);
}
catch (EnterpriseLayoutException ele) {
// There was an error building the ValidPassword element from the quuery request
// object.