org.edg.data.util
Class SQLCatalog

java.lang.Object
  |
  +--org.edg.data.util.SQLCatalog

public final class SQLCatalog
extends java.lang.Object

A Catalog for SQL Statements

Version:
$Id: SQLCatalog.java,v 1.13 2003/10/21 13:12:48 jamesc Exp $
Author:
James Casey, Sophie Lemaitre

Constructor Summary
SQLCatalog(java.lang.String name, java.lang.String vendor)
          Create a new catalog.
 
Method Summary
 boolean contains(java.lang.String name)
          Does this Catalog contain a given entry ?
 java.lang.String getParameterizedSQL(java.lang.String name, java.util.Map valueMap)
          return the SQL statement that has been created with the parameters.
 java.lang.String getSQL(java.lang.String name)
          return the SQL statement from the catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLCatalog

public SQLCatalog(java.lang.String name,
                  java.lang.String vendor)
           throws InvalidCatalogException
Create a new catalog. This has a base set of SQL Statements, and a vendor specific set, which takes precedence and overrides the base set.

Parameters:
name - the name of the catalog
vendor - the vendor flavour to use
Method Detail

getSQL

public java.lang.String getSQL(java.lang.String name)
                        throws InvalidCatalogEntryException
return the SQL statement from the catalog.

Parameters:
name - the name of the statement to use
Returns:
the statement.
Throws:
InvalidCatalogEntryException - if the entry is not found in the catalog

getParameterizedSQL

public java.lang.String getParameterizedSQL(java.lang.String name,
                                            java.util.Map valueMap)
                                     throws InvalidCatalogEntryException
return the SQL statement that has been created with the parameters.

Parameters:
name - the name of the statement to use
valueMap - the names that have to be replaced, and the values that have to be put instead
Returns:
the final statement
Throws:
InvalidCatalogEntryException - if the entry is not found in the catalog or name is null

contains

public boolean contains(java.lang.String name)
Does this Catalog contain a given entry ?

Parameters:
name - the name of the catalog entry
Returns:
true if there is an entry there