comparison m-toolbox/classes/@LTPDARepositoryManager/getConnection.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 % GETCONNECTION makes a new managed repository connection.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: GETCONNECTION makes a new managed repository connection.
5 %
6 % CALL: conn = rm.getConnection(pl);
7 % conn = rm.getConnection('hostname');
8 % conn = rm.getConnection('hostname', 'database');
9 % conn = rm.getConnection('hostname', 'database', 'username');
10 % conn = rm.getConnection('hostname', 'database', 'username', 'password');
11 %
12 % If all required connection fields are input, the connection will be
13 % silently created and added to the manager. Otherwise, a connection dialog
14 % will be presented and the resulting connection added to the manager.
15 %
16 % <a href="matlab:web(LTPDARepositoryManager.getInfo('getConnection').tohtml, '-helpbrowser')">Parameters Description</a>
17 %
18 % VERSION: $Id: getConnection.m,v 1.4 2011/04/08 08:56:35 hewitson Exp $
19 %
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 function varargout = getConnection(varargin)
23
24 % Check if this is a call for parameters
25 if utils.helper.isinfocall(varargin{:})
26 varargout{1} = getInfo(varargin{3});
27 return
28 end
29
30 varargout{1} = newConnection(varargin{:});
31
32 end
33
34 %--------------------------------------------------------------------------
35 % Get Info Object
36 %--------------------------------------------------------------------------
37 function ii = getInfo(varargin)
38 if nargin == 1 && strcmpi(varargin{1}, 'None')
39 sets = {};
40 pl = [];
41 else
42 sets = {'Default'};
43 pl = getDefaultPlist;
44 end
45 % Build info object
46 ii = minfo(mfilename, 'LTPDARepositoryManager', 'ltpda', utils.const.categories.gui, '$Id: getConnection.m,v 1.4 2011/04/08 08:56:35 hewitson Exp $', sets, pl);
47 end
48
49 %--------------------------------------------------------------------------
50 % Get Default Plist
51 %--------------------------------------------------------------------------
52 function pl = getDefaultPlist()
53
54 % Initialise plist
55 pl = plist();
56
57 % hostname
58 p = param({'hostname', 'The hostname of the repository to connect to.'}, paramValue.EMPTY_STRING);
59 pl.append(p);
60
61 % database
62 p = param({'database', 'The database on the repository.'}, paramValue.EMPTY_STRING);
63 pl.append(p);
64
65 % username
66 p = param({'username', 'The username to connect with.'}, paramValue.EMPTY_STRING);
67 pl.append(p);
68
69 % password
70 p = param({'password', 'The password to connect with. Leave this empty to be prompted on connection.'}, paramValue.EMPTY_STRING);
71 pl.append(p);
72
73 end
74 % END