Mercurial > hg > ltpda
comparison m-toolbox/classes/@LTPDARepositoryManager/updatePrefs.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % UPDATEPREFS updates the Repository Manager depending on the preferences. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % description: updates the Repository Manager depending on the preferences. | |
5 % | |
6 % call: rm = updatePrefs(rm, pl) | |
7 % | |
8 % version: $Id: updatePrefs.m,v 1.6 2011/03/28 12:45:45 hewitson Exp $ | |
9 % | |
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | |
12 function rm = updatePrefs(varargin) | |
13 | |
14 % Check if this is a call for parameters | |
15 if utils.helper.isinfocall(varargin{:}) | |
16 rm = getInfo(varargin{3}); | |
17 return | |
18 end | |
19 | |
20 utils.helper.msg(utils.const.msg.PROC1, 'Update expiry login time.'); | |
21 rm = varargin{1}; | |
22 | |
23 % Get timer for login expiry password | |
24 t = rm.timerClearPass; | |
25 | |
26 % Get pointer to the preferences | |
27 prefs = getappdata(0, 'LTPDApreferences'); | |
28 expiryTime = double(prefs.getRepoPrefs.getExpiry()); | |
29 | |
30 % Set the new expiry time to the repository manager | |
31 if isa(t, 'timer') | |
32 | |
33 % Check if the user have changed the expire time | |
34 if (t.Period ~= expiryTime) | |
35 | |
36 if strcmp(get(t,'Running'), 'on') | |
37 stop(t); | |
38 end | |
39 set(t, 'Period', expiryTime); | |
40 set(t, 'StartDelay', expiryTime); | |
41 start(t); | |
42 | |
43 else | |
44 % Do nothing if the user didn'T change the exire time | |
45 end | |
46 | |
47 else | |
48 t = LTPDARepositoryManager.startTimer('LTPDA_clearPassword', @LTPDARepositoryManager.cb_clearPassord, expiryTime); | |
49 rm.timerClearPass = t; | |
50 end | |
51 | |
52 % Set the host-names to the repository manager | |
53 jhosts = prefs.getRepoPrefs.getHostnames; | |
54 rm.manager.setRepoHosts(jhosts); | |
55 | |
56 % Resets the timers if a user make some changes to the preferences. | |
57 conns = rm.manager.getConnections; | |
58 for ii=1:conns.size | |
59 conn = conns.get(ii-1); | |
60 LTPDARepositoryManager.resetTimer(rm.timerClearPass, conn); | |
61 LTPDARepositoryManager.resetTimer(rm.timerDisconnect, conn); | |
62 end | |
63 end | |
64 | |
65 %-------------------------------------------------------------------------- | |
66 % Get Info Object | |
67 %-------------------------------------------------------------------------- | |
68 function ii = getInfo(varargin) | |
69 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
70 sets = {}; | |
71 pl = []; | |
72 else | |
73 sets = {'Default'}; | |
74 pl = getDefaultPlist; | |
75 end | |
76 % Build info object | |
77 ii = minfo(mfilename, 'LTPDARepositoryManager', 'ltpda', utils.const.categories.internal, '$Id: updatePrefs.m,v 1.6 2011/03/28 12:45:45 hewitson Exp $', sets, pl); | |
78 end | |
79 | |
80 %-------------------------------------------------------------------------- | |
81 % Get Default Plist | |
82 %-------------------------------------------------------------------------- | |
83 function pl = getDefaultPlist() | |
84 pl = plist(); | |
85 end |