Package org.jmanage.core.config

Examples of org.jmanage.core.config.AlertSourceConfig


        return mapping.findForward(Forwards.SUCCESS);
    }

    private AlertSourceConfig getAlertSourceConfig(WebContext context,
                                                   AlertForm form){
        AlertSourceConfig sourceConfig = null;
        Expression expression = new Expression(form.getExpression());
        if(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION.equals(
                form.getAlertSourceType())){
            sourceConfig = new AlertSourceConfig(expression.getMBeanName(),
                    expression.getTargetName());
        }else if(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR.equals(
                form.getAlertSourceType())){
            MBeanService mbeanService = ServiceFactory.getMBeanService();
            String attributeDataType = mbeanService.getAttributeDataType(
                    Utils.getServiceContext(context),expression.getTargetName(),
                    expression.getMBeanName());
            sourceConfig = new AlertSourceConfig(expression.getMBeanName(),
                    expression.getTargetName(),
                    CoreUtils.valueOf(form.getMinAttributeValue(),attributeDataType),
                    CoreUtils.valueOf(form.getMaxAttributeValue(),attributeDataType),
                    attributeDataType);
        }else if(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR.equals(
                form.getAlertSourceType())){
            sourceConfig = new AlertSourceConfig(expression.getMBeanName(),
                    expression.getTargetName(), form.getStringAttributeValue());

        }else if(AlertSourceConfig.SOURCE_TYPE_APPLICATION_DOWN.equals(
                form.getAlertSourceType())){
            sourceConfig = new AlertSourceConfig();
           
        }else {
            assert false: "not supported type";
        }
        sourceConfig.setApplicationConfig(context.getApplicationConfig());
        return sourceConfig;
    }
View Full Code Here


        AlertConfig alertConfig = appConfig.findAlertById(alertId);
        if(alertConfig!=null){
            form.setAlertName(alertConfig.getAlertName());
            form.setAlertDelivery(alertConfig.getAlertDelivery());
            form.setEmailAddress(alertConfig.getEmailAddress());
            AlertSourceConfig alertSrcConfig = alertConfig.getAlertSourceConfig();
            String sourceType = alertSrcConfig.getSourceType();
            form.setAlertSourceType(alertSrcConfig.getSourceType());
            request.setAttribute("alertSourceType",sourceType);
            request.setAttribute("sourceMBean", alertSrcConfig.getObjectName());
            // expression
            Expression expression = null;
            if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION) ||
              sourceType.equals(AlertSourceConfig.SOURCE_TYPE_APPLICATION_DOWN)){
                expression = new Expression(null, alertSrcConfig.getObjectName(),
                        alertSrcConfig.getNotificationType());
                request.setAttribute("notificationType",
                        alertSrcConfig.getNotificationType());
            }else if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR) ||sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR) ){
                expression = new Expression(null, alertSrcConfig.getObjectName(),
                        alertSrcConfig.getAttributeName());
                request.setAttribute("attribute", alertSrcConfig.getAttributeName());
                MBeanService mbeanService = ServiceFactory.getMBeanService();
                ObjectAttribute objAttr = mbeanService.getObjectAttribute(
                    Utils.getServiceContext(context, expression),
                    expression.getTargetName());
                request.setAttribute("currentAttrValue",
                        objAttr.getDisplayValue());
                if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)){
                    form.setMinAttributeValue(alertSrcConfig.getLowThreshold().toString());
                    form.setMaxAttributeValue(alertSrcConfig.getHighThreshold().toString());
                }else if(sourceType.equals(
                    AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
                    form.setStringAttributeValue(alertSrcConfig.getStringAttributeValue());
                }
            }
            form.setExpression(expression.toString());
        }
        /*set current page for navigation*/
 
View Full Code Here

TOP

Related Classes of org.jmanage.core.config.AlertSourceConfig

Copyright © 2018 www.massapicom. 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.