edu.vt.middleware.password
Class AbstractCharacterRule

java.lang.Object
  extended by edu.vt.middleware.password.AbstractCharacterRule
All Implemented Interfaces:
CharacterRule, Rule
Direct Known Subclasses:
AlphabeticalCharacterRule, DigitCharacterRule, LowercaseCharacterRule, NonAlphanumericCharacterRule, UppercaseCharacterRule

public abstract class AbstractCharacterRule
extends java.lang.Object
implements CharacterRule

AbstractCharacterRule provides common implementation for password character rules.

Version:
$Revision: 1636 $ $Date: 2010-10-04 11:12:15 -0400 (Mon, 04 Oct 2010) $
Author:
Middleware Services

Field Summary
protected  int numCharacters
          number of characters to require.
 
Constructor Summary
AbstractCharacterRule()
           
 
Method Summary
 int getNumberOfCharacters()
          This returns the number of characters which must exist in order for a password to meet the requirements of this rule.
protected abstract  int getNumberOfCharacterType(Password password)
          Returns the number of the type of characters in the supplied password for the implementing class.
protected abstract  java.lang.String getRuleResultDetailMessage()
          Returns the detail message for the implementing class should this rule fail validation.
 void setNumberOfCharacters(int n)
          This sets the number of characters to require in a password.
 java.lang.String toString()
          This returns a string representation of this object.
 RuleResult validate(PasswordData passwordData)
          This returns whether or not the supplied password data meets the requirements of this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.vt.middleware.password.CharacterRule
getValidCharacters
 

Field Detail

numCharacters

protected int numCharacters
number of characters to require. Default value is 1.

Constructor Detail

AbstractCharacterRule

public AbstractCharacterRule()
Method Detail

setNumberOfCharacters

public void setNumberOfCharacters(int n)
This sets the number of characters to require in a password.

Specified by:
setNumberOfCharacters in interface CharacterRule
Parameters:
n - int number of characters to require where n > 0

getNumberOfCharacters

public int getNumberOfCharacters()
This returns the number of characters which must exist in order for a password to meet the requirements of this rule.

Specified by:
getNumberOfCharacters in interface CharacterRule
Returns:
int number of characters to require

getNumberOfCharacterType

protected abstract int getNumberOfCharacterType(Password password)
Returns the number of the type of characters in the supplied password for the implementing class.

Parameters:
password - Password to get character count from
Returns:
int number of characters

getRuleResultDetailMessage

protected abstract java.lang.String getRuleResultDetailMessage()
Returns the detail message for the implementing class should this rule fail validation.

Returns:
String detail message

validate

public RuleResult validate(PasswordData passwordData)
This returns whether or not the supplied password data meets the requirements of this rule.

Specified by:
validate in interface Rule
Parameters:
passwordData - PasswordData to verify (not null).
Returns:
RuleResult - details on password verification

toString

public java.lang.String toString()
This returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
String


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.