Thanks Anissa.
Please see the inline comment.
----- Original Message -----
From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Saturday, November 3, 2007 11:00 am
Subject: Re: Code Review Request
To: Rajeshwar V Patil <Rajeshwar.Patil_at_Sun.COM>
Cc: admin_at_glassfish.dev.java.net
> Hi Rajeshwar,
>
> Thanks for taking care of the GUI module changes.
> Just a comment, it will make the code much simpler if we use {0}
> new
> update(s) instead of putting out different msg for 1 or greater
> than 1 update. The same for modules.
> If thats what you really want to do, then i see that there is missing
> a
> case where update is more than 1 but Module is 1. You will then
> need
> to add msg.updatesAndNewModuleAvailable in the Properties file.
> So, either you simplify the code or add this missing case.
The case you are referring to is handled by msg.updatesAndNewModulesAvailable.
In case of new software(module), we do not need a separate string as *software* is applicable/used in both the cases- singular as well as plural.
Thanks
Rajeshwar
>
> thanks
> Anissa
>
> Rajeshwar V Patil wrote:
> > I am planning to check-in following changes to admin-gui module.
> Please review.
> > These changes are related to UC issue- https://updatecenter.dev.java.net/issues/show_bug.cgi?id=336
> >
> > Brief context:
> > ---------------
> > Currently, on Admin GUI login, we report no. of updates available if
> any. Now, we also want to report number of new software available if
> any. UC code is already fixed. These are corresponding changes in
> Admin GUI.
> >
> >
> > What the change is:
> > ----------------------
> > In addition to new updates, now we are also checking for new
> software modules and constructing the update message accordingly.
> >
> >
> > Code diffs:
> > ------------
> >
> > Index: handlers/CommonHandlers.java
> > ===================================================================
> > RCS file: /cvs/glassfish/admin-gui/src/java/com/sun/enterprise/tools/admingui/handlers/CommonHandlers.java,v
> > retrieving revision 1.16
> > diff -c -r1.16 CommonHandlers.java
> > *** handlers/CommonHandlers.java 6 Jun 2007 08:07:34 -0000 1.16
> > --- handlers/CommonHandlers.java 3 Nov 2007 17:39:28 -0000
> > ***************
> > *** 143,151 ****
> > return;
> >
> > try{
> > ! //We check if any thing is available for update once
> per session.
> > ! int numModule = AMXUtil.getDomainRoot().getUpdateStatus().getNumModules();
> > ! sessionMap.put("updateCenterMsg", (numModule > 0)?
> GuiUtil.getMessage("msg.updateAvailable") : "");
> > }catch(Exception ex){
> > //ex.printStackTrace(); was told that we shouldn't
> log update center exception
> > sessionMap.put("updateCenterMsg", "");
> > --- 143,151 ----
> > return;
> >
> > try{
> > ! //Check if any new updates or modules are available
> > ! sessionMap.put("updateCenterMsg", getUpdateMessage());
> > !
> > }catch(Exception ex){
> > //ex.printStackTrace(); was told that we shouldn't
> log update center exception
> > sessionMap.put("updateCenterMsg", "");
> > ***************
> > *** 628,633 ****
> > --- 628,677 ----
> > }
> > }
> >
> > + private static String getUpdateMessage() {
> > + //Get number of new updates available
> > + int numUpdates = AMXUtil.getDomainRoot().getUpdateStatus().getNumModules();
> > +
> > + //Get number of new software available
> > + int numNewModules = AMXUtil.getDomainRoot().getUpdateStatus().getNumNewSoftware();
> > +
> > + String updateMessage = "";
> > + if ((numUpdates > 0) && (numNewModules > 0)) {
> > + //New update as well as software modules are available
>
> > + updateMessage = (numUpdates == 1) ?
> > +
> GuiUtil.getMessage("msg.updateAndNewModulesAvailable",
> > + new Object[]{numNewModules}) :
> > +
> GuiUtil.getMessage("msg.updatesAndNewModulesAvailable",
> > + new Object[]{numUpdates, numNewModules});
> > + } else {
> > + if ((numUpdates <= 0) && (numNewModules <= 0)) {
> > + //No new update or sofware modules are available
> > + updateMessage = "";
> > + } else {
> > + if (numUpdates > 0) {
> > + //New updates are available
> > + updateMessage = (numUpdates == 1) ?
> > + GuiUtil.getMessage("msg.updateAvailable")
> :
> > + GuiUtil.getMessage("msg.updatesAvailable",
> > + new Object[]{numUpdates});
> > + } else {
> > + //New software modules are available
> > + updateMessage = (numNewModules == 1) ?
> > +
> GuiUtil.getMessage("msg.newModuleAvailable") :
> > +
> GuiUtil.getMessage("msg.newModulesAvailable",
> > + new Object[]{numNewModules});
> > + }
> > + }
> > + }
> > +
> > + if(!updateMessage.equals("")) {
> > + updateMessage = updateMessage + " " +
> > + GuiUtil.getMessage("msg.runUpdateCenter");
> > + }
> > +
> > + return updateMessage;
> > + }
> > +
> > private static final String CHARTING_COOKIE_NAME = "as91-doCharting";
> > private static final int INDEX=0;
> >
> > Index: resources/Strings.properties
> > ===================================================================
> > RCS file: /cvs/glassfish/admin-gui/src/java/com/sun/enterprise/tools/admingui/resources/Strings.properties,v
> > retrieving revision 1.132.2.3.2.8
> > diff -c -r1.132.2.3.2.8 Strings.properties
> > *** resources/Strings.properties 30 Oct 2007 19:19:06 -0000 1.132.2.3.2.8
> > --- resources/Strings.properties 3 Nov 2007 17:39:30 -0000
> > ***************
> > *** 228,234 ****
> > msg.PingError=Ping returned error without known reason.
> > msg.JmsPingSucceed=Ping succeeded: JMS service is running
> > msg.Error=An error has occurred
> > ! msg.updateAvailable=** Update is available. Please run the Update
> Center Client for download and installation. **
> > msg.enableSuccessful=Selected application(s) has been enabled on
> all targets.
> > msg.disableSuccessful=Selected application(s) has been disabled on
> all targets.
> > msg.enableResourceSuccessful=Selected resource(s) has been enabled
> on all targets.
> > --- 228,240 ----
> > msg.PingError=Ping returned error without known reason.
> > msg.JmsPingSucceed=Ping succeeded: JMS service is running
> > msg.Error=An error has occurred
> > ! msg.updatesAvailable={0} new updates are available.
> > ! msg.updateAvailable=1 new update is available.
> > ! msg.newModulesAvailable={0} new software are available.
> > ! msg.newModuleAvailable=1 new software is available.
> > ! msg.updatesAndNewModulesAvailable={0} new updates and {1} new
> software are available.
> > ! msg.updateAndNewModulesAvailable=1 new update and {0} new software
> are available.
> > ! msg.runUpdateCenter=Please run the Update Center Client
> (install-root/updatecenter/bin/updatetool) for download and installation.
> > msg.enableSuccessful=Selected application(s) has been enabled on
> all targets.
> > msg.disableSuccessful=Selected application(s) has been disabled on
> all targets.
> > msg.enableResourceSuccessful=Selected resource(s) has been enabled
> on all targets.
> >
> >
> >
> > Thanks
> > Rajeshwar
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>