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

java.lang.Object
  extended byorg.apache.torque.engine.database.model.NameFactory

public class NameFactory
extends java.lang.Object

A name generation factory.

Version:
$Id: NameFactory.java,v 1.5 2003/08/04 05:30:29 mpoeschl Exp $
Author:
Field Summary
private  java.util.Hashtable algorithms
          The cache of NameGenerator algorithms in use for name generation, keyed by fully qualified class name.
static java.lang.String CONSTRAINT_GENERATOR
          The fully qualified class name of the constraint name generator.
private static NameFactory instance
          The single instance of this class.
static java.lang.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 java.lang.String generateName(java.lang.String algorithmName, java.util.List inputs)
          Given a list of String objects, implements an algorithm which produces a name.
protected  NameGenerator getAlgorithm(java.lang.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 java.lang.String JAVA_GENERATOR
The fully qualified class name of the Java name generator.


CONSTRAINT_GENERATOR

public static final java.lang.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 java.util.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(java.lang.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 java.lang.String generateName(java.lang.String algorithmName,
                                            java.util.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 © 2000-2003 Apache Software Foundation. All Rights Reserved.