@Component public class CityFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
private org.springframework.context.ApplicationContext |
context |
private static ConcurrentHashMap<String,ICity> |
createdCityCache
Cache storing the already created cities to avoid duplicate creation
|
private static org.apache.log4j.Logger |
logger |
private Map |
map |
private org.springframework.oxm.Unmarshaller |
unmarshaller |
| Constructor and Description |
|---|
CityFactory() |
| Modifier and Type | Method and Description |
|---|---|
private ICity |
createCity(City city) |
ICity |
createCityByName(String cityName)
Create a standard city based on its name
|
Collection<ICity> |
getCities()
Retrieve all cities from the internal cache.
|
private List<City> |
getCities(String mapName) |
private Source |
getSourceFromFile(String fileName) |
void |
initializeCityCache(String mapName)
Initialize all cities defined in
mapName |
private static final org.apache.log4j.Logger logger
@Autowired @Qualifier(value="jaxb2MapMarshaller") private org.springframework.oxm.Unmarshaller unmarshaller
@Autowired private org.springframework.context.ApplicationContext context
private static ConcurrentHashMap<String,ICity> createdCityCache
private Map map
public void initializeCityCache(String mapName) throws IOException
mapNamemapName - name of the XML fileIOException - invalid XML filepublic Collection<ICity> getCities()
public ICity createCityByName(String cityName) throws IOException
cityName - IOException - Error reading the city propertiesCopyright © 2011-2015 Sahits GmbH. All Rights Reserved.