/** Adds a list of objects to the repo. */ public void add (List<Object> items) { for (Object item: items) { add(item); } }
private void processBootDataset (Document document) { // Read and convert the bootstrap dataset XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); try { // we want all the children of the bootstrap node XPathExpression exp = xPath.compile("/powertac-bootstrap-data/bootstrap/*"); NodeList nodes = (NodeList)exp.evaluate(document, XPathConstants.NODESET); log.info("Found " + nodes.getLength() + " bootstrap nodes"); // Each node is a bootstrap data item for (int i = 0; i < nodes.getLength(); i++) { String xml = nodeToString(nodes.item(i)); add(messageConverter.fromXML(xml)); } } catch (XPathExpressionException xee) { log.error("runOnce: Error reading config file: " + xee.toString()); } }
@Override public void run () { cc.setAuthorizedBrokerList(brokers); cc.setInputQueueName(inputQueueName); Document document = getDocument(bootUrl); if (document != null) { if (preGame(document)) { bootstrapDataRepo.add(processBootDataset(document)); cc.runOnce(false); nextGameId(); } } } };