Class KeyGeneratorRegistry

java.lang.Object
org.castor.ddlgen.KeyGeneratorRegistry

public final class KeyGeneratorRegistry extends 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 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.
    • 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.
    • getKeyGeneratorFactories

      public Collection<KeyGeneratorFactory> getKeyGeneratorFactories()
      Returns a collection of the current configured key generator factories.
      Returns:
      Collection of the current configured key generator factories.
    • getKeyGeneratorFactoryAlgorithms

      public Collection<String> 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(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 Collection<KeyGenerator> getKeyGenerators()
      Returns a collection of the current registered key generators.
      Returns:
      Collection of the current registered key generators.
    • getKeyGeneratorAliases

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