org.opensaml.xml.security.credential.criteria
Class EvaluableCredentialCriteriaRegistry

java.lang.Object
  extended by org.opensaml.xml.security.credential.criteria.EvaluableCredentialCriteriaRegistry

public final class EvaluableCredentialCriteriaRegistry
extends Object

A registry which manages mappings from types of Criteria to the class type which can evaluate that criteria's data against a Credential target. That latter class will be a subtype of EvaluableCredentialCriteria. Each EvaluableCredentialCriteria implementation that is registered MUST implement a single-arg constructor which takes an instance of the Criteria to be evaluated. The evaluable instance is instantiated reflectively based on this requirement.


Field Summary
static String DEFAULT_MAPPINGS_FILE
          Properties file storing default mappings from criteria to evaluable credential criteria.
private static boolean initialized
          Flag to track whether registry is initialized.
private static Map<Class<? extends Criteria>,Class<? extends EvaluableCredentialCriteria>> registry
          Storage for the registry mappings.
 
Constructor Summary
private EvaluableCredentialCriteriaRegistry()
          Constructor.
 
Method Summary
static void clearRegistry()
          Clear all mappings from the registry.
static void deregister(Class<? extends Criteria> criteriaClass)
          Deregister a criteria-evaluator mapping.
static EvaluableCredentialCriteria getEvaluator(Criteria criteria)
          Get an instance of EvaluableCredentialCriteria which can evaluate the supplied criteria's requirements against a Credential target.
private static Logger getLogger()
          Get an SLF4J Logger.
static void init()
          Initialize the registry.
static boolean isInitialized()
          Check whether the registry has been initialized.
static void loadDefaultMappings()
          Load the default set of criteria-evaluator mappings from the default mappings properties file.
static void loadMappings(Properties mappings)
          Load a set of criteria-evaluator mappings from the supplied properties set.
static Class<? extends EvaluableCredentialCriteria> lookup(Class<? extends Criteria> clazz)
          Lookup the class subtype of EvaluableCredentialCriteria which is registered for the specified Criteria class.
static void register(Class<? extends Criteria> criteriaClass, Class<? extends EvaluableCredentialCriteria> evaluableClass)
          Register a credential evaluator class for a criteria class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAPPINGS_FILE

public static final String DEFAULT_MAPPINGS_FILE
Properties file storing default mappings from criteria to evaluable credential criteria. Will be loaded as a resource stream relative to this class.

See Also:
Constant Field Values

registry

private static Map<Class<? extends Criteria>,Class<? extends EvaluableCredentialCriteria>> registry
Storage for the registry mappings.


initialized

private static boolean initialized
Flag to track whether registry is initialized.

Constructor Detail

EvaluableCredentialCriteriaRegistry

private EvaluableCredentialCriteriaRegistry()
Constructor.

Method Detail

getEvaluator

public static EvaluableCredentialCriteria getEvaluator(Criteria criteria)
                                                throws SecurityException
Get an instance of EvaluableCredentialCriteria which can evaluate the supplied criteria's requirements against a Credential target.

Parameters:
criteria - the criteria to be evaluated against a credential
Returns:
an instance of of EvaluableCredentialCriteria representing the specified criteria's requirements
Throws:
SecurityException - thrown if there is an error reflectively instantiating a new instance of EvaluableCredentialCriteria based on class information stored in the registry

lookup

public static Class<? extends EvaluableCredentialCriteria> lookup(Class<? extends Criteria> clazz)
Lookup the class subtype of EvaluableCredentialCriteria which is registered for the specified Criteria class.

Parameters:
clazz - the Criteria class subtype to lookup
Returns:
the registered EvaluableCredentialCriteria class subtype

register

public static void register(Class<? extends Criteria> criteriaClass,
                            Class<? extends EvaluableCredentialCriteria> evaluableClass)
Register a credential evaluator class for a criteria class.

Parameters:
criteriaClass - class subtype of Criteria
evaluableClass - class subtype of EvaluableCredentialCriteria

deregister

public static void deregister(Class<? extends Criteria> criteriaClass)
Deregister a criteria-evaluator mapping.

Parameters:
criteriaClass - class subtype of Criteria

clearRegistry

public static void clearRegistry()
Clear all mappings from the registry.


isInitialized

public static boolean isInitialized()
Check whether the registry has been initialized.

Returns:
true if registry is already initialized, false otherwise

init

public static void init()
Initialize the registry.


loadDefaultMappings

public static void loadDefaultMappings()
Load the default set of criteria-evaluator mappings from the default mappings properties file.


loadMappings

public static void loadMappings(Properties mappings)
Load a set of criteria-evaluator mappings from the supplied properties set.

Parameters:
mappings - properies set where the key is the criteria class name, the value is the evaluator class name

getLogger

private static Logger getLogger()
Get an SLF4J Logger.

Returns:
a Logger instance


Copyright © 1999-2013. All Rights Reserved.