|
From: <cl...@hy...> - 2007-03-13 04:06:34
|
Author: clee Date: 2007-03-12 20:06:31 -0800 (Mon, 12 Mar 2007) New Revision: 3726 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3726 Modified: trunk/src/org/hyperic/hq/ui/ServiceLocator.java trunk/src/org/hyperic/hq/ui/action/portlet/DisplayDashboardAction.java trunk/src/org/hyperic/hq/ui/util/ContextUtils.java trunk/web/WEB-INF/classes/ApplicationResources.properties Log: Set the update info in the request if available Modified: trunk/src/org/hyperic/hq/ui/ServiceLocator.java =================================================================== --- trunk/src/org/hyperic/hq/ui/ServiceLocator.java 2007-03-13 03:41:30 UTC (rev 3725) +++ trunk/src/org/hyperic/hq/ui/ServiceLocator.java 2007-03-13 04:06:31 UTC (rev 3726) @@ -54,12 +54,14 @@ import org.hyperic.hq.bizapp.shared.EventLogBossHome; import org.hyperic.hq.bizapp.shared.EventsBoss; import org.hyperic.hq.bizapp.shared.EventsBossHome; +import org.hyperic.hq.bizapp.shared.GalertBoss; +import org.hyperic.hq.bizapp.shared.GalertBossHome; import org.hyperic.hq.bizapp.shared.MeasurementBoss; import org.hyperic.hq.bizapp.shared.MeasurementBossHome; -import org.hyperic.hq.bizapp.shared.GalertBoss; -import org.hyperic.hq.bizapp.shared.GalertBossHome; import org.hyperic.hq.bizapp.shared.ProductBoss; import org.hyperic.hq.bizapp.shared.ProductBossHome; +import org.hyperic.hq.bizapp.shared.UpdateBoss; +import org.hyperic.hq.bizapp.shared.UpdateBossHome; import org.hyperic.hq.ui.exception.ServiceLocatorException; import org.hyperic.hq.ui.util.UIUtils; /** @@ -104,6 +106,9 @@ private static final String GALERT_NAME = GalertBossHome.JNDI_NAME; private static final Class GALERT_CLASS = GalertBossHome.class; + private static final String UPDATE_NAME = UpdateBossHome.JNDI_NAME; + private static final Class UPDATE_CLASS = UpdateBossHome.class; + private final static String CONTEXT_FACTORY_NAME = "ejb-remote-config.context-factory"; private final static String PROVIDER_URL_NAME = @@ -161,8 +166,7 @@ * @exception ServiceLocatorException if the lookup or create fails */ public AppdefBoss getAppdefBoss() throws ServiceLocatorException { - AppdefBossHome home = - (AppdefBossHome) lookup(APPDEF_NAME, APPDEF_CLASS); + AppdefBossHome home = (AppdefBossHome) lookup(APPDEF_NAME, APPDEF_CLASS); try { return (AppdefBoss) home.create(); } catch (Exception e) { @@ -178,8 +182,7 @@ * @exception ServiceLocatorException if the lookup or create fails */ public AIBoss getAIBoss() throws ServiceLocatorException { - AIBossHome home = - (AIBossHome) lookup(AI_NAME, AI_CLASS); + AIBossHome home = (AIBossHome) lookup(AI_NAME, AI_CLASS); try { return (AIBoss) home.create(); } catch (Exception e) { @@ -195,8 +198,7 @@ * @exception ServiceLocatorException if the lookup or create fails */ public AuthBoss getAuthBoss() throws ServiceLocatorException { - AuthBossHome home = - (AuthBossHome) lookup(AUTH_NAME, AUTH_CLASS); + AuthBossHome home = (AuthBossHome) lookup(AUTH_NAME, AUTH_CLASS); try { return (AuthBoss) home.create(); } catch (Exception e) { @@ -212,8 +214,7 @@ * @exception ServiceLocatorException if the lookup or create fails */ public AuthzBoss getAuthzBoss() throws ServiceLocatorException { - AuthzBossHome home = - (AuthzBossHome) lookup(AUTHZ_NAME, AUTHZ_CLASS); + AuthzBossHome home = (AuthzBossHome) lookup(AUTHZ_NAME, AUTHZ_CLASS); try { return (AuthzBoss) home.create(); } catch (Exception e) { @@ -247,8 +248,7 @@ * @exception ServiceLocatorException if the lookup or create fails */ public EventsBoss getEventsBoss() throws ServiceLocatorException { - EventsBossHome home = - (EventsBossHome) lookup(EVENTS_NAME, EVENTS_CLASS); + EventsBossHome home = (EventsBossHome) lookup(EVENTS_NAME, EVENTS_CLASS); try { return (EventsBoss) home.create(); } catch (Exception e) { @@ -265,7 +265,7 @@ */ public ProductBoss getProductBoss() throws ServiceLocatorException { ProductBossHome home = - (ProductBossHome) lookup(PRODUCT_NAME, PRODUCT_CLASS); + (ProductBossHome) lookup(PRODUCT_NAME, PRODUCT_CLASS); try { return (ProductBoss) home.create(); } catch (Exception e) { @@ -283,7 +283,7 @@ public MeasurementBoss getMeasurementBoss() throws ServiceLocatorException { MeasurementBossHome home = - (MeasurementBossHome) lookup(MEASURE_NAME, MEASURE_CLASS); + (MeasurementBossHome) lookup(MEASURE_NAME, MEASURE_CLASS); try { return (MeasurementBoss) home.create(); } catch (Exception e) { @@ -378,4 +378,14 @@ } } + public UpdateBoss getUpdateBoss() throws ServiceLocatorException { + UpdateBossHome home = (UpdateBossHome)lookup(UPDATE_NAME, UPDATE_CLASS); + + try { + return (UpdateBoss) home.create(); + } catch (Exception e) { + throw new ServiceLocatorException(e); + } + } + } Modified: trunk/src/org/hyperic/hq/ui/action/portlet/DisplayDashboardAction.java =================================================================== --- trunk/src/org/hyperic/hq/ui/action/portlet/DisplayDashboardAction.java 2007-03-13 03:41:30 UTC (rev 3725) +++ trunk/src/org/hyperic/hq/ui/action/portlet/DisplayDashboardAction.java 2007-03-13 04:06:31 UTC (rev 3726) @@ -27,6 +27,7 @@ import java.util.Collection; import java.util.Iterator; +import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; @@ -38,12 +39,16 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.tiles.ComponentContext; import org.apache.struts.tiles.actions.TilesAction; +import org.hyperic.hq.authz.shared.AuthzConstants; import org.hyperic.hq.bizapp.shared.AuthzBoss; +import org.hyperic.hq.bizapp.shared.UpdateBoss; import org.hyperic.hq.ui.Constants; import org.hyperic.hq.ui.Portal; import org.hyperic.hq.ui.Portlet; import org.hyperic.hq.ui.WebUser; +import org.hyperic.hq.ui.exception.ParameterNotFoundException; import org.hyperic.hq.ui.util.ContextUtils; +import org.hyperic.hq.ui.util.RequestUtils; import org.hyperic.util.config.InvalidOptionException; public class DisplayDashboardAction extends TilesAction { @@ -56,6 +61,7 @@ throws Exception{ HttpSession session = request.getSession(); + ServletContext ctx = getServlet().getServletContext(); Portal portal = (Portal) session.getAttribute(Constants.USERS_SES_PORTAL); @@ -94,7 +100,6 @@ rssToken = String.valueOf(session.hashCode()); // Now store the RSS auth token - ServletContext ctx = getServlet().getServletContext(); AuthzBoss boss = ContextUtils.getAuthzBoss(ctx); user.setPreference(Constants.RSS_TOKEN, rssToken); boss.setUserPrefs(user.getSessionId(), user.getId(), @@ -104,6 +109,25 @@ } request.setAttribute(Constants.PORTAL_KEY, portal); + + Map userOpsMap = + (Map) session.getAttribute(Constants.USER_OPERATIONS_ATTR); + + if (userOpsMap.containsKey(AuthzConstants.rootOpCAMAdmin)) { + // Now check for updates + UpdateBoss uboss = ContextUtils.getUpdateBoss(ctx); + + try { + RequestUtils.getStringParameter(request, "update"); + uboss.ignoreUpdate(); + } catch (ParameterNotFoundException e) { + String update = uboss.getUpdateReport(); + if (update != null) { + request.setAttribute("HQUpdateReport", update); + } + } + } + return null; } } Modified: trunk/src/org/hyperic/hq/ui/util/ContextUtils.java =================================================================== --- trunk/src/org/hyperic/hq/ui/util/ContextUtils.java 2007-03-13 03:41:30 UTC (rev 3725) +++ trunk/src/org/hyperic/hq/ui/util/ContextUtils.java 2007-03-13 04:06:31 UTC (rev 3726) @@ -44,11 +44,12 @@ import org.hyperic.hq.bizapp.shared.AuthzBoss; import org.hyperic.hq.bizapp.shared.ConfigBoss; import org.hyperic.hq.bizapp.shared.ControlBoss; -import org.hyperic.hq.bizapp.shared.GalertBoss; import org.hyperic.hq.bizapp.shared.EventLogBoss; import org.hyperic.hq.bizapp.shared.EventsBoss; +import org.hyperic.hq.bizapp.shared.GalertBoss; import org.hyperic.hq.bizapp.shared.MeasurementBoss; import org.hyperic.hq.bizapp.shared.ProductBoss; +import org.hyperic.hq.bizapp.shared.UpdateBoss; import org.hyperic.hq.common.shared.HQConstants; import org.hyperic.hq.ui.Constants; import org.hyperic.hq.ui.ServiceLocator; @@ -66,7 +67,7 @@ * * @param ctx the <code>ServletContext</code> */ - public static ServiceLocator getServiceLocator(ServletContext ctx) + protected static ServiceLocator getServiceLocator(ServletContext ctx) throws ServiceLocatorException { ServiceLocator sl = (ServiceLocator) ctx.getAttribute(Constants.SERVICE_LOCATOR_CTX_ATTR); @@ -111,7 +112,6 @@ */ public static AppdefBoss getAppdefBoss(ServletContext ctx) throws ServiceLocatorException { - return getServiceLocator(ctx).getAppdefBoss(); } @@ -122,7 +122,6 @@ */ public static AIBoss getAIBoss(ServletContext ctx) throws ServiceLocatorException { - return getServiceLocator(ctx).getAIBoss(); } @@ -142,8 +141,7 @@ * @param ctx the <code>ServletContext</code> */ public static AuthBoss getAuthBoss(ServletContext ctx) - throws ServiceLocatorException { - + throws ServiceLocatorException { return getServiceLocator(ctx).getAuthBoss(); } @@ -154,7 +152,6 @@ */ public static AuthzBoss getAuthzBoss(ServletContext ctx) throws ServiceLocatorException { - return getServiceLocator(ctx).getAuthzBoss(); } @@ -175,7 +172,6 @@ */ public static MeasurementBoss getMeasurementBoss(ServletContext ctx) throws ServiceLocatorException { - return getServiceLocator(ctx).getMeasurementBoss(); } @@ -185,94 +181,96 @@ * @param ctx the <code>ServletContext</code> */ public static ProductBoss getProductBoss(ServletContext ctx) - throws ServiceLocatorException { - + throws ServiceLocatorException { return getServiceLocator(ctx).getProductBoss(); } /** Consult the cached <code>ServiceLocator</code> for an instance of - * <code>UIUtils</code>. + * <code>EventBoss</code>. * * @param ctx the <code>ServletContext</code> */ - public static UIUtils getUIUtils(ServletContext ctx) + public static EventLogBoss getEventLogBoss(ServletContext ctx) throws ServiceLocatorException { - - return getServiceLocator(ctx).getUIUtils(ctx); + return getServiceLocator(ctx).getEventLogBoss(); } - + /** - * Load the specified properties file and return the properties. - * - * @param ctx the <code>ServletContext</code> - * @param filename the fully qualifed name of the properties file - * @exception Exception if a problem occurs while loading the file + * Consult the cached <code>ServiceLocator</code> for an instance of + * <code>ControlBoss</code>. + * + * @param ctx + * the <code>ServletContext</code> */ - public static Properties loadProperties(ServletContext ctx, - String filename) - throws Exception { - Properties props = new Properties(); - InputStream is = ctx.getResourceAsStream(filename); - if (is != null) { - props.load(is); - is.close(); - } - - return props; + public static ControlBoss getControlBoss(ServletContext ctx) + throws ServiceLocatorException { + return getServiceLocator(ctx).getControlBoss(); } - public static void saveProperties(ServletContext ctx, - String filename, - Properties props) - throws Exception { - - filename = ctx.getRealPath(filename); - - FileOutputStream out = new FileOutputStream(filename); - props.store((OutputStream) out, null); + public static GalertBoss getGalertBoss(ServletContext ctx) + throws ServiceLocatorException { + return getServiceLocator(ctx).getGalertBoss(); } - + + public static UpdateBoss getUpdateBoss(ServletContext ctx) + throws ServiceLocatorException { + return getServiceLocator(ctx).getUpdateBoss(); + } + public static boolean usingJDBCAuthentication(ServletContext ctx) throws Exception { String provider = (String) ctx.getAttribute(Constants.JAAS_PROVIDER_CTX_ATTR); - + if (provider == null) { Properties conf = ContextUtils.getConfigBoss(ctx).getConfig(); provider = conf.getProperty(HQConstants.JAASProvider); ctx.setAttribute(Constants.JAAS_PROVIDER_CTX_ATTR, provider); } - + return provider != null && provider.equals(HQConstants.JDBCJAASProvider); } - /** Consult the cached <code>ServiceLocator</code> for an instance of - * <code>EventBoss</code>. + public static void saveProperties(ServletContext ctx, + String filename, + Properties props) + throws Exception { + + filename = ctx.getRealPath(filename); + + FileOutputStream out = new FileOutputStream(filename); + props.store((OutputStream) out, null); + } + + /** + * Load the specified properties file and return the properties. * * @param ctx the <code>ServletContext</code> + * @param filename the fully qualifed name of the properties file + * @exception Exception if a problem occurs while loading the file */ - public static EventLogBoss getEventLogBoss(ServletContext ctx) - throws ServiceLocatorException { - ServiceLocator sl = (ServiceLocator) getServiceLocator(ctx); - return sl.getEventLogBoss(); + public static Properties loadProperties(ServletContext ctx, + String filename) + throws Exception { + Properties props = new Properties(); + InputStream is = ctx.getResourceAsStream(filename); + if (is != null) { + props.load(is); + is.close(); } + + return props; + } /** Consult the cached <code>ServiceLocator</code> for an instance of - * <code>ControlBoss</code>. + * <code>UIUtils</code>. * * @param ctx the <code>ServletContext</code> */ - public static ControlBoss getControlBoss(ServletContext ctx) + public static UIUtils getUIUtils(ServletContext ctx) throws ServiceLocatorException { - ServiceLocator sl = getServiceLocator(ctx); - return sl.getControlBoss(); - } - - public static GalertBoss getGalertBoss(ServletContext ctx) - throws ServiceLocatorException - { - ServiceLocator sl = getServiceLocator(ctx); - return sl.getGalertBoss(); + + return getServiceLocator(ctx).getUIUtils(ctx); } } Modified: trunk/web/WEB-INF/classes/ApplicationResources.properties =================================================================== --- trunk/web/WEB-INF/classes/ApplicationResources.properties 2007-03-13 03:41:30 UTC (rev 3725) +++ trunk/web/WEB-INF/classes/ApplicationResources.properties 2007-03-13 04:06:31 UTC (rev 3726) @@ -2041,7 +2041,7 @@ alerts.alert.AlertList.ListHeader.AlertCondition=Alert Condition alerts.alert.AlertList.ListHeader.ActualValue=Actual Value alerts.alert.AlertList.ListHeader.Fixed=Fixed -alerts.alert.AlertList.ListHeader.Acknowledge=Acknowledge +alerts.alert.AlertList.ListHeader.Acknowledge=Ack alerts.config.DefinitionList.Title=HQ List Alert Definitions alerts.config.DefinitionList.ListHeader.AlertName=Alert Name @@ -2653,4 +2653,4 @@ inform.config.admin.HQServerConfig= - Change settings for email, data compression, database maintenance and authentication services inform.config.admin.MonitoringDefaults= - Define monitoring policies for the entire environment inform.config.admin.PolicyDefaults= - Define monitoring and alerting policies for the entire environment -inform.config.admin.EscalationScheme= - Define global escalation schemes that can be applied to individual alerts \ No newline at end of file +inform.config.admin.EscalationScheme= - Define global escalation schemes that can be applied to individual alerts |