Beispiel #1
0
 /** Create empty Variables. */
 Variables() {
   logger = JOVALMsg.getLogger();
   variables = new Hashtable<String, List<IType>>();
   comments = new Hashtable<String, String>();
   try {
     ctx = JAXBContext.newInstance(SchemaRegistry.lookup(SchemaRegistry.OVAL_VARIABLES));
   } catch (JAXBException e) {
     logger.error(JOVALMsg.getMessage(JOVALMsg.ERROR_EXCEPTION), e);
   }
 }
Beispiel #2
0
 /** Create a Results based on the specified Definitions and SystemCharacteristics. */
 public Results(IDefinitions definitions, ISystemCharacteristics sc) {
   this.definitions = definitions;
   this.sc = sc;
   logger = JOVALMsg.getLogger();
   definitionTable = new Hashtable<String, DefinitionType>();
   testTable = new Hashtable<String, TestType>();
   directives = new Directives();
   try {
     ctx = JAXBContext.newInstance(SchemaRegistry.lookup(SchemaRegistry.OVAL_RESULTS));
   } catch (JAXBException e) {
     logger.error(JOVALMsg.getMessage(JOVALMsg.ERROR_EXCEPTION), e);
   }
 }
Beispiel #3
0
 public static final OvalResults getOvalResults(File f) throws OvalException {
   try {
     String packages = SchemaRegistry.lookup(SchemaRegistry.OVAL_RESULTS);
     JAXBContext ctx = JAXBContext.newInstance(packages);
     Unmarshaller unmarshaller = ctx.createUnmarshaller();
     Object rootObj = unmarshaller.unmarshal(f);
     if (rootObj instanceof OvalResults) {
       return (OvalResults) rootObj;
     } else {
       throw new OvalException(JOVALMsg.getMessage(JOVALMsg.ERROR_RESULTS_BAD_SOURCE, f));
     }
   } catch (JAXBException e) {
     throw new OvalException(e);
   }
 }
Beispiel #4
0
 public static final OvalVariables getOvalVariables(Source source) throws OvalException {
   try {
     JAXBContext ctx =
         JAXBContext.newInstance(SchemaRegistry.lookup(SchemaRegistry.OVAL_VARIABLES));
     Unmarshaller unmarshaller = ctx.createUnmarshaller();
     Object rootObj = unmarshaller.unmarshal(source);
     if (rootObj instanceof OvalVariables) {
       return (OvalVariables) rootObj;
     } else {
       throw new OvalException(
           JOVALMsg.getMessage(JOVALMsg.ERROR_VARIABLES_BAD_SOURCE, source.getSystemId()));
     }
   } catch (JAXBException e) {
     throw new OvalException(e);
   }
 }