Class PlatformFactory
java.lang.Object
edu.internet2.middleware.grouper.ext.org.apache.ddlutils.PlatformFactory
A factory of
org.apache.ddlutils.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PlatformcreateNewPlatformInstance(String databaseName) Creates a new platform for the given (case insensitive) database name or returns null if the database is not recognized.static PlatformcreateNewPlatformInstance(String jdbcDriver, String jdbcConnectionUrl) Creates a new platform for the specified database.static PlatformcreateNewPlatformInstance(DataSource dataSource) Creates a new platform for the specified database.static PlatformcreateNewPlatformInstance(DataSource dataSource, String username, String password) Creates a new platform for the specified database.static String[]Returns a list of all supported platforms.static booleanisPlatformSupported(String platformName) Determines whether the indicated platform is supported.static voidregisterPlatform(String platformName, Class platformClass) Registers a new platform.
-
Constructor Details
-
PlatformFactory
public PlatformFactory()
-
-
Method Details
-
createNewPlatformInstance
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
nullif 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 usesPlatformUtils.determineDatabaseType(String, String)to determine the parameter forcreateNewPlatformInstance(String). Note that no database connection is established when using this method.- Parameters:
jdbcDriver- The jdbc driverjdbcConnectionUrl- The connection url- Returns:
- The platform or
nullif the database is not supported - Throws:
DdlUtilsException
-
createNewPlatformInstance
Creates a new platform for the specified database. This is a shortcut method that usesPlatformUtils.determineDatabaseType(DataSource)to determine the parameter forcreateNewPlatformInstance(String). Note that this method sets the data source at the returned platform instance (methodPlatform.setDataSource(DataSource)).- Parameters:
dataSource- The data source for the database- Returns:
- The platform or
nullif 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 usesPlatformUtils.determineDatabaseType(DataSource)to determine the parameter forcreateNewPlatformInstance(String). Note that this method sets the data source at the returned platform instance (methodPlatform.setDataSource(DataSource)).- Parameters:
dataSource- The data source for the databaseusername- The user name to use for connecting to the databasepassword- The password to use for connecting to the database- Returns:
- The platform or
nullif the database is not supported - Throws:
DdlUtilsException
-
getSupportedPlatforms
Returns a list of all supported platforms.- Returns:
- The names of the currently registered platforms
-
isPlatformSupported
Determines whether the indicated platform is supported.- Parameters:
platformName- The name of the platform- Returns:
trueif the platform is supported
-
registerPlatform
Registers a new platform.- Parameters:
platformName- The platform nameplatformClass- The platform class which must implement thePlatforminterface
-