Examples of AlertManagerLocal


Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

    }

    public String acknowledgeSelectedAlerts() {

        Subject subject = EnterpriseFacesContextUtility.getSubject();
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();

        try {
            Integer[] selectedItems = getSelectedItems();
            int num = alertManager.acknowledgeAlerts(subject, ArrayUtils.unwrapArray(selectedItems));
            if (num == -1)
                FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No Alerts passed to ack");
            else
                FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Acknowledged " + num + " alerts");
        } catch (Exception e) {
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

        AlertCriteria criteria = new AlertCriteria();
        criteria.addFilterResourceIds(resourceId);
        criteria.setPageControl(lastFive);

        AlertManagerLocal alertManager = LookupUtil.getAlertManager();
        List<Alert> results = alertManager.findAlertsByCriteria(subject, criteria);
        return results;
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

            ScriptContext sc = engine.getContext();
            sc.setAttribute("alertPreferences",preferencesMap,ScriptContext.ENGINE_SCOPE);
            sc.setAttribute("alertParameters",parameterMap,ScriptContext.ENGINE_SCOPE);
            engine.eval(br);

            AlertManagerLocal alertManager = LookupUtil.getAlertManager();

            Object[] args = new Object[3];
            args[0] = alert;
            args[1] = alertManager.prettyPrintAlertURL(alert);
            args[2] = alertManager.prettyPrintAlertConditions(alert, false);
            result = ((Invocable) engine).invokeFunction("sendAlert", args);

            if (result == null) {
                return SenderResult.getSimpleFailure("Script ]" + scriptName + "] returned null, so success is unknown");
            }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

            Twitter twitter = tFactory.getInstance();
            twitter.setOAuthConsumer(consumerKey, consumerSecret);
            twitter.setOAuthAccessToken(accessToken);

            AlertManagerLocal alertManager = LookupUtil.getAlertManager();
            StringBuilder b = new StringBuilder("Alert ");
            b.append(alert.getId()).append(":'"); // Alert id
            b.append(alert.getAlertDefinition().getResource().getName());
            b.append("' (");
            b.append(alert.getAlertDefinition().getResource().getId());
            b.append("): ");
            b.append(alertManager.prettyPrintAlertConditions(alert, true));
            b.append("-by " + this.alertParameters.getSimpleValue("twittedBy", "@RHQ")); // TODO not for production :-)
            // TODO use some alert url shortening service

            String msg = b.toString();
            if (msg.length() > 140)
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

        MobiKind kind = MobiKind.valueOf(kindString);

        Integer alertId = alert.getId();
        StringBuilder b = new StringBuilder("alertText=");
        Resource res = alert.getAlertDefinition().getResource();
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();

        switch (kind) {
        case VOICE:
            b.append("Alert on resource ");
            do {
                b.append(res.getName());
                res = res.getParentResource();
                if (res != null)
                    b.append(" with parent ");
            } while (res != null);
            b.append(". Cause is ");

            // Switch locale to english, as the voice synthesizer expects this for now
            Locale currentLocale = Locale.getDefault();
            Locale.setDefault(Locale.ENGLISH);
            b.append(alertManager.prettyPrintAlertConditions(alert, false));
            Locale.setDefault(currentLocale);

            boolean willBeDisabled = alertManager.willDefinitionBeDisabled(alert);

            if (willBeDisabled)
                b.append(" The alert definition will now be disabled. \n\n");

            //            b.append(" Please press ");
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

            return SenderResult.getSimpleFailure("IRC Alert to [" + chan + "] failed! " + t.getMessage());
        }
    }

    private String getIrcMessage(Alert alert) {
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();

        StringBuilder b = new StringBuilder("Alert -- ");
        b.append(alert.getAlertDefinition().getName());
        b.append(" (on ");
        b.append(alert.getAlertDefinition().getResource().getName());
        b.append("):  ");
        b.append(alertManager.prettyPrintAlertURL(alert));
        b.append("\n");
        b.append(alertManager.prettyPrintAlertConditions(alert, false));

        return b.toString();
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

    @Override
    public SenderResult send(Alert alert) {
        String category = alertParameters.getSimpleValue("log4JCategory", this.getClass().getName());
        Logger logger = Logger.getLogger(category);
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

        List lineage = resourceManager.getResourceLineage(alert.getAlertDefinition().getResource().getId());
        String platformName = ((Resource)lineage.get(0)).getName();
        String conditions = alertManager.prettyPrintAlertConditions(alert, false).replace('\n', ' ');
        String alertURL = alertManager.prettyPrintAlertURL(alert);
        StringBuilder message = new StringBuilder();
        message.append("ALERT,");
        message.append(alert.getAlertDefinition().getPriority().getName());
        message.append(',');
        message.append(alert.getAlertDefinition().getName());
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

            // get the user's preferences for the alerts portlet
            AlertsPortletPreferences alertPrefs = preferences.getAlertsPortletPreferences();

            PageControl pageControl = new PageControl(0, alertPrefs.count);
            AlertManagerLocal alertManager = LookupUtil.getAlertManager();
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

            AlertCriteria criteria = new AlertCriteria();
            criteria.addFilterPriorities(AlertPriority.getByLegacyIndex(alertPrefs.priority));
            criteria.addFilterStartTime(alertPrefs.timeRange);
            criteria.addFilterResourceIds(("all".equals(alertPrefs.displayAll) ? null : ArrayUtils
                .wrapInArray(alertPrefs.asArray())));
            criteria.setPageControl(pageControl);

            PageList<Alert> alerts = alertManager.findAlertsByCriteria(user.getSubject(), criteria);

            disambiguatedAlerts = DisambiguatedResourceListUtil.disambiguate(resourceManager, alerts,
                RESOURCE_ID_EXTRACTOR);
        } catch (Exception e) {
            if (log.isDebugEnabled()) {
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

     */
    @Override
    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        Subject subject = RequestUtils.getSubject(request);
        AlertManagerLocal alertManager = LookupUtil.getAlertManager();

        // pass-through the alertId
        Integer alertId = new Integer(request.getParameter("a"));
        log.trace("alertId=" + alertId);
        request.setAttribute("a", alertId);

        // properties
        AlertCriteria criteria = new AlertCriteria();
        criteria.addFilterId(alertId);
        List<Alert> results = alertManager.findAlertsByCriteria(subject, criteria);

        if (results.size() == 0) {
            throw new IllegalArgumentException("Alert with id " + alertId + " was not found");
        }

View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertManagerLocal

        }

        if (resourceId == null)
            return returnNoResource(request, mapping);

        AlertManagerLocal alertManager = LookupUtil.getAlertManager();
        alertManager.deleteAlerts(WebUtility.getSubject(request), ArrayUtils.unwrapArray(alertIds));

        if (log.isDebugEnabled())
            log.debug("!!!!!!!!!!!!!!!! removing alerts!!!!!!!!!!!!");

        return returnSuccess(request, mapping, params);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.