use of org.nhindirect.dns.DNSServerSettings in project nhin-d by DirectProject.
the class WSDNSServerConfig method getServerInjector.
/**
* {@inheritDoc}
*/
@Override
public Injector getServerInjector() {
LOGGER.info("Looking up DNS server configuration info from location " + configServiceLocation.toExternalForm());
Provider<DNSServerSettings> settingsProv = getServerSettings();
if (storeProvider == null)
storeProvider = new ConfigServiceDNSStoreProvider(configServiceLocation);
DNSServerModule module = DNSServerModule.create(storeProvider, settingsProv);
return Guice.createInjector(module);
}
use of org.nhindirect.dns.DNSServerSettings in project nhin-d by DirectProject.
the class SimpleServiceRunner method startAndRun.
/*
* Creates, intializes, and runs the server.
*/
private static void startAndRun() {
StringBuffer buffer = new StringBuffer("Starting DNS server. Settings:");
buffer.append("\r\n\tBind Addresses: ").append(bind);
buffer.append("\r\n\tListen Port: ").append(port);
buffer.append("\r\n\tService URL: ").append(servURL.toString());
LOGGER.info(buffer.toString() + "\n");
DNSServerService server = null;
try {
DNSServerSettings settings = new DNSServerSettings();
settings.setPort(port);
settings.setBindAddress(bind);
server = new DNSServerService(servURL, settings);
} catch (DNSException e) {
LOGGER.error("Server failed to start: " + e.getMessage(), e);
return;
}
if (mode.equalsIgnoreCase(MODE_STANDALONE)) {
LOGGER.info("\r\nServer running.... Press Enter or Return to stop.");
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
try {
reader.readLine();
LOGGER.info("Shutting down server. Wait 5 seconds for cleanup.");
server.stopService();
Thread.sleep(5000);
LOGGER.info("Server stopped");
} catch (Exception e) {
}
} else
LOGGER.info("\r\nServer running.");
}
Aggregations