atom feed2 messages in net.java.dev.updatecenter.cvsCVS update [SJSAS91_FCS_BRANCH]: /upd...
FromSent OnAttachments
raje...@dev.java.netOct 16, 2007 5:01 pm 
raje...@dev.java.netOct 19, 2007 8:38 pm 
Subject:CVS update [SJSAS91_FCS_BRANCH]: /updatecenter/core/src/java/com/sun/enterprise/update/schedule/, /updatecenter/gui/src/java/com/sun/enterprise/upd...
From:raje...@dev.java.net (raje@dev.java.net)
Date:Oct 19, 2007 8:38:38 pm
List:net.java.dev.updatecenter.cvs

Tag: SJSAS91_FCS_BRANCH User: rajeshwar Date: 2007-10-20 03:38:38+0000 Modified: updatecenter/core/src/java/com/sun/enterprise/update/schedule/LocalStrings.properties updatecenter/core/src/java/com/sun/enterprise/update/schedule/SchedulerImpl.java updatecenter/gui/src/java/com/sun/enterprise/update/ui/LocalStrings.properties updatecenter/gui/src/java/com/sun/enterprise/update/ui/UpdateCenterMainPanel.java updatecenter/startup/src/java/com/sun/enterprise/update/desktop/UpdateCenterTray.java

Log: Issue number: 336 Fix for update of update center when scheduler is running. Fixed update of update center exceptions.

File Changes:

Directory: /updatecenter/core/src/java/com/sun/enterprise/update/schedule/ ==========================================================================

File [changed]: LocalStrings.properties Url:
https://updatecenter.dev.java.net/source/browse/updatecenter/core/src/java/com/sun/enterprise/update/schedule/LocalStrings.properties?r1=1.2&r2=1.2.2.1 Delta lines: +5 -0

------------------- --- LocalStrings.properties 2007-07-23 22:28:40+0000 1.2 +++ LocalStrings.properties 2007-10-20 03:38:35+0000 1.2.2.1 @@ -35,3 +35,8 @@ # MSG_UnknownEvent=Unknown event: {0}

+TITLE_Update_Available=Update Available +VALUE_Update_Available=An update has been installed. Restart is required.\n +LBL_Restart_Now=Restart Now +LBL_Shutdown=Shutdown +

File [changed]: SchedulerImpl.java Url:
https://updatecenter.dev.java.net/source/browse/updatecenter/core/src/java/com/sun/enterprise/update/schedule/SchedulerImpl.java?r1=1.22.2.1&r2=1.22.2.2 Delta lines: +51 -0

-------------------- --- SchedulerImpl.java 2007-10-17 00:01:26+0000 1.22.2.1 +++ SchedulerImpl.java 2007-10-20 03:38:35+0000 1.22.2.2 @@ -43,6 +43,7 @@ import java.util.EventObject; import java.util.logging.Logger; import java.util.logging.Level; +import javax.swing.JOptionPane;

import com.sun.enterprise.update.AvailableModules; import com.sun.enterprise.update.Updates; @@ -59,6 +60,7 @@ import com.sun.enterprise.update.logging.LogDomains; import com.sun.enterprise.update.config.ConfigManagerImpl; import com.sun.enterprise.update.util.InstallationID; +import com.sun.enterprise.update.logging.StringManager;

/** * This class schedules download/install activities and also fires the @@ -390,6 +392,9 @@ } } if ( us == null ) restart(); + + // do update of update center check + checkUpdateOfUpdateCenter(); }

private Module[] getModules(Updates u) throws UpdateFailureException { @@ -565,6 +570,50 @@ return getNewSoftwares(availableModules); }

+ + //This method is called when the scheduler is running and user preference
is + //auto install. + private void checkUpdateOfUpdateCenter() { + try { + UpdateManager updateManager = UpdateManager.getInstance(); + Updates updates = updateManager.getUpdates(); + com.sun.enterprise.update.Catalog systemCatalog =
updates.getUpdateForUpdateCenter(); + + // non-null systemCatalog with modules means there's an update of
the + // update center available + if (systemCatalog != null) { + Module[] modules = systemCatalog.getAllModules(); + if ((modules != null) && (modules.length > 0)) { +
UpdateManager.getInstance().getDownloadManager().silentDownload(modules); + InstallManager installManager =
UpdateManager.getInstance().getInstallManager(); + for(Module module : modules) { + installManager.install(module.getCatalogName(),
module); + } + + String updateTitle =
_strMgr.getString("TITLE_Update_Available"); + String nowOption = _strMgr.getString("LBL_Restart_Now"); + String[] options = new String[]{nowOption, + _strMgr.getString("LBL_Shutdown")}; + int result = JOptionPane.showOptionDialog(null, + _strMgr.getString("VALUE_Update_Available"),
updateTitle, + JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, + null, options, nowOption); + + if (result == JOptionPane.YES_OPTION) { // restart now + System.exit(2); + } else { + if (result == JOptionPane.NO_OPTION) { //shutdown + System.exit(0); + } + } + } + } + } catch (Exception exception) { + logger.log(Level.SEVERE, exception.getMessage()); + } + } + + //----- PRIVATE VARS ----------------- private HashMap evtListeners = new HashMap(); private EventType evt = null; @@ -573,4 +622,6 @@ private static final long MILLI_SECS_IN_WEEK = 604800000; private static final long MILLI_SECS_IN_A_DAY = 86400000; private static final Logger logger =
Logger.getLogger(LogDomains.ROOT_LOGGER); + private static StringManager _strMgr = + StringManager.getManager(SchedulerImpl.class); }

Directory: /updatecenter/gui/src/java/com/sun/enterprise/update/ui/ ===================================================================

File [changed]: LocalStrings.properties Url:
https://updatecenter.dev.java.net/source/browse/updatecenter/gui/src/java/com/sun/enterprise/update/ui/LocalStrings.properties?r1=1.8.2.2&r2=1.8.2.3 Delta lines: +1 -1

------------------- --- LocalStrings.properties 2007-10-17 00:01:26+0000 1.8.2.2 +++ LocalStrings.properties 2007-10-20 03:38:35+0000 1.8.2.3 @@ -53,7 +53,7 @@ TITLE_Update_Available=Update Available VALUE_Update_Available=An update has been installed. Restart is required.\n LBL_Restart_Now=Restart Now -LBL_Restart_Later=Do Not Restart +LBL_Shutdown=Shutdown MSG_Downloads_Avail=Downloads ready for install

# UpdateCheckerDialog - remove when get from progress event/status

File [changed]: UpdateCenterMainPanel.java Url:
https://updatecenter.dev.java.net/source/browse/updatecenter/gui/src/java/com/sun/enterprise/update/ui/UpdateCenterMainPanel.java?r1=1.48.2.1&r2=1.48.2.2 Delta lines: +18 -7

-------------------- --- UpdateCenterMainPanel.java 2007-10-17 00:01:26+0000 1.48.2.1 +++ UpdateCenterMainPanel.java 2007-10-20 03:38:35+0000 1.48.2.2 @@ -138,6 +138,7 @@ public void initialize() { setVisible(true); lastUpdate = new Date(); + checkUpdateOfUpdateCenter(); }

/* @@ -393,17 +394,27 @@ String updateTitle =
bundle.getString("TITLE_Update_Available"); String nowOption =
bundle.getString("LBL_Restart_Now"); String[] options = new String[]{nowOption, - bundle.getString("LBL_Restart_Later")}; + bundle.getString("LBL_Shutdown")}; + try { int result =
JOptionPane.showOptionDialog(UpdateCenterMainPanel.this, bundle.getString("VALUE_Update_Available"),
updateTitle, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
options, nowOption);

if (result == JOptionPane.YES_OPTION) { // restart
now + //restart System.exit(2); - } else if (result == JOptionPane.NO_OPTION) { //
restart later - // no action - user will restart - checkDownloadedUpdates(); + } else if (result == JOptionPane.NO_OPTION) {
// shutdown + //shutdown + System.exit(0); + + } + } catch(Throwable t) { + //Ignore. We are in bad state due to update of
update center. + //We may encounter this when clicked popup
message + //while Restart/Shutdown dialog is displayed. + //Restart/Shutdown dialog is displayed on
update + //of update center. } } });

Directory: /updatecenter/startup/src/java/com/sun/enterprise/update/desktop/ ============================================================================

File [changed]: UpdateCenterTray.java Url:
https://updatecenter.dev.java.net/source/browse/updatecenter/startup/src/java/com/sun/enterprise/update/desktop/UpdateCenterTray.java?r1=1.13.2.1&r2=1.13.2.2 Delta lines: +35 -13

--------------------- --- UpdateCenterTray.java 2007-10-17 00:01:27+0000 1.13.2.1 +++ UpdateCenterTray.java 2007-10-20 03:38:35+0000 1.13.2.2 @@ -101,23 +101,37 @@

ti.setIconAutoSize(true);

+ //click, double-click handler ti.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + try { if (_client == null) { _client = new UpdateCenterMainPanel(); } _client.initialize(); - + } catch (Throwable error) { + //Ignore. User clicked/double-clicked tray icon + //while Restart/Shutdown dialog is displayed. + //Restart/Shutdown dialog is displayed on update + //of update center. + } } });

+ //popup click handler ti.addBalloonActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + try { if (_client == null) { _client = new UpdateCenterMainPanel(); } _client.initialize(); - + } catch (Throwable error) { + //Ignore. User clicked popup message + //while Restart/Shutdown dialog is displayed. + //Restart/Shutdown dialog is displayed on update + //of update center. + } } });

@@ -128,17 +142,24 @@

}

+ //right-click-->StartUpdateCenter handler public void actionPerformed(ActionEvent e) { JMenuItem source = (JMenuItem) (e.getSource()); if (source != null) { String s = source.getText();

if (s.equalsIgnoreCase(bundle.getString("MENU_Start_Label"))) { + try { if (_client == null) { _client = new UpdateCenterMainPanel(); } _client.initialize(); - + } catch (Throwable error) { + //Ignore. User right-clicked tray icon and selected + //Start Update Center option while Restart/Shutdown + //dialog is displayed. Restart/Shutdown dialog is + //displayed on update of update center. + } }

else if (s.equalsIgnoreCase(bundle.getString("MENU_Exit_Label"))) { @@ -149,6 +170,7 @@

}

+ //scheduler handler public void handleUpdateEvent(EventObject ue) {

Module[] ms = null;