Class LegacySchemaImporter

java.lang.Object
com.illumon.iris.db.schema.LegacySchemaImporter

public class LegacySchemaImporter extends Object
One-time (?) bridge to import schema stored on disk into the schema service.
  • Constructor Details

    • LegacySchemaImporter

      public LegacySchemaImporter()
  • Method Details

    • preValidateSchema

      public static org.jdom2.Element preValidateSchema(String namespace, String tableName, org.jdom2.Element element) throws SchemaValidationException
      Validate that the schema file is properly formatted and contains the correct internal Table element. This does _not_ validate the schema itself; that is handled by the Schema implementations. This verifies that:
      Parameters:
      namespace - The namespace defined by the file name
      tableName - The table name defined by the file name
      element - The root element of the file to validate
      Returns:
      The validated root element.
      Throws:
      SchemaValidationException - If the root element was incorrect or missing.
    • doMigration

      public static void doMigration(@NotNull com.fishlib.io.logger.Logger log, @NotNull SchemaService schemaService, @NotNull org.apache.commons.cli.CommandLine commandLine)
    • gatherSchemaFiles

      public static Map<String,Map<String,SchemaXml>> gatherSchemaFiles(@NotNull com.fishlib.io.logger.Logger log, @NotNull com.fishlib.configuration.Configuration configuration, @NotNull List<String> errorMessages, @NotNull Collection<String> includeNamespaces, @NotNull Collection<String> excludeNamespaces, boolean allowErrors, @Nullable String[] schemaFileNames, @Nullable SchemaService schemaService, @Nullable String directory, @Nullable List<NamespaceSet> namespaceSets, boolean migrateOption, boolean verbose, boolean lenientValidation, boolean compileListeners)
      Search the (legacy) schema resource locations for schema files. If locations are specified, only those locations will be used. Otherwise, migration mode must be enabled and the legacy locations are searched for schema files.
      Parameters:
      log - for logging warnings
      configuration - the configuration to use
      errorMessages - any errors found while parsing schema files
      includeNamespaces - if non-empty, only these namespaces will be processed and all will be included (even if empty)
      excludeNamespaces - namespaces in this list will not be processed
      allowErrors - if false, any error parsing a schema file will be fatal. If true, valid schemas will be processed even if some schemas have errors
      schemaFileNames - an optional array of schema file names to be imported (this takes priority over legacy schema resolution)
      schemaService - an optional schema service that can be used to see if copy table sources already exist
      directory - an optional directory in which to find schema files (this takes priority over schemaFileNames and legacy resource resolution)
      namespaceSets - if specified, the namespace sets to add
      migrateOption - if true, schemas will be gathered from legacy resource locations if no directory or files are specified
      verbose - if true, log full exception text
      lenientValidation - if true, ClassNotFoundExceptions will be ignored when validating
      compileListeners - if true, try to compile listeners
      Returns:
      a map of namespace to table to schema
    • maybeCompileLoggersListeners

      public static void maybeCompileLoggersListeners(boolean compileListeners, SchemaXml newSchema) throws IOException, ClassNotFoundException
      Maybe try to compile the loggers and listeners for the new schema. This is public so it can be used as a validation step.
      Parameters:
      compileListeners - don't compile loggers or listeners if false
      newSchema - the schema source for loggers and listeners
      Throws:
      IOException - passed along from the generate methods
      ClassNotFoundException - passed along from the generate methods
    • main

      public static void main(String... commandLineArguments)