package uk.ac.ox.it.ords.api.statistics.services.impl;

import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.configuration.XMLConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import uk.ac.ox.it.ords.api.statistics.configuration.CommonVars;
import uk.ac.ox.it.ords.api.statistics.services.ServerConfigurationService;

public class ServerConfigurationServiceImpl implements ServerConfigurationService {

	Logger log = LoggerFactory.getLogger(ServerConfigurationServiceImpl.class);

	@Override
	public List<String> getServers() throws Exception {
		
		try {
			//
			// Load the configuration file
			//
			XMLConfiguration config = new XMLConfiguration(CommonVars.serverConfig);
			
			//
			// Read the server list
			//
			String[] servers = config.getStringArray("serverList.server[@name]");
			return Arrays.asList(servers);
		} catch (Exception e) {
			log.error("Unable to find server configuration file in " + CommonVars.serverConfig);
			throw new FileNotFoundException();
		}
		

	}
}

@@ -256,73 +256,8 @@
 y;%0A%0A
-import uk.ac.ox.it.ords.api.statistics.configuration.CommonVars;%0A
 impo
@@ -495,75 +495,247 @@
 s);%0A
-%0A%09@Override%0A%09public List%3CString%3E getServers() throws Exception %7B%0A%09%09
+%09%0A%09public static final String DEFAULT_SERVER_CONFIG_LOCATION = %22/etc/ordsConfig/serverConfig.xml%22;%0A%0A%0A%09@Override%0A%09public List%3CString%3E getServers() throws Exception %7B%0A%09%09%0A%09%09String serverConfigurationLocation = DEFAULT_SERVER_CONFIG_LOCATION;%0A
 %0A%09%09t
@@ -760,16 +760,21 @@
 oad the 
+meta-
 configur
@@ -844,37 +844,598 @@
 ion(
-CommonVars.serverConfig);%0A%09%09%09
+%22config.xml%22);%0A%09%09%09serverConfigurationLocation = config.getString(%22serverConfigurationLocation%22);%0A%09%09%09if (serverConfigurationLocation == null)%7B%0A%09%09%09%09log.warn(%22No server configuration location set; using defaults%22);%0A%09%09%09%09serverConfigurationLocation = DEFAULT_SERVER_CONFIG_LOCATION;%0A%09%09%09%7D%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09log.warn(%22No server configuration location set; using defaults%22);%0A%09%09%09serverConfigurationLocation = DEFAULT_SERVER_CONFIG_LOCATION;%0A%09%09%7D%0A%09%09%0A%09%09try %7B%0A%09%09%09//%0A%09%09%09// Load the configuration file%0A%09%09%09//%0A%09%09%09XMLConfiguration serverConfig = new XMLConfiguration(serverConfigurationLocation);%0A
 %0A%09%09%09
@@ -1492,17 +1492,23 @@
 rvers = 
-c
+serverC
 onfig.ge
@@ -1675,19 +1675,8 @@
 %22 + 
-CommonVars.
 serv
@@ -1683,16 +1683,31 @@
 erConfig
+urationLocation
 );%0A%09%09%09th

Use meta-config and commons-configuration to get location of ORDS server config, rather than CommonVars class