com.bbn.swede.core.libraries
Class ConfigurationValidator

java.lang.Object
  extended bycom.bbn.swede.core.libraries.ConfigurationValidator
All Implemented Interfaces:
IConfigurationValidator

public class ConfigurationValidator
extends Object
implements IConfigurationValidator

Implementation of IConfigurationValidator that provides validation for LibraryEntry and Library configurations. Provide the constructor with one of the two constants, either VALIDATE_ENTRY or VALIDATE_LIBRARY to determine the behavior of the class.

Author:
aperezlo

Field Summary
protected  IConfigurationValidator _validator
          Inner validator that does the actual work.
static int VALIDATE_ENTRY
          Mode constant for creating ConfigurationValidators to operate on instances of LibraryEntry.
static int VALIDATE_LIBRARY
          Mode constant for creating ConfigurationValidators to operate on instances of Library.
 
Constructor Summary
ConfigurationValidator(int mode)
          Creates a new configuration validator to validate an entry or a library.
 
Method Summary
 String[] getErrorMessages()
          Retrieves any error messages generated during validation.
 boolean isValid(IConfiguration props)
          Indicates whether a given configuration is valid.
 boolean isValid(Map.Entry property)
          Indicates whether a specific property from a configuration is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATE_ENTRY

public static final int VALIDATE_ENTRY
Mode constant for creating ConfigurationValidators to operate on instances of LibraryEntry.

See Also:
Constant Field Values

VALIDATE_LIBRARY

public static final int VALIDATE_LIBRARY
Mode constant for creating ConfigurationValidators to operate on instances of Library.

See Also:
Constant Field Values

_validator

protected IConfigurationValidator _validator
Inner validator that does the actual work. This will be either an EntryValidator or a LibraryValidator depending on the mode specified at construction.

Constructor Detail

ConfigurationValidator

public ConfigurationValidator(int mode)
Creates a new configuration validator to validate an entry or a library.

Parameters:
mode - Either VALIDATE_ENTRY or VALIDATE_LIBRARY. If any other mode is specified, the resulting object will return false for all validation attempts.
Method Detail

getErrorMessages

public String[] getErrorMessages()
Description copied from interface: IConfigurationValidator
Retrieves any error messages generated during validation.

Specified by:
getErrorMessages in interface IConfigurationValidator
Returns:
an array containing all error messages generated during the validation operation

isValid

public boolean isValid(Map.Entry property)
Description copied from interface: IConfigurationValidator
Indicates whether a specific property from a configuration is valid.

Specified by:
isValid in interface IConfigurationValidator
Parameters:
property - a generalized representation of a single property of a configuration
Returns:
true if this is a valid property, false otherwise

isValid

public boolean isValid(IConfiguration props)
Description copied from interface: IConfigurationValidator
Indicates whether a given configuration is valid.

Specified by:
isValid in interface IConfigurationValidator
Parameters:
props - The configuration to check
Returns:
true if props is valid, false otherwise


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.