org.castor.ddlgen
Class KeyGeneratorRegistry

java.lang.Object
  extended by org.castor.ddlgen.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.

Since:
1.1
Version:
$Revision: 5951 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Le Duc Bao, Ralf Joachim

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(java.lang.String alias)
          Returns key generator with given alias.
 java.util.Collection getKeyGeneratorAliases()
          Returns a collection of the aliasses of current registered key generators.
 java.util.Collection getKeyGeneratorFactories()
          Returns a collection of the current configured key generator factories.
 KeyGeneratorFactory getKeyGeneratorFactory(java.lang.String algorithm)
          Returns key generator factory with given algorithm.
 java.util.Collection getKeyGeneratorFactoryAlgorithms()
          Returns a collection of the algorithms of current configured key generator factories.
 java.util.Collection getKeyGenerators()
          Returns a collection of the current registered key generators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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.

getKeyGeneratorFactory

public KeyGeneratorFactory getKeyGeneratorFactory(java.lang.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.

getKeyGeneratorFactories

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

Returns:
Collection of the current configured key generator factories.

getKeyGeneratorFactoryAlgorithms

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

Returns:
Algorithms of current configured key generator factories.

getKeyGenerator

public KeyGenerator getKeyGenerator(java.lang.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.

getKeyGenerators

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

Returns:
Collection of the current registered key generators.

getKeyGeneratorAliases

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

Returns:
Aliasses of current registered key generators.


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