/** 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); } }
/** 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); } }
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); } }
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); } }