org.eclipse.datatools.sqltools.parsers.sql.query
Class SQLQueryParserManagerProvider

java.lang.Object
  extended by org.eclipse.datatools.sqltools.parsers.sql.query.SQLQueryParserManagerProvider

public class SQLQueryParserManagerProvider
extends java.lang.Object

Singleton SQLQueryParserManagerProvider holds a registry of SQLQueryParserManager extensions and creates instances of SQLQueryParserManagers, that are registered for a specific database product and version. As plugin in an eclipse runtime environment, the registration of SQLQueryParserManager extensions is done at start time of the SQL Query parser plugin. The registry is implemented following the lazy loading startegy and the plugin extending the SQL Query parser plugin is only loaded the first time the parser for the specific SQL dialect is needed.

Author:
ckadner
See Also:
getParserManager(String, String), #registerParserManager(String, String, String)

Method Summary
 void clearParserManagerRegistry()
          Clears the registry of SQLQueryParserManager extensions.
static SQLQueryParserManagerProvider getInstance()
          Returns the singleton SQLQueryParserManagerProvider instance.
 SQLQueryParserManager getParserManager(java.lang.String dbProduct, java.lang.String dbVersion)
          Returns the best compliant SQLQueryParserManager supporting the SQL dialect of the database described by the given database product information.
 void registerParserManager(java.lang.String parserManagerClassName, java.lang.String dbProduct, java.lang.String fromDbVersion, java.lang.String toDbVersion)
          Registers the SQLQueryParserManager Class name of the SQL Query parser plugin extension.
 void unregisterParserManager(java.lang.String parserManagerClassName)
          Unregisters the SQLQueryParserManager Class name of the SQL Query parser plugin extension, for example if the extending plugin was stoped Plugin.stop(org.osgi.framework.BundleContext).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SQLQueryParserManagerProvider getInstance()
Returns the singleton SQLQueryParserManagerProvider instance.

Returns:
SQLQueryParserManagerProvider

getParserManager

public SQLQueryParserManager getParserManager(java.lang.String dbProduct,
                                              java.lang.String dbVersion)
Returns the best compliant SQLQueryParserManager supporting the SQL dialect of the database described by the given database product information.

Parameters:
dbProduct - the database vendor and product name, e.g. "DB2 UDB"
dbVersion - the database version and release, e.g. "V8.1"
Returns:
SQLQueryParserManager supporting the SQL dialect of the specified database

clearParserManagerRegistry

public void clearParserManagerRegistry()
Clears the registry of SQLQueryParserManager extensions.


registerParserManager

public void registerParserManager(java.lang.String parserManagerClassName,
                                  java.lang.String dbProduct,
                                  java.lang.String fromDbVersion,
                                  java.lang.String toDbVersion)
Registers the SQLQueryParserManager Class name of the SQL Query parser plugin extension. For the purpose of lazy loading we only register the Class name of the SQLQueryParserManager extension and instanciate the Class only at actual execution of a SQL query for the specific db vendor dialect.

Parameters:
parserManagerClassName - the fully qualified name of the SQLQueryParserManager extension to be registered
dbProduct - the database vendor and product name, e.g. "DB2 UDB"
fromDbVersion - the earliest database version and release, e.g. "V6.1" that is supported by the ParserManager
toDbVersion - the latest database version and release, e.g. "V8.1" that is supported by the ParserManager

unregisterParserManager

public void unregisterParserManager(java.lang.String parserManagerClassName)
Unregisters the SQLQueryParserManager Class name of the SQL Query parser plugin extension, for example if the extending plugin was stoped Plugin.stop(org.osgi.framework.BundleContext).

Parameters:
parserManagerClassName - the fully qualified name of the SQLQueryParserManager extension to be registered
dbProduct - the database vendor and product name, e.g. "DB2 UDB"
dbVersion - the database version and release, e.g. "V8.1"