def __init__(self):
        PeerConfiguration.__init__(self)

        self._torrent_selection_interval = 30
        self._rate_interval = 30
        self._max_torrents = 10
        self._min_leechers = 0
        self._min_local_leechers = 0
        self._min_ulfactor = 0.6
        self._torrent_selection_mechanism = 'local_folder'
        self._torrent_directory = 'torrents'
        self._rate_management = 'equal'
        self._replacement_strategy = constants.RP_FIFO
        self._max_downloads = 5
        self._ranking_source = constants.RS_IP_PRE
        self._directory = "iop_data"
        self._space_limit = 100
        self._cache_console = False
        self._establish_remote_connections = True
        self._stay_in_torrents = 4
        self._ns_mode = constants.NS_MODE_ENABLE
        self._locality_pref = float(1)
        self._logfile = 'iop.log'
        #TODO: the meaning here is different than for a normal client, since cache divides connections across all torrents! Better to use another name for it?
        self._connection_limit = 10000
        #TODO: some default values might be missing!!! Cf. self._mapping
        
        self._logger = logging.getLogger("Cache.Configuration")

        self._mapping = {
                   'torrent_selection_interval' :   (int, self.set_torrent_selection_interval, self.get_torrent_selection_interval),
                   'torrent_selection_mechanism' :  (str, self.set_torrent_selection_mechanism, self.get_torrent_selection_mechanism),
                   'max_torrents'               :   (int, self.set_max_torrents, self.get_max_torrents),
                   'min_leechers'               :   (int, self.set_min_leechers, self.get_min_leechers),
                   'torrent_directory'          :   (str, self.set_torrent_directory, self.get_torrent_directory),
                   'rate_management'            :   (str, self.set_rate_management, self.get_rate_management),
                   'replacement_strategy'       :   (str, self.set_replacement_strategy, self.get_replacement_strategy),
                   'min_ulfactor'               :   (float, self.set_min_ulfactor, self.get_min_ulfactor),
                   'max_downloads'              :   (int, self.set_max_downloads, self.get_max_downloads),
                   #TODO #944: Test whether ip prefixes are properly parsed!!!
                   'ip_prefix'                  :   (lambda x: x.split(";"), self.set_ip_prefixes, self.get_ip_prefixes),
                   'rate_interval'              :   (int, self.set_rate_interval, self.get_rate_interval),
                   'report_interval'            :   (float, self.set_report_interval, self.get_report_interval),
                   'compress_xml_reports'       :   (lambda x: x == 'True', self.set_compress_xml_reports, self.get_compress_xml_reports),
                   'serialization_method'       :   (str, self.set_serialization_method, self.get_serialization_method),
                   'space_limit'                :   (int, self.set_space_limit, self.get_space_limit),
                   'cache_directory'            :   (str, self.set_directory, self.get_directory),
                   'download_limit'             :   (int, self.set_download_limit, self.get_download_limit),
                   'upload_limit'             :   (int, self.set_upload_limit, self.get_upload_limit),
                   'sis_url'                    : (str, self.set_sis_url, self.get_sis_url),
                   'max_uploads_per_dl'         : (int, self.set_max_upload_slots_per_download, self.get_max_upload_slots_per_download),
                   'stay_in_torrents'           : (int, self.set_stay_in_torrents, self.get_stay_in_torrents)
    }
 def __init__(self):
     PeerConfiguration.__init__(self)
     
     self._state_directory = None
     self._mode_ps = constants.PS_MODE_NONE
     self._single_torrent = None
     self._exit_on = constants.EXIT_ON_ALL_FINISHED
     self._seeding_time = 15 # seconds
     self._activity_report_interval = 15 # seconds
     self._download_mode = simpledefs.DLMODE_NORMAL
     self._max_initiate = 10
     self._report_interval = 5.0
     self._logfile = 'player.log'
     self._hap_enabled = False
     self._hap_interval = 300
     self._supporter_seed = False
     self._supporter_ip = "127.0.0.1"
     
     self._mapping = {
         'ranking_source'    : (str, self.set_ranking_source, self.get_ranking_source),
         'mode_ns'        :   (str, self.set_ns_mode, self.get_ns_mode),
         'mode_ps'        :   (str, self.set_peer_selection_mode, self.get_peer_selection_mode),
         'locality_pref'  :   (float, self.set_locality_preference, self.get_locality_preference),
         'sis_url'        :   (str, self.set_sis_url, self.get_sis_url),
         'cache_interval' :   (float, self.set_rating_cache_interval, self.get_rating_cache_interval),
         'max_download_rate' : (int, self.set_download_limit, self.get_download_limit),
         'max_upload_rate'   : (int, self.set_upload_limit, self.get_upload_limit),
         'max_uploads'       : (int, self.set_max_upload_slots_per_download, self.get_max_upload_slots_per_download),
         'download_mode'     : (str, self.set_download_mode, self.get_download_mode),
         'max_connections'   : (int, self.set_connection_limit, self.get_connection_limit),
         #'max_initiate' : pass,
         #'min_uploads'  : pass,
         'torrent'           : (str, self.set_single_torrent, self.get_single_torrent),
         'report_to'         : (str, self.set_report_to, self.get_report_to),
         'serialization_method'  : (str, self.set_serialization_method, self.get_serialization_method),
         'compress_xml_reports'  : (lambda x: x == 'True', self.set_compress_xml_reports, self.get_compress_xml_reports),
         'report_interval'       : (float, self.set_report_interval, self.get_report_interval),
         'internal_id'           : (int, self.set_id, self.get_id),
         'activity_report_interval'      : (int, self.set_activity_report_interval, self.get_activity_report_interval),
         'hap_enabled'           : (lambda x: x == 'True', self.set_hap_enabled, self.is_hap_enabled),
         'hap_interval'          : (int, self.set_hap_interval, self.get_hap_interval), 
         'supporter_ips'         : (str, self.set_supporter_ip, self.get_supporter_ip)
         }
    def __init__(self):
        PeerConfiguration.__init__(self)

        self._torrent_selection_interval = 30
        self._rate_interval = 30
        self._max_torrents = 10
        self._min_leechers = 0
        self._min_local_leechers = 0
        self._min_ulfactor = 0.6
        self._torrent_selection_mechanism = 'local_folder'
        self._torrent_directory = 'torrents'
        self._rate_management = 'equal'
        self._replacement_strategy = constants.RP_FIFO
        self._max_downloads = 5
        self._ranking_source = constants.RS_IP_PRE
        self._directory = "iop_data"
        self._space_limit = 100
        self._cache_console = False
        self._establish_remote_connections = True
        self._stay_in_torrents = 4
        self._ns_mode = constants.NS_MODE_ENABLE
        self._locality_pref = float(1)
        self._logfile = 'iop.log'
        #TODO: the meaning here is different than for a normal client, since cache divides connections across all torrents! Better to use another name for it?
        self._connection_limit = 10000
        #TODO: some default values might be missing!!! Cf. self._mapping

        self._logger = logging.getLogger("Cache.Configuration")

        self._mapping = {
            'torrent_selection_interval':
            (int, self.set_torrent_selection_interval,
             self.get_torrent_selection_interval),
            'torrent_selection_mechanism':
            (str, self.set_torrent_selection_mechanism,
             self.get_torrent_selection_mechanism),
            'max_torrents':
            (int, self.set_max_torrents, self.get_max_torrents),
            'min_leechers': (int, self.set_min_leechers,
                             self.get_min_leechers),
            'torrent_directory': (str, self.set_torrent_directory,
                                  self.get_torrent_directory),
            'rate_management': (str, self.set_rate_management,
                                self.get_rate_management),
            'replacement_strategy': (str, self.set_replacement_strategy,
                                     self.get_replacement_strategy),
            'min_ulfactor': (float, self.set_min_ulfactor,
                             self.get_min_ulfactor),
            'max_downloads': (int, self.set_max_downloads,
                              self.get_max_downloads),
            #TODO #944: Test whether ip prefixes are properly parsed!!!
            'ip_prefix': (lambda x: x.split(";"), self.set_ip_prefixes,
                          self.get_ip_prefixes),
            'rate_interval': (int, self.set_rate_interval,
                              self.get_rate_interval),
            'report_interval': (float, self.set_report_interval,
                                self.get_report_interval),
            'compress_xml_reports':
            (lambda x: x == 'True', self.set_compress_xml_reports,
             self.get_compress_xml_reports),
            'serialization_method': (str, self.set_serialization_method,
                                     self.get_serialization_method),
            'space_limit': (int, self.set_space_limit, self.get_space_limit),
            'cache_directory': (str, self.set_directory, self.get_directory),
            'download_limit': (int, self.set_download_limit,
                               self.get_download_limit),
            'upload_limit': (int, self.set_upload_limit,
                             self.get_upload_limit),
            'sis_url': (str, self.set_sis_url, self.get_sis_url),
            'max_uploads_per_dl': (int, self.set_max_upload_slots_per_download,
                                   self.get_max_upload_slots_per_download),
            'stay_in_torrents': (int, self.set_stay_in_torrents,
                                 self.get_stay_in_torrents)
        }
    def __init__(self):
        PeerConfiguration.__init__(self)

        self._state_directory = None
        self._mode_ps = constants.PS_MODE_NONE
        self._single_torrent = None
        self._exit_on = constants.EXIT_ON_ALL_FINISHED
        self._seeding_time = 15  # seconds
        self._activity_report_interval = 15  # seconds
        self._download_mode = simpledefs.DLMODE_NORMAL
        self._max_initiate = 10
        self._report_interval = 5.0
        self._logfile = 'player.log'
        self._hap_enabled = False
        self._hap_interval = 300
        self._supporter_seed = False
        self._supporter_ip = "127.0.0.1"

        self._mapping = {
            'ranking_source':
            (str, self.set_ranking_source, self.get_ranking_source),
            'mode_ns': (str, self.set_ns_mode, self.get_ns_mode),
            'mode_ps':
            (str, self.set_peer_selection_mode, self.get_peer_selection_mode),
            'locality_pref': (float, self.set_locality_preference,
                              self.get_locality_preference),
            'sis_url': (str, self.set_sis_url, self.get_sis_url),
            'cache_interval': (float, self.set_rating_cache_interval,
                               self.get_rating_cache_interval),
            'max_download_rate': (int, self.set_download_limit,
                                  self.get_download_limit),
            'max_upload_rate': (int, self.set_upload_limit,
                                self.get_upload_limit),
            'max_uploads': (int, self.set_max_upload_slots_per_download,
                            self.get_max_upload_slots_per_download),
            'download_mode': (str, self.set_download_mode,
                              self.get_download_mode),
            'max_connections': (int, self.set_connection_limit,
                                self.get_connection_limit),
            #'max_initiate' : pass,
            #'min_uploads'  : pass,
            'torrent': (str, self.set_single_torrent, self.get_single_torrent),
            'report_to': (str, self.set_report_to, self.get_report_to),
            'serialization_method': (str, self.set_serialization_method,
                                     self.get_serialization_method),
            'compress_xml_reports':
            (lambda x: x == 'True', self.set_compress_xml_reports,
             self.get_compress_xml_reports),
            'report_interval': (float, self.set_report_interval,
                                self.get_report_interval),
            'internal_id': (int, self.set_id, self.get_id),
            'activity_report_interval':
            (int, self.set_activity_report_interval,
             self.get_activity_report_interval),
            'hap_enabled': (lambda x: x == 'True', self.set_hap_enabled,
                            self.is_hap_enabled),
            'hap_interval': (int, self.set_hap_interval,
                             self.get_hap_interval),
            'supporter_ips': (str, self.set_supporter_ip,
                              self.get_supporter_ip)
        }