Example #1
0
    def run(self):
        modeStr = None
        if self._evaluationMode is not None:
            modeStr = DataModel.EEvaluationModeNames.name(self._evaluationMode)
        whitelistStr = "<None>"
        if self._eventTypeWhitelist is not None:
            whitelistStr = ", ".join(self._eventTypeWhitelist)
        blacklistStr = "<None>"
        if self._eventTypeBlacklist is not None:
            blacklistStr = ", ".join(self._eventTypeBlacklist)
        stationFilterStr = "<None>"
        if self._stationFilter is not None:
            stationFilterStr = self._stationFilter
        dataSelectFilterStr = "<None>"
        if self._dataSelectFilter is not None:
            dataSelectFilterStr = self._dataSelectFilter
        Logging.debug("\n" \
                       "configuration read:\n" \
                       "  serve\n" \
                       "    dataselect    : %s\n" \
                       "    event         : %s\n" \
                       "    station       : %s\n" \
                       "  listenAddress   : %s\n" \
                       "  port            : %i\n" \
                       "  connections     : %i\n" \
                       "  htpasswd        : %s\n" \
                       "  accessLog       : %s\n" \
                       "  queryObjects    : %i\n" \
                       "  realtimeGap     : %s\n" \
                       "  samples (M)     : %s\n" \
                       "  allowRestricted : %s\n" \
                       "  useArclinkAccess: %s\n" \
                       "  hideAuthor      : %s\n" \
                       "  evaluationMode  : %s\n" \
                       "  eventType\n" \
                       "    whitelist     : %s\n" \
                       "    blacklist     : %s\n" \
                       "  inventory filter\n" \
                       "    station       : %s\n" \
                       "    dataSelect    : %s\n" \
                       "    debug enabled : %s\n" \
                       "  trackdb\n" \
                       "    enabled       : %s\n" \
                       "    defaultUser   : %s\n" \
                       "  auth\n" \
                       "    enabled       : %s\n" \
                       "    gnupgHome     : %s\n" % (
                       self._serveDataSelect, self._serveEvent,
                       self._serveStation, self._listenAddress, self._port,
                       self._connections, self._htpasswd, self._accessLogFile,
                       self._queryObjects, self._realtimeGap, self._samplesM,
                       self._allowRestricted, self._useArclinkAccess,
                       self._hideAuthor, modeStr,
                       whitelistStr, blacklistStr, stationFilterStr,
                       dataSelectFilterStr, self._debugFilter,
                       self._trackdbEnabled, self._trackdbDefaultUser,
                       self._authEnabled, self._authGnupgHome))

        if not self._serveDataSelect and not self._serveEvent and \
           not self._serveStation:
            Logging.error("all services disabled through configuration")
            return False

        # access logger if requested
        if self._accessLogFile:
            self._accessLog = Log(self._accessLogFile)

        # load inventory needed by DataSelect and Station service
        stationInv = dataSelectInv = None
        if self._serveDataSelect or self._serveStation:
            retn = False
            stationInv = dataSelectInv = Inventory.Instance().inventory()
            Logging.info("inventory loaded")

            if self._serveDataSelect and self._serveStation:
                # clone inventory if station and dataSelect filter are distinct
                # else share inventory between both services
                if self._stationFilter != self._dataSelectFilter:
                    dataSelectInv = self._cloneInventory(stationInv)
                    retn = self._filterInventory(stationInv, self._stationFilter, "station") and \
                           self._filterInventory(dataSelectInv, self._dataSelectFilter, "dataSelect")
                else:
                    retn = self._filterInventory(stationInv,
                                                 self._stationFilter)
            elif self._serveStation:
                retn = self._filterInventory(stationInv, self._stationFilter)
            else:
                retn = self._filterInventory(dataSelectInv,
                                             self._dataSelectFilter)

            if not retn:
                return False

        if self._serveDataSelect:
            self._access.initFromSC3Routing(self.query().loadRouting())

        DataModel.PublicObject.SetRegistrationEnabled(False)

        shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')

        # Overwrite/set mime type of *.wadl and *.xml documents. Instead of
        # using the official types defined in /etc/mime.types 'application/xml'
        # is used as enforced by the FDSNWS spec.
        static.File.contentTypes['.wadl'] = 'application/xml'
        static.File.contentTypes['.xml'] = 'application/xml'

        # create resource tree /fdsnws/...
        root = ListingResource()

        fileName = os.path.join(shareDir, 'favicon.ico')
        fileRes = static.File(fileName, 'image/x-icon')
        fileRes.childNotFound = NoResource()
        fileRes.isLeaf = True
        root.putChild('favicon.ico', fileRes)

        prefix = ListingResource()
        root.putChild('fdsnws', prefix)

        # right now service version is shared by all services
        serviceVersion = ServiceVersion()

        # dataselect
        if self._serveDataSelect:
            dataselect = ListingResource()
            prefix.putChild('dataselect', dataselect)
            dataselect1 = DirectoryResource(
                os.path.join(shareDir, 'dataselect.html'))
            dataselect.putChild('1', dataselect1)

            dataselect1.putChild('query', FDSNDataSelect(dataSelectInv))
            msg = 'authorization for restricted time series data required'
            authSession = self._getAuthSessionWrapper(dataSelectInv, msg)
            dataselect1.putChild('queryauth', authSession)
            dataselect1.putChild('version', serviceVersion)
            fileRes = static.File(os.path.join(shareDir, 'dataselect.wadl'))
            fileRes.childNotFound = NoResource()
            dataselect1.putChild('application.wadl', fileRes)
            fileRes = static.File(
                os.path.join(shareDir, 'dataselect-builder.html'))
            fileRes.childNotFound = NoResource()
            dataselect1.putChild('builder', fileRes)

            if self._authEnabled:
                dataselect1.putChild(
                    'auth', AuthResource(self._authGnupgHome, self._userdb))

        # event
        if self._serveEvent:
            event = ListingResource()
            prefix.putChild('event', event)
            event1 = DirectoryResource(os.path.join(shareDir, 'event.html'))
            event.putChild('1', event1)

            event1.putChild(
                'query',
                FDSNEvent(self._hideAuthor, self._evaluationMode,
                          self._eventTypeWhitelist, self._eventTypeBlacklist))
            fileRes = static.File(os.path.join(shareDir, 'catalogs.xml'))
            fileRes.childNotFound = NoResource()
            event1.putChild('catalogs', fileRes)
            fileRes = static.File(os.path.join(shareDir, 'contributors.xml'))
            fileRes.childNotFound = NoResource()
            event1.putChild('contributors', fileRes)
            event1.putChild('version', serviceVersion)
            fileRes = static.File(os.path.join(shareDir, 'event.wadl'))
            fileRes.childNotFound = NoResource()
            event1.putChild('application.wadl', fileRes)
            fileRes = static.File(os.path.join(shareDir, 'event-builder.html'))
            fileRes.childNotFound = NoResource()
            event1.putChild('builder', fileRes)

        # station
        if self._serveStation:
            station = ListingResource()
            prefix.putChild('station', station)
            station1 = DirectoryResource(os.path.join(shareDir,
                                                      'station.html'))
            station.putChild('1', station1)

            station1.putChild(
                'query',
                FDSNStation(stationInv, self._allowRestricted,
                            self._queryObjects))
            station1.putChild('version', serviceVersion)
            fileRes = static.File(os.path.join(shareDir, 'station.wadl'))
            fileRes.childNotFound = NoResource()
            station1.putChild('application.wadl', fileRes)
            fileRes = static.File(
                os.path.join(shareDir, 'station-builder.html'))
            fileRes.childNotFound = NoResource()
            station1.putChild('builder', fileRes)

        # static files
        fileRes = static.File(os.path.join(shareDir, 'js'))
        fileRes.childNotFound = NoResource()
        fileRes.hideInListing = True
        prefix.putChild('js', fileRes)

        fileRes = static.File(os.path.join(shareDir, 'css'))
        fileRes.childNotFound = NoResource()
        fileRes.hideInListing = True
        prefix.putChild('css', fileRes)

        retn = False
        try:
            # start listen for incoming request
            reactor.listenTCP(self._port, Site(root), self._connections,
                              self._listenAddress)

            # start processing
            Logging.info("start listening")
            log.addObserver(logSC3)

            reactor.run()
            retn = True
        except Exception, e:
            Logging.error(str(e))
Example #2
0
    def _site(self):
        modeStr = None
        if self._evaluationMode is not None:
            modeStr = DataModel.EEvaluationModeNames.name(self._evaluationMode)
        whitelistStr = "<None>"
        if self._eventTypeWhitelist is not None:
            whitelistStr = ", ".join(self._eventTypeWhitelist)
        blacklistStr = "<None>"
        if self._eventTypeBlacklist is not None:
            blacklistStr = ", ".join(self._eventTypeBlacklist)
        stationFilterStr = "<None>"
        if self._stationFilter is not None:
            stationFilterStr = self._stationFilter
        dataSelectFilterStr = "<None>"
        if self._dataSelectFilter is not None:
            dataSelectFilterStr = self._dataSelectFilter
        Logging.debug("\n"
                      "configuration read:\n"
                      "  serve\n"
                      "    dataselect    : %s\n"
                      "    event         : %s\n"
                      "    station       : %s\n"
                      "    availability  : %s\n"
                      "  listenAddress   : %s\n"
                      "  port            : %i\n"
                      "  connections     : %i\n"
                      "  htpasswd        : %s\n"
                      "  accessLog       : %s\n"
                      "  queryObjects    : %i\n"
                      "  realtimeGap     : %s\n"
                      "  samples (M)     : %s\n"
                      "  recordBulkSize  : %i\n"
                      "  allowRestricted : %s\n"
                      "  useArclinkAccess: %s\n"
                      "  hideAuthor      : %s\n"
                      "  evaluationMode  : %s\n"
                      "  data availability\n"
                      "    enabled       : %s\n"
                      "    cache duration: %i\n"
                      "    repo name     : %s\n"
                      "    dcc name      : %s\n"
                      "  eventType\n"
                      "    whitelist     : %s\n"
                      "    blacklist     : %s\n"
                      "  inventory filter\n"
                      "    station       : %s\n"
                      "    dataSelect    : %s\n"
                      "    debug enabled : %s\n"
                      "  trackdb\n"
                      "    enabled       : %s\n"
                      "    defaultUser   : %s\n"
                      "  auth\n"
                      "    enabled       : %s\n"
                      "    gnupgHome     : %s\n"
                      "  requestLog      : %s\n" % (
                          self._serveDataSelect, self._serveEvent,
                          self._serveStation, self._serveAvailability,
                          self._listenAddress, self._port, self._connections,
                          self._htpasswd, self._accessLogFile, self._queryObjects,
                          self._realtimeGap, self._samplesM, self._recordBulkSize,
                          self._allowRestricted, self._useArclinkAccess,
                          self._hideAuthor, modeStr, self._daEnabled,
                          self._daCacheDuration, self._daRepositoryName,
                          self._daDCCName, whitelistStr, blacklistStr,
                          stationFilterStr, dataSelectFilterStr,
                          self._debugFilter, self._trackdbEnabled,
                          self._trackdbDefaultUser, self._authEnabled,
                          self._authGnupgHome, self._requestLogFile))

        if not self._serveDataSelect and not self._serveEvent and \
           not self._serveStation:
            Logging.error("all services disabled through configuration")
            return None

        # access logger if requested
        if self._accessLogFile:
            self._accessLog = Log(self._accessLogFile)

        # request logger if requested
        if self._requestLogFile:
            # import here, so we don't depend on GeoIP if request log is not needed
            from seiscomp3.fdsnws.reqlog import RequestLog
            self._requestLog = RequestLog(self._requestLogFile)

        # load inventory needed by DataSelect and Station service
        stationInv = dataSelectInv = None
        if self._serveDataSelect or self._serveStation:
            retn = False
            stationInv = dataSelectInv = Inventory.Instance().inventory()
            Logging.info("inventory loaded")

            if self._serveDataSelect and self._serveStation:
                # clone inventory if station and dataSelect filter are distinct
                # else share inventory between both services
                if self._stationFilter != self._dataSelectFilter:
                    dataSelectInv = self._cloneInventory(stationInv)
                    retn = self._filterInventory(stationInv, self._stationFilter, "station") and \
                        self._filterInventory(
                            dataSelectInv, self._dataSelectFilter, "dataSelect")
                else:
                    retn = self._filterInventory(
                        stationInv, self._stationFilter)
            elif self._serveStation:
                retn = self._filterInventory(stationInv, self._stationFilter)
            else:
                retn = self._filterInventory(
                    dataSelectInv, self._dataSelectFilter)

            if not retn:
                return None

        self._access = Access()

        if self._serveDataSelect and self._useArclinkAccess:
            self._access.initFromSC3Routing(self.query().loadRouting())

        DataModel.PublicObject.SetRegistrationEnabled(False)

        shareDir = os.path.join(Environment.Instance().shareDir(), 'fdsnws')

        # Overwrite/set mime type of *.wadl and *.xml documents. Instead of
        # using the official types defined in /etc/mime.types 'application/xml'
        # is used as enforced by the FDSNWS spec.
        static.File.contentTypes['.wadl'] = 'application/xml'
        static.File.contentTypes['.xml'] = 'application/xml'

        # create resource tree /fdsnws/...
        root = ListingResource()

        fileName = os.path.join(shareDir, 'favicon.ico')
        fileRes = static.File(fileName, 'image/x-icon')
        fileRes.childNotFound = NoResource()
        fileRes.isLeaf = True
        root.putChild('favicon.ico', fileRes)

        prefix = ListingResource()
        root.putChild('fdsnws', prefix)

        # dataselect
        if self._serveDataSelect:
            dataselect = ListingResource(DataSelectVersion)
            prefix.putChild('dataselect', dataselect)
            lstFile = os.path.join(shareDir, 'dataselect.html')
            dataselect1 = DirectoryResource(lstFile, DataSelectVersion)
            dataselect.putChild('1', dataselect1)

            dataselect1.putChild('query', FDSNDataSelect(
                dataSelectInv, self._recordBulkSize))
            msg = 'authorization for restricted time series data required'
            authSession = self._getAuthSessionWrapper(dataSelectInv, msg)
            dataselect1.putChild('queryauth', authSession)
            dataselect1.putChild('version', ServiceVersion(DataSelectVersion))
            fileRes = static.File(os.path.join(shareDir, 'dataselect.wadl'))
            fileRes.childNotFound = NoResource(DataSelectVersion)
            dataselect1.putChild('application.wadl', fileRes)
            fileRes = static.File(os.path.join(
                shareDir, 'dataselect-builder.html'))
            fileRes.childNotFound = NoResource(DataSelectVersion)
            dataselect1.putChild('builder', fileRes)

            if self._authEnabled:
                dataselect1.putChild('auth', AuthResource(
                    DataSelectVersion, self._authGnupgHome, self._userdb))

        # event
        if self._serveEvent:
            event = ListingResource(EventVersion)
            prefix.putChild('event', event)
            lstFile = os.path.join(shareDir, 'event.html')
            event1 = DirectoryResource(lstFile, EventVersion)
            event.putChild('1', event1)

            event1.putChild('query', FDSNEvent(self._hideAuthor,
                                               self._evaluationMode,
                                               self._eventTypeWhitelist,
                                               self._eventTypeBlacklist,
                                               self._eventFormats))
            fileRes = static.File(os.path.join(shareDir, 'catalogs.xml'))
            fileRes.childNotFound = NoResource(EventVersion)
            event1.putChild('catalogs', fileRes)
            fileRes = static.File(os.path.join(shareDir, 'contributors.xml'))
            fileRes.childNotFound = NoResource(EventVersion)
            event1.putChild('contributors', fileRes)
            event1.putChild('version', ServiceVersion(EventVersion))
            fileRes = static.File(os.path.join(shareDir, 'event.wadl'))
            fileRes.childNotFound = NoResource(EventVersion)
            event1.putChild('application.wadl', fileRes)
            fileRes = static.File(os.path.join(shareDir, 'event-builder.html'))
            fileRes.childNotFound = NoResource(EventVersion)
            event1.putChild('builder', fileRes)

        # station
        if self._serveStation:
            station = ListingResource(StationVersion)
            prefix.putChild('station', station)
            lstFile = os.path.join(shareDir, 'station.html')
            station1 = DirectoryResource(lstFile, StationVersion)
            station.putChild('1', station1)

            station1.putChild('query', FDSNStation(stationInv,
                                                   self._allowRestricted,
                                                   self._queryObjects,
                                                   self._daEnabled))
            station1.putChild('version', ServiceVersion(StationVersion))

            # wadl, optionally filtered
            filterList = [] if self._daEnabled else ['name="matchtimeseries"']
            try:
                fileRes = WADLFilter(os.path.join(shareDir, 'station.wadl'),
                                     filterList)
            except:
                fileRes = NoResource(StationVersion)
            station1.putChild('application.wadl', fileRes)

            fileRes = static.File(os.path.join(
                shareDir, 'station-builder.html'))
            fileRes.childNotFound = NoResource(StationVersion)
            station1.putChild('builder', fileRes)

        # availability
        if self._serveAvailability:

            # create a set of waveformIDs which represent open channels
            if self._serveDataSelect:
                openStreams = set()
                for iNet in xrange(dataSelectInv.networkCount()):
                    net = dataSelectInv.network(iNet)
                    if utils.isRestricted(net):
                        continue
                    for iSta in xrange(net.stationCount()):
                        sta = net.station(iSta)
                        if utils.isRestricted(sta):
                            continue
                        for iLoc in xrange(sta.sensorLocationCount()):
                            loc = sta.sensorLocation(iLoc)
                            for iCha in xrange(loc.streamCount()):
                                cha = loc.stream(iCha)
                                if utils.isRestricted(cha):
                                    continue
                                openStreams.add("{0}.{1}.{2}.{3}".format(
                                                net.code(), sta.code(),
                                                loc.code(), cha.code()))
                self._openStreams = openStreams
            else:
                self._openStreams = None

            ext = ListingResource()
            prefix.putChild('ext', ext)
            availability = ListingResource(AvailabilityVersion)
            ext.putChild('availability', availability)
            lstFile = os.path.join(shareDir, 'availability.html')
            availability1 = DirectoryResource(lstFile, AvailabilityVersion)
            availability.putChild('1', availability1)

            availability1.putChild('extent', AvailabilityExtent())
            availability1.putChild('query', AvailabilityQuery())
            availability1.putChild(
                'version', ServiceVersion(AvailabilityVersion))
            fileRes = static.File(os.path.join(shareDir, 'station.wadl'))
            fileRes.childNotFound = NoResource(AvailabilityVersion)
            availability1.putChild('availability.wadl', fileRes)
            fileRes = static.File(os.path.join(
                shareDir, 'availability-extent-builder.html'))
            fileRes.childNotFound = NoResource(AvailabilityVersion)
            availability1.putChild('builder-extent', fileRes)
            fileRes = static.File(os.path.join(
                shareDir, 'availability-builder.html'))
            fileRes.childNotFound = NoResource(AvailabilityVersion)
            availability1.putChild('builder', fileRes)

        # static files
        fileRes = static.File(os.path.join(shareDir, 'js'))
        fileRes.childNotFound = NoResource()
        fileRes.hideInListing = True
        prefix.putChild('js', fileRes)

        fileRes = static.File(os.path.join(shareDir, 'css'))
        fileRes.childNotFound = NoResource()
        fileRes.hideInListing = True
        prefix.putChild('css', fileRes)

        return Site(root)
Example #3
0
    def initConfiguration(self):
        if not Application.initConfiguration(self):
            return False

        # bind address and port
        try:
            self._listenAddress = self.configGetString('listenAddress')
        except ConfigException:
            pass
        try:
            self._port = self.configGetInt('port')
        except ConfigException:
            pass

        # maximum number of connections
        try:
            self._connections = self.configGetInt('connections')
        except ConfigException:
            pass

        # maximum number of objects per query, used in fdsnws-station and
        # fdsnws-event to limit main memory consumption
        try:
            self._queryObjects = self.configGetInt('queryObjects')
        except ConfigException:
            pass

        # restrict end time of request to now-realtimeGap seconds, used in
        # fdsnws-dataselect
        try:
            self._realtimeGap = self.configGetInt('realtimeGap')
        except ConfigException:
            pass

        # maximum number of samples (in units of million) per query, used in
        # fdsnws-dataselect to limit bandwidth
        try:
            self._samplesM = self.configGetDouble('samplesM')
        except ConfigException:
            pass

        # location of htpasswd file
        try:
            self._htpasswd = self.configGetString('htpasswd')
        except ConfigException:
            pass
        self._htpasswd = Environment.Instance().absolutePath(self._htpasswd)

        # location of access log file
        try:
            self._accessLogFile = Environment.Instance().absolutePath(
                self.configGetString('accessLog'))
        except ConfigException:
            pass

        # access to restricted inventory information
        try:
            self._allowRestricted = self.configGetBool('allowRestricted')
        except:
            pass

        # use arclink-access bindings
        try:
            self._useArclinkAccess = self.configGetBool('useArclinkAccess')
        except:
            pass

        # services to enable
        try:
            self._serveDataSelect = self.configGetBool('serveDataSelect')
        except:
            pass
        try:
            self._serveEvent = self.configGetBool('serveEvent')
        except:
            pass
        try:
            self._serveStation = self.configGetBool('serveStation')
        except:
            pass

        # event filter
        try:
            self._hideAuthor = self.configGetBool('hideAuthor')
        except:
            pass
        try:
            name = self.configGetString('evaluationMode')
            if name.lower() == DataModel.EEvaluationModeNames.name(
                    DataModel.MANUAL):
                self._evaluationMode = DataModel.MANUAL
            elif name.lower() == DataModel.EEvaluationModeNames.name(
                    DataModel.AUTOMATIC):
                self._evaluationMode = DataModel.AUTOMATIC
            else:
                print >> sys.stderr, "invalid evaluation mode string: %s" % name
                return False
        except:
            pass
        try:
            strings = self.configGetStrings('eventType.whitelist')
            if len(strings) > 1 or len(strings[0]):
                self._eventTypeWhitelist = [s.lower() for s in strings]
        except:
            pass
        try:
            strings = self.configGetStrings('eventType.blacklist')
            if len(strings) > 0 or len(strings[0]):
                self._eventTypeBlacklist = [s.lower() for s in strings]
        except:
            pass

        # station filter
        try:
            self._stationFilter = Environment.Instance().absolutePath(
                self.configGetString('stationFilter'))
        except ConfigException:
            pass

        # dataSelect filter
        try:
            self._dataSelectFilter = Environment.Instance().absolutePath(
                self.configGetString('dataSelectFilter'))
        except ConfigException:
            pass

        # output filter debug information
        try:
            self._debugFilter = self.configGetBool('debugFilter')
        except ConfigException:
            pass

        # prefix to be used as default for output filenames
        try:
            self._fileNamePrefix = self.configGetString('fileNamePrefix')
        except ConfigException:
            pass

        # save request logs in database?
        try:
            self._trackdbEnabled = self.configGetBool('trackdb.enable')
        except ConfigException:
            pass

        # default user
        try:
            self._trackdbDefaultUser = self.configGetString(
                'trackdb.defaultUser')
        except ConfigException:
            pass

        # enable authentication extension?
        try:
            self._authEnabled = self.configGetBool('auth.enable')
        except ConfigException:
            pass

        # GnuPG home directory
        try:
            self._authGnupgHome = self.configGetString('auth.gnupgHome')
        except ConfigException:
            pass
        self._authGnupgHome = Environment.Instance().absolutePath(
            self._authGnupgHome)

        return True
Example #4
0
    def initConfiguration(self):
        if not Application.initConfiguration(self):
            return False

        # bind address and port
        try:
            self._listenAddress = self.configGetString('listenAddress')
        except Exception:
            pass
        try:
            self._port = self.configGetInt('port')
        except Exception:
            pass

        # maximum number of connections
        try:
            self._connections = self.configGetInt('connections')
        except Exception:
            pass

        # maximum number of objects per query, used in fdsnws-station and
        # fdsnws-event to limit main memory consumption
        try:
            self._queryObjects = self.configGetInt('queryObjects')
        except Exception:
            pass

        # restrict end time of request to now-realtimeGap seconds, used in
        # fdsnws-dataselect
        try:
            self._realtimeGap = self.configGetInt('realtimeGap')
        except Exception:
            pass

        # maximum number of samples (in units of million) per query, used in
        # fdsnws-dataselect to limit bandwidth
        try:
            self._samplesM = self.configGetDouble('samplesM')
        except Exception:
            pass

        try:
            self._recordBulkSize = self.configGetInt('recordBulkSize')
        except Exception:
            pass

        if self._recordBulkSize < 1:
            print >> sys.stderr, "Invalid recordBulkSize, must be larger than 0"
            return False

        # location of htpasswd file
        try:
            self._htpasswd = self.configGetString('htpasswd')
        except Exception:
            pass
        self._htpasswd = Environment.Instance().absolutePath(self._htpasswd)

        # location of access log file
        try:
            self._accessLogFile = Environment.Instance().absolutePath(
                self.configGetString('accessLog'))
        except Exception:
            pass

        # location of request log file
        try:
            self._requestLogFile = Environment.Instance().absolutePath(
                self.configGetString('requestLog'))
        except Exception:
            pass

        # access to restricted inventory information
        try:
            self._allowRestricted = self.configGetBool('allowRestricted')
        except Exception:
            pass

        # use arclink-access bindings
        try:
            self._useArclinkAccess = self.configGetBool('useArclinkAccess')
        except Exception:
            pass

        # services to enable
        try:
            self._serveDataSelect = self.configGetBool('serveDataSelect')
        except Exception:
            pass
        try:
            self._serveEvent = self.configGetBool('serveEvent')
        except Exception:
            pass
        try:
            self._serveStation = self.configGetBool('serveStation')
        except Exception:
            pass
        try:
            self._serveAvailability = self.configGetBool('serveAvailability')
        except Exception:
            pass

        # data availability
        try:
            self._daEnabled = self.configGetBool('dataAvailability.enable')
        except Exception:
            pass
        try:
            self._daCacheDuration = self.configGetInt(
                'dataAvailability.cacheDuration')
        except Exception:
            pass
        try:
            self._daRepositoryName = self.configGetString(
                'dataAvailability.repositoryName')
        except Exception:
            pass
        try:
            self._daDCCName = self.configGetString('dataAvailability.dccName')
        except Exception:
            pass

        if self._serveAvailability and not self._daEnabled:
            print >> sys.stderr, "can't serve availabilty without " \
                                 "dataAvailability.enable set to true"
            return False
        if not bool(re.match(r'^[a-zA-Z0-9_\ -]*$', self._daRepositoryName)):
            print >> sys.stderr, "invalid characters in dataAvailability.repositoryName"
            return False
        if not bool(re.match(r'^[a-zA-Z0-9_\ -]*$', self._daDCCName)):
            print >> sys.stderr, "invalid characters in dataAvailability.dccName"
            return False

        # event filter
        try:
            self._hideAuthor = self.configGetBool('hideAuthor')
        except Exception:
            pass
        try:
            name = self.configGetString('evaluationMode')
            if name.lower() == DataModel.EEvaluationModeNames.name(DataModel.MANUAL):
                self._evaluationMode = DataModel.MANUAL
            elif name.lower() == DataModel.EEvaluationModeNames.name(DataModel.AUTOMATIC):
                self._evaluationMode = DataModel.AUTOMATIC
            else:
                print >> sys.stderr, "invalid evaluation mode string: %s" % name
                return False
        except Exception:
            pass
        try:
            strings = self.configGetStrings('eventType.whitelist')
            if len(strings) > 1 or len(strings[0]):
                self._eventTypeWhitelist = [s.lower() for s in strings]
        except Exception:
            pass
        try:
            strings = self.configGetStrings('eventType.blacklist')
            if len(strings) > 0 or len(strings[0]):
                self._eventTypeBlacklist = [s.lower() for s in strings]
        except Exception:
            pass
        try:
            strings = self.configGetStrings('eventFormats')
            if len(strings) > 1 or len(strings[0]):
                self._eventFormats = [s.lower() for s in strings]
        except Exception:
            pass

        # station filter
        try:
            self._stationFilter = Environment.Instance().absolutePath(
                self.configGetString('stationFilter'))
        except Exception:
            pass

        # dataSelect filter
        try:
            self._dataSelectFilter = Environment.Instance().absolutePath(
                self.configGetString('dataSelectFilter'))
        except Exception:
            pass

        # output filter debug information
        try:
            self._debugFilter = self.configGetBool('debugFilter')
        except Exception:
            pass

        # prefix to be used as default for output filenames
        try:
            self._fileNamePrefix = self.configGetString('fileNamePrefix')
        except Exception:
            pass

        # save request logs in database?
        try:
            self._trackdbEnabled = self.configGetBool('trackdb.enable')
        except Exception:
            pass

        # default user
        try:
            self._trackdbDefaultUser = self.configGetString(
                'trackdb.defaultUser')
        except Exception:
            pass

        # enable authentication extension?
        try:
            self._authEnabled = self.configGetBool('auth.enable')
        except Exception:
            pass

        # GnuPG home directory
        try:
            self._authGnupgHome = self.configGetString('auth.gnupgHome')
        except Exception:
            pass
        self._authGnupgHome = Environment.Instance().absolutePath(self._authGnupgHome)

        # blacklist of users/tokens
        try:
            strings = self.configGetStrings('auth.blacklist')
            if len(strings) > 1 or len(strings[0]):
                self._authBlacklist = strings
        except Exception:
            pass

        # If the database connection is passed via command line or configuration
        # file then messaging is disabled. Messaging is only used to get
        # the configured database connection URI.
        if self.databaseURI() != "":
            self.setMessagingEnabled(self._trackdbEnabled)
        else:
            # Without the event service, a database connection is not
            # required if the inventory is loaded from file and no data
            # availability information should be processed
            if not self._serveEvent and not self._useArclinkAccess and \
               (not self._serveStation or (
                   not self.isInventoryDatabaseEnabled() and not self._daEnabled)):
                self.setMessagingEnabled(self._trackdbEnabled)
                self.setDatabaseEnabled(False, False)

        return True