Package org.rhq.enterprise.server.resource.group.definition.framework

Examples of org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator$Result


            keyResultArr = new Result[resultList.size()];
            resultList.toArray(keyResultArr);
           
            log.debug("After deleting Business. Obtained vector size:" + keyResultArr != null ? keyResultArr.length : 0);
            for (int i = 0; keyResultArr != null && i < keyResultArr.length; i++) {
                Result result = (Result) keyResultArr[i];
                int errno = result.getErrno();
                if (errno == 0) {
                    coll.addAll(keys);
                }
                else {
                    ErrInfo errinfo = result.getErrInfo();
                    DeleteException de = new DeleteException(errinfo.getErrCode() + ":" + errinfo.getValue());
                    bulk.setStatus(JAXRResponse.STATUS_FAILURE);
                    exceptions.add(de);
                }
            }
View Full Code Here


    }

    private static boolean validateCGE(CannedGroupExpression cge) {
        boolean valid = true;
        try {
            ExpressionEvaluator evaluator = new ExpressionEvaluator();
            evaluator.setTestMode(true); // to prevent actual query from happening
            for (String expr : cge.getExpression()) {
                evaluator.addExpression(expr);
            }
            evaluator.execute();
           
        } catch (Exception ex) {
            log.error("Failed to evaluate [expression], evaluator result : "+ex.getMessage());
            valid = false;
        }
View Full Code Here

        if (definition.getExpression() == null || definition.getExpression().isEmpty()) {
            throw new GroupDefinitionException("Expression is empty");
        }
       
        try {
            ExpressionEvaluator evaluator = new ExpressionEvaluator();
            for (String expression : definition.getExpressionAsList()) {
                evaluator.addExpression(expression);
            }
        } catch (InvalidExpressionException e) {
            throw new GroupDefinitionException("Cannot parse the expression: " + e.getMessage());
        }
View Full Code Here

        long startTime = System.currentTimeMillis();

        GroupDefinition groupDefinition = getById(groupDefinitionId);
        groupDefinition.setLastCalculationTime(System.currentTimeMillis()); // we're calculating now

        ExpressionEvaluator evaluator = new ExpressionEvaluator();
        for (String expression : groupDefinition.getExpressionAsList()) {
            evaluator.addExpression(expression);
        }

        Collection<Integer> doomedResourceGroupIds = new ArrayList<Integer>();
        for (Integer managedGroupId : getManagedResourceGroupIdsForGroupDefinition(groupDefinitionId)) {
            doomedResourceGroupIds.add(managedGroupId);
View Full Code Here

                String expectedGroupResult = "";
                if (successTestCases[i].length == 3) {
                    expectedGroupResult = successTestCases[i][2];
                }

                ExpressionEvaluator evaluator = new ExpressionEvaluator();
                evaluator.setTestMode(true); // to prevent actual query from happening
                for (String expression : inputExpressions.split(";")) {
                    try {
                        evaluator.addExpression(expression); // do not trim, evaluator must handle sloppy expressions
                    } catch (Exception e) {
                        e.printStackTrace(System.out);
                        assert false : "Error in TestCase[" + i + "], could not add expression[" + expression
                            + "], input[" + inputExpressions + "]";
                    }
                }

                evaluator.execute(); // execute will compute the JPQL statements

                String actualTopResult = evaluator.getComputedJPQLStatement();
                String actualGroupResult = evaluator.getComputedJPQLGroupStatement();

                expectedTopResult = cleanUp(expectedTopResult);
                actualTopResult = cleanUp(actualTopResult);
                expectedGroupResult = cleanUp(expectedGroupResult);
                actualGroupResult = cleanUp(actualGroupResult);
View Full Code Here

            { "resource", "pluginConfiguration[partition]" }, //
            { "resource", "pluginConfiguration[partition]", "contains" }, //
            { "resource", "pluginConfiguration[partition.name]", "contains" }, //
            { "memberof" } };

        ExpressionEvaluator evaluator = new ExpressionEvaluator();
        evaluator.setTestMode(true); // to prevent actual query from happening

        for (int i = 0; i < input.length; i++) {
            String nextInput = input[i];
            String[] nextExpectedOutput = expectedOutput[i];

            List<String> output = evaluator.tokenizeCondition(nextInput);
            String[] outputArray = output.toArray(new String[0]);

            if (nextExpectedOutput.length != outputArray.length) {
                System.out.println("Expected (" + Arrays.asList(nextExpectedOutput) + "), Received (" + output + ")");
                continue;
View Full Code Here

    }

    private void evaluateExpressions(ExpressionGenerator generator) throws Exception {
        try {
            getTransactionManager().begin();
            ExpressionEvaluator evaluator = new ExpressionEvaluator();
            for (String expression : generator.getExpressions()) {
                evaluator.addExpression(expression);
            }
            evaluator.execute();
            evaluator.iterator().next();
        } finally {
            getTransactionManager().rollback();
        }
    }
View Full Code Here

        private DispositionReport getSuccessMessage() {
                DispositionReport r = new DispositionReport();
                r.setGeneric("2.0");
                r.setTruncated(Truncated.FALSE);
                Result x = new Result();
                r.setOperator(getNodeID());
                r.getResult().add(x);
                return r;
        }
View Full Code Here

                List<Result> r = new ArrayList<Result>();
                if (result == null) {
                        return r;
                }
                for (int i = 0; i < result.size(); i++) {
                        Result x = new Result();
                        x.setErrno(result.get(i).getErrno());
                        x.setErrno(result.get(i).getErrno());
                        if (result.get(i).getKeyType() != null) {
                                switch (result.get(i).getKeyType()) {
                                        case BINDING_KEY:
                                                x.setKeyType(KeyType.BINDING_KEY);
                                                break;
                                        case BUSINESS_KEY:
                                                x.setKeyType(KeyType.BUSINESS_KEY);
                                                break;
                                        case SERVICE_KEY:
                                                x.setKeyType(KeyType.SERVICE_KEY);
                                                break;
                                        case T_MODEL_KEY:
                                                x.setKeyType(KeyType.T_MODEL_KEY);
                                                break;
                                }
                        }
                        x.setErrInfo(new ErrInfo());
                        x.getErrInfo().setErrCode(result.get(i).getErrInfo().getErrCode());
                        x.getErrInfo().setValue(result.get(i).getErrInfo().getValue());
                        r.add(x);
                }
               
                return r;
        }
View Full Code Here

   
   
    new ValidateSubscriptionListener().validateNotification(body);
     
    DispositionReport dr = new DispositionReport();
    Result res = new Result();
    dr.getResult().add(res);
    return dr;
  }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator$Result

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.