Loading TASMAN-core/pom.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion> <groupId>it.inaf.ia2.tap</groupId> <groupId>it.inaf.ia2.tap</groupId> <artifactId>tasman-core</artifactId> <artifactId>tasman-core</artifactId> <version>1.3.1</version> <version>1.3.2</version> <packaging>jar</packaging> <packaging>jar</packaging> <name>tasman-core</name> <name>tasman-core</name> <properties> <properties> Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class Column extends ChildEntity<Table> { public final static String UCD_KEY = "ucd"; public final static String UCD_KEY = "ucd"; public final static String UNIT_KEY = "unit"; public final static String UNIT_KEY = "unit"; public final static String COLUMN_INDEX = "column_index"; // TAP version >= 1.1 public final static String COLUMN_INDEX = "column_index"; // TAP version >= 1.1 public final static String DBNAME = "dbname"; // Original datatype (computed from information_schema data), used for consistency checking // Original datatype (computed from information_schema data), used for consistency checking public final static String ORIGINAL_DATATYPE_KEY = "original_datatype"; public final static String ORIGINAL_DATATYPE_KEY = "original_datatype"; Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Schema.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory; public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer<Table> { public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer<Table> { public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String DBNAME = "dbname"; private static final long serialVersionUID = 8828583158332877855L; private static final long serialVersionUID = 8828583158332877855L; private static final Logger LOG = LoggerFactory.getLogger(Schema.class); private static final Logger LOG = LoggerFactory.getLogger(Schema.class); Loading @@ -61,7 +62,7 @@ public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer< tables = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); tables = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); tablesTypes = broker.getAllTableTypes(name); tablesTypes = broker.getAllTableTypes(name); for (String tableName : broker.getAllTablesNames(name)) { for (String tableName : broker.getAllTablesNames(getRealSchemaName())) { tables.put(tableName, null); tables.put(tableName, null); } } LOG.debug("Schema {} contains {} tables", name, tables.size()); LOG.debug("Schema {} contains {} tables", name, tables.size()); Loading @@ -69,6 +70,13 @@ public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer< setStatus(Status.LOADED); setStatus(Status.LOADED); } } public String getRealSchemaName() { if (tapSchema.getDBName() != null && this.getName().equals(tapSchema.getName())) { return tapSchema.getDBName(); } return getName(); } /** /** * {@inheritDoc} The value in the {@code schema_name} column. * {@inheritDoc} The value in the {@code schema_name} column. */ */ Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/Table.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String TABLE_NAME_KEY = "table_name"; public final static String TABLE_NAME_KEY = "table_name"; public final static String TABLE_TYPE_KEY = "table_type"; public final static String TABLE_TYPE_KEY = "table_type"; public final static String DBNAME = "dbname"; private static final long serialVersionUID = 8265331530960896871L; private static final long serialVersionUID = 8265331530960896871L; private static final Logger LOG = LoggerFactory.getLogger(Table.class); private static final Logger LOG = LoggerFactory.getLogger(Table.class); Loading Loading @@ -98,7 +99,7 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu DBBroker broker = tapSchema.getDBBroker(schema.getName()); DBBroker broker = tapSchema.getDBBroker(schema.getName()); tableTableModel = getTableTableModel(); tableTableModel = getTableTableModel(); columnsMetadata = broker.getAllColumnsMetadata(schema.getName(), tableSimpleName, tableTableModel, tapSchema.getDataTypeMode()); columnsMetadata = broker.getAllColumnsMetadata(schema.getRealSchemaName(), tableSimpleName, tableTableModel, tapSchema.getDataTypeMode()); fixIndexedMetadataValues(); fixIndexedMetadataValues(); for (Map.Entry<String, Map<String, Object>> entry : columnsMetadata.entrySet()) { for (Map.Entry<String, Map<String, Object>> entry : columnsMetadata.entrySet()) { Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +55 −4 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ import org.slf4j.LoggerFactory; */ */ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public class TapSchema implements EntitiesContainer<Schema>, Serializable { public static final String STANDARD_NAME = "TAP_SCHEMA"; // Mandatory tables constants // Mandatory tables constants public static final String TABLES_TABLE = "tables"; public static final String TABLES_TABLE = "tables"; public static final String SCHEMAS_TABLE = "schemas"; public static final String SCHEMAS_TABLE = "schemas"; Loading @@ -65,6 +67,8 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { private boolean loading; private boolean loading; private DBWrapper dbWrapper; private DBWrapper dbWrapper; private String dbName; private String name; private boolean exists; private boolean exists; private TapSchemaSettings settings; private TapSchemaSettings settings; private DataTypeMode dataTypeMode; private DataTypeMode dataTypeMode; Loading Loading @@ -101,12 +105,32 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { this.dbWrapper = dbWrapper; this.dbWrapper = dbWrapper; this.exists = exists; this.exists = exists; this.settings = settings; this.settings = settings; // Don't change the instructions order! loadDBName(); loadName(); dataTypeMode = getTapSchemaModel().getDataTypeMode(); dataTypeMode = getTapSchemaModel().getDataTypeMode(); load(); load(); } } private void loadDBName() { // Detect if the TAP_SCHEMA version supports dbmodel SchemaModel tapSchemaModel = SchemaModels.getTapSchemaModel(settings.getTapSchemaVersion()); boolean hasDBName = tapSchemaModel.getTable(SCHEMAS_TABLE).get("dbname") != null; if (hasDBName && !STANDARD_NAME.equals(settings.getTapSchemaName())) { dbName = settings.getTapSchemaName(); } } private void loadName() { if (dbName != null) { name = STANDARD_NAME; } else { name = settings.getTapSchemaName(); } } public final void load() throws SQLException { public final void load() throws SQLException { loading = true; loading = true; Loading @@ -115,7 +139,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { for (String schemaName : getSourceDBBroker().getAllSchemaNames()) { for (String schemaName : getSourceDBBroker().getAllSchemaNames()) { schemas.put(schemaName, null); schemas.put(schemaName, null); } } schemas.put(settings.getTapSchemaName(), null); // the TAP_SCHEMA contains itself schemas.put(getName(), null); // the TAP_SCHEMA contains itself if (exists) { if (exists) { consistencyChecks = TapSchemaLoader.loadExistingTapSchema((this)); consistencyChecks = TapSchemaLoader.loadExistingTapSchema((this)); Loading @@ -138,7 +162,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { * The name of the TAP_SCHEMA schema. * The name of the TAP_SCHEMA schema. */ */ public final String getName() { public final String getName() { return settings.getTapSchemaName(); return name; } } /** /** Loading @@ -153,7 +177,8 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { } } private void loadSchemaKeysMetadata(String schemaName) throws SQLException { private void loadSchemaKeysMetadata(String schemaName) throws SQLException { allKeys.addAll(getDBBroker(schemaName).getKeys(this, schemaName)); allKeys.addAll(getDBBroker(schemaName) .getKeys(this, schemaName, getRealSchemaName(schemaName))); } } public Set<Key> getAllKeys() { public Set<Key> getAllKeys() { Loading Loading @@ -307,7 +332,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { if (!exists) { if (!exists) { SchemaModel tapSchemaModel = getTapSchemaModel(); SchemaModel tapSchemaModel = getTapSchemaModel(); broker.createTapSchemaStructure(getName(), tapSchemaModel); broker.createTapSchemaStructure(getRealName(), tapSchemaModel); // Adding TAP_SCHEMA into TAP_SCHEMA // Adding TAP_SCHEMA into TAP_SCHEMA addEntireSchema(getName()); addEntireSchema(getName()); Loading Loading @@ -525,6 +550,11 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public Map<String, Object> getSchemaMetadata(String schemaName) { public Map<String, Object> getSchemaMetadata(String schemaName) { Map<String, Object> metadata = new HashMap<>(); Map<String, Object> metadata = new HashMap<>(); metadata.put(Schema.SCHEMA_NAME_KEY, schemaName); metadata.put(Schema.SCHEMA_NAME_KEY, schemaName); String dbNameMetadata = null; if (dbName != null && schemaName.equals(STANDARD_NAME)) { dbNameMetadata = dbName; } metadata.put(Schema.DBNAME, dbNameMetadata); return metadata; return metadata; } } Loading Loading @@ -585,4 +615,25 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public void fillColumnsProperties(SchemaModel schemaModel) { public void fillColumnsProperties(SchemaModel schemaModel) { fillColumnProperties(schemaModel, schemaModel.getName()); fillColumnProperties(schemaModel, schemaModel.getName()); } } /** * Allows to name the TAP_SCHEMA using the standard name, but referring to a * differently named schema. This value is null if the TAP_SCHEMA version * doesn't support the dbname column or if the schema name is already the * standard value. */ public String getDBName() { return dbName; } public String getRealName() { return getRealSchemaName(getName()); } public String getRealSchemaName(String schemaName) { if (dbName != null && STANDARD_NAME.equals(schemaName)) { return dbName; } return schemaName; } } } Loading
TASMAN-core/pom.xml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion> <groupId>it.inaf.ia2.tap</groupId> <groupId>it.inaf.ia2.tap</groupId> <artifactId>tasman-core</artifactId> <artifactId>tasman-core</artifactId> <version>1.3.1</version> <version>1.3.2</version> <packaging>jar</packaging> <packaging>jar</packaging> <name>tasman-core</name> <name>tasman-core</name> <properties> <properties> Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Column.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,7 @@ public class Column extends ChildEntity<Table> { public final static String UCD_KEY = "ucd"; public final static String UCD_KEY = "ucd"; public final static String UNIT_KEY = "unit"; public final static String UNIT_KEY = "unit"; public final static String COLUMN_INDEX = "column_index"; // TAP version >= 1.1 public final static String COLUMN_INDEX = "column_index"; // TAP version >= 1.1 public final static String DBNAME = "dbname"; // Original datatype (computed from information_schema data), used for consistency checking // Original datatype (computed from information_schema data), used for consistency checking public final static String ORIGINAL_DATATYPE_KEY = "original_datatype"; public final static String ORIGINAL_DATATYPE_KEY = "original_datatype"; Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Schema.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory; public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer<Table> { public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer<Table> { public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String DBNAME = "dbname"; private static final long serialVersionUID = 8828583158332877855L; private static final long serialVersionUID = 8828583158332877855L; private static final Logger LOG = LoggerFactory.getLogger(Schema.class); private static final Logger LOG = LoggerFactory.getLogger(Schema.class); Loading @@ -61,7 +62,7 @@ public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer< tables = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); tables = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); tablesTypes = broker.getAllTableTypes(name); tablesTypes = broker.getAllTableTypes(name); for (String tableName : broker.getAllTablesNames(name)) { for (String tableName : broker.getAllTablesNames(getRealSchemaName())) { tables.put(tableName, null); tables.put(tableName, null); } } LOG.debug("Schema {} contains {} tables", name, tables.size()); LOG.debug("Schema {} contains {} tables", name, tables.size()); Loading @@ -69,6 +70,13 @@ public class Schema extends ChildEntity<TapSchema> implements EntitiesContainer< setStatus(Status.LOADED); setStatus(Status.LOADED); } } public String getRealSchemaName() { if (tapSchema.getDBName() != null && this.getName().equals(tapSchema.getName())) { return tapSchema.getDBName(); } return getName(); } /** /** * {@inheritDoc} The value in the {@code schema_name} column. * {@inheritDoc} The value in the {@code schema_name} column. */ */ Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/Table.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String SCHEMA_NAME_KEY = "schema_name"; public final static String TABLE_NAME_KEY = "table_name"; public final static String TABLE_NAME_KEY = "table_name"; public final static String TABLE_TYPE_KEY = "table_type"; public final static String TABLE_TYPE_KEY = "table_type"; public final static String DBNAME = "dbname"; private static final long serialVersionUID = 8265331530960896871L; private static final long serialVersionUID = 8265331530960896871L; private static final Logger LOG = LoggerFactory.getLogger(Table.class); private static final Logger LOG = LoggerFactory.getLogger(Table.class); Loading Loading @@ -98,7 +99,7 @@ public class Table extends ChildEntity<Schema> implements EntitiesContainer<Colu DBBroker broker = tapSchema.getDBBroker(schema.getName()); DBBroker broker = tapSchema.getDBBroker(schema.getName()); tableTableModel = getTableTableModel(); tableTableModel = getTableTableModel(); columnsMetadata = broker.getAllColumnsMetadata(schema.getName(), tableSimpleName, tableTableModel, tapSchema.getDataTypeMode()); columnsMetadata = broker.getAllColumnsMetadata(schema.getRealSchemaName(), tableSimpleName, tableTableModel, tapSchema.getDataTypeMode()); fixIndexedMetadataValues(); fixIndexedMetadataValues(); for (Map.Entry<String, Map<String, Object>> entry : columnsMetadata.entrySet()) { for (Map.Entry<String, Map<String, Object>> entry : columnsMetadata.entrySet()) { Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +55 −4 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,8 @@ import org.slf4j.LoggerFactory; */ */ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public class TapSchema implements EntitiesContainer<Schema>, Serializable { public static final String STANDARD_NAME = "TAP_SCHEMA"; // Mandatory tables constants // Mandatory tables constants public static final String TABLES_TABLE = "tables"; public static final String TABLES_TABLE = "tables"; public static final String SCHEMAS_TABLE = "schemas"; public static final String SCHEMAS_TABLE = "schemas"; Loading @@ -65,6 +67,8 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { private boolean loading; private boolean loading; private DBWrapper dbWrapper; private DBWrapper dbWrapper; private String dbName; private String name; private boolean exists; private boolean exists; private TapSchemaSettings settings; private TapSchemaSettings settings; private DataTypeMode dataTypeMode; private DataTypeMode dataTypeMode; Loading Loading @@ -101,12 +105,32 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { this.dbWrapper = dbWrapper; this.dbWrapper = dbWrapper; this.exists = exists; this.exists = exists; this.settings = settings; this.settings = settings; // Don't change the instructions order! loadDBName(); loadName(); dataTypeMode = getTapSchemaModel().getDataTypeMode(); dataTypeMode = getTapSchemaModel().getDataTypeMode(); load(); load(); } } private void loadDBName() { // Detect if the TAP_SCHEMA version supports dbmodel SchemaModel tapSchemaModel = SchemaModels.getTapSchemaModel(settings.getTapSchemaVersion()); boolean hasDBName = tapSchemaModel.getTable(SCHEMAS_TABLE).get("dbname") != null; if (hasDBName && !STANDARD_NAME.equals(settings.getTapSchemaName())) { dbName = settings.getTapSchemaName(); } } private void loadName() { if (dbName != null) { name = STANDARD_NAME; } else { name = settings.getTapSchemaName(); } } public final void load() throws SQLException { public final void load() throws SQLException { loading = true; loading = true; Loading @@ -115,7 +139,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { for (String schemaName : getSourceDBBroker().getAllSchemaNames()) { for (String schemaName : getSourceDBBroker().getAllSchemaNames()) { schemas.put(schemaName, null); schemas.put(schemaName, null); } } schemas.put(settings.getTapSchemaName(), null); // the TAP_SCHEMA contains itself schemas.put(getName(), null); // the TAP_SCHEMA contains itself if (exists) { if (exists) { consistencyChecks = TapSchemaLoader.loadExistingTapSchema((this)); consistencyChecks = TapSchemaLoader.loadExistingTapSchema((this)); Loading @@ -138,7 +162,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { * The name of the TAP_SCHEMA schema. * The name of the TAP_SCHEMA schema. */ */ public final String getName() { public final String getName() { return settings.getTapSchemaName(); return name; } } /** /** Loading @@ -153,7 +177,8 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { } } private void loadSchemaKeysMetadata(String schemaName) throws SQLException { private void loadSchemaKeysMetadata(String schemaName) throws SQLException { allKeys.addAll(getDBBroker(schemaName).getKeys(this, schemaName)); allKeys.addAll(getDBBroker(schemaName) .getKeys(this, schemaName, getRealSchemaName(schemaName))); } } public Set<Key> getAllKeys() { public Set<Key> getAllKeys() { Loading Loading @@ -307,7 +332,7 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { if (!exists) { if (!exists) { SchemaModel tapSchemaModel = getTapSchemaModel(); SchemaModel tapSchemaModel = getTapSchemaModel(); broker.createTapSchemaStructure(getName(), tapSchemaModel); broker.createTapSchemaStructure(getRealName(), tapSchemaModel); // Adding TAP_SCHEMA into TAP_SCHEMA // Adding TAP_SCHEMA into TAP_SCHEMA addEntireSchema(getName()); addEntireSchema(getName()); Loading Loading @@ -525,6 +550,11 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public Map<String, Object> getSchemaMetadata(String schemaName) { public Map<String, Object> getSchemaMetadata(String schemaName) { Map<String, Object> metadata = new HashMap<>(); Map<String, Object> metadata = new HashMap<>(); metadata.put(Schema.SCHEMA_NAME_KEY, schemaName); metadata.put(Schema.SCHEMA_NAME_KEY, schemaName); String dbNameMetadata = null; if (dbName != null && schemaName.equals(STANDARD_NAME)) { dbNameMetadata = dbName; } metadata.put(Schema.DBNAME, dbNameMetadata); return metadata; return metadata; } } Loading Loading @@ -585,4 +615,25 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { public void fillColumnsProperties(SchemaModel schemaModel) { public void fillColumnsProperties(SchemaModel schemaModel) { fillColumnProperties(schemaModel, schemaModel.getName()); fillColumnProperties(schemaModel, schemaModel.getName()); } } /** * Allows to name the TAP_SCHEMA using the standard name, but referring to a * differently named schema. This value is null if the TAP_SCHEMA version * doesn't support the dbname column or if the schema name is already the * standard value. */ public String getDBName() { return dbName; } public String getRealName() { return getRealSchemaName(getName()); } public String getRealSchemaName(String schemaName) { if (dbName != null && STANDARD_NAME.equals(schemaName)) { return dbName; } return schemaName; } } }