# HG changeset patch # User Daniele Nicolodi # Date 1323098406 -3600 # Node ID ce4df2e95a55e707094f21cba168e3edfef87fe8 # Parent 79dc7091dbbc2363460bbae949cfd553fc1a2574 Remove LTPDARepositoryManager initialization diff -r 79dc7091dbbc -r ce4df2e95a55 m-toolbox/classes/@LTPDAprefs/cb_guiClosed.m --- a/m-toolbox/classes/@LTPDAprefs/cb_guiClosed.m Mon Dec 05 16:20:06 2011 +0100 +++ b/m-toolbox/classes/@LTPDAprefs/cb_guiClosed.m Mon Dec 05 16:20:06 2011 +0100 @@ -10,11 +10,9 @@ % function cb_guiClosed(varargin) - disp('*** Goodbye from LTPDAprefs'); ltpdaPrefs = varargin{1}; if ~isempty(ltpdaPrefs) && isvalid(ltpdaPrefs) -% fprintf(2, 'deleting handles\n'); %--- called when window is closed h = handle(ltpdaPrefs.gui, 'callbackproperties'); set(h, 'WindowClosedCallback', []); diff -r 79dc7091dbbc -r ce4df2e95a55 m-toolbox/m/etc/ltpda_startup.m --- a/m-toolbox/m/etc/ltpda_startup.m Mon Dec 05 16:20:06 2011 +0100 +++ b/m-toolbox/m/etc/ltpda_startup.m Mon Dec 05 16:20:06 2011 +0100 @@ -11,14 +11,14 @@ % For the case that the user calls 'ltpda_startup' in his current MATLAB % session again it is necessary to destroy ALL java objects. - setappdata(0, 'LTPDApreferences', []); + try + rmappdata(0, 'LTPDApreferences'); + end - % Remove the repository manager - rm = getappdata(0, 'LTPDARepositoryManager'); - if ~isempty(rm) - delete(rm); + % Remove the database connection manager + try + rmappdata(0, 'LTPDADatabaseConnectionManager'); end - setappdata(0, 'LTPDARepositoryManager', []); clear java clear classes @@ -313,9 +313,6 @@ % methods coming from the extensions mc; - % ---- Start Repository Manager - LTPDARepositoryManager; - end function installExtensionJarFiles diff -r 79dc7091dbbc -r ce4df2e95a55 m-toolbox/m/helper/mc.m --- a/m-toolbox/m/helper/mc.m Mon Dec 05 16:20:06 2011 +0100 +++ b/m-toolbox/m/helper/mc.m Mon Dec 05 16:20:06 2011 +0100 @@ -13,40 +13,36 @@ function mc() - setappdata(0, 'LTPDApreferences', []); + % remove preferences + try + rmappdata(0, 'LTPDApreferences'); + end - % Remove the repository manager - rm = getappdata(0, 'LTPDARepositoryManager'); - if ~isempty(rm) - % store the connections so they don't get lost - rm.manager.closeAllConnections; - conns = rm.manager.getConnections; - delete(rm); - setappdata(0, 'LTPDAConnections', conns); + % database connection manager + cm = getappdata(0, 'LTPDADatabaseConnenctionManager'); + if ~isempty(cm) + % save cached credentials + setappdata(0, 'LTPDAcredentials', cm.credentials); + % remove database connection manager + rmappdata(0, 'LTPDADatabaseConnenctionManager'); end - setappdata(0, 'LTPDARepositoryManager', []); - - evalin('caller', 'clear'); % Deletes the timer-objects - clear classes % Deletes the local variables - evalin('caller', 'clear classes'); % Deletes the variables in the caller function - evalin('base', 'clear classes'); % Deletes the variables in the 'base' workspace - % Load the preferences again - LTPDAprefs.loadPrefs; + evalin('caller', 'clear'); % delete the timer-objects + clear classes % delete the local variables + evalin('caller', 'clear classes'); % delete the variables in the caller function + evalin('base', 'clear classes'); % delete the variables in the 'base' workspace + + % load the preferences again + LTPDAprefs.loadPrefs(); - % Make a new Repository Manager - conns = getappdata(0, 'LTPDAConnections'); - rm = LTPDARepositoryManager; - if ~isempty(conns) - % and put back the existing connections - for kk = 1:conns.size - conn = conns.get(kk-1); - rm.newConnection(char(conn.getHostname), ... - char(conn.getDatabase), ... - char(conn.getUsername), ... - char(conn.getPassword)); - end + % instantiate database connection manager if required + credentials = getappdata(0, 'LTPDAcredentials'); + if ~isempty(credentials) + cm = LTPDAConnectionManager(); + cm.credentials = credentials; end - setappdata(0, 'LTPDAConnections', []); + try + rmappdata(0, 'LTPDAcredentials'); + end end