Package org.jmanage.core.util

Examples of org.jmanage.core.util.Expression$CustomStringTokenizer


            // todo: it will be good to bring in a concept of ExpressionList
            // todo:    object which parses an expression into multiple
            // todo:    Expression objects - RK
            graphAttributes.append("[");
            Expression expr = new Expression(appConfig.getName(),
                    attrConfig.getMBean(),
                    attrConfig.getAttribute());
            graphAttributes.append(expr.toString());
            graphAttributes.append("]");
        }
        return graphAttributes.toString();
    }
View Full Code Here


        String[] attributes = form.getAttributes();
        String[] displayNames = request.getParameterValues("displayNames");
        List<GraphAttributeConfig> graphAttrConfigs =
          new ArrayList<GraphAttributeConfig>(attributes.length);
        for(int i=0; i<attributes.length; i++){
            Expression expression = new Expression(attributes[i]);
            GraphAttributeConfig graphAttrConfig = new GraphAttributeConfig(
                    expression.getMBeanName(),expression.getTargetName(),
                    displayNames[i]);
            graphAttrConfigs.add(graphAttrConfig);
        }
        String graphId = request.getParameter(RequestParams.GRAPH_ID);
        GraphConfig graphConfig = null;
View Full Code Here

        AlertForm alertForm = (AlertForm)actionForm;
        String sourceType = request.getParameter(RequestParams.ALERT_SOURCE_TYPE);
        request.setAttribute("alertSourceType",
                            sourceType);
        if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_NOTIFICATION)){
            Expression expr = new Expression(alertForm.getExpression());
            request.setAttribute("sourceMBean", expr.getMBeanName());
            request.setAttribute("notificationType", expr.getTargetName());
        }else if(sourceType.equals(AlertSourceConfig.SOURCE_TYPE_GAUGE_MONITOR)
                || sourceType.equals(AlertSourceConfig.SOURCE_TYPE_STRING_MONITOR)){
            Expression expr = new Expression(alertForm.getExpression());
            request.setAttribute("sourceMBean", expr.getMBeanName());
            request.setAttribute("attribute", expr.getTargetName());
            MBeanService mbeanService = ServiceFactory.getMBeanService();
            ObjectAttribute objAttr = mbeanService.getObjectAttribute(
                    Utils.getServiceContext(context, expr),
                    expr.getTargetName());
            request.setAttribute("currentAttrValue",
                    objAttr.getDisplayValue());

        }
View Full Code Here

    }

    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();
           
View Full Code Here

        String[] attributes = form.getAttributes();
        String[] attributeNames = new String[attributes.length];
        String[] objectNames = new String[attributes.length];
        String[] displayNames = new String[attributes.length];
        for(int i=0; i<attributes.length;i++){
            Expression expression = new Expression(attributes[i]);
            attributeNames[i] = expression.getTargetName();
            displayNames[i] = expression.getTargetName();
            objectNames[i] = expression.getMBeanName();
        }
        request.setAttribute("attributeNames", attributeNames);
        request.setAttribute("objectNames",objectNames);
        request.setAttribute("displayNames",displayNames);
        /*set current page for navigation*/
 
View Full Code Here

        if(args.length != 1){
            usage();
            return false;
        }

        Expression expression = new Expression(args[0]);
        if(expression.getAppName() == null || expression.getMBeanName() == null){
            usage();
            return false;
        }

        MBeanService service = ServiceFactory.getMBeanService();
        ObjectInfo objectInfo =
                service.getMBeanInfo(context.getServiceContext(
                        expression.getAppName(), expression.getMBeanName()));
        printObjectInfo(objectInfo);
        return true;
    }
View Full Code Here

     */
    private String getAttributesForGraph(String applicationName) throws Exception{
        StringBuffer graphAttributes = new StringBuffer();
        for(String mbean : mbeans){
            for(String attribute : attributes.get(mbean)){
                Expression expr =
                        new Expression(applicationName, mbean, attribute);
                if(graphAttributes.length() > 0){
                    graphAttributes.append(",");
                }
                graphAttributes.append("[");
                graphAttributes.append(expr.toString());
                graphAttributes.append("]");
            }
        }
        return URLEncoder.encode(graphAttributes.toString(), "UTF-8");
    }
View Full Code Here

        if(args.length == 0){
            usage();
            return false;
        }

        Expression expression = new Expression(args[0]);
        /* get the values */
        MBeanService service = ServiceFactory.getMBeanService();

        String[] attributeNames = null;
        if(args.length > 1){
            attributeNames = new String[args.length - 1];
            for(int i=0; i< attributeNames.length; i++){
                attributeNames[i] = args[i+1];
            }
        }
        ServiceContext serviceContext =
                context.getServiceContext(expression.getAppName(),
                            expression.getMBeanName());
        AttributeListData[] attributeValues = null;
        if(attributeNames != null){
            attributeValues = service.getAttributes(serviceContext,
                    attributeNames, true);
        }else{
View Full Code Here

            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*/
        request.setAttribute(RequestAttributes.NAV_CURRENT_PAGE, "Edit Alert");
        return mapping.findForward(Forwards.SUCCESS);
    }
View Full Code Here

        /* parse the expression and get the hashmap of appname+mbeanname to
            attribute list */
        final Map<AppMBeanKey, List<String>> appMBeanToAttributesMap =
          new HashMap<AppMBeanKey, List<String>>();

        Expression expression = null;
        for(int i=0; i<args.length; i++){
            expression = new Expression(args[i], expression);
            if(expression.getAppName() == null ||
                    expression.getMBeanName() == null ||
                    expression.getTargetName() == null){
                usage();
                return false;
            }
            AppMBeanKey key = new AppMBeanKey(expression.getAppName(),
                    expression.getMBeanName());
            List<String> attributes = appMBeanToAttributesMap.get(key);
            if(attributes == null){
                attributes = new LinkedList<String>();
                appMBeanToAttributesMap.put(key, attributes);
            }
            attributes.add(expression.getTargetName());
        }

        /* now get the values */
        MBeanService service = ServiceFactory.getMBeanService();
        for(Iterator it=appMBeanToAttributesMap.keySet().iterator(); it.hasNext();){
View Full Code Here

TOP

Related Classes of org.jmanage.core.util.Expression$CustomStringTokenizer

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.