Class DatabaseMetaBuilder

java.lang.Object
org.nuiton.db.meta.DatabaseMetaBuilder

public class DatabaseMetaBuilder extends Object
Since:
0.1
Author:
Arnaud Thimel (Code Lutin)
  • Field Details

    • POSSIBLE_VALUES_PATTERN

      public static final Pattern POSSIBLE_VALUES_PATTERN
    • metaCountCache

      protected static com.google.common.cache.Cache<String,Long> metaCountCache
    • worker

      protected final Consumer<SqlWork> worker
    • packageForEnumResolver

      protected final String packageForEnumResolver
  • Constructor Details

    • DatabaseMetaBuilder

      public DatabaseMetaBuilder(Consumer<SqlWork> worker, String packageForEnumResolver)
    • DatabaseMetaBuilder

      public DatabaseMetaBuilder(Connection sqlConnection, String packageForEnumResolver)
    • DatabaseMetaBuilder

      public DatabaseMetaBuilder(Connection sqlConnection)
  • Method Details

    • getMetaCountCache

      protected com.google.common.cache.Cache<String,Long> getMetaCountCache()
    • doWork

      protected void doWork(SqlWork work)
    • getTableNames

      protected com.google.common.collect.ImmutableSet<String> getTableNames(String schema, String type)
    • getColumnNames

      protected com.google.common.collect.ImmutableSet<String> getColumnNames(String schema, String tableName)
    • readTableMetas

      protected com.google.common.collect.ImmutableList<TableMeta> readTableMetas(String type, String schema, Map<ColumnRef, String> comments, Set<ColumnRef> primaryKeys, Set<ColumnRef> uniqueColumns, com.google.common.collect.Multimap<ColumnRef, ColumnRef> foreignKeys, com.google.common.collect.ImmutableList<CustomTypeMeta> customTypes)
    • getForeignKeys

      protected com.google.common.collect.ImmutableSet<String> getForeignKeys(com.google.common.collect.Multimap<ColumnRef, ColumnRef> foreignKeys, ColumnRef columnRef)
    • asCommentKey

      protected ColumnRef asCommentKey(String tableName, String columnName)
    • asProcedureKey

      protected ColumnRef asProcedureKey(String procedureName, String argTypesString)
    • readTableAndViewComments

      protected Map<ColumnRef, String> readTableAndViewComments(String schema)
      Dans la Map renvoyée, la clé est constituée d'une Pair de TABLE_NAME, COLUMN_NAME. Sachant que COLUMN_NAME peut être null s'il s'agit d'un commentaire sur la table.
    • readProcedureComments

      protected Map<ColumnRef, String> readProcedureComments(String schema)
      Dans la Map renvoyée, la clé est constituée d'une Pair de PROCEDURE_NAME, ATTRIBUTE_NAME. Sachant que ATTRIBUTE_NAME peut être null s'il s'agit d'un commentaire sur la procédure.
    • readProcedureMetas

      protected com.google.common.collect.ImmutableList<ProcedureMeta> readProcedureMetas(String schema)
    • readForeignKeys

      protected com.google.common.collect.Multimap<ColumnRef, ColumnRef> readForeignKeys(String schema)
      Dans la Multimap renvoyée, la clé est constituée d'une Pair de TABLE_NAME, COLUMN_NAME. Les valeurs sont également des Pair de TABLE_NAME, COLUMN_NAME représentant la colonne référencée par la FK
    • readPrimaryKeys

      protected com.google.common.collect.ImmutableSet<ColumnRef> readPrimaryKeys(String schema)
      Renvoie un ensemble de Pair de TABLE_NAME, COLUMN_NAME représentant les clés primaires de la base.
    • readUniqueColumns

      protected com.google.common.collect.ImmutableSet<ColumnRef> readUniqueColumns(String schema)
      Renvoie un ensemble de Pair de TABLE_NAME, COLUMN_NAME représentant les colonnes avec une contrainte d'unicité.
    • readTableMetas

      protected com.google.common.collect.ImmutableList<TableMeta> readTableMetas(String schema, com.google.common.collect.ImmutableList<CustomTypeMeta> customTypes)
    • readViewMetas

      protected com.google.common.collect.ImmutableList<TableMeta> readViewMetas(String schema, com.google.common.collect.ImmutableList<CustomTypeMeta> customTypes)
    • readCustomTypesComments

      protected Map<String,String> readCustomTypesComments(String schema)
    • readCustomTypes

      protected com.google.common.collect.ImmutableList<CustomTypeMeta> readCustomTypes(String schema, Function<String, Class<? extends Enum>> enumResolver)
    • packageEnumResolver

      protected Function<String, Class<? extends Enum>> packageEnumResolver()
    • buildMeta

      public DatabaseMeta buildMeta(String schema)