# File iowa.rb, line 93
        def Iowa.checkConfiguration
                # Make sure socket info was provided
                raise "A socket specification must be provided in the configuration file." unless @@config.has_key? 'socket'
                raise "Iowa supports both TCP and Unix domain sockets.  Please specify the socket to use within the 'socket' section of the configuration file." unless (@@config['socket'].class.to_s == 'Hash' and (@@config['socket'].has_key? 'path' or @@config['socket'].has_key? 'port'))
                raise "Please define only one of a TCP or a Unix domain socket in the configuration file." if @@config['socket'].has_key? 'path' and @@config['socket'].has_key? 'port'

                # Verify that the socket information is valid.  i.e. that the provided
                # port is a number, that the hostname for a TCP socket doesn't have
                # funny characters in it, or that the path for a Unix socket is writeable.
                #raise "A port number must be specified as an integer." if @@config['socket'].has_key? 'port' and @@config['socket']['port'].class.to_s == 'Fixnum'
                raise "The socket hostname contains illegal characters." unless @@config['socket'].has_key? 'hostname' and @@config['socket']['hostname'] =~ /^[a-zA-Z0-9\.\-]*$/
                if @@config['socket'].has_key? 'path'
                        begin
                                File.unlink @@config['socket']['path'] if FileTest.exist? @@config['socket']['path']
                                sf = File.open(@@config['socket']['path'],'w')
                                @@config['socket']['basename'] = File.basename(@@config['socket']['path'])
                                sf.close
                                File.unlink @@config['socket']['path']
                        rescue Exception => exception
                                puts "The path for a Unix socket must be writeable."
                                raise
                        end
                end

                # If any logging information has been specified, that needs to be
                # checked, as well.

                if @@config.has_key? 'logging'
                        if @@config['logging'].has_key? 'basedir'
                                raise "The logging basedir (#{@@config['logging']['basedir']}) must be a directory." unless FileTest.directory? @@config['logging']['basedir']
                                raise "The logging basedir #{@@config['logging']['basedir']}) must be writeable." unless FileTest.writable? @@config['logging']['basedir']
                        end
                
                        raise "The minimum logging level (minlevel) must be an integer between 0 to 7, inclusively." if @@config['logging'].has_key? 'minlevel' and (@@config['logging']['minlevel'] < 0 or @@config['logging']['minlevel'] > 7)

                        raise "The maximum log file size (maxsize) must be greater than zero." if @@config.has_key? 'maxsize' and @@config['maxsize'] <= 0

                        raise "The maximum log file age (maxage) must be greater than zero." if @@config.has_key? 'maxage' and @@config['maxage'] <= 0
                end

                # Now apply any defaults for optional items which were not specified.

                @@config['logging'] = Hash.new unless @@config.has_key? 'logging'
                @@config['logging']['basedir'] = '/tmp' unless @@config['logging'].has_key? 'basedir'
                @@config['logging']['minlevel'] = 'info' unless @@config['logging'].has_key? 'minlevel'
                @@config['logging']['maxsize'] = 1024 * 1024 unless @@config['logging'].has_key? 'maxsize'
                @@config['logging']['maxage'] = 86400 unless @@config['logging'].has_key? 'maxage'
                if @@config['socket'].has_key? 'path'
                        @@config['logging']['filename'] = "#{@@config['logging']['basedir']}/#{@@config['socket']['basename']}.log"
                else
                        @@config['logging']['filename'] = "#{@@config['logging']['basedir']}/#{@@config['socket']['hostname']}:#{@@config['socket']['port']}.log"
                end
        end