com.sun.enterprise.admin.servermgmt
Class DomainConfigValidator

java.lang.Object
  extended by com.sun.enterprise.admin.servermgmt.Validator
      extended by com.sun.enterprise.admin.servermgmt.DomainConfigValidator

public abstract class DomainConfigValidator
extends Validator

This class validates the domain config Map object. It does this by invoking the validator of each required entry. Subclasses must specify the required set of DomainConfigEntryInfo objects.


Nested Class Summary
protected static class DomainConfigValidator.DomainConfigEntryInfo
          Holder class for domain config entry meta info.
 
Constructor Summary
protected DomainConfigValidator(DomainConfigValidator.DomainConfigEntryInfo[] entries)
          Constructs a new DomainConfigValidator object.
protected DomainConfigValidator(String name, Class type, DomainConfigValidator.DomainConfigEntryInfo[] entries)
           
 
Method Summary
 String getDataType(Object key)
           
 boolean isKeyAllowed(Object key)
           
protected abstract  boolean isValidate(String name, Object domainConfig)
          This method allows subclasses to say if an entry should be validated at all.
 boolean isValueValid(Object key, Object value)
           
 void validate(Object domainConfig)
          Validates the domainConfig.
 
Methods inherited from class com.sun.enterprise.admin.servermgmt.Validator
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainConfigValidator

protected DomainConfigValidator(DomainConfigValidator.DomainConfigEntryInfo[] entries)
Constructs a new DomainConfigValidator object.

Parameters:
entries - An array of required DomainConfigEntryInfo objects. Must be supplied by subclasses.

DomainConfigValidator

protected DomainConfigValidator(String name,
                                Class type,
                                DomainConfigValidator.DomainConfigEntryInfo[] entries)
Method Detail

validate

public void validate(Object domainConfig)
              throws InvalidConfigException
Validates the domainConfig. For each required domain config entry in the entries, gets the value from the domainConfig object and invokes the validator of that entry. Skips the validation of an entry if no validator is specified for that entry.

Overrides:
validate in class Validator
Parameters:
domainConfig - The domainConfig object that needs to be validated. A domainConfig object is valid if it
    is of type DomainConfig contains the required set of DomainConfig keys the value for each required key is valid.
Throws:
InvalidConfigException - If invalid domainConfig is supplied.

isKeyAllowed

public boolean isKeyAllowed(Object key)
Parameters:
key -
Returns:
Returns true if the key is valid and required.

isValueValid

public boolean isValueValid(Object key,
                            Object value)
Parameters:
key -
value -
Returns:
Returns true if the key is valid and required and the value for that key is valid.

getDataType

public String getDataType(Object key)
Returns:
Returns the accepted datatype for the key. The returned value is the fully qualified class name of the datatype. If the key is invalid or doesnot belong to the valid domain config key set, "" is returned.

isValidate

protected abstract boolean isValidate(String name,
                                      Object domainConfig)
This method allows subclasses to say if an entry should be validated at all. This is an attempt to add some flexibility to the otherwise static validation. (Eg:- If we donot want to validate the ports during domain creation)



Copyright © 2012 GlassFish Community. All Rights Reserved.