Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
32:e22b091498e4 | 33:5e7477b94d94 |
---|---|
10 properties(Dependent=true) | 10 properties(Dependent=true) |
11 | 11 |
12 credentialsExpiry; % seconds | 12 credentialsExpiry; % seconds |
13 cachePassword; % 0=no 1=yes 2=ask | 13 cachePassword; % 0=no 1=yes 2=ask |
14 maxConnectionsNumber; | 14 maxConnectionsNumber; |
15 knownRepositories; % known repositories stored into prefereces | |
15 | 16 |
16 end % dependent properties | 17 end % dependent properties |
17 | 18 |
18 methods(Static) | 19 methods(Static) |
19 | 20 |
68 import utils.const.* | 69 import utils.const.* |
69 utils.helper.msg(msg.PROC1, 'new connection manager'); | 70 utils.helper.msg(msg.PROC1, 'new connection manager'); |
70 else | 71 else |
71 cm = acm; | 72 cm = acm; |
72 end | 73 end |
73 end | 74 |
75 % add known repositories from preferences | |
76 repos = cm.knownRepositories; | |
77 for kk = 1:numel(repos) | |
78 repo = repos{kk}; | |
79 for jj = 1:3 | |
80 % null empty parameters | |
81 if isempty(repo{jj}) | |
82 repo{jj} = []; | |
83 end | |
84 end | |
85 cm.add(utils.credentials(repo{:})); | |
86 end | |
87 end | |
88 | |
74 | 89 |
75 function str = disp(cm) | 90 function str = disp(cm) |
76 disp(sprintf('%s()\n', class(cm))); | 91 disp(sprintf('%s()\n', class(cm))); |
77 end | 92 end |
78 | 93 |
93 | 108 |
94 function val = get.maxConnectionsNumber(cm) | 109 function val = get.maxConnectionsNumber(cm) |
95 % obtain from user preferences | 110 % obtain from user preferences |
96 p = getappdata(0, 'LTPDApreferences'); | 111 p = getappdata(0, 'LTPDApreferences'); |
97 val = double(p.getRepoPrefs().getMaxConnectionsNumber()); | 112 val = double(p.getRepoPrefs().getMaxConnectionsNumber()); |
113 end | |
114 | |
115 | |
116 function val = get.knownRepositories(cm) | |
117 % obtain from user preferences | |
118 p = getappdata(0, 'LTPDApreferences'); | |
119 val = cell(p.getRepoPrefs().getRepositories().toArray()); | |
98 end | 120 end |
99 | 121 |
100 | 122 |
101 function n = count(cm) | 123 function n = count(cm) |
102 % COUNT Returns the number of open connections in the connections pool. | 124 % COUNT Returns the number of open connections in the connections pool. |