Package tigase.db.util

## Class SchemaManager

- java.lang.Object
- - tigase.db.util.SchemaManager

-     public class SchemaManager
      extends java.lang.Object

  Created by andrzej on 02.05.2017.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SchemaManager.DataSourceInfo` |
    `static class` | `SchemaManager.Pair<K,​V>` |
    `static class` | `SchemaManager.RepoInfo` |
    `static class` | `SchemaManager.ResultEntry` |
    `static class` | `SchemaManager.RootCredentials` |
    `static class` | `SchemaManager.RootCredentialsCache` |
    `static class` | `SchemaManager.SchemaInfo` |
    `static interface` | `SchemaManager.SchemaLoaderExecutor` |

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `COMMON_SCHEMA_ID` |
    `static java.lang.String` | `COMMON_SCHEMA_VERSION` |
    `protected static java.lang.Class[]` | `SUPPORTED_CLASSES` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SchemaManager()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.util.List<SchemaManager.ResultEntry>` | `checkUpgradeSupport​(DataSource ds, java.util.List<SchemaManager.SchemaInfo> schemas)` |
    `void` | `destroySchema​(java.util.Properties props)` |
    `java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.ResultEntry>>` | `destroySchemas​(java.util.Collection<SchemaManager.DataSourceInfo> dataSources)` |
    `java.util.List<SchemaManager.ResultEntry>` | `destroySchemas​(DataSource ds)` |
    `void` | `execute​(java.lang.String[] args)` |
    `static java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.SchemaInfo>>` | `getDataSourcesAndSchemas​(java.util.Map<java.lang.String,​java.lang.Object> config)` |
    `static java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.SchemaInfo>>` | `getDefaultDataSourceAndSchemas​(java.lang.String dbUri)` |
    `static java.util.Optional<SchemaManager.SchemaInfo>` | `getDefaultSchemaFor​(java.lang.String dbUri, java.lang.String schemaId, java.util.Set<java.lang.String> components)` |
    `static java.util.Optional<java.lang.String>` | `getProperty​(java.util.Properties props, CommandlineParameter parameter)` |
    `static <T> java.util.Optional<T>` | `getProperty​(java.util.Properties props, CommandlineParameter parameter, java.util.function.Function<java.lang.String,​T> converter)` |
    `static java.util.List<java.lang.Class<?>>` | `getRepositoryClasses()` |
    `void` | `installSchema​(java.util.Properties props)` |
    `java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.ResultEntry>>` | `loadSchemas()` |
    `java.util.List<SchemaManager.ResultEntry>` | `loadSchemas​(DataSource ds, java.util.List<SchemaManager.SchemaInfo> schemas)` |
    `static void` | `main​(java.lang.String[] args)` |
    `void` | `readConfig​(java.io.File file)` |
    `void` | `readConfig​(java.io.Reader reader)` |
    `void` | `readConfig​(java.lang.String configString)` |
    `void` | `setAdmins​(java.util.List<BareJID> admins, java.lang.String adminPass)` |
    `void` | `setConfig​(java.util.Map<java.lang.String,​java.lang.Object> config)` |
    `void` | `setDbRootCredentials​(java.lang.String user, java.lang.String pass)` |
    `void` | `upgradeSchema​(java.util.Properties props)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SUPPORTED_CLASSES

          protected static final java.lang.Class[] SUPPORTED_CLASSES

    - #### COMMON_SCHEMA_ID

          public static final java.lang.String COMMON_SCHEMA_ID

      See Also:
        Constant Field Values

    - #### COMMON_SCHEMA_VERSION

          public static final java.lang.String COMMON_SCHEMA_VERSION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SchemaManager

          public SchemaManager()

  - ### Method Detail

    - #### getProperty

          public static java.util.Optional<java.lang.String> getProperty​(java.util.Properties props,
                                                                         CommandlineParameter parameter)

    - #### getProperty

          public static <T> java.util.Optional<T> getProperty​(java.util.Properties props,
                                                              CommandlineParameter parameter,
                                                              java.util.function.Function<java.lang.String,​T> converter)

    - #### getRepositoryClasses

          public static java.util.List<java.lang.Class<?>> getRepositoryClasses()

    - #### main

          public static void main​(java.lang.String[] args)
                           throws java.io.IOException,
                                  ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### execute

          public void execute​(java.lang.String[] args)
                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### destroySchema

          public void destroySchema​(java.util.Properties props)
                             throws java.io.IOException,
                                    ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### installSchema

          public void installSchema​(java.util.Properties props)
                             throws java.io.IOException,
                                    ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### upgradeSchema

          public void upgradeSchema​(java.util.Properties props)
                             throws java.io.IOException,
                                    ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### readConfig

          public void readConfig​(java.io.File file)
                          throws java.io.IOException,
                                 ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### readConfig

          public void readConfig​(java.lang.String configString)
                          throws java.io.IOException,
                                 ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### readConfig

          public void readConfig​(java.io.Reader reader)
                          throws java.io.IOException,
                                 ConfigReader.ConfigException

      Throws:
        `java.io.IOException`
        `ConfigReader.ConfigException`

    - #### setAdmins

          public void setAdmins​(java.util.List<BareJID> admins,
                                java.lang.String adminPass)

    - #### setConfig

          public void setConfig​(java.util.Map<java.lang.String,​java.lang.Object> config)

    - #### setDbRootCredentials

          public void setDbRootCredentials​(java.lang.String user,
                                           java.lang.String pass)

    - #### getDefaultDataSourceAndSchemas

          public static java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.SchemaInfo>> getDefaultDataSourceAndSchemas​(java.lang.String dbUri)

    - #### getDefaultSchemaFor

          public static java.util.Optional<SchemaManager.SchemaInfo> getDefaultSchemaFor​(java.lang.String dbUri,
                                                                                         java.lang.String schemaId,
                                                                                         java.util.Set<java.lang.String> components)

    - #### getDataSourcesAndSchemas

          public static java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.SchemaInfo>> getDataSourcesAndSchemas​(java.util.Map<java.lang.String,​java.lang.Object> config)

    - #### destroySchemas

          public java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.ResultEntry>> destroySchemas​(java.util.Collection<SchemaManager.DataSourceInfo> dataSources)

    - #### destroySchemas

          public java.util.List<SchemaManager.ResultEntry> destroySchemas​(DataSource ds)

    - #### loadSchemas

          public java.util.Map<SchemaManager.DataSourceInfo,​java.util.List<SchemaManager.ResultEntry>> loadSchemas()

    - #### checkUpgradeSupport

          public java.util.List<SchemaManager.ResultEntry> checkUpgradeSupport​(DataSource ds,
                                                                               java.util.List<SchemaManager.SchemaInfo> schemas)

    - #### loadSchemas

          public java.util.List<SchemaManager.ResultEntry> loadSchemas​(DataSource ds,
                                                                       java.util.List<SchemaManager.SchemaInfo> schemas)