//DOMConfigurator.configure(logurl);
//DOMConfigurator.configure("conf/log4j.xml");
log.info(VERSION + " starting...");
XMLSettingNode configFile;
try {
log.debug("Parsing config file..." + configFilePath);
configFile = new XMLSettingNode(configFilePath);
} catch (Exception e) {
log.fatal("Unable to open config file " + configFilePath + ", aborting startup!");
System.out.println("Unable to open config file " + configFilePath + ", aborting startup!");
return;
}
List<Integer> ports = configFile.getIntegers("/Config/System/Port");
if (ports.isEmpty()) {
log.debug("No ports found in config file " + configFilePath + ", using default port 53");
ports.add(new Integer(53));
}
List<InetAddress> addresses = new ArrayList<InetAddress>();
List<String> addressStrings = configFile.getStrings("/Config/System/Address");
if (addressStrings == null || addressStrings.isEmpty()) {
log.debug("No addresses found in config, listening on all addresses (0.0.0.0)");
addresses.add(Address.getByAddress("0.0.0.0"));
} else {
for (String addressString : addressStrings) {
try {
addresses.add(Address.getByAddress(addressString));
} catch (UnknownHostException e) {
log.error("Invalid address " + addressString + " specified in config file, skipping address " + e);
}
}
if (addresses.isEmpty()) {
log.fatal("None of the " + addressStrings.size() + " addresses specified in the config file are valid, aborting startup!\n" + "Correct the addresses or remove them from the config file if you want to listen on all interfaces.");
return;
}
}
Integer tcpThreadPoolSize = configFile.getInteger("/Config/System/TCPThreadPoolSize");
if (tcpThreadPoolSize != null) {
log.debug("Setting TCP thread pool size to " + tcpThreadPoolSize);
this.tcpThreadPoolSize = tcpThreadPoolSize;
}
Integer tcpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/TCPThreadPoolShutdownTimeout");
if (tcpThreadPoolShutdownTimeout != null) {
log.debug("Setting TCP thread pool shutdown timeout to " + tcpThreadPoolSize + " seconds");
this.tcpThreadPoolShutdownTimeout = tcpThreadPoolShutdownTimeout;
}
Integer udpThreadPoolSize = configFile.getInteger("/Config/System/UDPThreadPoolSize");
if (udpThreadPoolSize != null) {
log.debug("Setting UDP thread pool size to " + udpThreadPoolSize);
this.udpThreadPoolSize = udpThreadPoolSize;
}
Integer udpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/UDPThreadPoolShutdownTimeout");
if (udpThreadPoolShutdownTimeout != null) {
log.debug("Setting UDP thread pool shutdown timeout to " + udpThreadPoolSize + " seconds");
this.udpThreadPoolShutdownTimeout = udpThreadPoolShutdownTimeout;
}
this.remotePassword = configFile.getString("/Config/System/RemoteManagementPassword");
log.debug("Remote management password set to " + remotePassword);
this.remotePort = configFile.getInteger("/Config/System/RemoteManagementPort");
log.debug("Remote management port set to " + remotePort);
Integer axfrTimeout = configFile.getInteger("/Config/System/AXFRTimeout");
if (axfrTimeout != null) {
log.debug("Setting AXFR timeout to " + axfrTimeout);
this.axfrTimeout = axfrTimeout;
}
// TODO TSIG stuff
List<XMLSettingNode> zoneProviderElements = configFile.getSettings("/Config/ZoneProviders/ZoneProvider");
for (XMLSettingNode settingNode : zoneProviderElements) {
String name = settingNode.getString("Name");