diff m-toolbox/classes/@LTPDADatabaseConnectionManager/LTPDADatabaseConnectionManager.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents e3c5468b1bfe
children 6def6533cb16
line wrap: on
line diff
--- a/m-toolbox/classes/@LTPDADatabaseConnectionManager/LTPDADatabaseConnectionManager.m	Mon Dec 05 16:20:06 2011 +0100
+++ b/m-toolbox/classes/@LTPDADatabaseConnectionManager/LTPDADatabaseConnectionManager.m	Mon Dec 05 16:20:06 2011 +0100
@@ -12,6 +12,7 @@
     credentialsExpiry; % seconds
     cachePassword; % 0=no 1=yes 2=ask
     maxConnectionsNumber;
+    knownRepositories; % known repositories stored into prefereces
 
   end % dependent properties
 
@@ -70,8 +71,22 @@
       else
         cm = acm;
       end
+
+      % add known repositories from preferences
+      repos = cm.knownRepositories;
+      for kk = 1:numel(repos)
+        repo = repos{kk};
+        for jj = 1:3
+          % null empty parameters
+          if isempty(repo{jj})
+            repo{jj} = [];
+          end
+        end
+        cm.add(utils.credentials(repo{:}));
+      end
     end
 
+
     function str = disp(cm)
       disp(sprintf('%s()\n', class(cm)));
     end
@@ -98,6 +113,13 @@
     end
 
 
+    function val = get.knownRepositories(cm)
+      % obtain from user preferences
+      p = getappdata(0, 'LTPDApreferences');
+      val = cell(p.getRepoPrefs().getRepositories().toArray());
+    end
+
+
     function n = count(cm)
     % COUNT Returns the number of open connections in the connections pool.
     %