org.powertac.common.repo.BootstrapDataRepo Maven / Gradle / Ivy
/*
* Copyright (c) 2015-2016 by John Collins
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.powertac.common.repo;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.powertac.common.Competition;
import org.powertac.common.CustomerInfo;
import org.powertac.common.XMLMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Repository for data contained in a bootstrap record.
* Presumably this will be unused during a boot session.
* The bootstrap data is simply an array of various types of objects.
* The repo allows retrieval of the entire array, or just the items of
* a particular class. It also reads a boot record, allowing it to be used
* outside the server without duplicating this functionality.
*
* @author John Collins
*/
@Service
public class BootstrapDataRepo implements DomainRepo
{
static private Logger log = LogManager.getLogger(BootstrapDataRepo.class);
@Autowired
private XMLMessageConverter messageConverter;
// The data store
private Competition bootstrapCompetition;
private ArrayList © 2015 - 2025 Weber Informatics LLC | Privacy Policy