Mercurial > hg > ltpda
comparison m-toolbox/classes/@LTPDARepositoryManager/listConnections.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 % LISTCONNECTIONS list all connections in the repository manager. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: LISTCONNECTIONS list all connections in the repository | |
5 % manager. | |
6 % | |
7 % CALL: rm.listConnections | |
8 % listConnections(rm) | |
9 % | |
10 % <a href="matlab:web(LTPDARepositoryManager.getInfo('listConnections').tohtml, '-helpbrowser')">Parameters Description</a> | |
11 % | |
12 % VERSION: $Id: listConnections.m,v 1.4 2011/04/08 08:56:35 hewitson Exp $ | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function varargout = listConnections(varargin) | |
17 | |
18 % Check if this is a call for parameters | |
19 if utils.helper.isinfocall(varargin{:}) | |
20 varargout{1} = getInfo(varargin{3}); | |
21 return | |
22 end | |
23 | |
24 rm = varargin{1}; | |
25 conns = rm.manager.getConnections; | |
26 for i=1:conns.size | |
27 conn = conns.get(i-1); | |
28 if (conn.isConnected) | |
29 message = sprintf('connected for %2.2f seconds', conn.ageConnected()); | |
30 else | |
31 message = 'not connected'; | |
32 end | |
33 disp(sprintf('%02d: %s@%s:%s [%s]', i, char(conn.getUsername), ... | |
34 char(conn.getHostname), char(conn.getDatabase), message)); | |
35 end | |
36 end | |
37 | |
38 %-------------------------------------------------------------------------- | |
39 % Get Info Object | |
40 %-------------------------------------------------------------------------- | |
41 function ii = getInfo(varargin) | |
42 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
43 sets = {}; | |
44 pl = []; | |
45 else | |
46 sets = {'Default'}; | |
47 pl = getDefaultPlist; | |
48 end | |
49 % Build info object | |
50 ii = minfo(mfilename, 'LTPDARepositoryManager', 'ltpda', utils.const.categories.internal, '$Id: listConnections.m,v 1.4 2011/04/08 08:56:35 hewitson Exp $', sets, pl); | |
51 ii.setModifier(false); | |
52 ii.setOutmin(0); | |
53 end | |
54 | |
55 %-------------------------------------------------------------------------- | |
56 % Get Default Plist | |
57 %-------------------------------------------------------------------------- | |
58 function pl = getDefaultPlist() | |
59 pl = plist(); | |
60 end |