org.apache.ddlutils
Class PlatformFactory

java.lang.Object
  extended by org.apache.ddlutils.PlatformFactory

public class PlatformFactory
extends Object

A factory of Platform instances based on a case insensitive database name. Note that this is a convenience class as the platforms can also simply be created via their constructors.

Version:
$Revision: 209952 $

Constructor Summary
PlatformFactory()
           
 
Method Summary
static Platform createNewPlatformInstance(DataSource dataSource)
          Creates a new platform for the specified database.
static Platform createNewPlatformInstance(DataSource dataSource, String username, String password)
          Creates a new platform for the specified database.
static Platform createNewPlatformInstance(String databaseName)
          Creates a new platform for the given (case insensitive) database name or returns null if the database is not recognized.
static Platform createNewPlatformInstance(String jdbcDriver, String jdbcConnectionUrl)
          Creates a new platform for the specified database.
static String[] getSupportedPlatforms()
          Returns a list of all supported platforms.
static boolean isPlatformSupported(String platformName)
          Determines whether the indicated platform is supported.
static void registerPlatform(String platformName, Class platformClass)
          Registers a new platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformFactory

public PlatformFactory()
Method Detail

createNewPlatformInstance

public static Platform createNewPlatformInstance(String databaseName)
                                          throws DdlUtilsException
Creates a new platform for the given (case insensitive) database name or returns null if the database is not recognized.

Parameters:
databaseName - The name of the database (case is not important)
Returns:
The platform or null if the database is not supported
Throws:
DdlUtilsException

createNewPlatformInstance

public static Platform createNewPlatformInstance(String jdbcDriver,
                                                 String jdbcConnectionUrl)
                                          throws DdlUtilsException
Creates a new platform for the specified database. This is a shortcut method that uses PlatformUtils.determineDatabaseType(String, String) to determine the parameter for createNewPlatformInstance(String). Note that no database connection is established when using this method.

Parameters:
jdbcDriver - The jdbc driver
jdbcConnectionUrl - The connection url
Returns:
The platform or null if the database is not supported
Throws:
DdlUtilsException

createNewPlatformInstance

public static Platform createNewPlatformInstance(DataSource dataSource)
                                          throws DdlUtilsException
Creates a new platform for the specified database. This is a shortcut method that uses PlatformUtils.determineDatabaseType(DataSource) to determine the parameter for createNewPlatformInstance(String). Note that this method sets the data source at the returned platform instance (method Platform.setDataSource(DataSource)).

Parameters:
dataSource - The data source for the database
Returns:
The platform or null if the database is not supported
Throws:
DdlUtilsException

createNewPlatformInstance

public static Platform createNewPlatformInstance(DataSource dataSource,
                                                 String username,
                                                 String password)
                                          throws DdlUtilsException
Creates a new platform for the specified database. This is a shortcut method that uses PlatformUtils.determineDatabaseType(DataSource) to determine the parameter for createNewPlatformInstance(String). Note that this method sets the data source at the returned platform instance (method Platform.setDataSource(DataSource)).

Parameters:
dataSource - The data source for the database
username - The user name to use for connecting to the database
password - The password to use for connecting to the database
Returns:
The platform or null if the database is not supported
Throws:
DdlUtilsException

getSupportedPlatforms

public static String[] getSupportedPlatforms()
Returns a list of all supported platforms.

Returns:
The names of the currently registered platforms

isPlatformSupported

public static boolean isPlatformSupported(String platformName)
Determines whether the indicated platform is supported.

Parameters:
platformName - The name of the platform
Returns:
true if the platform is supported

registerPlatform

public static void registerPlatform(String platformName,
                                    Class platformClass)
Registers a new platform.

Parameters:
platformName - The platform name
platformClass - The platform class which must implement the Platform interface


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.