Commit 5e2bad95 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Changes and improvements in credentials insertion page

parent 61d7d76e
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -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()];
+12 −2
Original line number Original line Diff line number Diff line
@@ -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);
    }
    }
@@ -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.
     */
     */
+2 −0
Original line number Original line Diff line number Diff line
@@ -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.");
                }
                }
+12 −0
Original line number Original line Diff line number Diff line
@@ -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;


@@ -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;
    }
}
}
+0 −3
Original line number Original line Diff line number Diff line
@@ -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")) {
@@ -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