javawebparts.misc.chain
Class ChainManager

java.lang.Object
  |
  +--javawebparts.misc.chain.ChainManager

public class ChainManager
extends java.lang.Object

This class is the top of the hierarchy, and all client application interaction with the Chain implementation should occur through this class.

Author:
Frank W. Zammetti.

Field Summary
static int CATALOG_ID
          When this class is asked to execute a chain, it will be passed a string in the form CatalogID/ChainID.
private static java.util.Map catalogs
          The collection of Catalogs.
static int CHAIN_ID
          When this class is asked to execute a chain, it will be passed a string in the form CatalogID/ChainID.
private static boolean configured
          Flag to determine if initialization has taken place.
static java.lang.String DEFAULT_FILE_NAME
          The default name of the configuration file.
private static org.apache.commons.logging.Log log
          Log instance.
 
Constructor Summary
ChainManager()
          Constructor.
ChainManager(java.lang.String inConfigFilename)
          Constructor.
 
Method Summary
 void addCatalog(Catalog inCatalog)
          Adds a Catalog to the collection of Catalogs.
 ChainContext createContext()
          Returns a new ChainContext instance.
 void executeChain(java.lang.String catalogChainID, ChainContext chainContext)
          Executes a named Chain from a named Catalog.
static Catalog findCatalog(java.lang.String catalogID)
          Looks up and returns a named Catalog.
static java.lang.String getCatalogOrChainID(java.lang.String catalogChainID, int which)
          Returns either the Catalog ID or Chain ID from a string in the form "xxxx/yyyy", where xxxx is the Catalog ID and yyyy is the Chain ID.
 java.lang.String toString()
          Overridden toString method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FILE_NAME

public static final java.lang.String DEFAULT_FILE_NAME
The default name of the configuration file.

See Also:
Constant Field Values

CATALOG_ID

public static final int CATALOG_ID
When this class is asked to execute a chain, it will be passed a string in the form CatalogID/ChainID. The getCatalogOrChainID() takes a string in this form and returns either the Catalog ID or Chain ID, depending on the flag passed in. This field is the value of the flag that specified the caller wants the Catalog ID.

See Also:
Constant Field Values

CHAIN_ID

public static final int CHAIN_ID
When this class is asked to execute a chain, it will be passed a string in the form CatalogID/ChainID. The getCatalogOrChainID() takes a string in this form and returns either the Catalog ID or Chain ID, depending on the flag passed in. This field is the value of the flag that specified the caller wants the Chain ID.

See Also:
Constant Field Values

log

private static org.apache.commons.logging.Log log
Log instance.


catalogs

private static java.util.Map catalogs
The collection of Catalogs.


configured

private static boolean configured
Flag to determine if initialization has taken place.

Constructor Detail

ChainManager

public ChainManager()
Constructor. Call ChainManager(null), where null is the configuration file name (meaning either use the default name, or an overriding environment variable, if present).


ChainManager

public ChainManager(java.lang.String inConfigFilename)
Constructor. This constructor accepts a configuration file name. The way it works is this: If a non-null filename is passed in, use that. If null is passed in, look for the environment variable and use it if present. If null is passed in and the environment variable is not found, use the default name.

Parameters:
inConfigFilename - Name (and path technically) to the config file.
Method Detail

addCatalog

public void addCatalog(Catalog inCatalog)
Adds a Catalog to the collection of Catalogs.

Parameters:
inCatalog - The Catalog instance to add.

findCatalog

public static Catalog findCatalog(java.lang.String catalogID)
Looks up and returns a named Catalog.

Parameters:
catalogID - The ID of the Catalog to find.
Returns:
The Catalog instance, or null if not found.

createContext

public ChainContext createContext()
Returns a new ChainContext instance.

Returns:
A new ChainContext instance.

executeChain

public void executeChain(java.lang.String catalogChainID,
                         ChainContext chainContext)
Executes a named Chain from a named Catalog.

Parameters:
catalogChainID - The ID of the Catalog/Chain to execute.
chainContext - The ChainContext instance this execution will use.

getCatalogOrChainID

public static java.lang.String getCatalogOrChainID(java.lang.String catalogChainID,
                                                   int which)
Returns either the Catalog ID or Chain ID from a string in the form "xxxx/yyyy", where xxxx is the Catalog ID and yyyy is the Chain ID. Which part is returned is specified by the inWhich flag.

Parameters:
catalogChainID - The Catalog/Chain ID to break up.
which - Which part to return Catalog ID or Chain ID.
Returns:
The Catalog ID or Chain ID, according to which.

toString

public java.lang.String toString()
Overridden toString method.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this bean.


Copyright © 2005 Frank W. Zammetti