public class DBSchemaLoader extends SchemaLoader<DBSchemaLoader.Parameters>
Properties is accepted: dbType - type of the database, possible values are:
mysql, postgresql, derby, sqlserver; schemaVersion - schema version to be
loaded, , possible values are: 7-2, 7-1, 5-1, 5, 4; dbName - name
of the database to be created/used; dbHostname - hostname of the database; dbUser - username
of the regular user; dbPass - password of the regular user; rootUser - username of the
database administrator user; rootPass - password of the database administrator user; query -
simple, single query to be executed; file - path to the single schema file to be loaded to the database;
adminJID - JID address of the XMPP administrator account; adminJIDpass - password of the XMPP
administrator account.| Modifier and Type | Class and Description |
|---|---|
static interface |
DBSchemaLoader.ExceptionHandler<T extends Exception,R> |
static class |
DBSchemaLoader.Parameters |
static class |
DBSchemaLoader.PARAMETERS_ENUM |
static interface |
DBSchemaLoader.SQLCommand<C,R> |
SchemaLoader.Result, SchemaLoader.TypeInfo| Constructor and Description |
|---|
DBSchemaLoader() |
| Modifier and Type | Method and Description |
|---|---|
SchemaLoader.Result |
addXmppAdminAccount(SchemaManager.SchemaInfo schemaInfo)
Method attempts to add XMPP admin user account to the database using
AuthRepository. |
DBSchemaLoader.Parameters |
createParameters() |
SchemaLoader.Result |
destroyDataSource() |
void |
execute(SchemaLoader.Parameters params)
Executes set of
TigaseDBTask tasks selected based on set on passed properties |
protected SchemaLoader.Result |
executeSingleQuery(String query)
Method checks whether the connection to the database is possible and that database of specified name exists.
|
List<CommandlineParameter> |
getCommandlineParameters() |
Optional<Version> |
getComponentVersionFromDb(String component) |
String |
getDBUri() |
Optional<Version> |
getMinimalRequiredComponentVersionForUpgrade(SchemaManager.SchemaInfo schema) |
Map<Version,Path> |
getSchemaFileNames(String schemaId) |
List<CommandlineParameter> |
getSetupOptions() |
List<SchemaLoader.TypeInfo> |
getSupportedTypes() |
void |
init(DBSchemaLoader.Parameters params,
Optional<SchemaManager.RootCredentialsCache> rootCredentialsCache) |
SchemaLoader.Result |
loadSchema(SchemaManager.SchemaInfo schema,
String version) |
SchemaLoader.Result |
loadSchemaFile(String fileName)
Method checks whether the connection to the database is possible and that database of specified name exists.
|
static void |
main(String[] args)
Main method allowing pass arguments to the class and setting all logging to be printed to console.
|
SchemaLoader.Result |
postInstallation()
Method performs post-installation action using using
*-installer-post.sql schema file substituting it's
variables with ones provided. |
SchemaLoader.Result |
printInfo()
Method performs post-installation action using using
*-installer-post.sql schema file substituting it's
variables with ones provided. |
SchemaLoader.Result |
setComponentVersion(String component,
String version)
Methods attempt to write to database loaded schema version for particular component
|
SchemaLoader.Result |
shutdown() |
SchemaLoader.Result |
shutdownDerby() |
SchemaLoader.Result |
validateDBConnection()
Method validates whether the connection can at least be eI stablished.
|
SchemaLoader.Result |
validateDBExists()
Method, if the connection is validated by
validateDBConnection, checks whether desired database exists. |
addUsersToRepository, addUsersToRepositoryFunction, getAllSupportedTypes, getAllSupportedTypesStream, getConfigString, getDataSourceAwareClassesForSchemaInfo, getInitializedDataSourceAwareForSchemaInfo, getMainCommandlineParameters, getType, init, initializeAuthRepository, initializeDataSourceAwareFunction, instantiateClass, isSupported, loadCommonSchema, newInstance, newInstanceForURIpublic static void main(String[] args)
args - key-value (in the form of "-<variable> value") parameters.public void init(DBSchemaLoader.Parameters params, Optional<SchemaManager.RootCredentialsCache> rootCredentialsCache)
init in class SchemaLoader<DBSchemaLoader.Parameters>public List<SchemaLoader.TypeInfo> getSupportedTypes()
getSupportedTypes in class SchemaLoader<DBSchemaLoader.Parameters>public DBSchemaLoader.Parameters createParameters()
createParameters in class SchemaLoader<DBSchemaLoader.Parameters>public void execute(SchemaLoader.Parameters params)
TigaseDBTask tasks selected based on set on passed propertiesexecute in class SchemaLoader<DBSchemaLoader.Parameters>params - set of configuration parameters.public SchemaLoader.Result validateDBConnection()
SchemaLoadervalidateDBConnection in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result shutdown()
shutdown in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result shutdownDerby()
public SchemaLoader.Result validateDBExists()
SchemaLoadervalidateDBConnection, checks whether desired database exists.
If not it creates such database using *-installer-create-db.sql schema file substituting it's variables
with ones provided.validateDBExists in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result postInstallation()
*-installer-post.sql schema file substituting it's
variables with ones provided.postInstallation in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result printInfo()
*-installer-post.sql schema file substituting it's
variables with ones provided.printInfo in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result addXmppAdminAccount(SchemaManager.SchemaInfo schemaInfo)
SchemaLoaderAuthRepository.addXmppAdminAccount in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result setComponentVersion(String component, String version)
SchemaLoadersetComponentVersion in class SchemaLoader<DBSchemaLoader.Parameters>component - name of the component for which version should be setversion - value which should be associated with the componentSchemaLoader.Result object indicating whether the call was successfulpublic Optional<Version> getComponentVersionFromDb(String component)
getComponentVersionFromDb in class SchemaLoader<DBSchemaLoader.Parameters>public Optional<Version> getMinimalRequiredComponentVersionForUpgrade(SchemaManager.SchemaInfo schema)
getMinimalRequiredComponentVersionForUpgrade in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result loadSchema(SchemaManager.SchemaInfo schema, String version)
loadSchema in class SchemaLoader<DBSchemaLoader.Parameters>public SchemaLoader.Result loadSchemaFile(String fileName)
SchemaLoaderloadSchemaFile in class SchemaLoader<DBSchemaLoader.Parameters>fileName - set of String with path to filepublic SchemaLoader.Result destroyDataSource()
destroyDataSource in class SchemaLoader<DBSchemaLoader.Parameters>public String getDBUri()
getDBUri in class SchemaLoader<DBSchemaLoader.Parameters>public List<CommandlineParameter> getCommandlineParameters()
getCommandlineParameters in class SchemaLoader<DBSchemaLoader.Parameters>public List<CommandlineParameter> getSetupOptions()
getSetupOptions in class SchemaLoader<DBSchemaLoader.Parameters>protected SchemaLoader.Result executeSingleQuery(String query)
query - to executeCopyright © 2004–2019 "Tigase, Inc.". All rights reserved.