Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -52,7 +52,7 @@ public class Column extends ChildEntity<Table> { /** /** * Original datatype (computed from information_schema data), used for * Original datatype (computed from information_schema data), used for * consistency checking inside the method * consistency checking inside the method * {@link #it.inaf.ia2.tsm.datalayer.DBBroker.getAllColumnsMetadata()} * {@link it.inaf.ia2.tsm.datalayer.DBBroker#getAllColumnsMetadata} * * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.ConsistencyChecks */ */ Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/ColumnHolder.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,10 @@ import java.io.Serializable; import java.util.Objects; import java.util.Objects; /** /** * Models a column during the consistency checking phase (it is used to display * Models the reference to a column in the database during the consistency * information about columns not already loaded/added into the TAP_SCHEMA). * checking phase (it is used to display information about columns not already * loaded/added into the TAP_SCHEMA or to represent a column which doesn't exist * yet). * * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.ConsistencyChecks * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Key.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class Key extends TapSchemaEntity implements Serializable { /** /** * Sets the identifier for this key. * Sets the identifier for this key. * * * @see {@code getId()} * @see #getId */ */ public void setId(String id) { public void setId(String id) { setValue(ID_KEY, id); setValue(ID_KEY, id); Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/WrongDataType.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,9 @@ import java.io.Serializable; /** /** * Models an inconsistency in a column definition detected in an existing * Models an inconsistency in a column definition detected in an existing * column. This happens when the column datatype read from the database metadata * column. This happens when the column datatype read from the database metadata * is different from what is expected according the {@link ColumnModel} defining * is different from what is expected according the * that column. To fix this issue an {@code ALTER TABLE} is necessary. * {@link it.inaf.ia2.tsm.model.ColumnModel} defining that column. To fix this * issue an {@code ALTER TABLE} is necessary. * * * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} */ */ Loading Loading @@ -77,8 +78,8 @@ public class WrongDataType implements Serializable { } } /** /** * Returns the expected datatype, according to the {@link ColumnModel} * Returns the expected datatype, according to the * associated to this column. * {@link it.inaf.ia2.tsm.model.ColumnModel} associated to this column. */ */ public String getCorrectDataType() { public String getCorrectDataType() { return correctDataType; return correctDataType; Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DBBroker.java +137 −5 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,9 @@ public interface DBBroker { /** /** * Returns the name of all schemata which structure is compatible with a * Returns the name of all schemata which structure is compatible with a * TAP_SCHEMA schema structure. * TAP_SCHEMA schema structure. * * @param allSchemas a list of all schemata names to use for searching; * names must be real schemata names (not renamed). */ */ List<String> getAllTAPSchemaNames(List<String> allSchemas) throws SQLException; List<String> getAllTAPSchemaNames(List<String> allSchemas) throws SQLException; Loading @@ -65,6 +68,7 @@ public interface DBBroker { * structure (e.<!-- -->g.<!-- --> the presence of the set of columns * structure (e.<!-- -->g.<!-- --> the presence of the set of columns * defined into the related XML model). * defined into the related XML model). * * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @return the name of the guessed TAP_SCHEMA version. * @return the name of the guessed TAP_SCHEMA version. */ */ String detectVersion(String tapSchemaName) throws SQLException; String detectVersion(String tapSchemaName) throws SQLException; Loading @@ -72,11 +76,15 @@ public interface DBBroker { /** /** * Returns a list of all the schemata exposed by an existing TAP_SCHEMA. * Returns a list of all the schemata exposed by an existing TAP_SCHEMA. * Queries the {@code TAP_SCHEMA.schemas} schema. * Queries the {@code TAP_SCHEMA.schemas} schema. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). */ */ List<String> getExposedSchemas(String tapSchemaName) throws SQLException; List<String> getExposedSchemas(String tapSchemaName) throws SQLException; /** /** * Returns all the tables owned by a schema, given its name. * Returns all the tables owned by a schema, given its name. * * @param schemaName the real schema name (not the renamed one). */ */ List<String> getAllTablesNames(String schemaName) throws SQLException; List<String> getAllTablesNames(String schemaName) throws SQLException; Loading @@ -84,6 +92,7 @@ public interface DBBroker { * Returns the table type ("table" or "view") for all the tables owned by a * Returns the table type ("table" or "view") for all the tables owned by a * schema, given its name. * schema, given its name. * * * @param schemaName the real schema name (not the renamed one). * @return a {@code Map} having table names as keys and table types as * @return a {@code Map} having table names as keys and table types as * values. * values. */ */ Loading @@ -91,13 +100,16 @@ public interface DBBroker { /** /** * Returns the list of the names of the columns contained in a given table. * Returns the list of the names of the columns contained in a given table. * * @param schemaName the real schema name (not the renamed one). * @param tableName the name of the table. */ */ List<String> getAllColumnsNames(String schemaName, String tableName) throws SQLException; List<String> getAllColumnsNames(String schemaName, String tableName) throws SQLException; /** /** * Returns the metadata of all the columns contained in a given table. * Returns the metadata of all the columns contained in a given table. * * * @param schemaName the name of the schema. * @param schemaName the real schema name (not the renamed one). * @param tableSimpleName the name of the table. * @param tableSimpleName the name of the table. * @param tableModel the {@link TableModel} of the owner column if it is a * @param tableModel the {@link TableModel} of the owner column if it is a * TAP_SCHEMA table or the ObsCore table, null otherwise. This is used for * TAP_SCHEMA table or the ObsCore table, null otherwise. This is used for Loading @@ -110,37 +122,157 @@ public interface DBBroker { */ */ Map<String, Map<String, Object>> getAllColumnsMetadata(String schemaName, String tableSimpleName, TableModel tableModel, DataTypeMode dataTypeMode) throws SQLException; Map<String, Map<String, Object>> getAllColumnsMetadata(String schemaName, String tableSimpleName, TableModel tableModel, DataTypeMode dataTypeMode) throws SQLException; /** * Returns a list of all the foreign key relationships the columns of which * are contained in a given schema. * * @param schemaName the schema name as exposed by the TAP_SCHEMA * (eventually renamed). * @param realSchemaName the real schema name (not renamed). */ List<Key> getKeys(TapSchema tapSchema, String schemaName, String realSchemaName) throws SQLException; List<Key> getKeys(TapSchema tapSchema, String schemaName, String realSchemaName) throws SQLException; List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel, String whereCondition, Object[] whereParams) throws SQLException; /** * Retrieves TAP_SCHEMA items saved into an existing TAP_SCHEMA, for a given * TAP_SCHEMA table, given its {@link TableModel}. For example, if the * {@code TableModel} models the {@code columns} table, this method will * return a list representing all the rows in the {@code columns} table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param tableModel the model for the TAP_SCHEMA table to read. * @return A {@code List} representing all the rows in a specific TAP_SCHEMA * table. Each element of the list is a {@code Map} having column names as * keys and row values as values. */ List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel) throws SQLException; List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel) throws SQLException; /** * Inserts a new row in a TAP_SCHEMA table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param entity the entity to insert (this is used to specify the table to * use and the values to insert). * @param conn the database connection. */ void insertItem(String tapSchemaName, TapSchemaEntity entity, Connection conn) throws SQLException; void insertItem(String tapSchemaName, TapSchemaEntity entity, Connection conn) throws SQLException; /** * Updates an existing row in a TAP_SCHEMA table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param entity the entity to update (this is used to specify the table to * use and the new values to insert). * @param conn the database connection. * @param whereCondition a SQL {@code WHERE} condition to add to the query. * @param whereParams a sequence of parameters for the {@code WHERE} * condition. */ void updateItem(String tapSchemaName, TapSchemaEntity entity, Connection conn, String whereCondition, Object... whereParams) throws SQLException; void updateItem(String tapSchemaName, TapSchemaEntity entity, Connection conn, String whereCondition, Object... whereParams) throws SQLException; /** * Creates all the tables of a TAP_SCHEMA. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param tapSchemaModel the {@link SchemaModel} used to represent the * TAP_SCHEMA schema. */ void createTapSchemaStructure(String tapSchemaName, SchemaModel tapSchemaModel) throws SQLException; void createTapSchemaStructure(String tapSchemaName, SchemaModel tapSchemaModel) throws SQLException; /** * Creates all the tables of an ivoa schema. * * @param ivoaSchemaModel the {@link SchemaModel} used to represent the ivoa * schema. * @param realIvoaSchemaName the real name of the ivoa schema (not the * renamed one). */ void createIvoaSchemaStructure(SchemaModel ivoaSchemaModel, String realIvoaSchemaName) throws SQLException; void createIvoaSchemaStructure(SchemaModel ivoaSchemaModel, String realIvoaSchemaName) throws SQLException; /** * Saves all the TAP_SCHEMA modifications into the database (creates a new * TAP_SCHEMA or update an existing one). */ void save(TapSchema tapSchema) throws SQLException; void save(TapSchema tapSchema) throws SQLException; /** * Create a new table into the database. * * @param schemaName the real schema name (not the renamed one). * @param tableModel the {@link TableModel} representing the table to * create. */ void createTable(String schemaName, TableModel tableModel) throws SQLException; void createTable(String schemaName, TableModel tableModel) throws SQLException; /** * Alter an existing table adding a new column. * * @param columnHolder a model representing a reference to a column which * doesn't exist yet. * @param columnModel the model used for representing the column structure. */ void addColumn(ColumnHolder columnHolder, ColumnModel columnModel) throws SQLException; void addColumn(ColumnHolder columnHolder, ColumnModel columnModel) throws SQLException; /** /** * @param like is for using both the schema name and the complete table name * Retrieves all the keys where the {@code from_table} or * in the query * {@code target_table} properties start by a given parameter, which must be * a schema name or a complete table name ({@code schema_name} plus * {@code table_name}). In this way it is possible to select keys that needs * to be removed both if the consistency checking mechanism has detected an * inexistent schema or an inexistent table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param like a string representing a schema name or a table complete name * ({@code schema_name} plus {@code table_name}). * * @see it.inaf.ia2.tsm.ConsistencyChecks */ */ Set<String> getKeysToRemove(String tapSchemaName, String like) throws SQLException; Set<String> getKeysToRemove(String tapSchemaName, String like) throws SQLException; /** * Deletes rows from the TAP_SCHEMA. * * @param keysToRemoveIds a {@code Set} of all the identifiers of the keys * to remove; the logic used to create this set is inside the * {@link it.inaf.ia2.tsm.TapSchemaMender} class. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void deleteUnexistingEntities(String tapSchemaName, ConsistencyChecks consistencyChecks, Set<String> keysToRemoveIds) throws SQLException; void deleteUnexistingEntities(String tapSchemaName, ConsistencyChecks consistencyChecks, Set<String> keysToRemoveIds) throws SQLException; /** * Retrieves all the key identifiers related to an inexistent column. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param unexistingColumn a reference to the inexistent column. * @return a {@code Set} of key identifier * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ Set<String> getKeysToRemoveFromUnexistingColumn(String tapSchemaName, ColumnHolder unexistingColumn) throws SQLException; Set<String> getKeysToRemoveFromUnexistingColumn(String tapSchemaName, ColumnHolder unexistingColumn) throws SQLException; /** * Update the (wrong) property value of column exposed by a TAP_SCHEMA. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param completeTableName the complete name of the table * ({@code schema_name} plus {@code table_name}). * @param columnName the name of the column. * @param key the name of the TAP_SCHEMA column property. * @param value the new value. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void updateTapSchemaColumnValue(String tapSchemaName, String completeTableName, String columnName, String key, Object value) throws SQLException; void updateTapSchemaColumnValue(String tapSchemaName, String completeTableName, String columnName, String key, Object value) throws SQLException; /** * Alter an existing TAP_SCHEMA or ObsCore column having an incoherent * datatype according to its {@link ColumnModel}. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void alterDataType(String schemaName, String tableName, String columnName, String adqlDataType, Integer size) throws SQLException; void alterDataType(String schemaName, String tableName, String columnName, String adqlDataType, Integer size) throws SQLException; } } Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -52,7 +52,7 @@ public class Column extends ChildEntity<Table> { /** /** * Original datatype (computed from information_schema data), used for * Original datatype (computed from information_schema data), used for * consistency checking inside the method * consistency checking inside the method * {@link #it.inaf.ia2.tsm.datalayer.DBBroker.getAllColumnsMetadata()} * {@link it.inaf.ia2.tsm.datalayer.DBBroker#getAllColumnsMetadata} * * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.ConsistencyChecks */ */ Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/ColumnHolder.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -26,8 +26,10 @@ import java.io.Serializable; import java.util.Objects; import java.util.Objects; /** /** * Models a column during the consistency checking phase (it is used to display * Models the reference to a column in the database during the consistency * information about columns not already loaded/added into the TAP_SCHEMA). * checking phase (it is used to display information about columns not already * loaded/added into the TAP_SCHEMA or to represent a column which doesn't exist * yet). * * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.ConsistencyChecks * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Key.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class Key extends TapSchemaEntity implements Serializable { /** /** * Sets the identifier for this key. * Sets the identifier for this key. * * * @see {@code getId()} * @see #getId */ */ public void setId(String id) { public void setId(String id) { setValue(ID_KEY, id); setValue(ID_KEY, id); Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/WrongDataType.java +5 −4 Original line number Original line Diff line number Diff line Loading @@ -27,8 +27,9 @@ import java.io.Serializable; /** /** * Models an inconsistency in a column definition detected in an existing * Models an inconsistency in a column definition detected in an existing * column. This happens when the column datatype read from the database metadata * column. This happens when the column datatype read from the database metadata * is different from what is expected according the {@link ColumnModel} defining * is different from what is expected according the * that column. To fix this issue an {@code ALTER TABLE} is necessary. * {@link it.inaf.ia2.tsm.model.ColumnModel} defining that column. To fix this * issue an {@code ALTER TABLE} is necessary. * * * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} * @author Sonia Zorba {@literal <zorba at oats.inaf.it>} */ */ Loading Loading @@ -77,8 +78,8 @@ public class WrongDataType implements Serializable { } } /** /** * Returns the expected datatype, according to the {@link ColumnModel} * Returns the expected datatype, according to the * associated to this column. * {@link it.inaf.ia2.tsm.model.ColumnModel} associated to this column. */ */ public String getCorrectDataType() { public String getCorrectDataType() { return correctDataType; return correctDataType; Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/DBBroker.java +137 −5 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,9 @@ public interface DBBroker { /** /** * Returns the name of all schemata which structure is compatible with a * Returns the name of all schemata which structure is compatible with a * TAP_SCHEMA schema structure. * TAP_SCHEMA schema structure. * * @param allSchemas a list of all schemata names to use for searching; * names must be real schemata names (not renamed). */ */ List<String> getAllTAPSchemaNames(List<String> allSchemas) throws SQLException; List<String> getAllTAPSchemaNames(List<String> allSchemas) throws SQLException; Loading @@ -65,6 +68,7 @@ public interface DBBroker { * structure (e.<!-- -->g.<!-- --> the presence of the set of columns * structure (e.<!-- -->g.<!-- --> the presence of the set of columns * defined into the related XML model). * defined into the related XML model). * * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @return the name of the guessed TAP_SCHEMA version. * @return the name of the guessed TAP_SCHEMA version. */ */ String detectVersion(String tapSchemaName) throws SQLException; String detectVersion(String tapSchemaName) throws SQLException; Loading @@ -72,11 +76,15 @@ public interface DBBroker { /** /** * Returns a list of all the schemata exposed by an existing TAP_SCHEMA. * Returns a list of all the schemata exposed by an existing TAP_SCHEMA. * Queries the {@code TAP_SCHEMA.schemas} schema. * Queries the {@code TAP_SCHEMA.schemas} schema. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). */ */ List<String> getExposedSchemas(String tapSchemaName) throws SQLException; List<String> getExposedSchemas(String tapSchemaName) throws SQLException; /** /** * Returns all the tables owned by a schema, given its name. * Returns all the tables owned by a schema, given its name. * * @param schemaName the real schema name (not the renamed one). */ */ List<String> getAllTablesNames(String schemaName) throws SQLException; List<String> getAllTablesNames(String schemaName) throws SQLException; Loading @@ -84,6 +92,7 @@ public interface DBBroker { * Returns the table type ("table" or "view") for all the tables owned by a * Returns the table type ("table" or "view") for all the tables owned by a * schema, given its name. * schema, given its name. * * * @param schemaName the real schema name (not the renamed one). * @return a {@code Map} having table names as keys and table types as * @return a {@code Map} having table names as keys and table types as * values. * values. */ */ Loading @@ -91,13 +100,16 @@ public interface DBBroker { /** /** * Returns the list of the names of the columns contained in a given table. * Returns the list of the names of the columns contained in a given table. * * @param schemaName the real schema name (not the renamed one). * @param tableName the name of the table. */ */ List<String> getAllColumnsNames(String schemaName, String tableName) throws SQLException; List<String> getAllColumnsNames(String schemaName, String tableName) throws SQLException; /** /** * Returns the metadata of all the columns contained in a given table. * Returns the metadata of all the columns contained in a given table. * * * @param schemaName the name of the schema. * @param schemaName the real schema name (not the renamed one). * @param tableSimpleName the name of the table. * @param tableSimpleName the name of the table. * @param tableModel the {@link TableModel} of the owner column if it is a * @param tableModel the {@link TableModel} of the owner column if it is a * TAP_SCHEMA table or the ObsCore table, null otherwise. This is used for * TAP_SCHEMA table or the ObsCore table, null otherwise. This is used for Loading @@ -110,37 +122,157 @@ public interface DBBroker { */ */ Map<String, Map<String, Object>> getAllColumnsMetadata(String schemaName, String tableSimpleName, TableModel tableModel, DataTypeMode dataTypeMode) throws SQLException; Map<String, Map<String, Object>> getAllColumnsMetadata(String schemaName, String tableSimpleName, TableModel tableModel, DataTypeMode dataTypeMode) throws SQLException; /** * Returns a list of all the foreign key relationships the columns of which * are contained in a given schema. * * @param schemaName the schema name as exposed by the TAP_SCHEMA * (eventually renamed). * @param realSchemaName the real schema name (not renamed). */ List<Key> getKeys(TapSchema tapSchema, String schemaName, String realSchemaName) throws SQLException; List<Key> getKeys(TapSchema tapSchema, String schemaName, String realSchemaName) throws SQLException; List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel, String whereCondition, Object[] whereParams) throws SQLException; /** * Retrieves TAP_SCHEMA items saved into an existing TAP_SCHEMA, for a given * TAP_SCHEMA table, given its {@link TableModel}. For example, if the * {@code TableModel} models the {@code columns} table, this method will * return a list representing all the rows in the {@code columns} table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param tableModel the model for the TAP_SCHEMA table to read. * @return A {@code List} representing all the rows in a specific TAP_SCHEMA * table. Each element of the list is a {@code Map} having column names as * keys and row values as values. */ List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel) throws SQLException; List<Map<String, Object>> getSavedItems(String tapSchemaName, TableModel tableModel) throws SQLException; /** * Inserts a new row in a TAP_SCHEMA table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param entity the entity to insert (this is used to specify the table to * use and the values to insert). * @param conn the database connection. */ void insertItem(String tapSchemaName, TapSchemaEntity entity, Connection conn) throws SQLException; void insertItem(String tapSchemaName, TapSchemaEntity entity, Connection conn) throws SQLException; /** * Updates an existing row in a TAP_SCHEMA table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param entity the entity to update (this is used to specify the table to * use and the new values to insert). * @param conn the database connection. * @param whereCondition a SQL {@code WHERE} condition to add to the query. * @param whereParams a sequence of parameters for the {@code WHERE} * condition. */ void updateItem(String tapSchemaName, TapSchemaEntity entity, Connection conn, String whereCondition, Object... whereParams) throws SQLException; void updateItem(String tapSchemaName, TapSchemaEntity entity, Connection conn, String whereCondition, Object... whereParams) throws SQLException; /** * Creates all the tables of a TAP_SCHEMA. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param tapSchemaModel the {@link SchemaModel} used to represent the * TAP_SCHEMA schema. */ void createTapSchemaStructure(String tapSchemaName, SchemaModel tapSchemaModel) throws SQLException; void createTapSchemaStructure(String tapSchemaName, SchemaModel tapSchemaModel) throws SQLException; /** * Creates all the tables of an ivoa schema. * * @param ivoaSchemaModel the {@link SchemaModel} used to represent the ivoa * schema. * @param realIvoaSchemaName the real name of the ivoa schema (not the * renamed one). */ void createIvoaSchemaStructure(SchemaModel ivoaSchemaModel, String realIvoaSchemaName) throws SQLException; void createIvoaSchemaStructure(SchemaModel ivoaSchemaModel, String realIvoaSchemaName) throws SQLException; /** * Saves all the TAP_SCHEMA modifications into the database (creates a new * TAP_SCHEMA or update an existing one). */ void save(TapSchema tapSchema) throws SQLException; void save(TapSchema tapSchema) throws SQLException; /** * Create a new table into the database. * * @param schemaName the real schema name (not the renamed one). * @param tableModel the {@link TableModel} representing the table to * create. */ void createTable(String schemaName, TableModel tableModel) throws SQLException; void createTable(String schemaName, TableModel tableModel) throws SQLException; /** * Alter an existing table adding a new column. * * @param columnHolder a model representing a reference to a column which * doesn't exist yet. * @param columnModel the model used for representing the column structure. */ void addColumn(ColumnHolder columnHolder, ColumnModel columnModel) throws SQLException; void addColumn(ColumnHolder columnHolder, ColumnModel columnModel) throws SQLException; /** /** * @param like is for using both the schema name and the complete table name * Retrieves all the keys where the {@code from_table} or * in the query * {@code target_table} properties start by a given parameter, which must be * a schema name or a complete table name ({@code schema_name} plus * {@code table_name}). In this way it is possible to select keys that needs * to be removed both if the consistency checking mechanism has detected an * inexistent schema or an inexistent table. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param like a string representing a schema name or a table complete name * ({@code schema_name} plus {@code table_name}). * * @see it.inaf.ia2.tsm.ConsistencyChecks */ */ Set<String> getKeysToRemove(String tapSchemaName, String like) throws SQLException; Set<String> getKeysToRemove(String tapSchemaName, String like) throws SQLException; /** * Deletes rows from the TAP_SCHEMA. * * @param keysToRemoveIds a {@code Set} of all the identifiers of the keys * to remove; the logic used to create this set is inside the * {@link it.inaf.ia2.tsm.TapSchemaMender} class. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void deleteUnexistingEntities(String tapSchemaName, ConsistencyChecks consistencyChecks, Set<String> keysToRemoveIds) throws SQLException; void deleteUnexistingEntities(String tapSchemaName, ConsistencyChecks consistencyChecks, Set<String> keysToRemoveIds) throws SQLException; /** * Retrieves all the key identifiers related to an inexistent column. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param unexistingColumn a reference to the inexistent column. * @return a {@code Set} of key identifier * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ Set<String> getKeysToRemoveFromUnexistingColumn(String tapSchemaName, ColumnHolder unexistingColumn) throws SQLException; Set<String> getKeysToRemoveFromUnexistingColumn(String tapSchemaName, ColumnHolder unexistingColumn) throws SQLException; /** * Update the (wrong) property value of column exposed by a TAP_SCHEMA. * * @param tapSchemaName the real TAP_SCHEMA name (not the renamed one). * @param completeTableName the complete name of the table * ({@code schema_name} plus {@code table_name}). * @param columnName the name of the column. * @param key the name of the TAP_SCHEMA column property. * @param value the new value. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void updateTapSchemaColumnValue(String tapSchemaName, String completeTableName, String columnName, String key, Object value) throws SQLException; void updateTapSchemaColumnValue(String tapSchemaName, String completeTableName, String columnName, String key, Object value) throws SQLException; /** * Alter an existing TAP_SCHEMA or ObsCore column having an incoherent * datatype according to its {@link ColumnModel}. * * @see it.inaf.ia2.tsm.ConsistencyChecks * @see it.inaf.ia2.tsm.TapSchemaMender */ void alterDataType(String schemaName, String tableName, String columnName, String adqlDataType, Integer size) throws SQLException; void alterDataType(String schemaName, String tableName, String columnName, String adqlDataType, Integer size) throws SQLException; } }