Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -266,9 +266,6 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { if (!keyFound) { if (!keyFound) { boolean setKeyToRemove = true; boolean setKeyToRemove = true; if (Tasman.ALLOWS_FICTITIOUS_KEYS) { // TODO } if (setKeyToRemove) { if (setKeyToRemove) { String[] fromColumns = new String[kcPropsById.size()]; String[] fromColumns = new String[kcPropsById.size()]; String[] targetColumns = new String[kcPropsById.size()]; String[] targetColumns = new String[kcPropsById.size()]; Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -39,14 +39,14 @@ public class Credentials implements Serializable { private static final long serialVersionUID = 1153912575502196261L; private static final long serialVersionUID = 1153912575502196261L; private static final Logger LOG = LoggerFactory.getLogger(Credentials.class); private static final Logger LOG = LoggerFactory.getLogger(Credentials.class); private DatabaseType databaseType; private String hostname; private String hostname; private int port; private int port; private String username; private String username; private String password; private String password; private String database; private String database; private DatabaseType databaseType; public Credentials() { public Credentials() { this(DatabaseType.MYSQL); this(DatabaseType.MYSQL); } } Loading @@ -56,6 +56,16 @@ public class Credentials implements Serializable { this.setDefaults(); this.setDefaults(); } } // Copy constructor public Credentials(Credentials credentials) { this(credentials.getDatabaseType()); this.hostname = credentials.getHostname(); this.port = credentials.getPort(); this.username = credentials.getUsername(); this.password = credentials.getPassword(); this.database = credentials.getDatabase(); } /** /** * The name of the server that hosts the RDBMS. * The name of the server that hosts the RDBMS. */ */ Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,8 @@ public class PropertyModel implements Serializable { defaultValue = Long.parseLong(strDefVal); defaultValue = Long.parseLong(strDefVal); } else if (type == Float.class) { } else if (type == Float.class) { defaultValue = Float.parseFloat(strDefVal); defaultValue = Float.parseFloat(strDefVal); } else if (type == Boolean.class) { defaultValue = Boolean.parseBoolean(strDefVal); } else { } else { throw new UnsupportedOperationException("Default value for type " + type.getCanonicalName() + " not supported yet."); throw new UnsupportedOperationException("Default value for type " + type.getCanonicalName() + " not supported yet."); } } Loading TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/TapSchemaModels.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -24,8 +24,10 @@ package it.inaf.ia2.tsm.model; import java.io.IOException; import java.io.IOException; import java.io.InputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashMap; import java.util.Iterator; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map; import javax.xml.bind.JAXB; import javax.xml.bind.JAXB; Loading Loading @@ -102,4 +104,14 @@ public class TapSchemaModels { public static TableModel getTableModel(String tableName, String version) { public static TableModel getTableModel(String tableName, String version) { return getTapSchemaModel(version).getTables().get(tableName); return getTapSchemaModel(version).getTables().get(tableName); } } public static List<String> getAvailableVersions() { List<String> versions = new ArrayList<>(); Iterator<TapSchemaModel> ite = getIterator(); while (ite.hasNext()) { TapSchemaModel tapSchemaModel = ite.next(); versions.add(tapSchemaModel.getVersion()); } return versions; } } } TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/Tasman.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import java.util.Properties; public class Tasman { public class Tasman { public static final String[] XML_MODEL_FILES; public static final String[] XML_MODEL_FILES; public static final boolean ALLOWS_FICTITIOUS_KEYS; static { static { try (InputStream in = Tasman.class.getClassLoader().getResourceAsStream("core.properties")) { try (InputStream in = Tasman.class.getClassLoader().getResourceAsStream("core.properties")) { Loading @@ -46,8 +45,6 @@ public class Tasman { String suffix = models[i]; String suffix = models[i]; XML_MODEL_FILES[i] = "tap_schema" + File.separator + "tap_schema-" + suffix + ".xml"; XML_MODEL_FILES[i] = "tap_schema" + File.separator + "tap_schema-" + suffix + ".xml"; } } ALLOWS_FICTITIOUS_KEYS = Boolean.parseBoolean(props.getProperty("allow_fictitious_keys")); } catch (IOException e) { } catch (IOException e) { throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e); } } Loading Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/TapSchema.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -266,9 +266,6 @@ public class TapSchema implements EntitiesContainer<Schema>, Serializable { if (!keyFound) { if (!keyFound) { boolean setKeyToRemove = true; boolean setKeyToRemove = true; if (Tasman.ALLOWS_FICTITIOUS_KEYS) { // TODO } if (setKeyToRemove) { if (setKeyToRemove) { String[] fromColumns = new String[kcPropsById.size()]; String[] fromColumns = new String[kcPropsById.size()]; String[] targetColumns = new String[kcPropsById.size()]; String[] targetColumns = new String[kcPropsById.size()]; Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java +12 −2 Original line number Original line Diff line number Diff line Loading @@ -39,14 +39,14 @@ public class Credentials implements Serializable { private static final long serialVersionUID = 1153912575502196261L; private static final long serialVersionUID = 1153912575502196261L; private static final Logger LOG = LoggerFactory.getLogger(Credentials.class); private static final Logger LOG = LoggerFactory.getLogger(Credentials.class); private DatabaseType databaseType; private String hostname; private String hostname; private int port; private int port; private String username; private String username; private String password; private String password; private String database; private String database; private DatabaseType databaseType; public Credentials() { public Credentials() { this(DatabaseType.MYSQL); this(DatabaseType.MYSQL); } } Loading @@ -56,6 +56,16 @@ public class Credentials implements Serializable { this.setDefaults(); this.setDefaults(); } } // Copy constructor public Credentials(Credentials credentials) { this(credentials.getDatabaseType()); this.hostname = credentials.getHostname(); this.port = credentials.getPort(); this.username = credentials.getUsername(); this.password = credentials.getPassword(); this.database = credentials.getDatabase(); } /** /** * The name of the server that hosts the RDBMS. * The name of the server that hosts the RDBMS. */ */ Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/PropertyModel.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -65,6 +65,8 @@ public class PropertyModel implements Serializable { defaultValue = Long.parseLong(strDefVal); defaultValue = Long.parseLong(strDefVal); } else if (type == Float.class) { } else if (type == Float.class) { defaultValue = Float.parseFloat(strDefVal); defaultValue = Float.parseFloat(strDefVal); } else if (type == Boolean.class) { defaultValue = Boolean.parseBoolean(strDefVal); } else { } else { throw new UnsupportedOperationException("Default value for type " + type.getCanonicalName() + " not supported yet."); throw new UnsupportedOperationException("Default value for type " + type.getCanonicalName() + " not supported yet."); } } Loading
TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/TapSchemaModels.java +12 −0 Original line number Original line Diff line number Diff line Loading @@ -24,8 +24,10 @@ package it.inaf.ia2.tsm.model; import java.io.IOException; import java.io.IOException; import java.io.InputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashMap; import java.util.Iterator; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map; import javax.xml.bind.JAXB; import javax.xml.bind.JAXB; Loading Loading @@ -102,4 +104,14 @@ public class TapSchemaModels { public static TableModel getTableModel(String tableName, String version) { public static TableModel getTableModel(String tableName, String version) { return getTapSchemaModel(version).getTables().get(tableName); return getTapSchemaModel(version).getTables().get(tableName); } } public static List<String> getAvailableVersions() { List<String> versions = new ArrayList<>(); Iterator<TapSchemaModel> ite = getIterator(); while (ite.hasNext()) { TapSchemaModel tapSchemaModel = ite.next(); versions.add(tapSchemaModel.getVersion()); } return versions; } } }
TASMAN-core/src/main/java/it/inaf/ia2/tsm/model/Tasman.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import java.util.Properties; public class Tasman { public class Tasman { public static final String[] XML_MODEL_FILES; public static final String[] XML_MODEL_FILES; public static final boolean ALLOWS_FICTITIOUS_KEYS; static { static { try (InputStream in = Tasman.class.getClassLoader().getResourceAsStream("core.properties")) { try (InputStream in = Tasman.class.getClassLoader().getResourceAsStream("core.properties")) { Loading @@ -46,8 +45,6 @@ public class Tasman { String suffix = models[i]; String suffix = models[i]; XML_MODEL_FILES[i] = "tap_schema" + File.separator + "tap_schema-" + suffix + ".xml"; XML_MODEL_FILES[i] = "tap_schema" + File.separator + "tap_schema-" + suffix + ".xml"; } } ALLOWS_FICTITIOUS_KEYS = Boolean.parseBoolean(props.getProperty("allow_fictitious_keys")); } catch (IOException e) { } catch (IOException e) { throw new ExceptionInInitializerError(e); throw new ExceptionInInitializerError(e); } } Loading