org.apache.torque.engine.database.model
Class NameFactory

java.lang.Object
  extended by org.apache.torque.engine.database.model.NameFactory

public class NameFactory
extends Object

A name generation factory.

Version:
$Id: NameFactory.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
Author:
Field Summary
private  Hashtable algorithms
          The cache of NameGenerator algorithms in use for name generation, keyed by fully qualified class name.
static String CONSTRAINT_GENERATOR
          The fully qualified class name of the constraint name generator.
private static NameFactory instance
          The single instance of this class.
static String JAVA_GENERATOR
          The fully qualified class name of the Java name generator.
 
Constructor Summary
protected NameFactory()
          Creates a new instance with storage for algorithm implementations.
 
Method Summary
static String generateName(String algorithmName, List inputs)
          Given a list of String objects, implements an algorithm which produces a name.
protected  NameGenerator getAlgorithm(String name)
          Factory method which retrieves an instance of the named generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVA_GENERATOR

public static final String JAVA_GENERATOR
The fully qualified class name of the Java name generator.


CONSTRAINT_GENERATOR

public static final String CONSTRAINT_GENERATOR
The fully qualified class name of the constraint name generator.


instance

private static NameFactory instance
The single instance of this class.


algorithms

private Hashtable algorithms
The cache of NameGenerator algorithms in use for name generation, keyed by fully qualified class name.

Constructor Detail

NameFactory

protected NameFactory()
Creates a new instance with storage for algorithm implementations.

Method Detail

getAlgorithm

protected NameGenerator getAlgorithm(String name)
                              throws EngineException
Factory method which retrieves an instance of the named generator.

Parameters:
name - The fully qualified class name of the name generation algorithm to retrieve.
Returns:
A name generator
Throws:
EngineException

generateName

public static String generateName(String algorithmName,
                                  List inputs)
                           throws EngineException
Given a list of String objects, implements an algorithm which produces a name.

Parameters:
algorithmName - The fully qualified class name of the NameGenerator implementation to use to generate names.
inputs - Inputs used to generate a name.
Returns:
The generated name.
Throws:
EngineException - an exception


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.