Package org.apache.imperius.spl.parser.statements

Examples of org.apache.imperius.spl.parser.statements.EvaluationResults


  throws SPLException
  {
    logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluatePolicies");

    // Iterate over the List of maps
    EvaluationResults result = new EvaluationResults();
    Iterator instanceMapKeyIt = instanceMap.keySet().iterator();
//    System.out.println("Iterating over all instances of Anchor class");

    while(instanceMapKeyIt.hasNext())
    {

      String  className = (String)instanceMapKeyIt.next()
      List instancesForClass = (List)instanceMap.get(className);
      Iterator instancesForClassIt = instancesForClass.iterator();
      if(logger.isLoggable(Level.FINE))
        logger.fine(Thread.currentThread().getName()+" iterating over instances ");
//      System.out.println(">>>>>>>>>>>"+"Starting policy Evaluation"+"<<<<<<<<<<<");
//      auditloggerString+=">>>>>>>>>>>"+"Starting policy Evaluation"+"<<<<<<<<<<<"+"\n";
      int instanceCount=1;
      while(instancesForClassIt.hasNext())
      { 
//        System.out.println("+++++++++++"+"Evaluating policy against instance "+instanceCount+"+++++++++++");
        auditloggerString+="+++++++++++"+"Evaluating policy against instance "+instanceCount+"+++++++++++"+"\n";
       
       
        InstanceInfo instanceOfClass = (InstanceInfo)instancesForClassIt.next();
        String instanceName = instanceOfClass.getInstanceName();
        Object instance = instanceOfClass.getInstance();
        Map instanceSymbolMap = instanceOfClass.getInstanceSymbolsMap();
        // populate the symboltable with information from the map
        _symTab.populateInstanceValuesForInstance(className, instanceName,instance, instanceSymbolMap);
      }
     } 
    //evaluate the declaration to populate the values for the constants

     if(_declaration != null)
     { 
      _declaration.evaluate();
     }   
    // iterate over all the policies
    for(int j=0; j<_policyList.size();j++)
    {

//      System.out.println("***********"+"evaluating sub policy number "+(j+1)+"***********");
      auditloggerString+="***********"+"evaluating sub policy number "+(j+1)+"***********"+"\n";
      PolicyStatement pStatement = (PolicyStatement)_policyList.get(j);
      // evaluate each policy 
      EvaluationResults er1 = pStatement.evaluateForResults(dc,ac);
      result.appendResult(er1);
      int result1 = result.getStatusCode(); // pStatement.evaluate(dc,ac);
      auditloggerString+=pStatement.getAuditLogString();

      if(result1 == POLICY_EVALUATION_FAILED) // report failure even if a single policy fails
View Full Code Here


      String role2) throws SPLException
  {
    logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
    this.auditloggerString="";
   
    EvaluationResults result = new EvaluationResults();
//    System.out.println("cimObjectName "+anchorClassName+" "+anchornamespace+" "+anchorInstance.toString());
    //Map keys=this.symTab.getInstance().getMapOfKeys();
    ImportStatement imp=(ImportStatement)this._importStmtList.get(0);
    InstanceInfo ii=(InstanceInfo)imp.getImportInstanceInfoList().get(0);
    String targetclassnm = ii.getInstanceName();
    List targetClassInstances = dc.getAssociatedInstanceReferences(anchorInstance, anchornamespace, targetclassnm, assocName, role1, role2);
   
    Iterator it=targetClassInstances.iterator();
//    System.out.println(">>>>>>>>>>>"+"Policy Group Evaluation - number of associated instances :"+targetClassInstances.size()+"<<<<<<<<<<<");
   
    auditloggerString+=">>>>>>>>>>>"+"Policy Group Evaluation - number of associated instances :"+targetClassInstances.size()+"<<<<<<<<<<<"+"\n";
   
    while(it.hasNext()){
      Object inst=it.next();
      //InstanceInfo iinfo=new InstanceInfo(targetclassnm,inst);
//      List instanceInfoList=new ArrayList();
      //instanceInfoList.add(iinfo);

      Map objMap=new HashMap();
      objMap.put(targetclassnm, inst);
      result.appendResult(evaluateForResults(dc,ac,objMap));

    }
//    System.out.println(">>>>>>>>>>>"+"policy evaluation complete, result :"+result+"<<<<<<<<<<<");
//    auditloggerString+=">>>>>>>>>>>"+"policy evaluation complete, result :"+result+"<<<<<<<<<<<"+"\n";
   
View Full Code Here

    return result;
  }

  public int evaluate(DataCollector dc, Actuator ac, Map iMap) throws SPLException
    {
    EvaluationResults er = evaluateForResults(dc,ac,iMap);
    return er.getStatusCode();
    }
View Full Code Here

        if (logger.isLoggable(Level.FINE))
            logger.fine(Thread.currentThread().getName()+"evaluating policy against instances cimPolicy");
        Map instanceMap =  _buildInstanceMap(iMap,dc);
       
       
        EvaluationResults result;
        if(!instanceMap.isEmpty())
        {
            if (logger.isLoggable(Level.FINE))
            {  
                logger.fine(Thread.currentThread().getName()+
                        "number of instances passed in for evaluation is "+instanceMap.size());
            }   
//            System.out.println(">>>>>>>>>>>"+"number of instances passed in for evaluation is :"+instanceMap.size()+"<<<<<<<<<<<");
           
            auditloggerString+=">>>>>>>>>>>"+"number of instances passed in for evaluation is :"+instanceMap.size()+"<<<<<<<<<<<"+"\n";
               
           
            result = _evaluatePolicies(instanceMap,dc,ac);
           
//            System.out.println(">>>>>>>>>>>"+"policy evaluation complete, result :"+result+"<<<<<<<<<<<");
            auditloggerString+=">>>>>>>>>>>"+"policy evaluation complete, result :"+result+"<<<<<<<<<<<"+"\n";
           
           
        }
        else
        {
            result = new EvaluationResults();
            logger.warning(Thread.currentThread().getName()+" "+"No valid instances for policy evaluation");
            //throw new SPLException("Out of the Instances that were passed in for Evaluation, none have passed the filter");
        }
        if (logger.isLoggable(Level.FINE))
            logger.fine(Thread.currentThread().getName()+"result of evaluation is "+result);
View Full Code Here

        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
       
    }
   
    public int evaluate(DataCollector dc , Actuator ac) throws SPLException {
      EvaluationResults er = evaluateForResults(dc,ac);
      return er.getStatusCode();
    }
View Full Code Here

        if (conditionResult != null)  {
          psr = new PolicyStatementResult(result, conditionResult, decisionResult);
        } else {
          psr = new PolicyStatementResult(result, decisionResult);
        }
        return new EvaluationResults(psr);
    }
View Full Code Here

        if (!instances.isEmpty() && instances.size() > 0)
        {
          logger.fine(Thread.currentThread().getName() + " Policy Evaluator calling evaluate method of SPLPolicy");
         
          EvaluationResults er = cp.evaluateForResults(_dataCollector, _actuator, instances);
          result = er.getStatusCode() == SPLPolicy.POLICY_EVALUATED_SUCCESSFULLY ? SUCCESS : FAILURE;
         
          auditLogger.fine(Thread.currentThread().getName() + "\n" + cp.getAuditLogString());
        }
        else
        {
View Full Code Here

        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setRole2");
       
  }
 
  public int evaluate(DataCollector dc,Actuator ac) throws SPLException {
    EvaluationResults er = evaluateForResults(dc,ac);
    return er.getStatusCode();
  }
View Full Code Here

 
  public EvaluationResults evaluateForResults(DataCollector dc,Actuator ac) throws SPLException
  {
        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
        this.auditloggerString="";
        EvaluationResults result = null;
    //System.out.println("Policy Gp::evaluate::symTab.getInstance().getCimObjectName() "+symTab.getAnchorClassList());
//    Map classToInstanceMap = null;
//    Iterator it = classToInstanceMap.keySet().iterator();
//    Object instance = null;
//    while(it.hasNext())
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.statements.EvaluationResults

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.