Package scap.check.content

Examples of scap.check.content.ResultContext


      try {
        OCILQIExec exec = new OCILQIExec();
        exec.setInputFile(getSourceContext().getSourceContent().getLocalFile());
        exec.setVerboseOutput(config.isLogOutput());

        ResultContext resultContext = config.getResultContextResolver().resolve(getSourceContext(), "ocil-results_", ".xml");

        File resultFile = resultContext.getResultFile();
        exec.setOutputFile(resultFile);

//        OcilDocument variablesDocument = getVariablesDocument(getExports(), config);
//              if (variablesDocument != null) {
//                  File variablesFile = File.createTempFile( "oval-variables_", ".xml", config.getResultDir());
//                  variablesDocument.save( variablesFile, new XmlOptions().setSavePrettyPrint() );
//                  exec.setExternalVariableFile( variablesFile );
//                  variablesDocumentContent = new FileResultContent(variablesFile);
//              }
 
        int exitCode = exec.exec(getCheckSystem(), config, System.out);
        if (exitCode != 0 || resultFile.canRead() == false) {
          log.error("execution of OCILQI failed for content: " + getSourceContext().getId());
          result = new OCILResult(this, "Execution of OCILQI failed with error code:"
                  + exitCode);
        } else {
          FileResultContent resultContent = new FileResultContent(resultFile);
          resultContext.setResultContent(resultContent);

          result = new OCILResult(this, resultContext);
        }
      } catch (FileNotFoundException ex) {
        log.error("cannot find OCILQI executable", ex);
View Full Code Here


            System.out.println();
            printRuleResults(results);
            System.out.println();
              }
 
              ResultContext resultContext = results.getXccdfResult();
              resultContext.write();
            }
//        } catch (ProfileNotFoundException ex) {
//          log.log(Level.SEVERE,"!! checklist processing failed : " + ex.getMessage(), ex);
//        } catch (CircularReferenceException ex) {
//          log.log(Level.SEVERE,"!! checklist processing failed : " + ex.getMessage(), ex);
View Full Code Here

      if (!document.validate()) {
        throw new ValidationException("invalid xccdf document: "+document.getId());
      }

     
      ResultContext resultContext;
      File resultFile = options.getXccdfResultFile();
      if (resultFile != null) {
        resultContext = new FileResultContext(checklist, resultContextResolver, resultFile);
      } else {
        resultContext = resultContextResolver.resolve(checklist, "xccdf-results_", ".xml");
      }

        /*
         * 1 - Load and resolve the Benchmark
         */
        if (document.load() && !options.isSuppressXccdfResolved()) {
          //File resolvedFile = File.createTempFile("xccdf-resolved", ".xml",resultDirectory);
          File resolvedFile = resultContext.getAuxiliaryFile("xccdf-resolved_", ".xml");
 
          log.info("Saving the resolved checklist to: "+resolvedFile.getCanonicalPath());
          document.write(resolvedFile);
        }

View Full Code Here

    AssessmentResultItem item = instance.getAssessmentResultItem();
   
    CheckContentRefType checkContentRef = data.addNewCheckContentRef();
    checkContentRef.setName(item.getId());

    ResultContext resultContext = item.getAssessmentResult().getResultContext();
    checkContentRef.setHref(resultContext.resolveRelative(getXccdfResultContext()));
  }
View Full Code Here

    AssessmentResultItem item = instance.getAssessmentResultItem();
   
    CheckContentRefType checkContentRef = data.addNewCheckContentRef();
    checkContentRef.setName(item.getId());

    ResultContext resultContext = item.getAssessmentResult().getResultContext();
    checkContentRef.setHref(resultContext.resolveRelative(getXccdfResultContext()));
  }
View Full Code Here

          exec.setDefinitionXmlFile(getSourceContext().getSourceContent().getLocalFile());
          exec.setVerifyDefinitionsFileMD5Hash(false);
          exec.setOutputInfoAndErrorsToSTDOUT(config.isLogOutput());
          exec.setApplyXSLStylesheetToResults(false);

      ResultContext resultContext = config.getResultContextResolver().resolve(getSourceContext(), "oval-results_", ".xml");

      File resultFile = resultContext.getResultFile();
            exec.setResultsFile(resultFile);

            OvalVariablesDocument variablesDocument = getVariablesDocument(getExports(), config);
            if (variablesDocument != null) {
          File variablesFile = resultContext.getAuxiliaryFile("oval-variables_", ".xml");
                variablesDocument.save( variablesFile, new XmlOptions().setSavePrettyPrint() );
                exec.setExternalVariableFile( variablesFile );
                variablesDocumentContent = new FileResultContent(variablesFile);
            }

            Set<String> defList = getCheckedDefinitions();
            if (!defList.isEmpty()) {
                EvalutationDefinitionIdsDocument evaluatedDefinitionsDocument = getEvaluatedDefinitionsDocument(defList);
                if (evaluatedDefinitionsDocument != null) {
                    File evaluatedDefinitionsFile = resultContext.getAuxiliaryFile("oval-evaluation-ids_", ".xml");
                    evaluatedDefinitionsDocument.save(evaluatedDefinitionsFile, new XmlOptions().setSavePrettyPrint());
                    exec.setExternalEvaluatedDefinitionsFile(evaluatedDefinitionsFile);
                    evaluationIdsDocumentContent = new FileResultContent(evaluatedDefinitionsFile);
                }
            }

            OVALDirectives directives = (OVALDirectives)config.getDirective(getCheckSystem().getSystem());
            if (directives != null) {
              File directivesFile = resultContext.getAuxiliaryFile("oval-directives_", ".xml");
              XmlObject content = directives.getContent(config);
              content.save(directivesFile, new XmlOptions().setSavePrettyPrint());
                exec.setDirectivesFile(directivesFile);
                directivesContent = new FileResultContent(directivesFile);

                // Handle suppression of systems characteristics
                if (directives.isSuppressSystemsCharacteristics()) {
                  // TODO: P4: implement XSL to remove item data using -t and -x
                }
            }

            int exitCode = exec.exec(getCheckSystem(), config, System.out);
            if ( exitCode != 0 || resultFile.canRead() == false ) {
              log.error("execution of OVALDI failed for content: " + getSourceContext().getId());
                result = new OVALResult(this, "Execution of OVALDI failed with error code: "+exitCode);
            } else {
        FileResultContent resultContent = new FileResultContent(resultFile);
        resultContext.setResultContent(resultContent);

              result = new OVALResult(this, resultContext);
            }
        } catch ( FileNotFoundException ex ) {
            log.error("cannot find OVALDI executable", ex);
View Full Code Here

TOP

Related Classes of scap.check.content.ResultContext

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.