Package com.exasol.dbbuilder.dialects
Class AbstractObjectFactory
- java.lang.Object
-
- com.exasol.dbbuilder.dialects.AbstractObjectFactory
-
- All Implemented Interfaces:
DatabaseObjectFactory
- Direct Known Subclasses:
ExasolObjectFactory,MySqlObjectFactory,OracleObjectFactory,PostgreSqlObjectFactory
public abstract class AbstractObjectFactory extends Object implements DatabaseObjectFactory
An abstract base for all ObjectFactories.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractObjectFactory(DatabaseObjectWriter writer)Create a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UsercreateLoginUser(String name)Create user that can log into the database with a default password.UsercreateLoginUser(String name, String password)Create user that can log into the database.UsercreateUser(String name)/** Create a new database user with a default password.voidexecuteSqlFile(Path... sqlFiles)Execute the contents of one or more SQL script files.protected <T extends Schema>
TwriteSchema(T schema)Write the givenSchemato the database.protected <T extends User>
TwriteUser(T user)Write the givenUserto the database.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exasol.dbbuilder.dialects.DatabaseObjectFactory
createSchema, createUser
-
-
-
-
Constructor Detail
-
AbstractObjectFactory
protected AbstractObjectFactory(DatabaseObjectWriter writer)
Create a new instance- Parameters:
writer- a database object writer
-
-
Method Detail
-
executeSqlFile
public void executeSqlFile(Path... sqlFiles)
Description copied from interface:DatabaseObjectFactoryExecute the contents of one or more SQL script files. Each file may contain multiple SQL statements, separated with;.- Specified by:
executeSqlFilein interfaceDatabaseObjectFactory- Parameters:
sqlFiles- paths to the script files
-
createUser
public User createUser(String name)
Description copied from interface:DatabaseObjectFactory/** Create a new database user with a default password.This method creates a user with a password derived from the user name. Note that this is only acceptable in the scope of testing for which the TDBJ is made. Never use something like this in production code!
- Specified by:
createUserin interfaceDatabaseObjectFactory- Parameters:
name- user name- Returns:
- new
Userinstance
-
createLoginUser
public User createLoginUser(String name)
Description copied from interface:DatabaseObjectFactoryCreate user that can log into the database with a default password.This method creates a user with a password derived from the user name. Note that this is only acceptable in the scope of testing for which the TDBJ is made. Never use something like this in production code!
- Specified by:
createLoginUserin interfaceDatabaseObjectFactory- Parameters:
name- user name- Returns:
- new
Userinstance
-
createLoginUser
public User createLoginUser(String name, String password)
Description copied from interface:DatabaseObjectFactoryCreate user that can log into the database.- Specified by:
createLoginUserin interfaceDatabaseObjectFactory- Parameters:
name- user namepassword- login password- Returns:
- new
Userinstance
-
writeUser
protected <T extends User> T writeUser(T user)
Write the givenUserto the database. The method returns the user to allow creating, writing and returning in a single line.- Type Parameters:
T- the concrete user type- Parameters:
user- the user to write- Returns:
- the user
-
writeSchema
protected <T extends Schema> T writeSchema(T schema)
Write the givenSchemato the database. The method returns the schema to allow creating, writing and returning in a single line.- Type Parameters:
T- the concrete schema type- Parameters:
schema- the schema to write- Returns:
- the schema
-
-