Class SchemaLoader<P extends SchemaLoader.Parameters>

    • Field Detail

      • log

        protected static final java.util.logging.Logger log
    • Constructor Detail

      • SchemaLoader

        public SchemaLoader()
    • Method Detail

      • getMainCommandlineParameters

        public static java.util.List<CommandlineParameter> getMainCommandlineParameters​(boolean forceNotRequired)
      • getAllSupportedTypesStream

        public static<SchemaLoader.TypeInfo> getAllSupportedTypesStream()
      • main

        public static void main​(java.lang.String[] args)
        Main method allowing pass arguments to the class and setting all logging to be printed to console.
        args - key-value (in the form of "-<variable> value") parameters.
      • newInstance

        public static SchemaLoader newInstance​(java.lang.String type)
      • newInstanceForURI

        public static SchemaLoader newInstanceForURI​(java.lang.String uri)
      • createParameters

        public abstract P createParameters()
      • init

        public void init​(P props)
      • isSupported

        public boolean isSupported​(java.lang.String dbType)
      • getDBUri

        public abstract java.lang.String getDBUri()
      • getCommandlineParameters

        public abstract java.util.List<CommandlineParameter> getCommandlineParameters()
      • validateDBConnection

        public abstract SchemaLoader.Result validateDBConnection()
        Method validates whether the connection can at least be eI stablished. If yes then appropriate flag is set.
      • validateDBExists

        public abstract SchemaLoader.Result validateDBExists()
        Method, if the connection is validated by validateDBConnection, 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.
      • getConfigString

        protected java.lang.String getConfigString()
      • setComponentVersion

        public abstract SchemaLoader.Result setComponentVersion​(java.lang.String component,
                                                                java.lang.String version)
        Methods attempt to write to database loaded schema version for particular component
        component - name of the component for which version should be set
        version - value which should be associated with the component
        a SchemaLoader.Result object indicating whether the call was successful
      • getComponentVersionFromDb

        public abstract java.util.Optional<Version> getComponentVersionFromDb​(java.lang.String component)
      • loadSchemaFile

        public abstract SchemaLoader.Result loadSchemaFile​(java.lang.String fileName)
        Method checks whether the connection to the database is possible and that database of specified name exists. If yes then a schema file from properties is loaded.
        fileName - set of String with path to file
      • getMinimalRequiredComponentVersionForUpgrade

        public abstract java.util.Optional<Version> getMinimalRequiredComponentVersionForUpgrade​(SchemaManager.SchemaInfo schema)
      • getDataSourceAwareClassesForSchemaInfo

        protected <DS extends DataSource><java.lang.Class<DataSourceAware<DS>>> getDataSourceAwareClassesForSchemaInfo​(SchemaManager.SchemaInfo schema,
                                                                                                                                               java.lang.Class<DS> dataSourceIfc)
      • getInitializedDataSourceAwareForSchemaInfo

        protected <DSIFC extends DataSource,​DS extends DSIFC><DataSourceAware> getInitializedDataSourceAwareForSchemaInfo​(SchemaManager.SchemaInfo schema,
                                                                                                                                                        java.lang.Class<DSIFC> dataSourceIfc,
                                                                                                                                                        DS dataSource,
                                                                                                                                                        java.util.logging.Logger log)
      • initializeDataSourceAwareFunction

        protected <T extends DataSource> java.util.function.Function<DataSourceAware<T>,​DataSourceAware<T>> initializeDataSourceAwareFunction​(T dataSource,
                                                                                                                                                    java.util.logging.Logger log)
      • addUsersToRepositoryFunction

        protected java.util.function.Function<AuthRepository,​SchemaLoader.Result> addUsersToRepositoryFunction​(java.util.List<BareJID> jids,
                                                                                                                     java.lang.String pwd,
                                                                                                                     java.util.logging.Logger log)
      • instantiateClass

        protected <T> T instantiateClass​(java.lang.Class<T> clazz)
      • getType

        protected java.lang.String getType()