Search in sources :

Example 1 with DNSServerSettings

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);
}
Also used : ConfigServiceDNSStoreProvider(org.nhindirect.dns.provider.ConfigServiceDNSStoreProvider) DNSServerSettings(org.nhindirect.dns.DNSServerSettings) DNSServerModule(org.nhindirect.dns.module.DNSServerModule)

Example 2 with DNSServerSettings

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.");
}
Also used : InputStreamReader(java.io.InputStreamReader) DNSException(org.nhindirect.dns.DNSException) BufferedReader(java.io.BufferedReader) DNSServerSettings(org.nhindirect.dns.DNSServerSettings) DNSException(org.nhindirect.dns.DNSException)

Aggregations

DNSServerSettings (org.nhindirect.dns.DNSServerSettings)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 DNSException (org.nhindirect.dns.DNSException)1 DNSServerModule (org.nhindirect.dns.module.DNSServerModule)1 ConfigServiceDNSStoreProvider (org.nhindirect.dns.provider.ConfigServiceDNSStoreProvider)1