From 9f6da9403d38a5ea5e056f2f24a3385b58a3b8b9 Mon Sep 17 00:00:00 2001
From: Arno Schoenmakers <schoenmakers@astron.nl>
Date: Tue, 17 May 2011 14:43:15 +0000
Subject: [PATCH] Bug 1682: Merged changes from
 Scheduler-20110426-1_0-release-branch (-r 17843:HEAD) into trunk

---
 .gitattributes                                |   2 +-
 .gitignore                                    |   1 +
 .../src/SASGateway/SASGateway.conf            |   2 +-
 .../src/MACScheduler/MACScheduler.conf.in     |   2 +-
 MAC/Deployment/data/OTDB/Scheduler.comp       |   2 +-
 MAC/Deployment/data/PVSS/Clusters.list        |   6 +-
 .../OTB/src/nl/astron/lofar/sas/otb/Main.java |  15 +-
 .../nl/astron/lofar/sas/otb/MainFrame.java    |  24 +--
 .../lofar/sas/otb/panels/MainPanel.java       |  32 +---
 .../lofar/sas/otb/util/ConfigPanelHelper.java |  30 ++--
 .../lofar/sas/otb/util/ResultPanelHelper.java |  20 +--
 .../lofar/sas/otbcomponents/LoginDialog.form  |   2 +-
 .../lofar/sas/otbcomponents/LoginDialog.java  |   8 +-
 .../sas/otbcomponents/ParSetViewPanel.java    |   4 +-
 SAS/OTB/jOTDB3/build.xml                      | 148 +++++++++---------
 .../lofar/sas/otb/jotdb3/jOTDBserver.java     | 122 ++++++++++-----
 SAS/OTDB/sql/create_OTDB.sql                  |   2 +-
 SAS/OTDB/sql/getAllTaskID_func.sql            |   3 +-
 ...ulerInfo.sql => getSchedulerInfo_func.sql} |  10 +-
 SAS/OTDB/sql/saveSchedulerInfo_func.sql       |   7 +-
 20 files changed, 255 insertions(+), 187 deletions(-)
 rename SAS/OTDB/sql/{getSchedulerInfo.sql => getSchedulerInfo_func.sql} (92%)

diff --git a/.gitattributes b/.gitattributes
index 6e19ce63f18..17a44834a7b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2568,7 +2568,7 @@ SAS/OTDB/sql/campaignAPI.sql -text
 SAS/OTDB/sql/fresh_sas001_database.sh -text
 SAS/OTDB/sql/getAllTaskID_func.sql -text
 SAS/OTDB/sql/getDefaultTemplates_func.sql -text
-SAS/OTDB/sql/getSchedulerInfo.sql -text
+SAS/OTDB/sql/getSchedulerInfo_func.sql -text
 SAS/OTDB/sql/getTreeGroup_func.sql -text
 SAS/OTDB/sql/getTreesInPeriod_func.sql -text
 SAS/OTDB/sql/saveSchedulerInfo_func.sql -text
diff --git a/.gitignore b/.gitignore
index 37b8bc74c04..da0f07d160e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -275,6 +275,7 @@ SAS/OTB/jOTDB2/lofarconf
 SAS/OTB/jOTDB2/nbproject
 SAS/OTB/jOTDB3/build
 SAS/OTB/jOTDB3/dist
+SAS/OTB/nbproject
 SAS/OTB/scripts/Makefile.common
 SAS/OTB/scripts/autoconf_share
 SAS/OTB/scripts/lofarconf
diff --git a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGateway.conf b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGateway.conf
index e09add8fd8d..9f1980e1a64 100644
--- a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGateway.conf
+++ b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGateway.conf
@@ -1,6 +1,6 @@
 #
 #
 #
-SASGateway.OTDBdatabase = LOFAR_1
+SASGateway.OTDBdatabase = LOFAR_2
 SASGateway.OTDBhostname = sas001
 
diff --git a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.conf.in b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.conf.in
index 8f729fa0824..cb2031bb627 100644
--- a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.conf.in
+++ b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.conf.in
@@ -1,7 +1,7 @@
 # Startup parameters for the MACScheduler.
 
 # OTDB connection info
-OTDBdatabasename	= LOFAR_1
+OTDBdatabasename	= LOFAR_2
 OTDBhostname		= sas001
 OTDBusername		= paulus
 OTDBpassword		= boskabouter
diff --git a/MAC/Deployment/data/OTDB/Scheduler.comp b/MAC/Deployment/data/OTDB/Scheduler.comp
index 9a30e3d4d95..850dbc2e586 100644
--- a/MAC/Deployment/data/OTDB/Scheduler.comp
+++ b/MAC/Deployment/data/OTDB/Scheduler.comp
@@ -5,7 +5,6 @@ node	Scheduler	4.0.0	development	'node constraint'	"Scheduler"
 
 #	name			dir.	type	unit	prun.	vm	value	constr.	descr.
 #--------------------------------------------------------------------------------------------------------
-par autoSelectStorage           I       bool    -       10      0       true    -       "let scheduler decide on storage nodes and raid arrays used"
 par contactEmail		I	text	-	10	0 	''	-	"email of contact person"
 par contactName			I	text	-	10	0 	''	-	"name of contact person"
 par contactPhone		I	text	-	10	0 	''	-	"phone number of contact person"
@@ -20,6 +19,7 @@ par predMaxTimeDif		I   	text    -	10	0 	''	-	"maximal distance to predecessor"
 par predMinTimeDif		I   	text    -	10	0 	''	-	"minimal distance to predecessor"
 par priority			I	flt	-	10	0	0.0	-	"the task priority"
 par referenceFrame		I	uint	-	10	0	0	-	"reference frame (0=J2000,1=B1950)"
+par storageSelectionMode        I       int     -       10      0       1       -       "the storage nodes selection mode"
 par taskDuration		I	uint	-	10	0	0	-	"duration of the task in seconds"
 par taskID			I	uint	-	10	0	0	-	"internal scheduler task ID"
 par taskName			I	text	-	10	0	''	-	"name of the task"
diff --git a/MAC/Deployment/data/PVSS/Clusters.list b/MAC/Deployment/data/PVSS/Clusters.list
index c315bdaab28..0c7584db730 100644
--- a/MAC/Deployment/data/PVSS/Clusters.list
+++ b/MAC/Deployment/data/PVSS/Clusters.list
@@ -1,3 +1,3 @@
-BGL		bglfen	2
-Storage		lse	24
-Offline		lce	72
+BGL		bglfen	1
+Storage		locus   79
+Offline		locus   79
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/Main.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/Main.java
index c5f5b8720d8..4fe74e3ee94 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/Main.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/Main.java
@@ -57,11 +57,16 @@ public class Main {
             String logConfig = "OTB.log_prop";
             String server    = "sas001";
             String port      = "10199";
+            String database  = "LOFAR_2";
+            String user      = "observer";
+
             boolean errs     = false;
             GetOptDesc options[] = {
                 new GetOptDesc('s', "server", true),
                 new GetOptDesc('p', "port", true),
                 new GetOptDesc('l', "logfile", true),
+                new GetOptDesc('d', "database", true),
+                new GetOptDesc('u', "user", true),
                 new GetOptDesc('h', "help", false)
             };
             
@@ -81,6 +86,12 @@ public class Main {
                     case 'l':
                         logConfig = (String)optionsFound.get(key);
                         break;
+                    case 'd':
+                        database = (String)optionsFound.get(key);
+                        break;
+                    case 'u':
+                        user = (String)optionsFound.get(key);
+                        break;
                     case 'h':
                         errs = true;
                         break;
@@ -93,7 +104,7 @@ public class Main {
                 }
             }
             if (errs) {
-                System.err.println("Usage: OTB.jar [-s server] [-p port] [-l logFile] [-h]");
+                System.err.println("Usage: OTB.jar [-s server] [-p port] [-d database] [-u username] [-l logFile] [-h]");
             }         
 
             File f = new File(logConfig);
@@ -111,7 +122,7 @@ public class Main {
             logger.info("OTB started");
 
             try {
-               MainFrame aMainFrame = new MainFrame(server,port);
+               MainFrame aMainFrame = new MainFrame(server,port,database,user);
 
                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                Rectangle screenRect = ge.getMaximumWindowBounds();
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/MainFrame.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/MainFrame.java
index 4747a3413f3..e0890c67b46 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/MainFrame.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/MainFrame.java
@@ -58,6 +58,7 @@ public class MainFrame extends javax.swing.JFrame {
     private String itsServer               = "";
     private String itsPort                 = "";
     private String itsDBName               = "No Database";
+    private String itsUserName             = "";
 
     private String itsServiceName          = "";
 
@@ -102,9 +103,12 @@ public class MainFrame extends javax.swing.JFrame {
     }
     
     /** Creates new form MainFrame */
-    public MainFrame(String server, String port) throws NoServerConnectionException,NotLoggedInException {
+    public MainFrame(String server, String port, String database, String user ) throws NoServerConnectionException,NotLoggedInException {
         itsServer=server;
         itsPort=port;
+        itsDBName=database;
+        itsUserName=user;
+
         itsPlugins = new HashMap<String,PluginPanelInfo>();
 
         itsSharedVars = new SharedVars(this);
@@ -520,23 +524,23 @@ public class MainFrame extends javax.swing.JFrame {
         boolean accessAllowed = false;
         while(!accessAllowed) {
             // show login dialog
-            LoginDialog loginDialog = new LoginDialog(this,true);
+            LoginDialog loginDialog = new LoginDialog(this,true,itsUserName,itsDBName);
             loginDialog.setLocationRelativeTo(this);
             loginDialog.setVisible(true);
             if(loginDialog.isOk()) {
-                String userName = loginDialog.getUserName();
-                String password = loginDialog.getPassword();
-                itsDBName       = loginDialog.getDBName();
+                itsUserName   = loginDialog.getUserName();
+                String pwd    = loginDialog.getPassword();
+                itsDBName     = loginDialog.getDBName();
 
-                logger.info("User: " + userName);
+                logger.info("User: " + itsUserName);
 
                 // create a useraccount object Interaction object
                 try {
-                    itsUserAccount = new UserAccount(userName, password);
+                    itsUserAccount = new UserAccount(itsUserName, pwd);
 //                    itsMACInteraction.setCurrentUser(userName,password);
 
 
-                    statusPanelMainFrame.setText(StatusPanel.MIDDLE,"User: "+userName);
+                    statusPanelMainFrame.setText(StatusPanel.MIDDLE,"User: "+itsUserName);
 
                     String aC = "NO Main DB connection";
                   // Start the actual RMI connection
@@ -560,7 +564,7 @@ public class MainFrame extends javax.swing.JFrame {
                         // we now have the OTDBaccess object and we can login, and obtain the OTDBconnection servicename.
                         logger.trace("remoteAccess object available, trying to login");
                         try {
-                            itsServiceName = OtdbRmi.getRemoteOTDBaccess().login(userName,password,itsDBName);
+                            itsServiceName = OtdbRmi.getRemoteOTDBaccess().login(itsUserName,pwd,itsDBName);
                             if (!itsServiceName.equals("")) {
                                 OtdbRmi.setRMIRegistryName(itsServiceName);
 
@@ -646,7 +650,7 @@ public class MainFrame extends javax.swing.JFrame {
         java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
                 try {
-                    new MainFrame("","").setVisible(true);
+                    new MainFrame("","","","").setVisible(true);
                 } catch (Exception e) {
                     System.out.println(e);
                 } finally {
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/panels/MainPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/panels/MainPanel.java
index e14a3e9eac1..eabab881fbd 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/panels/MainPanel.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/panels/MainPanel.java
@@ -293,7 +293,8 @@ public class MainPanel extends javax.swing.JPanel
     public void setChanged(boolean flag) {
         changed = flag;
     }
-    
+
+
     public void checkChanged() {
         if (inputFieldBuilder.currentInputField != null) {
             inputFieldBuilder.currentInputField.checkPopup();
@@ -315,35 +316,14 @@ public class MainPanel extends javax.swing.JPanel
                 if (!((TemplatetableModel)TemplatesPanel.getTableModel()).fillTable()) {
                     logger.error("error filling templateTable");
                 }
-                // VICTree could have been changed also
-                if (!((VICtableModel)VICPanel.getTableModel()).fillTable()) {
-                    logger.error("error filling VICTable");
-                }
-                // Default Templates could have been changed also
-                if (!((DefaultTemplatetableModel)DefaultTemplatesPanel.getTableModel()).fillTable()) {
-                    logger.error("error filling default template table");
-                }
-
             } else if (itsTabFocus.equals("Default Templates")) {
                 if (!((DefaultTemplatetableModel)DefaultTemplatesPanel.getTableModel()).fillTable()) {
                     logger.error("error filling Default templateTable");
                 }
-                // VICTree could have been changed also
-                if (!((VICtableModel)VICPanel.getTableModel()).fillTable()) {
-                    logger.error("error filling VICTable");
-                }
-                // Template could have been changed also
-                if (!((TemplatetableModel)TemplatesPanel.getTableModel()).fillTable()) {
-                    logger.error("error filling TemplateTable");
-                }
             } else if (itsTabFocus.equals("Components")) {
                 if (!((ComponentTableModel)ComponentsPanel.getTableModel()).fillTable()) {
                     logger.error("error filling ComponentsTable");
                 }
-                // templateTree could have been changed also
-                if (!((TemplatetableModel)TemplatesPanel.getTableModel()).fillTable()) {
-                    logger.error("error filling templateTable");
-                }
             }
             if (aSavedID > 0) {
                 itsMainFrame.getSharedVars().setTreeID(aSavedID);
@@ -503,8 +483,12 @@ public class MainPanel extends javax.swing.JPanel
     }//GEN-LAST:event_PICPanelMouseClicked
 
     private void jTabbedPane1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane1StateChanged
-        itsTabFocus=jTabbedPane1.getTitleAt(jTabbedPane1.getSelectedIndex());
-        logger.debug("Tab changed: "+ itsTabFocus);
+        if (!itsTabFocus.equals(jTabbedPane1.getTitleAt(jTabbedPane1.getSelectedIndex()))) {
+            itsTabFocus=jTabbedPane1.getTitleAt(jTabbedPane1.getSelectedIndex());
+            // force reload
+            logger.debug("Tab changed, force reload: "+ itsTabFocus);
+            this.setChanged(true);
+        }
         if (buttonsInitialized) {        
             initializeButtons();
             validateButtons();
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java
index af8f6070b46..1fbca88fce8 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ConfigPanelHelper.java
@@ -71,35 +71,41 @@ public class ConfigPanelHelper {
         itsPanelMap.put("*",itsVector);
         
         //BBS
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.bbs.BBSPanel");
-//        itsPanelMap.put("BBSControl",itsVector);
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.bbs.BBSPanel");
+        itsPanelMap.put("BBSControl",itsVector);
+        addParSetPanel();
         
         //BBS Strategy
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.bbs.BBSStrategyPanel");
-//        itsPanelMap.put("Strategy",itsVector);
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.bbs.BBSStrategyPanel");
+        itsPanelMap.put("Strategy",itsVector);
+        addParSetPanel();
   
 
         //OLAP
         itsVector = new Vector<String>();
         itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.OlapPanel");
         itsPanelMap.put("OLAP",itsVector);
+        addParSetPanel();
         
         // Observation
         itsVector = new Vector<String>();
         itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ObservationPanel");
         itsPanelMap.put("Observation",itsVector);
+        addParSetPanel();
         
         //TBB
         itsVector = new Vector<String>();
         itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.TBBConfigPanel");
         itsPanelMap.put("TBB",itsVector);
+        addParSetPanel();
         
         //Imager
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ImagerPanel");
-//        itsPanelMap.put("Imager",itsVector);
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ImagerPanel");
+        itsPanelMap.put("Imager",itsVector);
+        addParSetPanel();
     }
     
     
@@ -108,8 +114,14 @@ public class ConfigPanelHelper {
         itsVector.add("nl.astron.lofar.sas.otbcomponents.NodeViewPanel");
         //generic parameter panel
         itsVector.add("nl.astron.lofar.sas.otbcomponents.ParameterViewPanel");
+        addParSetPanel();
     }
     
+    private void addParSetPanel() {
+        //generic parset view panel
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.ParSetViewPanel");
+    }
+
     /**
      * Returns the possible panels for this Key
      *
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ResultPanelHelper.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ResultPanelHelper.java
index bdd9a2bd7a2..bf24400095f 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ResultPanelHelper.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/ResultPanelHelper.java
@@ -71,12 +71,12 @@ public class ResultPanelHelper {
         itsPanelMap.put("*",itsVector);
 
         //ParmDB
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.ParmDBConfigPanel");
-//        itsPanelMap.put("ParmDB",itsVector);
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.ParmDBPlotPanel");
-//        itsPanelMap.put("ParmDBValues",itsVector);
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.ParmDBConfigPanel");
+        itsPanelMap.put("ParmDB",itsVector);
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.ParmDBPlotPanel");
+        itsPanelMap.put("ParmDBValues",itsVector);
         
         // Observation
         itsVector = new Vector<String>();
@@ -97,10 +97,10 @@ public class ResultPanelHelper {
         addParSetAndLogPanels();
 
         //Imager
-//        itsVector = new Vector<String>();
-//        itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ImagerPanel");
-//        itsPanelMap.put("Imager",itsVector);
-//        addParSetAndLogPanels();
+        itsVector = new Vector<String>();
+        itsVector.add("nl.astron.lofar.sas.otbcomponents.userpanels.ImagerPanel");
+        itsPanelMap.put("Imager",itsVector);
+        addParSetAndLogPanels();
     }
     
     
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.form b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.form
index fcd1b134cc8..7b46506b5ea 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.form
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.form
@@ -40,7 +40,7 @@
     </Component>
     <Component class="javax.swing.JTextField" name="jDatabaseField">
       <Properties>
-        <Property name="text" type="java.lang.String" value="LOFAR_1"/>
+        <Property name="text" type="java.lang.String" value="LOFAR_2"/>
       </Properties>
       <Constraints>
         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.java
index f25baddadcb..e7370c58b1a 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/LoginDialog.java
@@ -33,9 +33,11 @@ package nl.astron.lofar.sas.otbcomponents;
 public class LoginDialog extends javax.swing.JDialog {
     
     /** Creates new form LoginDialog */
-    public LoginDialog(java.awt.Frame parent, boolean modal) {
+    public LoginDialog(java.awt.Frame parent, boolean modal, String user, String database) {
         super(parent, modal);
         initComponents();
+        this.jUserNameField.setText(user);
+        this.jDatabaseField.setText(database);
         getRootPane().setDefaultButton(jButtonOK);
                 
         ok = true;
@@ -69,7 +71,7 @@ public class LoginDialog extends javax.swing.JDialog {
         jLabel1.setText("User name");
         getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, -1, -1));
 
-        jDatabaseField.setText("LOFAR_1");
+        jDatabaseField.setText("LOFAR_2");
         getContentPane().add(jDatabaseField, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 70, 200, -1));
 
         jLabel2.setText("Password");
@@ -121,7 +123,7 @@ public class LoginDialog extends javax.swing.JDialog {
     public static void main(String args[]) {
         java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
-                new LoginDialog(new javax.swing.JFrame(), true).setVisible(true);
+                new LoginDialog(new javax.swing.JFrame(), true,"","").setVisible(true);
             }
         });
     }
diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParSetViewPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParSetViewPanel.java
index dea765af41f..f56c65b1487 100644
--- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParSetViewPanel.java
+++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otbcomponents/ParSetViewPanel.java
@@ -288,7 +288,9 @@ public class ParSetViewPanel extends javax.swing.JPanel implements IViewPanel{
             
             for (int i=0; i< lines.length; i++) {
                 String[] keyval = lines[i].split("=");
-                String aS=lines[i].replaceFirst(keyval[0]+"=", "");
+                String aS="";
+                if (keyval.length>1) aS=keyval[1];
+//                String aS=lines[i].replaceFirst(keyval[0]+"=", "");
 
                 String [] str={keyval[0],aS};
                 aModel.addRow(str);
diff --git a/SAS/OTB/jOTDB3/build.xml b/SAS/OTB/jOTDB3/build.xml
index 7e289ce344c..aa36292d80e 100644
--- a/SAS/OTB/jOTDB3/build.xml
+++ b/SAS/OTB/jOTDB3/build.xml
@@ -1,74 +1,74 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- You may freely edit this file. See commented blocks below for -->
-<!-- some examples of how to customize the build. -->
-<!-- (If you delete it and reopen the project it will be recreated.) -->
-<!-- By default, only the Clean and Build commands use this build script. -->
-<!-- Commands such as Run, Debug, and Test only use this build script if -->
-<!-- the Compile on Save feature is turned off for the project. -->
-<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
-<!-- in the project's Project Properties dialog box.-->
-<project name="jOTDB3" default="default" basedir=".">
-    <description>Builds, tests, and runs the project jOTDB3.</description>
-    <import file="nbproject/build-impl.xml"/>
-    <!--
-
-    There exist several targets which are by default empty and which can be 
-    used for execution of your tasks. These targets are usually executed 
-    before and after some main targets. They are: 
-
-      -pre-init:                 called before initialization of project properties
-      -post-init:                called after initialization of project properties
-      -pre-compile:              called before javac compilation
-      -post-compile:             called after javac compilation
-      -pre-compile-single:       called before javac compilation of single file
-      -post-compile-single:      called after javac compilation of single file
-      -pre-compile-test:         called before javac compilation of JUnit tests
-      -post-compile-test:        called after javac compilation of JUnit tests
-      -pre-compile-test-single:  called before javac compilation of single JUnit test
-      -post-compile-test-single: called after javac compilation of single JUunit test
-      -pre-jar:                  called before JAR building
-      -post-jar:                 called after JAR building
-      -post-clean:               called after cleaning build products
-
-    (Targets beginning with '-' are not intended to be called on their own.)
-
-    Example of inserting an obfuscator after compilation could look like this:
-
-        <target name="-post-compile">
-            <obfuscate>
-                <fileset dir="${build.classes.dir}"/>
-            </obfuscate>
-        </target>
-
-    For list of available properties check the imported 
-    nbproject/build-impl.xml file. 
-
-
-    Another way to customize the build is by overriding existing main targets.
-    The targets of interest are: 
-
-      -init-macrodef-javac:     defines macro for javac compilation
-      -init-macrodef-junit:     defines macro for junit execution
-      -init-macrodef-debug:     defines macro for class debugging
-      -init-macrodef-java:      defines macro for class execution
-      -do-jar-with-manifest:    JAR building (if you are using a manifest)
-      -do-jar-without-manifest: JAR building (if you are not using a manifest)
-      run:                      execution of project 
-      -javadoc-build:           Javadoc generation
-      test-report:              JUnit report generation
-
-    An example of overriding the target for project execution could look like this:
-
-        <target name="run" depends="jOTDB3-impl.jar">
-            <exec dir="bin" executable="launcher.exe">
-                <arg file="${dist.jar}"/>
-            </exec>
-        </target>
-
-    Notice that the overridden target depends on the jar target and not only on 
-    the compile target as the regular run target does. Again, for a list of available 
-    properties which you can use, check the target you are overriding in the
-    nbproject/build-impl.xml file. 
-
-    -->
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="jOTDB3" default="default" basedir=".">
+    <description>Builds, tests, and runs the project jOTDB3.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="jOTDB3-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+</project>
diff --git a/SAS/OTB/jOTDB3/src/nl/astron/lofar/sas/otb/jotdb3/jOTDBserver.java b/SAS/OTB/jOTDB3/src/nl/astron/lofar/sas/otb/jotdb3/jOTDBserver.java
index a43e49ece3e..58149a51a6e 100644
--- a/SAS/OTB/jOTDB3/src/nl/astron/lofar/sas/otb/jotdb3/jOTDBserver.java
+++ b/SAS/OTB/jOTDB3/src/nl/astron/lofar/sas/otb/jotdb3/jOTDBserver.java
@@ -21,10 +21,14 @@
 
 package nl.astron.lofar.sas.otb.jotdb3;
 
+import com.darwinsys.lang.GetOpt;
+import com.darwinsys.lang.GetOptDesc;
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import java.rmi.server.UnicastRemoteObject;
+import java.util.Iterator;
+import java.util.Map;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
@@ -41,7 +45,7 @@ public class jOTDBserver {
     // Keep a static reference to the access object to prevent the server from exitting.
     static jOTDBaccessInterface access = null;
 
-    public static void main(String[] args)  {
+    public static void main(String[] argv)  {
         try {
             String logConfig = "jOTDB3.log_prop";
             
@@ -66,12 +70,10 @@ public class jOTDBserver {
             // needed args for an rmi connection:
 
             // given to this server:
-            // 1) database username
-            // 2) database username pwd
-            // 4) host where database runs
-            // 5) hostname where this server runs
-            // 6) rmi port used by the server for client contact(OPTIONAL)
-            // 7) rmi port used for firewall/tunneling purposes (OPTIONAL)
+            // 1) host where database runs
+            // 2) hostname where this server runs
+            // 3) rmi port used by the server for client contact(OPTIONAL)
+            // 4) rmi port used for firewall/tunneling purposes (OPTIONAL)
 
 
             // given by client that wants to connect :
@@ -80,44 +82,94 @@ public class jOTDBserver {
 
             //
 
-            if (args.length < 2) {
-                System.out.println("Usage: java -jar jOTDBnewServer.jar <db-hostname> <hostname> <rmiportnumber-OPTIONAL> <rmi objects portnumber for firewall/tunneling purposes-OPTIONAL>");
+            
+            String dbHostName     = "";
+            String serverHostName = "";
+            int rmiPort           = 0;
+            int rmiObjectPort     = 0;
+            boolean errs          = false;
+
+
+            // try to resolve the arguments
+            GetOptDesc options[] = {
+                new GetOptDesc('s', "serverHostName", true),
+                new GetOptDesc('d', "dbHostName", true),
+                new GetOptDesc('p', "rmiPort", true),
+                new GetOptDesc('o', "rmiObjectPort", true),
+                new GetOptDesc('h', "help", false)
+            };
+
+            GetOpt parser = new GetOpt(options);
+            Map optionsFound = parser.parseArguments(argv);
+            Iterator it = optionsFound.keySet().iterator();
+            while (it.hasNext()) {
+                String key = (String)it.next();
+                char c = key.charAt(0);
+                switch (c) {
+                    case 's':
+                        serverHostName = (String)optionsFound.get(key);
+                        break;
+                    case 'd':
+                        dbHostName = (String)optionsFound.get(key);
+                        break;
+                    case 'p':
+                        rmiPort = Integer.parseInt((String)optionsFound.get(key));
+                        break;
+                    case 'o':
+                        rmiObjectPort = Integer.parseInt((String)optionsFound.get(key));
+                        break;
+                    case 'h':
+                        errs = true;
+                        break;
+                    default:
+                        throw new IllegalStateException(
+                                "Unexpected option character: "+ c);
+                }
+            }
+            if (errs) {
+                System.out.println("Usage: java -jar jOTDBnewServer.jar  -p rmiPort -o rmiObjectPort [-s server] [-d database server]  [-h]");
+                System.out.println("");
+                System.out.println("       The rmi port is needed for rmi traffic and must be unique fior each server");
+                System.out.println("       The rmiObjectPort is needed for firewall/tunneling java objects and must be unique for each server");
+                System.out.println("       When the servername is not provided the server will try to resolve one itself for the local machine");
+                System.out.println("       When the database server name is not provided it is assumed to run on the localmachine");
+            }
+
+            if (rmiPort <= 0 || rmiObjectPort <= 0 || rmiPort==rmiObjectPort) {
+                logger.fatal("Invalid rmiPort or rmiObjectPort provided");
                 System.exit(0);
             }
-            
-            
-            String aHostName = new String(args[1]);
-            
-            logger.info("Running on: "+aHostName);
-            System.setProperty("java.rmi.server.hostname", aHostName);
 
+            if (serverHostName.equals("")) {
+                try {
+                    java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
+                    logger.info("Hostname of local machine: " + localMachine.getHostName());
+                    serverHostName=localMachine.getHostName();
+                }
+                catch (java.net.UnknownHostException ex) {
+                    logger.error("Couldn't resolve hostname" + ex);
+                    logger.fatal("restart using -h hostname switch");
+                    System.exit(0);
+                }
+            }
 
+            System.setProperty("java.rmi.server.hostname", serverHostName);
+
+            // if dbHostname not provided, the server runs on same machin as the database
+            if (dbHostName.equals("")) dbHostName=serverHostName;
 
             // Create the access object that will take care of registering to rmi
-            int rmiPort = 0;
-            int rmiObjectPort=0;
-            Registry registry = null;
-            try {
-                rmiPort = Integer.parseInt(args[2]);
-            } catch (NumberFormatException ex) {
-                logger.error("jOTDBserver rmiPort error: "+args[2]+ "  " + ex);
-            }
+            logger.info("jOTDBserver creating a local RMI registry on port "+rmiPort+" ...");
+            Registry registry=null;
             try {
-                rmiObjectPort = Integer.parseInt(args[3]);
-            } catch (NumberFormatException ex) {
-                logger.error("jOTDBserver rmiObjectPort error: "+args[3]+ "  " + ex);
-            }
-
-            if (rmiPort <= 0) {
-                logger.info("jOTDBaccess creating a local RMI registry on port " + Registry.REGISTRY_PORT + " ...");
-                registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
-            } else {
-                logger.info("jOTDBserver creating a local RMI registry on port "+rmiPort+" ...");
                 registry = LocateRegistry.createRegistry(rmiPort);
-                logger.info("jOTDBserver setting up RMI server objects on port "+rmiObjectPort+" ...");
+            } catch (RemoteException ex) {
+                logger.fatal("Error creating registry port:" + ex);
+                System.exit(0);
             }
+            logger.info("jOTDBserver setting up RMI server objects on port "+rmiObjectPort+" ...");
 
-            access = new jOTDBaccess(args[0], args[1],rmiPort,rmiObjectPort,registry);
+            access = new jOTDBaccess(dbHostName, serverHostName, rmiPort, rmiObjectPort, registry);
             jOTDBaccessInterface stub =
                 (jOTDBaccessInterface) UnicastRemoteObject.exportObject(access, rmiObjectPort);
 
diff --git a/SAS/OTDB/sql/create_OTDB.sql b/SAS/OTDB/sql/create_OTDB.sql
index 87c1a1a35e0..f006b83a79a 100644
--- a/SAS/OTDB/sql/create_OTDB.sql
+++ b/SAS/OTDB/sql/create_OTDB.sql
@@ -78,7 +78,7 @@
 \i campaignAPI.sql
 
 -- SchedulerInfo
-\i getSchedulerInfo.sql
+\i getSchedulerInfo_func.sql
 \i saveSchedulerInfo_func.sql
 \i getAllTaskID_func.sql
 
diff --git a/SAS/OTDB/sql/getAllTaskID_func.sql b/SAS/OTDB/sql/getAllTaskID_func.sql
index 87a976c663a..ee352ab93bc 100644
--- a/SAS/OTDB/sql/getAllTaskID_func.sql
+++ b/SAS/OTDB/sql/getAllTaskID_func.sql
@@ -19,8 +19,7 @@
 --  along with this program; if not, write to the Free Software
 --  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 --
---  $Id: getSchedulerInfo.sql 8438 2006-05-18 19:16:37Z overeem $
---
+--  $Id:$
 
 CREATE OR REPLACE FUNCTION getAllTaskID()
   RETURNS SETOF INTEGER AS $$
diff --git a/SAS/OTDB/sql/getSchedulerInfo.sql b/SAS/OTDB/sql/getSchedulerInfo_func.sql
similarity index 92%
rename from SAS/OTDB/sql/getSchedulerInfo.sql
rename to SAS/OTDB/sql/getSchedulerInfo_func.sql
index 955093f15ac..10b9e438331 100644
--- a/SAS/OTDB/sql/getSchedulerInfo.sql
+++ b/SAS/OTDB/sql/getSchedulerInfo_func.sql
@@ -1,5 +1,5 @@
 --
---  getSchedulerInfo.sql: function for getting treeinfo from the OTDB
+--  getSchedulerInfo_func.sql: function for getting treeinfo from the OTDB
 --
 --  Copyright (C) 2010
 --  ASTRON (Netherlands Foundation for Research in Astronomy)
@@ -19,13 +19,10 @@
 --  along with this program; if not, write to the Free Software
 --  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 --
---  $Id: getSchedulerInfo.sql 8438 2006-05-18 19:16:37Z overeem $
---
 
 DROP TYPE schedulerInfo CASCADE;
 
 CREATE TYPE schedulerInfo AS (
-	autoSelectStorage      BOOLEAN,
 	contactEmail           VARCHAR(40),
 	contactName            VARCHAR(30),
 	contactPhone           VARCHAR(20),
@@ -40,6 +37,8 @@ CREATE TYPE schedulerInfo AS (
 	predMinTimeDif         VARCHAR(10),
 	priority               FLOAT,
 	referenceFrame         INT4,
+        reservation            INT4,
+	storageSelectionMode   INT4,
 	taskDuration           INT4,
 	taskID                 INT4,
 	taskName               VARCHAR(40),
@@ -57,7 +56,6 @@ CREATE OR REPLACE FUNCTION getSchedulerInfo(INT4)
 
 	BEGIN
       	OPEN fieldList;
-        FETCH fieldList INTO vRecord.autoSelectStorage;
 	FETCH fieldList INTO vRecord.contactEmail;
 	FETCH fieldList INTO vRecord.contactName;
 	FETCH fieldList INTO vRecord.contactPhone;
@@ -72,6 +70,8 @@ CREATE OR REPLACE FUNCTION getSchedulerInfo(INT4)
 	FETCH fieldList INTO vRecord.predMinTimeDif;
 	FETCH fieldList INTO vRecord.priority;
         FETCH fieldList INTO vRecord.referenceFrame;
+        FETCH fieldList INTO vRecord.reservation;
+        FETCH fieldList INTO vRecord.storageSelectionMode;
 	FETCH fieldList INTO vRecord.taskDuration;
 	FETCH fieldList INTO vRecord.taskID;
 	FETCH fieldList INTO vRecord.taskName;
diff --git a/SAS/OTDB/sql/saveSchedulerInfo_func.sql b/SAS/OTDB/sql/saveSchedulerInfo_func.sql
index 76e3a426f2e..78468137f95 100644
--- a/SAS/OTDB/sql/saveSchedulerInfo_func.sql
+++ b/SAS/OTDB/sql/saveSchedulerInfo_func.sql
@@ -34,7 +34,8 @@
 --
 -- Types:	none
 --
-CREATE OR REPLACE FUNCTION saveSchedulerInfo(INT4, INT4, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT)
+CREATE OR REPLACE FUNCTION saveSchedulerInfo(INT4, INT4, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, 
+TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT)
   RETURNS BOOLEAN AS $$ 
 	DECLARE
 		TThierarchy CONSTANT	INT2 := 30;
@@ -119,8 +120,8 @@ CREATE OR REPLACE FUNCTION saveSchedulerInfo(INT4, INT4, TEXT, TEXT, TEXT, TEXT,
 		UPDATE VIChierarchy SET value=$23 WHERE treeID=$2 AND nodeID=vRecord.nodeID;
 		FETCH fieldList INTO vRecord;
 		UPDATE VIChierarchy SET value=$24 WHERE treeID=$2 AND nodeID=vRecord.nodeID;
---              FETCH fieldList INTO vRecord;
---              UPDATE VIChierarchy SET value=$25 WHERE treeID=$2 AND nodeID=vRecord.nodeID;
+                FETCH fieldList INTO vRecord;
+                UPDATE VIChierarchy SET value=$25 WHERE treeID=$2 AND nodeID=vRecord.nodeID;
 --              FETCH fieldList INTO vRecord;
 --              UPDATE VIChierarchy SET value=$26 WHERE treeID=$2 AND nodeID=vRecord.nodeID;
 --              FETCH fieldList INTO vRecord;
-- 
GitLab