changeset 5:5a49956df427 database-connection-manager

LTPDAPreferences panel for new LTPDADatabaseConnectionManager
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents e3c5468b1bfe
children 2b57573b11c7
files src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroup.java src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.form src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.java src/MPipeline2/src/mpipeline/plisttable/JPlist.java
diffstat 4 files changed, 181 insertions(+), 287 deletions(-) [+]
line wrap: on
line diff
--- a/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroup.java	Mon Dec 05 16:20:06 2011 +0100
+++ b/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroup.java	Mon Dec 05 16:20:06 2011 +0100
@@ -5,15 +5,11 @@
 package mpipeline.ltpdapreferences;
 
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
 import mpipeline.utils.MXMLUtils;
-import mpipeline.utils.Utils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 /**
  *
@@ -26,7 +22,6 @@
   public static final int REPOSITORY_CACHE_PASSWORD_CHANGED = 3;
   public static final int REPOSITORY_MAX_CONNECTIONS_NUMBER_CHANGED = 4;
   
-  private ArrayList<String> hostnames = new ArrayList<String>();
   private Integer expiry = 60;
   private Integer cachePassword = 2;
   private Integer maxConnectionsNumber = 10;
@@ -38,45 +33,21 @@
 
     NamedNodeMap nmap = node.getAttributes();
     expiry = MXMLUtils.getIntegerFromNode("expiry", nmap, version, version);
-
-    NodeList nl = node.getChildNodes();
-    for (int ii = 0; ii < nl.getLength(); ii++) {
-      Node n = nl.item(ii);
-      Utils.dmsg(" reading child node: " + n.getNodeName());
-      if (n.getNodeName().equals("Hostname")) {
-        NamedNodeMap wbnm = n.getAttributes();
-        String path = MXMLUtils.getStringFromNode("Host", wbnm, version, version);
-        this.addHostname(path);
-      }
-    }
+    cachePassword = MXMLUtils.getIntegerFromNode("cachePassword", nmap, version, version);
+    if (cachePassword < 0)
+        cachePassword = 2;
+    maxConnectionsNumber = MXMLUtils.getIntegerFromNode("maxConnectionsNumber", nmap, version, version);
+    if (maxConnectionsNumber < 0)
+        maxConnectionsNumber = 10;
   }
 
   public void attachToDom(Document doc, Element tnode) {
 
     Element pnode = doc.createElement("Repository");
-
     pnode.setAttribute("expiry", ""+expiry);
-
-    Iterator it = hostnames.iterator();
-    while (it.hasNext()) {
-      String path = (String) it.next();
-      Element snode = doc.createElement("Hostname");
-      snode.setAttribute("Host", path);
-      pnode.appendChild(snode);
-    }
-
+    pnode.setAttribute("cachePassword", ""+cachePassword);
+    pnode.setAttribute("maxConnectionsNumber", ""+maxConnectionsNumber);
     tnode.appendChild(pnode);
-
-  }
-
-  public void addHostname(String host) {
-    hostnames.add(host);
-    this.setChanged();
-    this.notifyObservers(REPOSITORY_HOSTNAMES_CHANGED);
-  }
-
-  public ArrayList<String> getHostnames() {
-    return hostnames;
   }
 
   public Integer getExpiry() {
@@ -88,18 +59,6 @@
     setChanged();
     notifyObservers(REPOSITORY_EXPIRY_CHANGED);
   }
-
-  public void setHostnames(ArrayList<String> hostnames) {
-    this.hostnames = hostnames;
-    setChanged();
-    notifyObservers(REPOSITORY_HOSTNAMES_CHANGED);
-  }
-
-  public void removeHostnames(Object objs[]) {
-    hostnames.removeAll(Arrays.asList(objs));
-    this.setChanged();
-    this.notifyObservers(REPOSITORY_HOSTNAMES_CHANGED);
-  }
   
   public Integer getCachePassword() {
       return cachePassword;
@@ -121,6 +80,11 @@
       notifyObservers(REPOSITORY_MAX_CONNECTIONS_NUMBER_CHANGED);
   }
   
+  // for backward compatibility
+  public ArrayList<String> getHostnames() {
+    return new ArrayList<String>();
+  }
+  
   public void display() {
     System.out.printf(
         "RepositoryPrefGroup(expiry=%d, cachePassword=%d, maxConnectionsNumber=%d)\n",
--- a/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.form	Mon Dec 05 16:20:06 2011 +0100
+++ b/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.form	Mon Dec 05 16:20:06 2011 +0100
@@ -16,30 +16,30 @@
   <Layout>
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
-          <Group type="102" alignment="1" attributes="0">
+          <Group type="102" attributes="0">
               <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="1" attributes="0">
-                  <Component id="removeBtn" alignment="1" min="-2" max="-2" attributes="0"/>
-                  <Component id="jScrollPane1" alignment="0" pref="380" max="32767" attributes="0"/>
-                  <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
-                  <Group type="102" alignment="1" attributes="0">
-                      <Group type="103" groupAlignment="1" attributes="0">
-                          <Group type="102" attributes="0">
-                              <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" alignment="0" attributes="0">
+                      <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="maxConnectionsNumberSpinner" min="-2" pref="48" max="-2" attributes="1"/>
+                  </Group>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Group type="103" groupAlignment="1" max="-2" attributes="0">
+                          <Group type="102" alignment="0" attributes="1">
+                              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
                               <EmptySpace max="-2" attributes="0"/>
-                              <Component id="expirySpinner" max="32767" attributes="0"/>
+                              <Component id="cachePasswordComboBox" max="32767" attributes="1"/>
                           </Group>
-                          <Group type="102" alignment="1" attributes="0">
-                              <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
-                              <EmptySpace max="-2" attributes="0"/>
-                              <Component id="newHostnameTextField" pref="226" max="32767" attributes="0"/>
-                          </Group>
+                          <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
                       </Group>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="addBtn" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="expirySpinner" min="-2" pref="59" max="-2" attributes="1"/>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Component id="jLabel4" min="-2" max="-2" attributes="0"/>
                   </Group>
               </Group>
-              <EmptySpace max="-2" attributes="0"/>
+              <EmptySpace max="32767" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
@@ -47,23 +47,20 @@
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
               <EmptySpace max="-2" attributes="0"/>
-              <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="maxConnectionsNumberSpinner" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
               <EmptySpace type="unrelated" max="-2" attributes="0"/>
-              <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="0" attributes="0">
-                  <Group type="103" alignment="0" groupAlignment="3" attributes="0">
-                      <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="newHostnameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
-                  </Group>
-                  <Component id="addBtn" min="-2" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="cachePasswordComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
               </Group>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="removeBtn" min="-2" max="-2" attributes="0"/>
-              <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="2" attributes="0">
-                  <Component id="jLabel3" alignment="2" min="-2" max="-2" attributes="0"/>
-                  <Component id="expirySpinner" alignment="2" min="-2" max="-2" attributes="0"/>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="expirySpinner" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
               </Group>
               <EmptySpace max="32767" attributes="0"/>
           </Group>
@@ -71,63 +68,9 @@
     </DimensionLayout>
   </Layout>
   <SubComponents>
-    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
-      <AuxValues>
-        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
-      </AuxValues>
-
-      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
-      <SubComponents>
-        <Component class="javax.swing.JList" name="hostnameList">
-          <Properties>
-            <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
-              <StringArray count="0"/>
-            </Property>
-          </Properties>
-        </Component>
-      </SubComponents>
-    </Container>
-    <Component class="javax.swing.JTextField" name="newHostnameTextField">
-    </Component>
-    <Component class="javax.swing.JLabel" name="jLabel1">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="New Hostname:"/>
-      </Properties>
-    </Component>
-    <Component class="javax.swing.JButton" name="addBtn">
-      <Properties>
-        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
-          <Image iconType="3" name="/mpipeline/icons/add_small.png"/>
-        </Property>
-        <Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
-          <Image iconType="3" name="/mpipeline/icons/add_small_ro.png"/>
-        </Property>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JButton" name="removeBtn">
-      <Properties>
-        <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
-          <Image iconType="3" name="/mpipeline/icons/subtract_small.png"/>
-        </Property>
-        <Property name="rolloverIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
-          <Image iconType="3" name="/mpipeline/icons/subtract_small_ro.png"/>
-        </Property>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeBtnActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JLabel" name="jLabel2">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="User-defined LTPDA Repository Hostnames"/>
-      </Properties>
-    </Component>
     <Component class="javax.swing.JLabel" name="jLabel3">
       <Properties>
-        <Property name="text" type="java.lang.String" value="Repository Login Expiry (s):"/>
+        <Property name="text" type="java.lang.String" value="Cached passwords expire after:"/>
       </Properties>
     </Component>
     <Component class="javax.swing.JSpinner" name="expirySpinner">
@@ -137,5 +80,38 @@
         </Property>
       </Properties>
     </Component>
+    <Component class="javax.swing.JLabel" name="jLabel1">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Maximum number of simultaneous database connections:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel2">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Cache password:"/>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JSpinner" name="maxConnectionsNumberSpinner">
+      <Properties>
+        <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
+          <SpinnerModel initial="1" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JComboBox" name="cachePasswordComboBox">
+      <Properties>
+        <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+          <StringArray count="3">
+            <StringItem index="0" value="No"/>
+            <StringItem index="1" value="Yes"/>
+            <StringItem index="2" value="Ask"/>
+          </StringArray>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JLabel" name="jLabel4">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="[seconds]"/>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>
--- a/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.java	Mon Dec 05 16:20:06 2011 +0100
+++ b/src/MPipeline2/src/mpipeline/ltpdapreferences/RepositoryPrefGroupPanel.java	Mon Dec 05 16:20:06 2011 +0100
@@ -12,13 +12,8 @@
 
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Observable;
 import java.util.Observer;
-import javax.swing.DefaultListModel;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
@@ -35,17 +30,17 @@
     this.repoPrefs = repoPrefs;
     initComponents();
 
-    DefaultListModel mdl = new DefaultListModel();
-    hostnameList.setModel(mdl);
     setPreferences();
     repoPrefs.addObserver(this);
 
+    maxConnectionsNumberSpinner.addChangeListener(this);
+    cachePasswordComboBox.addActionListener(this);
     expirySpinner.addChangeListener(this);
-
   }
 
   public void setPreferences() {
-    updateHostnames();
+    updateMaxConnectionsNumber();
+    updateCachePasswords();
     updateExpiry();
   }
 
@@ -55,157 +50,132 @@
    * always regenerated by the Form Editor.
    */
   @SuppressWarnings("unchecked")
-  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
-  private void initComponents() {
+    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+    private void initComponents() {
 
-    jScrollPane1 = new javax.swing.JScrollPane();
-    hostnameList = new javax.swing.JList();
-    newHostnameTextField = new javax.swing.JTextField();
-    jLabel1 = new javax.swing.JLabel();
-    addBtn = new javax.swing.JButton();
-    removeBtn = new javax.swing.JButton();
-    jLabel2 = new javax.swing.JLabel();
-    jLabel3 = new javax.swing.JLabel();
-    expirySpinner = new javax.swing.JSpinner();
-
-    jScrollPane1.setViewportView(hostnameList);
-
-    jLabel1.setText("New Hostname:");
+        jLabel3 = new javax.swing.JLabel();
+        expirySpinner = new javax.swing.JSpinner();
+        jLabel1 = new javax.swing.JLabel();
+        jLabel2 = new javax.swing.JLabel();
+        maxConnectionsNumberSpinner = new javax.swing.JSpinner();
+        cachePasswordComboBox = new javax.swing.JComboBox();
+        jLabel4 = new javax.swing.JLabel();
 
-    addBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpipeline/icons/add_small.png"))); // NOI18N
-    addBtn.setRolloverEnabled(true);
-    addBtn.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/mpipeline/icons/add_small_ro.png"))); // NOI18N
-    addBtn.addActionListener(new java.awt.event.ActionListener() {
-      public void actionPerformed(java.awt.event.ActionEvent evt) {
-        addBtnActionPerformed(evt);
-      }
-    });
+        jLabel3.setText("Cached passwords expire after:");
+
+        expirySpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 10000000, 10));
+
+        jLabel1.setText("Maximum number of simultaneous database connections:");
 
-    removeBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mpipeline/icons/subtract_small.png"))); // NOI18N
-    removeBtn.setRolloverEnabled(true);
-    removeBtn.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/mpipeline/icons/subtract_small_ro.png"))); // NOI18N
-    removeBtn.addActionListener(new java.awt.event.ActionListener() {
-      public void actionPerformed(java.awt.event.ActionEvent evt) {
-        removeBtnActionPerformed(evt);
-      }
-    });
+        jLabel2.setText("Cache password:");
+
+        maxConnectionsNumberSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), Integer.valueOf(1), null, Integer.valueOf(1)));
 
-    jLabel2.setText("User-defined LTPDA Repository Hostnames");
+        cachePasswordComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "No", "Yes", "Ask" }));
 
-    jLabel3.setText("Repository Login Expiry (s):");
-
-    expirySpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 10000000, 10));
+        jLabel4.setText("[seconds]");
 
-    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
-    this.setLayout(layout);
-    layout.setHorizontalGroup(
-      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-      .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
-        .addContainerGap()
-        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
-          .add(removeBtn)
-          .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 372, Short.MAX_VALUE)
-          .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2)
-          .add(layout.createSequentialGroup()
-            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
-              .add(layout.createSequentialGroup()
-                .add(jLabel3)
-                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-                .add(expirySpinner))
-              .add(layout.createSequentialGroup()
-                .add(jLabel1)
-                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-                .add(newHostnameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)))
-            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
-            .add(addBtn)))
-        .addContainerGap())
-    );
-    layout.setVerticalGroup(
-      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-      .add(layout.createSequentialGroup()
-        .addContainerGap()
-        .add(jLabel2)
-        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
-        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
-        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-          .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
-            .add(jLabel1)
-            .add(newHostnameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
-          .add(addBtn))
-        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-        .add(removeBtn)
-        .add(10, 10, 10)
-        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
-          .add(jLabel3)
-          .add(expirySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
-        .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-    );
-  }// </editor-fold>//GEN-END:initComponents
-
-  private void removeBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeBtnActionPerformed
-    // get selected index
-    Object objs[] = hostnameList.getSelectedValues();
-    repoPrefs.removeHostnames(objs);
-  }//GEN-LAST:event_removeBtnActionPerformed
-
-  private void addBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBtnActionPerformed
-
-    if (newHostnameTextField.getText().length() != 0) {
-      repoPrefs.addHostname(newHostnameTextField.getText());
-    }
-  }//GEN-LAST:event_addBtnActionPerformed
+        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .addContainerGap()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+                    .add(layout.createSequentialGroup()
+                        .add(jLabel1)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(maxConnectionsNumberSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 48, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                    .add(layout.createSequentialGroup()
+                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
+                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
+                                .add(jLabel2)
+                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                                .add(cachePasswordComboBox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+                            .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3))
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(expirySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 59, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+                        .add(jLabel4)))
+                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .addContainerGap()
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel1)
+                    .add(maxConnectionsNumberSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel2)
+                    .add(cachePasswordComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
+                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+                    .add(jLabel3)
+                    .add(expirySpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+                    .add(jLabel4))
+                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+        );
+    }// </editor-fold>//GEN-END:initComponents
 
   public void update(Observable o, Object arg) {
     if (arg != null) {
-
       if (arg instanceof Integer) {
         int identifier = ((Integer) arg).intValue();
-
-        if (identifier == RepositoryPrefGroup.REPOSITORY_EXPIRY_CHANGED) {
-          updateExpiry();
-        }
-        else if (identifier == RepositoryPrefGroup.REPOSITORY_HOSTNAMES_CHANGED) {
-          updateHostnames();
-        }
-        else {
-          System.err.println("Unknown observation argument: " + arg.toString());
+        switch (identifier) {
+          case RepositoryPrefGroup.REPOSITORY_EXPIRY_CHANGED:
+            updateExpiry();
+            break;
+          case RepositoryPrefGroup.REPOSITORY_MAX_CONNECTIONS_NUMBER_CHANGED:
+            updateMaxConnectionsNumber();
+            break;
+          case RepositoryPrefGroup.REPOSITORY_CACHE_PASSWORD_CHANGED:
+            updateCachePasswords();
+            break;
+          default:
+            System.err.println("Unknown observation argument: " + arg.toString());
         }
       }
     }
   }
 
+  private void updateMaxConnectionsNumber() {
+    maxConnectionsNumberSpinner.setValue(repoPrefs.getMaxConnectionsNumber());
+  }
+  
+  private void updateCachePasswords() {
+    cachePasswordComboBox.setSelectedIndex(repoPrefs.getCachePassword().intValue());
+  }
+  
   private void updateExpiry() {
     expirySpinner.setValue(repoPrefs.getExpiry());
   }
 
-  private void updateHostnames() {
-    DefaultListModel mmdl = (DefaultListModel) hostnameList.getModel();
-    mmdl.removeAllElements();
-    Iterator it = repoPrefs.getHostnames().iterator();
-    while (it.hasNext()) {
-      String path = (String) it.next();
-      mmdl.addElement(path);
-    }
-  }
-
   public void stateChanged(ChangeEvent e) {
     if (e.getSource() == expirySpinner) {
       repoPrefs.setExpiry((Integer) expirySpinner.getValue());
+      return;
+    }
+    if (e.getSource() == maxConnectionsNumberSpinner) {
+      repoPrefs.setMaxConnectionsNumber((Integer) maxConnectionsNumberSpinner.getValue());
+      return;
     }
   }
 
   public void actionPerformed(ActionEvent e) {
+    if (e.getSource() == cachePasswordComboBox) {
+      repoPrefs.setCachePassword((Integer) cachePasswordComboBox.getSelectedIndex());
+      return;  
+    }
   }
-  // Variables declaration - do not modify//GEN-BEGIN:variables
-  private javax.swing.JButton addBtn;
-  private javax.swing.JSpinner expirySpinner;
-  private javax.swing.JList hostnameList;
-  private javax.swing.JLabel jLabel1;
-  private javax.swing.JLabel jLabel2;
-  private javax.swing.JLabel jLabel3;
-  private javax.swing.JScrollPane jScrollPane1;
-  private javax.swing.JTextField newHostnameTextField;
-  private javax.swing.JButton removeBtn;
-  // End of variables declaration//GEN-END:variables
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JComboBox cachePasswordComboBox;
+    private javax.swing.JSpinner expirySpinner;
+    private javax.swing.JLabel jLabel1;
+    private javax.swing.JLabel jLabel2;
+    private javax.swing.JLabel jLabel3;
+    private javax.swing.JLabel jLabel4;
+    private javax.swing.JSpinner maxConnectionsNumberSpinner;
+    // End of variables declaration//GEN-END:variables
 }
--- a/src/MPipeline2/src/mpipeline/plisttable/JPlist.java	Mon Dec 05 16:20:06 2011 +0100
+++ b/src/MPipeline2/src/mpipeline/plisttable/JPlist.java	Mon Dec 05 16:20:06 2011 +0100
@@ -564,22 +564,6 @@
         String defaultWin = ltpdaPreferences2.getMiscPrefs().getDefaultWindow();
         p.setDefaultVal(defaultWin);
       }
-      else if (p.getKey().equalsIgnoreCase("HOSTNAME")) {
-
-        Object currentHostname = p.getDefaultVal();
-        p.getVal().clearOptions();
-        // Get hostnames from the preferences
-        ArrayList<String> prefsHosts = ltpdaPreferences2.getRepoPrefs().getHostnames();
-        // Add this hostnames to the options of the param object
-        for (int i = 0; i < prefsHosts.size(); i++) {
-          p.addOption(prefsHosts.get(i), "char");
-        }
-        p.setDefaultVal(currentHostname);
-
-        if (p.getOptions().isEmpty()) {
-          p.addOption("", "char");
-        }
-      }
     }
   }
 }