org.castor.ddlgen

Class KeyGeneratorRegistry


public final class KeyGeneratorRegistry
extends java.lang.Object

Registry for key generator factory implementations obtained from the configuration. In addition this is also a registry for key generators that holds default key generators as well as key generators defined through mapping.
Version:
$Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Authors:
Le Duc Bao
Ralf Joachim
Since:
1.1

Constructor Summary

KeyGeneratorRegistry(DDLGenConfiguration config)
Construct an instance of each key generator factory specified in given configuration.

Method Summary

KeyGenerator
createKeyGenerator(KeyGeneratorDef definition)
Create an instance of the key generator specifed by given definiton.
KeyGenerator
getKeyGenerator(String alias)
Returns key generator with given alias.
Collection
getKeyGeneratorAliases()
Returns a collection of the aliasses of current registered key generators.
Collection
getKeyGeneratorFactories()
Returns a collection of the current configured key generator factories.
KeyGeneratorFactory
getKeyGeneratorFactory(String algorithm)
Returns key generator factory with given algorithm.
Collection
getKeyGeneratorFactoryAlgorithms()
Returns a collection of the algorithms of current configured key generator factories.
Collection
getKeyGenerators()
Returns a collection of the current registered key generators.

Constructor Details

KeyGeneratorRegistry

public KeyGeneratorRegistry(DDLGenConfiguration config)
Construct an instance of each key generator factory specified in given configuration. If key generator does not require mandatory parameters a default instance of the key generator will also be created.
Parameters:
config - The configuration to obtain the key generator factory classes from. Also used for all key generator instances to obtain configuration properties from.

Method Details

createKeyGenerator

public KeyGenerator createKeyGenerator(KeyGeneratorDef definition)
            throws GeneratorException
Create an instance of the key generator specifed by given definiton. The name of the definition is used as algorithm to lookup the key generator factory. The is used to create a key generator initialized with the given definition and the configuration that has been passed to the constructor of this registry. At least the key generator is added to the registry assoziated by its alias.
Parameters:
definition - The definition to initialize the key generator.
Returns:
A key generator instance initialized with given definition.
Throws:
GeneratorException - If failed to create a key generator instance.

getKeyGenerator

public KeyGenerator getKeyGenerator(String alias)
            throws GeneratorException
Returns key generator with given alias.
Parameters:
alias - Alias of the key generator.
Returns:
Generator with given alias.
Throws:
GeneratorException - If no generator for alias can be found.

getKeyGeneratorAliases

public Collection getKeyGeneratorAliases()
Returns a collection of the aliasses of current registered key generators.
Returns:
Aliasses of current registered key generators.

getKeyGeneratorFactories

public Collection getKeyGeneratorFactories()
Returns a collection of the current configured key generator factories.
Returns:
Collection of the current configured key generator factories.

getKeyGeneratorFactory

public KeyGeneratorFactory getKeyGeneratorFactory(String algorithm)
            throws GeneratorException
Returns key generator factory with given algorithm.
Parameters:
algorithm - Algorithm of the key generator factory.
Returns:
Key generator factory with algorithm.
Throws:
GeneratorException - If no key generator factory with given algorithm can be found.

getKeyGeneratorFactoryAlgorithms

public Collection getKeyGeneratorFactoryAlgorithms()
Returns a collection of the algorithms of current configured key generator factories.
Returns:
Algorithms of current configured key generator factories.

getKeyGenerators

public Collection getKeyGenerators()
Returns a collection of the current registered key generators.
Returns:
Collection of the current registered key generators.

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com