From f233c97c72ce0ef29cbe7953ed6510a2a72d1d55 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <zorba@oats.inaf.it>
Date: Wed, 19 Jul 2017 15:54:32 +0200
Subject: [PATCH] Started changes for new configuration settings

---
 .../inaf/ia2/tsm/datalayer/Credentials.java   |  46 +++-
 .../src/main/resources/core.properties        |   2 -
 .../ia2/tsm/webapp/ConfigurationData.java     | 114 --------
 .../ia2/tsm/webapp/ConfigurationManager.java  | 246 ++++++++++++++++++
 .../ia2/tsm/webapp/CredentialsEditing.java    |  37 +--
 .../it/inaf/ia2/tsm/webapp/FirstSetup.java    |   2 +-
 .../java/it/inaf/ia2/tsm/webapp/Login.java    |   4 +-
 .../inaf/ia2/tsm/webapp/SearchUCDDialog.java  |   7 +-
 .../it/inaf/ia2/tsm/webapp/UCDEditor.java     |  37 ++-
 .../java/it/inaf/ia2/tsm/webapp/User.java     |   2 +-
 .../it/inaf/ia2/tsm/webapp/UsersEditing.java  |  40 +--
 .../tsm/webapp/checker/FirstSetupChecker.java |  10 +-
 .../webapp/xmlconfig/JoinedCredentials.java   |  79 ++++++
 .../SeparatedCredentials.java}                |  41 ++-
 .../tsm/webapp/xmlconfig/TapCredentials.java  |  66 +++++
 .../webapp/xmlconfig/UCDConfiguration.java    |  22 +-
 .../xmlconfig/UCDListConfiguration.java       |  53 ++++
 .../webapp/xmlconfig/UserConfiguration.java   |  24 +-
 ...iguration.java => UsersConfiguration.java} |  15 +-
 .../src/main/resources/webapp.properties      |   2 +-
 .../resources/tsm_components/ucd_editor.xhtml |   2 +-
 TASMAN-webapp/src/main/webapp/setup.xhtml     |   4 +-
 .../src/test/java/TapSchemaMangerTest.java    |   2 +-
 23 files changed, 631 insertions(+), 226 deletions(-)
 delete mode 100644 TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationData.java
 create mode 100644 TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationManager.java
 create mode 100644 TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/JoinedCredentials.java
 rename TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/{SeparateCredentials.java => xmlconfig/SeparatedCredentials.java} (62%)
 create mode 100644 TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/TapCredentials.java
 create mode 100644 TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDListConfiguration.java
 rename TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/{Configuration.java => UsersConfiguration.java} (82%)

diff --git a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java
index 7f8e342..dfc0272 100644
--- a/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java
+++ b/TASMAN-core/src/main/java/it/inaf/ia2/tsm/datalayer/Credentials.java
@@ -22,8 +22,8 @@
  */
 package it.inaf.ia2.tsm.datalayer;
 
-import it.inaf.ia2.tsm.datalayer.DatabaseType;
 import java.io.Serializable;
+import java.util.Objects;
 import javax.xml.bind.annotation.XmlAttribute;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 public class Credentials implements Serializable {
 
     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 String hostname;
     private int port;
@@ -160,4 +160,46 @@ public class Credentials implements Serializable {
                 Credentials.class.getCanonicalName(),
                 databaseType, hostname, port, username, password, database);
     }
+
+    @Override
+    public int hashCode() {
+        int hash = 3;
+        hash = 97 * hash + Objects.hashCode(this.hostname);
+        hash = 97 * hash + this.port;
+        hash = 97 * hash + Objects.hashCode(this.username);
+        hash = 97 * hash + Objects.hashCode(this.password);
+        hash = 97 * hash + Objects.hashCode(this.database);
+        hash = 97 * hash + Objects.hashCode(this.databaseType);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Credentials other = (Credentials) obj;
+        if (this.port != other.port) {
+            return false;
+        }
+        if (!Objects.equals(this.hostname, other.hostname)) {
+            return false;
+        }
+        if (!Objects.equals(this.username, other.username)) {
+            return false;
+        }
+        if (!Objects.equals(this.password, other.password)) {
+            return false;
+        }
+        if (!Objects.equals(this.database, other.database)) {
+            return false;
+        }
+        return this.databaseType == other.databaseType;
+    }
 }
diff --git a/TASMAN-core/src/main/resources/core.properties b/TASMAN-core/src/main/resources/core.properties
index d7dd188..c6d53af 100644
--- a/TASMAN-core/src/main/resources/core.properties
+++ b/TASMAN-core/src/main/resources/core.properties
@@ -5,5 +5,3 @@
 # (It is necessary to put this list here because, unfortunately, there is no
 # easy way to read an entire resource folder using the ClassLoader).
 models = 1,1-IA2,1_1
-
-allow_fictitious_keys = false
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationData.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationData.java
deleted file mode 100644
index 8c0f5b7..0000000
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationData.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/* 
- * _____________________________________________________________________________
- * 
- * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of
- * Trieste INAF - IA2 Italian Center for Astronomical Archives
- * _____________________________________________________________________________
- * 
- * Copyright (C) 2016 Istituto Nazionale di Astrofisica
- * 
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License Version 3 as published by the
- * Free Software Foundation.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package it.inaf.ia2.tsm.webapp;
-
-import it.inaf.ia2.tsm.webapp.xmlconfig.Configuration;
-import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Properties;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.faces.context.FacesContext;
-import javax.inject.Named;
-import javax.xml.bind.JAXB;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
- */
-@Named("config")
-@ApplicationScoped
-public class ConfigurationData {
-
-    private static final Logger LOG = LoggerFactory.getLogger(ConfigurationData.class);
-
-    private File configFile;
-    private Configuration configuration;
-
-    @PostConstruct
-    public void init() {
-        try {
-            Properties prop = new Properties();
-            try (InputStream in = getClass().getClassLoader().getResourceAsStream("webapp.properties")) {
-                prop.load(in);
-            }
-            configFile = new File(prop.getProperty("config_file_path"));
-
-            if (!configFile.exists()) {
-
-                LOG.debug("Configuration file doesn't exist: creating a new one at " + configFile.getAbsolutePath());
-
-                configFile.getParentFile().mkdirs();
-                configFile.createNewFile();
-                configuration = new Configuration();
-                updateConfigurationFile();
-
-            } else {
-
-                // Configuration file exists, simply unmarshal it
-                configuration = JAXB.unmarshal(configFile, Configuration.class);
-            }
-        } catch (IOException e) {
-            throw new ExceptionInInitializerError(e);
-        }
-    }
-
-    public Configuration getData() {
-        return configuration;
-    }
-
-    public synchronized List<UserConfiguration> cloneUsersConfiguration() {
-        // JAXB is exploited for doing deep copy.
-        return JAXB.unmarshal(configFile, Configuration.class).getUsers();
-    }
-
-    public void updateConfigurationFile() throws IOException {
-        JAXB.marshal(configuration, configFile);
-    }
-
-    public synchronized void addUser(UserConfiguration user) throws IOException {
-        configuration.getUsers().add(user);
-        updateConfigurationFile();
-    }
-
-    public synchronized void updateUsersList(List<UserConfiguration> users) throws IOException {
-        configuration.getUsers().clear();
-        for (UserConfiguration user : users) {
-            configuration.getUsers().add(user);
-        }
-        updateConfigurationFile();
-    }
-
-    public String getRestPath() {
-        return FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() + "/faces/rest";
-    }
-
-    public String getVersion() {
-        return Version.NUMBER;
-    }
-}
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationManager.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationManager.java
new file mode 100644
index 0000000..953d010
--- /dev/null
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/ConfigurationManager.java
@@ -0,0 +1,246 @@
+/* 
+ * _____________________________________________________________________________
+ * 
+ * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of
+ * Trieste INAF - IA2 Italian Center for Astronomical Archives
+ * _____________________________________________________________________________
+ * 
+ * Copyright (C) 2016 Istituto Nazionale di Astrofisica
+ * 
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License Version 3 as published by the
+ * Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.inaf.ia2.tsm.webapp;
+
+import it.inaf.ia2.tsm.webapp.xmlconfig.TapCredentials;
+import it.inaf.ia2.tsm.webapp.xmlconfig.UCDConfiguration;
+import it.inaf.ia2.tsm.webapp.xmlconfig.UCDListConfiguration;
+import it.inaf.ia2.tsm.webapp.xmlconfig.UsersConfiguration;
+import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Named;
+import javax.xml.bind.JAXB;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
+ */
+@Named("config")
+@ApplicationScoped
+public class ConfigurationManager {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigurationManager.class);
+
+    private static final String USERS_CONFIG_FILE_NAME = "users.xml";
+    private static final String UCD_CONFIG_FILE_NAME = "ucd.xml";
+
+    private File configDirectory;
+    private File usersConfigFile;
+    private File ucdConfigFile;
+
+    private UsersConfiguration usersConfig;
+    private UCDListConfiguration ucdListConfig;
+
+    @PostConstruct
+    public void init() {
+        try {
+            Properties prop = new Properties();
+            try (InputStream in = getClass().getClassLoader().getResourceAsStream("webapp.properties")) {
+                prop.load(in);
+            }
+            configDirectory = new File(prop.getProperty("config_directory"));
+            usersConfigFile = configDirectory.toPath().resolve(USERS_CONFIG_FILE_NAME).toFile();
+            ucdConfigFile = configDirectory.toPath().resolve(UCD_CONFIG_FILE_NAME).toFile();
+
+            if (!configDirectory.exists()) {
+                configDirectory.mkdirs();
+            }
+
+            if (!usersConfigFile.exists()) {
+                usersConfigFile.createNewFile();
+                usersConfig = new UsersConfiguration();
+                updateUsersConfigurationFile();
+            } else {
+                usersConfig = JAXB.unmarshal(usersConfigFile, UsersConfiguration.class);
+            }
+
+            if (!ucdConfigFile.exists()) {
+                ucdConfigFile.createNewFile();
+                ucdListConfig = new UCDListConfiguration();
+                updateUCDConfigurationFile();
+            } else {
+                ucdListConfig = JAXB.unmarshal(ucdConfigFile, UCDListConfiguration.class);
+            }
+        } catch (IOException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    public List<UserConfiguration> getUsersConfiguration() {
+        return Collections.unmodifiableList(usersConfig.getUsers());
+    }
+
+    public List<UCDConfiguration> getUCDConfiguration() {
+        return Collections.unmodifiableList(ucdListConfig.getUCDList());
+    }
+
+    private void updateUsersConfigurationFile() {
+        JAXB.marshal(usersConfig, usersConfigFile);
+    }
+
+    private void updateUCDConfigurationFile() {
+        JAXB.marshal(ucdListConfig, ucdConfigFile);
+    }
+
+    /**
+     * Add a new user to the list, but only if none of the existing users have
+     * the same username.
+     *
+     * @return true if the user has been added to the list, false otherwise.
+     */
+    public synchronized boolean addUser(UserConfiguration user) {
+        if (user.getUsername() == null) {
+            return false;
+        }
+        
+        for (UserConfiguration u : usersConfig.getUsers()) {
+            if (u.getUsername().equals(user.getUsername())) {
+                return false;
+            }
+        }
+
+        usersConfig.getUsers().add(user);
+        updateUsersConfigurationFile();
+        return true;
+    }
+
+    public synchronized boolean deleteUser(String username) {
+        Iterator<UserConfiguration> ite = usersConfig.getUsers().iterator();
+        while (ite.hasNext()) {
+            UserConfiguration userConfig = ite.next();
+            if (userConfig.getUsername().equals(username)) {
+                ite.remove();
+                updateUsersConfigurationFile();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Add a new UCD to the list, but only if the word has not already been
+     * entered.
+     *
+     * @return true if the UCD has been added to the list, false otherwise.
+     */
+    public synchronized boolean addUCD(UCDConfiguration ucdConfig) {
+        for (UCDConfiguration ucd : ucdListConfig.getUCDList()) {
+            if (ucd.getWord().equals(ucdConfig.getWord())) {
+                return false;
+            }
+        }
+
+        ucdListConfig.getUCDList().add(ucdConfig);
+        updateUCDConfigurationFile();
+        return true;
+    }
+
+    /**
+     * @return true if the UCD has been deleted from the list, false otherwise.
+     */
+    public synchronized boolean deleteUCD(UCDConfiguration ucdConfig) {
+        Iterator<UCDConfiguration> ite = ucdListConfig.getUCDList().iterator();
+        while (ite.hasNext()) {
+            UCDConfiguration ucd = ite.next();
+            if (ucd.getWord().equals(ucdConfig.getWord())) {
+                ite.remove();
+                updateUCDConfigurationFile();
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public List<TapCredentials> getCredentials(String username) {
+        for (UserConfiguration user : usersConfig.getUsers()) {
+            if (user.getUsername().equals(username)) {
+                return Collections.unmodifiableList(user.getCredentialsInfo());
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Add a new credentials to the list, but only if the credentials has not
+     * already been inserted.
+     *
+     * @return true if the credentials has been added to the list, false
+     * otherwise.
+     */
+    public synchronized boolean addCredentials(String username, TapCredentials credentials) {
+        for (UserConfiguration user : usersConfig.getUsers()) {
+            if (user.getUsername().equals(username)) {
+                for (TapCredentials tapCredentials : user.getCredentialsInfo()) {
+                    if (tapCredentials.equals(credentials)) {
+                        return false;
+                    }
+                }
+
+                user.getCredentialsInfo().add(credentials);
+                updateUsersConfigurationFile();
+                return false;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @return true if the credentials has been deleted from the list, false
+     * otherwise.
+     */
+    public synchronized boolean deleteCredentials(String username, TapCredentials credentials) {
+        for (UserConfiguration user : usersConfig.getUsers()) {
+            if (user.getUsername().equals(username)) {
+                Iterator<TapCredentials> ite = user.getCredentialsInfo().iterator();
+                while (ite.hasNext()) {
+                    TapCredentials tapCredentials = ite.next();
+                    if (tapCredentials.equals(credentials)) {
+                        ite.remove();
+                        updateUsersConfigurationFile();
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    public String getRestPath() {
+        return FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() + "/faces/rest";
+    }
+
+    public String getVersion() {
+        return Version.NUMBER;
+    }
+}
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/CredentialsEditing.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/CredentialsEditing.java
index 2820153..3201fa5 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/CredentialsEditing.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/CredentialsEditing.java
@@ -22,6 +22,7 @@
  */
 package it.inaf.ia2.tsm.webapp;
 
+import it.inaf.ia2.tsm.webapp.xmlconfig.SeparatedCredentials;
 import it.inaf.ia2.tsm.datalayer.Credentials;
 import it.inaf.ia2.tsm.datalayer.DBWrapper;
 import java.io.IOException;
@@ -52,7 +53,7 @@ public class CredentialsEditing implements Serializable {
     private User user;
 
     @Inject
-    private ConfigurationData config;
+    private ConfigurationManager config;
 
     @Inject
     private SchemaSelectionBean schemaSelectionBean;
@@ -80,7 +81,7 @@ public class CredentialsEditing implements Serializable {
         currentEditingRow = index;
     }
 
-    public void editSeparateCredentials(SeparateCredentials sc, int index) {
+    public void editSeparateCredentials(SeparatedCredentials sc, int index) {
         this.sourceCredentials = sc.getSourceCredentials();
         this.tapSchemaCredentials = sc.getTapSchemaCredentials();
         currentEditingRow = index;
@@ -118,25 +119,25 @@ public class CredentialsEditing implements Serializable {
     }
 
     public void removeCredentials(int index) throws IOException {
-        getSavedCredentials().remove(index);
-        config.updateConfigurationFile();
+//        getSavedCredentials().remove(index);
+//        config.updateUsersConfigurationFile();
     }
 
     public void saveCredentialsEdited() throws IOException {
-
-        // If is editing existing, remove old for creating a new one
-        if (currentEditingRow < getSavedCredentials().size()) {
-            getSavedCredentials().remove(currentEditingRow);
-        }
-
-        if (separateCredentials) {
-            SeparateCredentials sc = new SeparateCredentials(sourceCredentials, tapSchemaCredentials);
-            getSavedCredentials().add(currentEditingRow, sc);
-        } else {
-            getSavedCredentials().add(currentEditingRow, sourceCredentials);
-        }
-
-        config.updateConfigurationFile();
+//
+//        // If is editing existing, remove old for creating a new one
+//        if (currentEditingRow < getSavedCredentials().size()) {
+//            getSavedCredentials().remove(currentEditingRow);
+//        }
+//
+//        if (separateCredentials) {
+//            SeparatedCredentials sc = new SeparatedCredentials(sourceCredentials, tapSchemaCredentials);
+//            getSavedCredentials().add(currentEditingRow, sc);
+//        } else {
+//            getSavedCredentials().add(currentEditingRow, sourceCredentials);
+//        }
+//
+//        config.updateUsersConfigurationFile();
     }
 
     public boolean isSeparateCredentials() {
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/FirstSetup.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/FirstSetup.java
index 34e1a7b..70078a7 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/FirstSetup.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/FirstSetup.java
@@ -17,7 +17,7 @@ import javax.inject.Named;
 public class FirstSetup {
     
     @Inject
-    ConfigurationData config;
+    ConfigurationManager config;
     
     private String adminUsername;
     private String adminPassword;
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/Login.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/Login.java
index 8c58bb0..f4f59e3 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/Login.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/Login.java
@@ -38,7 +38,7 @@ import javax.inject.Named;
 public class Login {
 
     @Inject
-    private ConfigurationData config;
+    private ConfigurationManager config;
     @Inject
     private User user;
 
@@ -62,7 +62,7 @@ public class Login {
     }
 
     public String login() {
-        for (UserConfiguration u : config.getData().getUsers()) {
+        for (UserConfiguration u : config.getUsersConfiguration()) {
             if (u.getUsername().equals(username) && u.getPassword().equals(password)) {
                 user.login(u);
                 return "credentialsEditing.xhtml?faces-redirect=true";
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SearchUCDDialog.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SearchUCDDialog.java
index 91c8d07..f421706 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SearchUCDDialog.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SearchUCDDialog.java
@@ -40,7 +40,10 @@ public class SearchUCDDialog implements Serializable {
     private static final long serialVersionUID = -3503024742241865133L;
 
     @Inject
-    User user;
+    private ConfigurationManager config;
+
+    @Inject
+    private User user;
 
     private boolean manualInsertion;
 
@@ -153,7 +156,7 @@ public class SearchUCDDialog implements Serializable {
         if (UCDManualText == null || UCDManualText.isEmpty() || UCDManualText.trim().isEmpty()) {
             parsedUCD = null;
         } else {
-            parsedUCD = new ParsedUCD(UCDManualText, user.getUserConfiguration().getCustomUCDs());
+            parsedUCD = new ParsedUCD(UCDManualText, config.getUCDConfiguration());
         }
     }
 
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UCDEditor.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UCDEditor.java
index 2ea0939..cc88797 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UCDEditor.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UCDEditor.java
@@ -3,7 +3,6 @@ package it.inaf.ia2.tsm.webapp;
 import ari.ucidy.UCD;
 import ari.ucidy.UCDParser;
 import it.inaf.ia2.tsm.webapp.xmlconfig.UCDConfiguration;
-import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.List;
@@ -22,7 +21,7 @@ public class UCDEditor implements Serializable {
     private static final long serialVersionUID = -9117203239681234534L;
 
     @Inject
-    private ConfigurationData config;
+    private ConfigurationManager config;
 
     @Inject
     private User user;
@@ -30,20 +29,11 @@ public class UCDEditor implements Serializable {
     private boolean viewExisting;
     private UCDConfiguration newUCDConfiguration;
     private String invalidUCDMessage;
-    private List<UCDConfiguration> customUCDs;
 
     public void openDialog() {
         viewExisting = true;
-        newUCDConfiguration = new UCDConfiguration();
+        newUCDConfiguration = new UCDConfiguration(user.getUsername());
         invalidUCDMessage = null;
-
-        // Retriving UCD list of current user
-        for (UserConfiguration u : config.getData().getUsers()) {
-            if (u.getUsername().equals(user.getUsername())) {
-                customUCDs = u.getCustomUCDs();
-                break;
-            }
-        }
     }
 
     public boolean isViewExisting() {
@@ -60,7 +50,14 @@ public class UCDEditor implements Serializable {
     }
 
     public List<UCDConfiguration> getCustomUCDs() {
-        return customUCDs;
+        return config.getUCDConfiguration();
+    }
+
+    public boolean isEditable(UCDConfiguration ucdConfig) {
+        if (user.isAdmin()) {
+            return true;
+        }
+        return ucdConfig.getCreator().equals(user.getUsername());
     }
 
     public void addUCD() throws IOException {
@@ -78,15 +75,15 @@ public class UCDEditor implements Serializable {
             invalidUCDMessage = "Invalid UCD word syntax";
             return;
         }
-
-        customUCDs.add(newUCDConfiguration);
-        newUCDConfiguration = new UCDConfiguration();
-        config.updateConfigurationFile();
+//
+//        newUCDConfiguration = new UCDConfiguration(user.getUsername());
+//        if(config.addUCD(newUCDConfiguration)) {
+//            ne
+//        }
     }
 
-    public void removeUCD(int index) throws IOException {
-        customUCDs.remove(index);
-        config.updateConfigurationFile();
+    public void removeUCD(UCDConfiguration ucd) {
+        config.deleteUCD(ucd);
     }
 
     /**
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/User.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/User.java
index ee72326..c385acf 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/User.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/User.java
@@ -41,7 +41,7 @@ public class User implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Inject
-    ConfigurationData config;
+    ConfigurationManager config;
 
     private UserConfiguration userConfiguration;
 
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UsersEditing.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UsersEditing.java
index 93c42a5..04b8daa 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UsersEditing.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/UsersEditing.java
@@ -23,11 +23,8 @@
 package it.inaf.ia2.tsm.webapp;
 
 import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
-import java.io.IOException;
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.List;
-import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.apache.deltaspike.core.api.scope.WindowScoped;
@@ -43,34 +40,41 @@ public class UsersEditing implements Serializable {
     private static final long serialVersionUID = -8758568990541836689L;
 
     @Inject
-    private ConfigurationData config;
+    private ConfigurationManager config;
 
-    private List<UserConfiguration> users;
-
-    @PostConstruct
-    public void init() {
-        users = new ArrayList<>();
-    }
+    private UserConfiguration newUser;
 
     public String open() {
-        // Copying users list (to avoid issues caused by simultaneously changes)
-        users = config.cloneUsersConfiguration();
         return "usersEditing.xhtml?faces-redirect=true";
     }
 
     public List<UserConfiguration> getUsers() {
-        return users;
+        return config.getUsersConfiguration();
+    }
+
+    public void save() {
+        //config.updateUsersList(users);
     }
 
-    public void save() throws IOException {
-        config.updateUsersList(users);
+    public void createNewUser() {
+        newUser = new UserConfiguration();
     }
 
     public void addUser() {
-        users.add(new UserConfiguration());
+        if (newUser != null) {
+            config.addUser(newUser);
+        }
+    }
+
+    public void removeUser(UserConfiguration user) {
+        config.deleteUser(user.getUsername());
+    }
+
+    public UserConfiguration getNewUser() {
+        return newUser;
     }
 
-    public void removeUser(int index) {
-        users.remove(index);
+    public void setNewUser(UserConfiguration newUser) {
+        this.newUser = newUser;
     }
 }
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/checker/FirstSetupChecker.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/checker/FirstSetupChecker.java
index 6450c4e..a11059c 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/checker/FirstSetupChecker.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/checker/FirstSetupChecker.java
@@ -22,8 +22,7 @@
  */
 package it.inaf.ia2.tsm.webapp.checker;
 
-import it.inaf.ia2.tsm.webapp.ConfigurationData;
-import it.inaf.ia2.tsm.webapp.xmlconfig.Configuration;
+import it.inaf.ia2.tsm.webapp.ConfigurationManager;
 import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.context.FacesContext;
@@ -39,12 +38,11 @@ import javax.inject.Named;
 public class FirstSetupChecker {
 
     @Inject
-    private ConfigurationData config;
+    private ConfigurationManager config;
 
     public boolean isFirstSetupCompleted() {
-        Configuration c = config.getData();
-        for (UserConfiguration user : c.getUsers()) {
-            if ("admin".equals(user.getRole())) {
+        for (UserConfiguration userConfig : config.getUsersConfiguration()) {
+            if ("admin".equals(userConfig.getRole())) {
                 return true;
             }
         }
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/JoinedCredentials.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/JoinedCredentials.java
new file mode 100644
index 0000000..731c1bd
--- /dev/null
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/JoinedCredentials.java
@@ -0,0 +1,79 @@
+/*
+ * _____________________________________________________________________________
+ * 
+ * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of
+ * Trieste INAF - IA2 Italian Center for Astronomical Archives
+ * _____________________________________________________________________________
+ * 
+ * Copyright (C) 2017 Istituto Nazionale di Astrofisica
+ * 
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License Version 3 as published by the
+ * Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.inaf.ia2.tsm.webapp.xmlconfig;
+
+import it.inaf.ia2.tsm.datalayer.Credentials;
+import java.util.Objects;
+
+/**
+ *
+ * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
+ */
+public class JoinedCredentials extends TapCredentials {
+
+    private static final long serialVersionUID = 6683479851687703335L;
+
+    private Credentials credentials;
+
+    public JoinedCredentials() {
+    }
+
+    public JoinedCredentials(Credentials credentials) {
+        this.credentials = credentials;
+    }
+
+    public Credentials getCredentials() {
+        return credentials;
+    }
+
+    public void setCredentials(Credentials credentials) {
+        this.credentials = credentials;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 53 * hash + Objects.hashCode(this.credentials);
+        hash = 53 * hash + Objects.hashCode(this.getTapSchemaName());
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final JoinedCredentials other = (JoinedCredentials) obj;
+
+        if (!Objects.equals(this.credentials, other.credentials)) {
+            return false;
+        }
+        return Objects.equals(this.getTapSchemaName(), other.getTapSchemaName());
+    }
+}
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SeparateCredentials.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/SeparatedCredentials.java
similarity index 62%
rename from TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SeparateCredentials.java
rename to TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/SeparatedCredentials.java
index f3c072c..4024a60 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/SeparateCredentials.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/SeparatedCredentials.java
@@ -20,27 +20,27 @@
  * this program; if not, write to the Free Software Foundation, Inc., 51
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
-package it.inaf.ia2.tsm.webapp;
+package it.inaf.ia2.tsm.webapp.xmlconfig;
 
 import it.inaf.ia2.tsm.datalayer.Credentials;
-import java.io.Serializable;
+import java.util.Objects;
 import javax.xml.bind.annotation.XmlElement;
 
 /**
  *
  * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
  */
-public class SeparateCredentials implements Serializable {
+public class SeparatedCredentials extends TapCredentials {
 
     private static final long serialVersionUID = 2108950341601128938L;
 
     private Credentials sourceCredentials;
     private Credentials tapSchemaCredentials;
 
-    public SeparateCredentials() {
+    public SeparatedCredentials() {
     }
 
-    public SeparateCredentials(Credentials sourceCredentials, Credentials tapSchemaCredentials) {
+    public SeparatedCredentials(Credentials sourceCredentials, Credentials tapSchemaCredentials) {
         this.sourceCredentials = sourceCredentials;
         this.tapSchemaCredentials = tapSchemaCredentials;
     }
@@ -62,4 +62,35 @@ public class SeparateCredentials implements Serializable {
     public void setTapSchemaCredentials(Credentials tapSchemaCredentials) {
         this.tapSchemaCredentials = tapSchemaCredentials;
     }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 53 * hash + Objects.hashCode(this.sourceCredentials);
+        hash = 53 * hash + Objects.hashCode(this.tapSchemaCredentials);
+        hash = 53 * hash + Objects.hashCode(this.getTapSchemaName());
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final SeparatedCredentials other = (SeparatedCredentials) obj;
+
+        if (!Objects.equals(this.sourceCredentials, other.getSourceCredentials())) {
+            return false;
+        }
+        if (!Objects.equals(this.tapSchemaCredentials, other.getTapSchemaCredentials())) {
+            return false;
+        }
+        return Objects.equals(this.getTapSchemaName(), other.getTapSchemaName());
+    }
 }
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/TapCredentials.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/TapCredentials.java
new file mode 100644
index 0000000..f4c8c1a
--- /dev/null
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/TapCredentials.java
@@ -0,0 +1,66 @@
+/*
+ * _____________________________________________________________________________
+ * 
+ * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of
+ * Trieste INAF - IA2 Italian Center for Astronomical Archives
+ * _____________________________________________________________________________
+ * 
+ * Copyright (C) 2017 Istituto Nazionale di Astrofisica
+ * 
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License Version 3 as published by the
+ * Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.inaf.ia2.tsm.webapp.xmlconfig;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ *
+ * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
+ */
+public abstract class TapCredentials implements Serializable {
+
+    private static final long serialVersionUID = -3736612935129057338L;
+
+    private String tapSchemaName;
+    private String tapSchemaVersion;
+    private boolean hasObscore;
+
+    @XmlElement(name = "tap_schema_name")
+    public String getTapSchemaName() {
+        return tapSchemaName;
+    }
+
+    public void setTapSchemaName(String tapSchemaName) {
+        this.tapSchemaName = tapSchemaName;
+    }
+
+    @XmlElement(name = "tap_schema_version")
+    public String getTapSchemaVersion() {
+        return tapSchemaVersion;
+    }
+
+    public void setTapSchemaVersion(String tapSchemaVersion) {
+        this.tapSchemaVersion = tapSchemaVersion;
+    }
+
+    @XmlElement(name = "obscore")
+    public boolean isHasObscore() {
+        return hasObscore;
+    }
+
+    public void setHasObscore(boolean hasObscore) {
+        this.hasObscore = hasObscore;
+    }
+}
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDConfiguration.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDConfiguration.java
index 3cd80ff..a8b58f4 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDConfiguration.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDConfiguration.java
@@ -24,6 +24,7 @@ package it.inaf.ia2.tsm.webapp.xmlconfig;
 
 import ari.ucidy.UCDSyntax;
 import java.io.Serializable;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 
 /**
@@ -38,11 +39,17 @@ public class UCDConfiguration implements Serializable {
     private UCDSyntax syntax;
     private String word;
     private String description;
+    private String creator;
 
-    public UCDConfiguration() {
+    private UCDConfiguration() {
         syntax = UCDSyntax.BOTH;
     }
 
+    public UCDConfiguration(String creator) {
+        this();
+        this.creator = creator;
+    }
+
     @XmlElement(name = "code")
     public UCDSyntax getSyntax() {
         return syntax;
@@ -73,6 +80,19 @@ public class UCDConfiguration implements Serializable {
         this.description = description;
     }
 
+    /**
+     * The user that created the UCD. This is used to assign delete privilege on
+     * the UCD.
+     */
+    @XmlAttribute(name = "creator")
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
     public String getCode() {
         switch (syntax) {
             case PRIMARY:
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDListConfiguration.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDListConfiguration.java
new file mode 100644
index 0000000..2109304
--- /dev/null
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UCDListConfiguration.java
@@ -0,0 +1,53 @@
+/*
+ * _____________________________________________________________________________
+ * 
+ * INAF - OATS National Institute for Astrophysics - Astronomical Observatory of
+ * Trieste INAF - IA2 Italian Center for Astronomical Archives
+ * _____________________________________________________________________________
+ * 
+ * Copyright (C) 2017 Istituto Nazionale di Astrofisica
+ * 
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License Version 3 as published by the
+ * Free Software Foundation.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.inaf.ia2.tsm.webapp.xmlconfig;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
+ */
+@XmlRootElement(name = "ucd-configuration")
+public class UCDListConfiguration implements Serializable {
+
+    private static final long serialVersionUID = -751858966136122647L;
+
+    private final List<UCDConfiguration> ucdConfigs;
+
+    public UCDListConfiguration() {
+        ucdConfigs = new ArrayList<>();
+    }
+
+    @XmlElements({
+        @XmlElement(name = "ucd")
+    })
+    public List<UCDConfiguration> getUCDList() {
+        return ucdConfigs;
+    }
+}
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UserConfiguration.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UserConfiguration.java
index b7e7592..1a94038 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UserConfiguration.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UserConfiguration.java
@@ -22,8 +22,6 @@
  */
 package it.inaf.ia2.tsm.webapp.xmlconfig;
 
-import it.inaf.ia2.tsm.datalayer.Credentials;
-import it.inaf.ia2.tsm.webapp.SeparateCredentials;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
@@ -43,14 +41,12 @@ public class UserConfiguration implements Serializable {
     private String role;
     private String username;
     private String password;
-    private final List<UCDConfiguration> customUCDs;
-    private final List<Object> credentialsInfo;
+    private final List<TapCredentials> credentialsInfo;
 
     public UserConfiguration() {
         credentialsInfo = new ArrayList<>();
-        customUCDs = new ArrayList<>();
     }
-    
+
     @XmlAttribute(name = "username")
     public String getUsername() {
         return username;
@@ -69,11 +65,11 @@ public class UserConfiguration implements Serializable {
         this.password = password;
     }
 
-    public void addCredentials(Credentials credentials) {
+    public void addCredentials(JoinedCredentials credentials) {
         credentialsInfo.add(credentials);
     }
 
-    public void addSeparateCredentials(SeparateCredentials separateCredentials) {
+    public void addSeparateCredentials(SeparatedCredentials separateCredentials) {
         credentialsInfo.add(separateCredentials);
     }
 
@@ -88,17 +84,11 @@ public class UserConfiguration implements Serializable {
 
     @XmlElementWrapper(name = "credentials-configuration")
     @XmlElements({
-        @XmlElement(name = "credentials", type = Credentials.class)
+        @XmlElement(name = "credentials", type = JoinedCredentials.class)
         ,
-        @XmlElement(name = "separate-credentials", type = SeparateCredentials.class)
+        @XmlElement(name = "separated-credentials", type = SeparatedCredentials.class)
     })
-    public List<Object> getCredentialsInfo() {
+    public List<TapCredentials> getCredentialsInfo() {
         return credentialsInfo;
     }
-
-    @XmlElementWrapper(name = "ucd-list")
-    @XmlElement(name = "ucd")
-    public List<UCDConfiguration> getCustomUCDs() {
-        return customUCDs;
-    }
 }
diff --git a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/Configuration.java b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UsersConfiguration.java
similarity index 82%
rename from TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/Configuration.java
rename to TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UsersConfiguration.java
index ca6386a..08a3ec3 100644
--- a/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/Configuration.java
+++ b/TASMAN-webapp/src/main/java/it/inaf/ia2/tsm/webapp/xmlconfig/UsersConfiguration.java
@@ -22,11 +22,9 @@
  */
 package it.inaf.ia2.tsm.webapp.xmlconfig;
 
-import it.inaf.ia2.tsm.webapp.Version;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -36,16 +34,14 @@ import javax.xml.bind.annotation.XmlRootElement;
  *
  * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
  */
-@XmlRootElement(name = "configuration")
-public class Configuration implements Serializable {
+@XmlRootElement(name = "users-configuration")
+public class UsersConfiguration implements Serializable {
 
     private static final long serialVersionUID = 5424034991075602177L;
 
-    private final String version;
     private final List<UserConfiguration> users;
 
-    public Configuration() {
-        version = Version.NUMBER;
+    public UsersConfiguration() {
         users = new ArrayList<>();
     }
 
@@ -55,9 +51,4 @@ public class Configuration implements Serializable {
     public List<UserConfiguration> getUsers() {
         return users;
     }
-
-    @XmlAttribute(name = "version")
-    public String getVersion() {
-        return version;
-    }
 }
diff --git a/TASMAN-webapp/src/main/resources/webapp.properties b/TASMAN-webapp/src/main/resources/webapp.properties
index 8a2b506..bb985de 100644
--- a/TASMAN-webapp/src/main/resources/webapp.properties
+++ b/TASMAN-webapp/src/main/resources/webapp.properties
@@ -1,2 +1,2 @@
 ucd_service_url=http://ia2-vo.oats.inaf.it/ucd/
-config_file_path=/home/sonia/.tsm/config.xml
\ No newline at end of file
+config_directory=/home/sonia/.tasman
\ No newline at end of file
diff --git a/TASMAN-webapp/src/main/webapp/resources/tsm_components/ucd_editor.xhtml b/TASMAN-webapp/src/main/webapp/resources/tsm_components/ucd_editor.xhtml
index 39acc18..d148008 100644
--- a/TASMAN-webapp/src/main/webapp/resources/tsm_components/ucd_editor.xhtml
+++ b/TASMAN-webapp/src/main/webapp/resources/tsm_components/ucd_editor.xhtml
@@ -31,7 +31,7 @@
                                 <ul>
                                     <ui:repeat value="#{ucdEditor.customUCDs}" var="ucd" varStatus="loop">
                                         <li>
-                                            <h:commandLink class="text-danger" action="#{ucdEditor.removeUCD(loop.index)}">
+                                            <h:commandLink class="text-danger" action="#{ucdEditor.removeUCD(ucd)}">
                                                 &#215;
                                                 <ui:remove>
                                                     <!-- Note: due to a strange JSF bug following render attribute needs complete component id reference -->
diff --git a/TASMAN-webapp/src/main/webapp/setup.xhtml b/TASMAN-webapp/src/main/webapp/setup.xhtml
index 777fa5f..c2097b4 100644
--- a/TASMAN-webapp/src/main/webapp/setup.xhtml
+++ b/TASMAN-webapp/src/main/webapp/setup.xhtml
@@ -25,13 +25,13 @@
                             <div class="form-group">
                                 <h:outputLabel for="admin-password" class="control-label col-xs-2">Admin password</h:outputLabel>
                                 <div class="col-xs-5">
-                                    <h:inputText class="form-control" id="admin-password" value="#{firstSetup.adminPassword}" required="true" requiredMessage="Specify a password"  />
+                                    <h:inputSecret class="form-control" id="admin-password" value="#{firstSetup.adminPassword}" required="true" requiredMessage="Specify a password"  />
                                 </div>
                             </div>
                             <div class="form-group">
                                 <h:outputLabel for="admin-password-confirm" class="control-label col-xs-2">Re-enter password</h:outputLabel>
                                 <div class="col-xs-5">
-                                    <h:inputText class="form-control" id="admin-password-confirm" value="#{firstSetup.adminPasswordConfirm}" required="true" requiredMessage="Insert password confirmation"  />
+                                    <h:inputSecret class="form-control" id="admin-password-confirm" value="#{firstSetup.adminPasswordConfirm}" required="true" requiredMessage="Insert password confirmation"  />
                                 </div>
                             </div>
                             <div class="row">    
diff --git a/TASMAN-webapp/src/test/java/TapSchemaMangerTest.java b/TASMAN-webapp/src/test/java/TapSchemaMangerTest.java
index a960597..dc61a5a 100644
--- a/TASMAN-webapp/src/test/java/TapSchemaMangerTest.java
+++ b/TASMAN-webapp/src/test/java/TapSchemaMangerTest.java
@@ -20,7 +20,7 @@
  * this program; if not, write to the Free Software Foundation, Inc., 51
  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
-import it.inaf.ia2.tsm.webapp.SeparateCredentials;
+import it.inaf.ia2.tsm.webapp.xmlconfig.SeparatedCredentials;
 import it.inaf.ia2.tsm.datalayer.Credentials;
 import it.inaf.ia2.tsm.webapp.xmlconfig.UserConfiguration;
 import java.io.StringReader;
-- 
GitLab