def __init__(self):
        super(BrasovPollutionWrapper, self).__init__()

        basesensordescription = SensorDescription()
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofbrasov"
        basesensordescription.graphName = "brasov_air_pollution#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/json"
        basesensordescription.information = "Air pollution in the city of Brasov"
        basesensordescription.cityName = "Brasov"
        basesensordescription.countryName = "Romania"
        basesensordescription.movementBuffer = 0
        basesensordescription.maxLatency = 2
        basesensordescription.updateInterval = 60 * 5
        basesensordescription.fields = ['aqisitionStation', 'aqisitionStationDetails', 'eventTypeName', 'qualityLevelType', 'timestamp']

        basesensordescription.field.aqisitionStation.propertyName = "Property"
        basesensordescription.field.aqisitionStation.propertyPrefix = "ssn"
        basesensordescription.field.aqisitionStation.propertyURI = basesensordescription.namespace + "brasov/pollution#Station"
        basesensordescription.field.aqisitionStation.min = ""
        basesensordescription.field.aqisitionStation.max = ""
        basesensordescription.field.aqisitionStation.dataType = "str"
        basesensordescription.field.aqisitionStation.showOnCityDashboard = True

        basesensordescription.field.aqisitionStationDetails.propertyName = "Property"
        basesensordescription.field.aqisitionStationDetails.propertyPrefix = "ssn"
        basesensordescription.field.aqisitionStationDetails.propertyURI = basesensordescription.namespace + "brasov/pollution#StationDetails"
        basesensordescription.field.aqisitionStationDetails.min = ""
        basesensordescription.field.aqisitionStationDetails.max = ""
        basesensordescription.field.aqisitionStationDetails.dataType = "str"
        basesensordescription.field.aqisitionStationDetails.showOnCityDashboard = True

        basesensordescription.field.eventTypeName.propertyName = "AirPollutionIndex"
        basesensordescription.field.eventTypeName.propertyURI = basesensordescription.namespace + "brasov/pollution#EventType"
        basesensordescription.field.eventTypeName.min = ""
        basesensordescription.field.eventTypeName.max = ""
        basesensordescription.field.eventTypeName.dataType = "str"
        basesensordescription.field.eventTypeName.showOnCityDashboard = True

        basesensordescription.field.qualityLevelType.propertyName = "AirPollutionLevel"
        basesensordescription.field.qualityLevelType.propertyURI = basesensordescription.namespace + "brasov/pollution#QualityLevelType"
        basesensordescription.field.qualityLevelType.min = ""
        basesensordescription.field.qualityLevelType.max = ""
        basesensordescription.field.qualityLevelType.dataType = "str"
        basesensordescription.field.qualityLevelType.showOnCityDashboard = True

        basesensordescription.field.timestamp.propertyName = "MeasuredTime"
        basesensordescription.field.timestamp.propertyURI = basesensordescription.namespace + "city#MeasuredTime"
        basesensordescription.field.timestamp.unit = basesensordescription.namespace + "unit:time"
        basesensordescription.field.timestamp.min = ""
        basesensordescription.field.timestamp.max = ""
        basesensordescription.field.timestamp.dataType = "str"        
        basesensordescription.field.timestamp.skip_annotation = True

        basesensordescription.timestamp.inField = "timestamp"
        basesensordescription.timestamp.format = "UNIX5"

        locations = [
            ("BV-1", "Brasov, Calea Bucuresti, Str. Soarelui", "POINT(25.63272 45.636742)"),
            ("BV-2", "Brasov, Str. Castanilor, FN, cod postal 500097", "POINT(25.604125 45.649339)"),
            ("BV-3", "Brasov, Bdul. Garii, Aleea Lacramioarelor", "POINT(25.6169 45.658564)"),
            ("BV-4", "Brasov, Sanpetru, Str. Morii, FN", "POINT(25.625372 45.718173)"),
            ("BV-5", "Brasov, Bdul. Vlahuta, Str. Parcul Mic, Nr. 9", "POINT(25.625952 45.651784)")
        ]

        eventTypeNames = ["SO2", "PM10", "NO2", "O3", "CO"]

        for _id, loc, coords in locations:
            for eventTypeName in eventTypeNames:
                sensordescription = basesensordescription.deepcopy()
                sensordescription.source = "http://www.bamct.siemens.ro:9000/brasovDataCollector/pollutionView?location=%s&pollutionType=%s" % (_id, eventTypeName)
                sensordescription.sensorName = "brasov_air_pollution_%s_%s" % (eventTypeName, _id)
                sensordescription.sensorID = _id + "-" + eventTypeName
                sensordescription.fullSensorID = basesensordescription.namespace + "brasov/pollution/" + _id + "/" + eventTypeName
                sensordescription.location = coords
                #sensordescription.sensorType = "Brasov_Air_Pollution_" + eventTypeName
                sensordescription.sensorType = "Brasov_Air_Pollution"

                sensordescription.field.aqisitionStation.equals = _id
                sensordescription.field.aqisitionStationDetails.equals = loc
                sensordescription.field.eventTypeName.equals = eventTypeName

                sensordescription.messagebus.routingKey = "Brasov.Air.Pollution.%s.%s" % (eventTypeName, _id)

                self.addWrapper(InternalBrasovWrapper(sensordescription))
    def __init__(self):
        super(ComposedAarhusPollutionWrapper, self).__init__()
        metadatafile = AbstractComposedWrapper.getFileObject(__file__, "metadata.json", "rU")
        metadata = JOb(metadatafile)

        basesensordescription = SensorDescription()
        basesensordescription.source = "???" # TODO
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofaarhus"
        basesensordescription.sensorType = "Aarhus_Pollution"
        basesensordescription.graphName = "aarhus_pollution#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/json"
        basesensordescription.information = "Pollution data for the City of Aarhus"
        basesensordescription.cityName = "Aarhus"
        basesensordescription.countryName = "Denmark"
        basesensordescription.movementBuffer = 3
        basesensordescription.maxLatency = 2
        basesensordescription.updateInterval = 5 * 60
        basesensordescription.fields = ["ozone", "particullate_matter", "carbon_monoxide", "sulfure_dioxide",
                                        "nitrogen_dioxide", "longitude", "latitude", "timestamp"]

        basesensordescription.field.ozone.propertyName = "Property"
        basesensordescription.field.ozone.propertyPrefix = "ssn"
        basesensordescription.field.ozone.propertyURI = basesensordescription.namespace + "city#Ozone"
        basesensordescription.field.ozone.unit = basesensordescription.namespace + "unit:km-per-hour"
        basesensordescription.field.ozone.min = 0
        basesensordescription.field.ozone.max = 150
        basesensordescription.field.ozone.dataType = "int"
        basesensordescription.field.ozone.showOnCityDashboard = True
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.particullate_matter.propertyName = "Property"
        basesensordescription.field.particullate_matter.propertyPrefix = "ssn"
        basesensordescription.field.particullate_matter.propertyURI = basesensordescription.namespace + "city#ParticleMatter"
        basesensordescription.field.particullate_matter.unit = basesensordescription.namespace + "unit:number-of-vehicle-per-5min"
        basesensordescription.field.particullate_matter.min = 0
        basesensordescription.field.particullate_matter.max = 10000
        basesensordescription.field.particullate_matter.dataType = "int"
        basesensordescription.field.particullate_matter.showOnCityDashboard = True
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.carbon_monoxide.propertyName = "Property"
        basesensordescription.field.carbon_monoxide.propertyPrefix = "ssn"
        basesensordescription.field.carbon_monoxide.propertyURI = basesensordescription.namespace + "city#CarbonMonoxide"
        basesensordescription.field.carbon_monoxide.unit = basesensordescription.namespace + "unit:minutes"
        basesensordescription.field.carbon_monoxide.min = 0
        basesensordescription.field.carbon_monoxide.max = 1000
        basesensordescription.field.carbon_monoxide.dataType = "int"
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.sulfure_dioxide.propertyName = "Property"
        basesensordescription.field.sulfure_dioxide.propertyPrefix = "ssn"
        basesensordescription.field.sulfure_dioxide.propertyURI = basesensordescription.namespace + "city#SulfureDioxide"
        basesensordescription.field.sulfure_dioxide.unit = basesensordescription.namespace + "unit:minutes"
        basesensordescription.field.sulfure_dioxide.min = 0
        basesensordescription.field.sulfure_dioxide.max = 1000
        basesensordescription.field.sulfure_dioxide.dataType = "int"
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.nitrogen_dioxide.propertyName = "Property"
        basesensordescription.field.nitrogen_dioxide.propertyPrefix = "ssn"
        basesensordescription.field.nitrogen_dioxide.propertyURI = basesensordescription.namespace + "city#NitrogenDioxide"
        basesensordescription.field.nitrogen_dioxide.unit = basesensordescription.namespace + "unit:minutes"
        basesensordescription.field.nitrogen_dioxide.min = 0
        basesensordescription.field.nitrogen_dioxide.max = 1000
        basesensordescription.field.nitrogen_dioxide.dataType = "int"
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.longitude.propertyName = "Property"
        basesensordescription.field.longitude.propertyPrefix = "ssn"
        basesensordescription.field.longitude.propertyURI = basesensordescription.namespace + "city#Longitude"
        basesensordescription.field.longitude.unit = basesensordescription.namespace + "unit:degrees"
        basesensordescription.field.longitude.min = 0
        basesensordescription.field.longitude.max = 180
        basesensordescription.field.longitude.dataType = "float"
        basesensordescription.field.vehicleCount.aggregationMethod = None


        basesensordescription.field.latitude.propertyName = "Property"
        basesensordescription.field.latitude.propertyPrefix = "ssn"
        basesensordescription.field.latitude.propertyURI = basesensordescription.namespace + "city#Latitude"
        basesensordescription.field.latitude.unit = basesensordescription.namespace + "unit:degrees"
        basesensordescription.field.latitude.min = 0
        basesensordescription.field.latitude.max = 180
        basesensordescription.field.latitude.dataType = "float"
        basesensordescription.field.vehicleCount.aggregationMethod = None


        basesensordescription.field.timestamp.propertyName = "MeasuredTime"
        basesensordescription.field.timestamp.propertyURI = basesensordescription.namespace + "city#MeasuredTime"
        basesensordescription.field.timestamp.unit = basesensordescription.namespace + "unit:time"
        basesensordescription.field.timestamp.min = "2012-01-01T00:00:00"
        basesensordescription.field.timestamp.max = "2099-12-31T23:59:59"
        basesensordescription.field.timestamp.dataType = "datetime.datetime"
        basesensordescription.field.timestamp.format = "%Y-%m-%d %H:%M:%S"
        basesensordescription.field.timestamp.skip_annotation = True

        basesensordescription.timestamp.inField = "timestamp"
        basesensordescription.timestamp.format = "%Y-%m-%d %H:%M:%S"

        for point in metadata:
            sensordescription = basesensordescription.deepcopy()
            sensordescription.sensorName = "aarhus_pollution_" + point["id"]
            sensordescription.sensorID = str(point["id"])
            sensordescription.fullSensorID = basesensordescription.namespace + "sensor/Aarhus-Pollution-" + sensordescription.sensorID
            sensordescription.location = "POINT(%(long)s %(lat)s)" % point
            sensordescription.messagebus.routingKey = "Aarhus.Pollution." + sensordescription.sensorID
            self.addWrapper(AarhusPollutionWrapper(sensordescription))
    def __init__(self):
        super(RomanianWeatherAWWrapper, self).__init__()

        basesensordescription = SensorDescription()
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofbrasov"
        basesensordescription.sensorType = "Romanian_Weather"
        basesensordescription.graphName = "romanian_weather#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/json"
        basesensordescription.information = "Weather data of Romania"
        basesensordescription.countryName = "Romania"
        basesensordescription.movementBuffer = 3
        basesensordescription.updateInterval = 60 * 60
        basesensordescription.maxLatency = 2
        basesensordescription.fields = ["aqisitionStation", "precipitations", "temperature", "timestamp", "wind"]

        basesensordescription.field.aqisitionStation.propertyName = "Property"
        basesensordescription.field.aqisitionStation.propertyPrefix = "ssn"
        basesensordescription.field.aqisitionStation.propertyURI = basesensordescription.namespace + "romania/weather#Station"
        basesensordescription.field.aqisitionStation.min = ""
        basesensordescription.field.aqisitionStation.max = ""
        basesensordescription.field.aqisitionStation.dataType = "str"
        basesensordescription.field.aqisitionStation.showOnCityDashboard = True

        basesensordescription.field.precipitations.propertyName = "Property"
        basesensordescription.field.precipitations.propertyPrefix = "ssn"
        basesensordescription.field.precipitations.propertyURI = \
            basesensordescription.namespace + "romania/weather#Precipitation"
        basesensordescription.field.precipitations.unit = basesensordescription.namespace + "unit:millimeter"
        basesensordescription.field.precipitations.min = 0
        basesensordescription.field.precipitations.max = 100
        basesensordescription.field.precipitations.dataType = "float"
        basesensordescription.field.precipitations.showOnCityDashboard = True
        basesensordescription.field.precipitations.aggregationMethod = "sax"
        basesensordescription.field.precipitations.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}

        basesensordescription.field.temperature.propertyName = "Temperature"
        basesensordescription.field.temperature.propertyURI = basesensordescription.namespace + "romania/weather#Temperature"
        basesensordescription.field.temperature.unit = basesensordescription.namespace + "unit:degreecelsius"
        basesensordescription.field.temperature.min = -40
        basesensordescription.field.temperature.max = 70
        basesensordescription.field.temperature.dataType = "int"
        basesensordescription.field.temperature.showOnCityDashboard = True
        basesensordescription.field.temperature.aggregationMethod = "sax"
        basesensordescription.field.temperature.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}

        basesensordescription.field.wind.propertyName = "WindSpeed"
        basesensordescription.field.wind.propertyURI = basesensordescription.namespace + "romania/weather#WindSpeed"
        basesensordescription.field.wind.unit = basesensordescription.namespace + "unit:km-per-hour"
        basesensordescription.field.wind.min = 0
        basesensordescription.field.wind.max = 50
        basesensordescription.field.wind.dataType = "int"
        basesensordescription.field.wind.showOnCityDashboard = True
        basesensordescription.field.wind.aggregationMethod = "sax"
        basesensordescription.field.wind.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}

        basesensordescription.field.timestamp.propertyName = "MeasuredTime"
        basesensordescription.field.timestamp.propertyURI = basesensordescription.namespace + "city#MeasuredTime"
        basesensordescription.field.timestamp.unit = basesensordescription.namespace + "unit:time"
        basesensordescription.field.timestamp.min = 0
        basesensordescription.field.timestamp.max = 9999999999999
        basesensordescription.field.timestamp.dataType = "long"
        basesensordescription.field.timestamp.skip_annotation = True

        basesensordescription.timestamp.inField = "timestamp"
        basesensordescription.timestamp.format = "UNIX5"

        locations = {
            "Arad": "POINT(21.31 46.19)",
            "Bacau": "POINT(26.91 46.57)",
            "Baia Mare": "POINT(23.57 47.65)",
            "Barlad": "POINT(27.67 46.23)",
            "Bistrita": "POINT(24.04 45.19)",
            "Botosani": "POINT(26.67 47.75)",
            "Braila": "POINT(27.97 45.28)",
            "Brasov": "POINT(25.60 45.65)",
            "Bucuresti": "POINT(26.1 44.44)",
            "Buzau": "POINT(26.82 45.15)",
            "Calarasi": "POINT(23.85 46.48)",
            "Cluj-Napoca": "POINT(23.61 46.78)",
            "Constanta": "POINT(28.63 44.18)",
            "Craiova": "POINT(23.8 44.32)",
            "Deva": "POINT(22.9 45.88)",
            "Drobeta Turnu Severin": "POINT(22.66 44.63)",
            "Focsani": "POINT(27.18 45.69)",
            "Galati": "POINT(28.04 45.44)",
            "Iasi": "POINT(27.58 47.16)",
            "Ploiesti": "POINT(26.02 44.94)",
            "Piatra-Neamt": "POINT(26.37 46.93)",
            "Ramnicu Valcea": "POINT(24.37 45.10)",
            "Roman": "POINT(26.92 46.92)",
            "Satu Mare": "POINT(22.88 47.78)",
            "Sibiu": "POINT(24.15 45.79)",
            "Slatina": "POINT(24.36 44.42)",
            "Suceava": "POINT(26.15 47.60)",
            "Targu-Mures": "POINT(24.55 46.54)",
            "Timisoara": "POINT(21.23 45.76)",
            "Tulcea": "POINT(28.79 45.17)"
        }

        for _id in locations:
            sensordescription = basesensordescription.deepcopy()
            sensordescription.source = "http://www.bamct.siemens.ro:9000/brasovDataCollector/AccuWeatherView?location=" + urllib.quote_plus(_id)
            sensordescription.sensorName = "romania_weather_aw_%s" % (niceFilename(_id),)
            sensordescription.sensorID = niceFilename(_id)
            sensordescription.fullSensorID = basesensordescription.namespace + "romania/weather/aw/" + niceFilename(sensordescription.sensorID)
            sensordescription.location = locations[_id]

            # One message bus routingkey for each sensorid
            sensordescription.messagebus.routingKey = "Romania.Weather." + sensordescription.sensorID
            self.addWrapper(InternalWeatherAWWrapper(sensordescription))
    def __init__(self):
        super(AarhusTrafficWrapper, self).__init__()
        metadatafile = AbstractComposedWrapper.getFileObject(__file__, "aarhus-traffic-points.json", "rU")
        metadata = JOb(metadatafile)

        basesensordescription = SensorDescription()
        basesensordescription.source = "http://www.odaa.dk/api/action/datastore_search?resource_id=b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d"
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofaarhus" #or id of user profile
        basesensordescription.sensorType = "Aarhus_Road_Traffic" #serviceCategory
        basesensordescription.graphName = "aarhus_road_traffic#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/json" #MIMEs
        basesensordescription.information = "Road traffic for the City of Aarhus"
        # basesensordescription.cityName = "Aarhus"
        # basesensordescription.countryName = "Denmark"
        basesensordescription.movementBuffer = 3 # in meter, 0 means stationary
        basesensordescription.maxLatency = 2
        basesensordescription.updateInterval = 60 * 5  # with push an interval to send a keep alive message
        basesensordescription.fields = "TIMESTAMP, avgSpeed, vehicleCount, avgMeasuredTime".split(", ")

        basesensordescription.field.avgSpeed.propertyName = "AverageSpeed"
        basesensordescription.field.avgSpeed.propertyURI = basesensordescription.namespace + "city#AverageSpeed"
        basesensordescription.field.avgSpeed.unit = basesensordescription.namespace + "unit:km-per-hour"
        basesensordescription.field.avgSpeed.min = 0
        basesensordescription.field.avgSpeed.max = 250
        basesensordescription.field.avgSpeed.dataType = "float"
        basesensordescription.field.avgSpeed.showOnCityDashboard = True
        basesensordescription.field.avgSpeed.aggregationMethod = "sax"
        basesensordescription.field.avgSpeed.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 4}


        basesensordescription.field.vehicleCount.propertyName = "StreetVehicleCount"
        basesensordescription.field.vehicleCount.propertyURI = basesensordescription.namespace + "city#StreetVehicleCount"
        basesensordescription.field.vehicleCount.unit = basesensordescription.namespace + "unit:number-of-vehicle-per-5min"
        basesensordescription.field.vehicleCount.min = 0
        basesensordescription.field.vehicleCount.max = 1000
        basesensordescription.field.vehicleCount.dataType = "int"
        basesensordescription.field.vehicleCount.showOnCityDashboard = True
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 4}


        basesensordescription.field.avgMeasuredTime.propertyName = "MeasuredTime"
        # basesensordescription.field.avgMeasuredTime.propertyName = "Property"
        # basesensordescription.field.avgMeasuredTime.propertyPrefix = "ssn"
        basesensordescription.field.avgMeasuredTime.propertyURI = basesensordescription.namespace + "city#AvgMeasuredTime"
        basesensordescription.field.avgMeasuredTime.unit = "http://purl.oclc.org/NET/muo/ucum/unit/time/minute" # basesensordescription.namespace + "unit:minutes"
        basesensordescription.field.avgMeasuredTime.min = 0
        basesensordescription.field.avgMeasuredTime.max = 1000
        basesensordescription.field.avgMeasuredTime.dataType = "int"

        basesensordescription.field.TIMESTAMP.propertyName = "MeasuredTime"
        basesensordescription.field.TIMESTAMP.propertyURI = basesensordescription.namespace + "city#MeasuredTime"
        basesensordescription.field.TIMESTAMP.unit = "http://purl.oclc.org/NET/muo/ucum/unit/time/minute" # basesensordescription.namespace + "unit:time#minutes"
        basesensordescription.field.TIMESTAMP.min = "2012-01-01T00:00:00"
        basesensordescription.field.TIMESTAMP.max = "2099-12-31T23:59:59"
        basesensordescription.field.TIMESTAMP.dataType = "datetime.datetime"
        basesensordescription.field.TIMESTAMP.format = "%Y-%m-%dT%H:%M:%S"
        basesensordescription.field.TIMESTAMP.skip_annotation = True

        basesensordescription.timestamp.inField = "TIMESTAMP"
        basesensordescription.timestamp.format = "%Y-%m-%dT%H:%M:%S"

        for point in metadata.result.records:
            sensordescription = basesensordescription.deepcopy()
            sensordescription.sensorName = "aarhus_road_traffic_" + str(point.REPORT_ID)
            sensordescription.sensorID = point.REPORT_ID
            sensordescription.fullSensorID = basesensordescription.namespace + "sensor/" + str(point.REPORT_ID)
            sensordescription.location = "LINESTRING(%s %s, %s %s)" % (point.POINT_1_LNG, point.POINT_1_LAT, point.POINT_2_LNG, point.POINT_2_LAT)
            sensordescription.cityName = [self.__getattr(point, "POINT_1_CITY", "n/a"), self.__getattr(point, "POINT_1_CITY", "n/a")]
            sensordescription.countryName = [self.__getattr(point, "POINT_1_COUNTRY", "n/a"), self.__getattr(point, "POINT_2_COUNTRY", "n/a")]
            sensordescription.streetName = [self.__getattr(point, "POINT_1_STREET", "n/a"), self.__getattr(point, "POINT_2_STREET", "n/a")]
            sensordescription.postalCode = [self.__getattr(point, "POINT_1_POSTAL_CODE", "n/a"), self.__getattr(point, "POINT_2_POSTAL_CODE", "n/a")]
            sensordescription.messagebus.routingKey = "Aarhus.Road.Traffic." + str(point.REPORT_ID)
            self.addWrapper(InternalWrapper(sensordescription))

        self.splitter = AarhusTrafficSplitter(self)
        self.connection = AarhusTrafficConnection(self)
    def __init__(self):
        super(RomanianWeatherMRWrapper, self).__init__()

        basesensordescription = SensorDescription()
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofbrasov"
        basesensordescription.sensorType = "Romanian_Weather"
        basesensordescription.graphName = "romanian_weather#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/json"
        basesensordescription.information = "Weather data of Romania"
        basesensordescription.countryName = "Romania"
        basesensordescription.movementBuffer = 0
        basesensordescription.maxLatency = 2
        basesensordescription.updateInterval = 60 * 60
        basesensordescription.fields = ["aqisitionStation", "pressure", "relative_humidity", "temperature", "timestamp",
                                        "wind", "nebulosityType", "windtyp"]

        basesensordescription.field.aqisitionStation.propertyName = "Property"
        basesensordescription.field.aqisitionStation.propertyPrefix = "ssn"
        basesensordescription.field.aqisitionStation.propertyURI = basesensordescription.namespace + "romania/weather#Station"
        basesensordescription.field.aqisitionStation.min = ""
        basesensordescription.field.aqisitionStation.max = ""
        basesensordescription.field.aqisitionStation.dataType = "str"
        basesensordescription.field.aqisitionStation.showOnCityDashboard = True

        basesensordescription.field.pressure.propertyName = "Property"
        basesensordescription.field.pressure.propertyPrefix = "ssn"
        basesensordescription.field.pressure.propertyURI = \
            basesensordescription.namespace + "romania/weather#Pressure"
        basesensordescription.field.pressure.unit = basesensordescription.namespace + "unit:mmHG"
        basesensordescription.field.pressure.min = 500
        basesensordescription.field.pressure.max = 1500
        basesensordescription.field.pressure.dataType = "float"
        basesensordescription.field.pressure.showOnCityDashboard = True
        basesensordescription.field.pressure.aggregationMethod = "sax"
        basesensordescription.field.pressure.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.temperature.propertyName = "Temperature"
        basesensordescription.field.temperature.propertyURI = basesensordescription.namespace + "romania/weather#Temperature"
        basesensordescription.field.temperature.unit = basesensordescription.namespace + "unit:degreecelsius"
        basesensordescription.field.temperature.min = -40
        basesensordescription.field.temperature.max = 70
        basesensordescription.field.temperature.dataType = "float"
        basesensordescription.field.temperature.showOnCityDashboard = True
        basesensordescription.field.temperature.aggregationMethod = "sax"
        basesensordescription.field.temperature.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.wind.propertyName = "WindSpeed"
        basesensordescription.field.wind.propertyURI = basesensordescription.namespace + "romania/weather#WindSpeed"
        basesensordescription.field.wind.unit = basesensordescription.namespace + "unit:km-per-hour"
        basesensordescription.field.wind.min = 0
        basesensordescription.field.wind.max = 12
        basesensordescription.field.wind.dataType = "int"
        basesensordescription.field.wind.showOnCityDashboard = True
        basesensordescription.field.wind.aggregationMethod = "sax"
        basesensordescription.field.wind.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.relative_humidity.propertyName = "Property"
        basesensordescription.field.relative_humidity.propertyPrefix = "ssn"
        basesensordescription.field.relative_humidity.propertyURI = basesensordescription.namespace + "romania/weather#Humidity"
        # TODO unit of measurement?
        basesensordescription.field.relative_humidity.min = 0
        basesensordescription.field.relative_humidity.max = 100
        basesensordescription.field.relative_humidity.dataType = "int"
        basesensordescription.field.relative_humidity.showOnCityDashboard = True
        basesensordescription.field.relative_humidity.aggregationMethod = "sax"
        basesensordescription.field.relative_humidity.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}


        basesensordescription.field.timestamp.propertyName = "MeasuredTime"
        basesensordescription.field.timestamp.propertyURI = basesensordescription.namespace + "city#MeasuredTime"
        basesensordescription.field.timestamp.unit = basesensordescription.namespace + "unit:time"
        basesensordescription.field.timestamp.min = 0
        basesensordescription.field.timestamp.max = 9999999999999
        basesensordescription.field.timestamp.dataType = "long"
        basesensordescription.field.timestamp.skip_annotation = True

        basesensordescription.field.nebulosityType.propertyName = "Property"
        basesensordescription.field.nebulosityType.propertyPrefix = "ssn"
        basesensordescription.field.nebulosityType.propertyURI = basesensordescription.namespace + "romania/weather#NebulosityType"
        basesensordescription.field.nebulosityType.min = ""
        basesensordescription.field.nebulosityType.max = ""
        basesensordescription.field.nebulosityType.dataType = "str"
        basesensordescription.field.nebulosityType.showOnCityDashboard = True

        basesensordescription.field.windtyp.propertyName = "Property"
        basesensordescription.field.windtyp.propertyPrefix = "ssn"
        basesensordescription.field.windtyp.propertyURI = basesensordescription.namespace + "romania/weather#WindType"
        basesensordescription.field.windtyp.min = ""
        basesensordescription.field.windtyp.max = ""
        basesensordescription.field.windtyp.dataType = "str"
        basesensordescription.field.windtyp.showOnCityDashboard = True

        basesensordescription.timestamp.inField = "timestamp"
        basesensordescription.timestamp.format = "UNIX5"

        locations = {
            "ADAMCLISI": "POINT(27.96 44.09)",
            "ADJUD": "POINT(27.18 46.1)",
            "ALBA IULIA": "POINT(23.57 46.07)",
            "ALEXANDRIA": "POINT(25.33 43.97)",
            "ARAD": "POINT(21.32 46.17)",
            "BACAU": "POINT(26.92 46.58)",
            "BACLES": "POINT(23.12 44.49)",
            "BAIA MARE": "POINT(23.58 47.67)",
            "BAILE HERCULANE": "POINT(22.41 44.88)",
            "BAILESTI": "POINT(23.35 44.03)",
            "BAISOARA": "POINT(23.46 46.58)",
            "BALEA LAC": "POINT(24.61 45.60)",
            "BANLOC": "POINT(21.14 45.39)",
            "BARAOLT": "POINT(25.6 46.08)",
            "BARLAD:": "POINT(27.67 46.23)",
            "BARNOVA RADAR": "POINT(27.63 47.07)",
            "BATOS": "POINT(24.65 46.89)",
            "BECHET": "POINT(24.18 44.39)",
            "BISOCA": "POINT(26.71 45.54)",
            "BISTRITA": "POINT(24.49 47.13)",
            "BLAJ": "POINT(23.91 46.18)",
            "BOITA": "POINT(24.26 45.63)",
            "BOROD": "POINT(22.61 46.99)",
            "BOTOSANI": "POINT(26.67 47.75)",
            "BOZOVICI": "POINT(22.0 44.93)",
            "BRAILA": "POINT(27.96 45.27)",
            "BRASOV GHIMBAV": "POINT(25.51 45.66)",
            "BUCIN": "POINT(25.42 46.68)",
            "BUCURESTI AFUMATI": "POINT(26.25 44.53)",
            "BUCURESTI BANEASA": "POINT(26.08 44.49)",
            "BUCURESTI FILARET": "POINT(26.08 44.42)",
            "BUZAU": "POINT(26.82 45.15)",
            "CALAFAT": "POINT(22.94 43.99)",
            "CALARASI": "POINT(27.34 44.2)",
            "CALIMANI RETITIS": "POINT(25.24 47.09)",
            "CAMPENI BISTRA": "POINT(23.05 46.36)",
            "CAMPINA": "POINT(25.74 45.13)",
            "CAMPULUNG MUSCEL": "POINT(25.05 45.27)",
            "CARACAL": "POINT(24.35 44.11)",
            "CARANSEBES": "POINT(22.22 45.42)",
            "CEAHLAU TOACA": "POINT(25.95 46.98)",
            "CERNAVODA": "POINT(28.03 44.34)",
            "CHISINEU CRIS": "POINT(21.52 46.52)",
            "CLUJ-NAPOCA": "POINT(23.58 46.76)",
            "CONSTANTA": "POINT(28.64 44.17)",
            "CORUGEA": "POINT(28.34 44.74)",
            "COTNARI": "POINT(26.94 47.35)",
            "CRAIOVA": "POINT(23.8 44.32)",
            "CUNTU": "POINT(24.14 45.59)",
            "CURTEA DE ARGES": "POINT(24.68 45.14)",
            "DARABANI": "POINT(28.3 43.79)",
            "DEDULES": None,
            "DEDULESTI-MORARESTI": "POINT(24.53 45.01)",
            "DEJ": "POINT(23.88 47.14)",
            "DEVA": "POINT(22.9 45.88)",
            "DRAGASANI": "POINT(24.26 44.66)",
            "DROBETA TURNU SEVERIN": "POINT(22.67 44.63)",
            "DUMBRAVENI": "POINT(24.58 46.23)",
            "DUMBRAVITA DE CODRU": "POINT(22.16 46.66)",
            "FAGARAS": "POINT(24.97 45.84)",
            "FETESTI": "POINT(27.83 44.37)",
            "FOCSANI": "POINT(27.18 45.7)",
            "FUNDATA": "POINT(25.29 45.44)",
            "FUNDULEA": "POINT(26.52 44.45)",
            "GALATI": "POINT(28.04 45.42)",
            "GIURGIU": "POINT(25.97 43.9)",
            "GORGOVA": "POINT(29.17 45.18)",
            "GRIVITA": "POINT(27.65 45.72)",
            "GURA PORTITEI": "POINT(29.00 44.69)",
            "GURAHONT": "POINT(22.34 46.27)",
            "HALANGA": "POINT(22.69 44.68)",
            "HARSOVA": "POINT(27.95 44.69)",
            "HOLOD": "POINT(22.13 46.79)",
            "HUEDIN": "POINT(23.03 46.87)",
            "IASI": "POINT(27.59 47.16)",
            "IEZER": "POINT(26.34 47.99)",
            "INTORSURA BUZAULUI": "POINT(26.03 45.67)",
            "JIMBOLIA": "POINT(20.72 45.79)",
            "JOSENI": "POINT(25.5 46.7)",
            "JURILOVCA": "POINT(28.87 44.76)",
            "LACAUTI": "POINT(26.02 44.93)",
            "LUGOJ": "POINT(21.9 45.69)",
            "MAHMUDIA": "POINT(29.08 45.08)",
            "MANGALIA": "POINT(28.58 43.82)",
            "MEDGIDIA": "POINT(28.27 44.25)",
            "MIERCUREA CIUC": "POINT(25.81 46.36)",
            "MOLDOVA VECHE": "POINT(21.62 44.72)",
            "NEGRESTI VASLUI": "POINT(27.46 46.83)",
            "OBARSIA LOTRULUI": "POINT(23.63 45.44)",
            "OCNA SUGATAG": "POINT(23.93 47.78)",
            "ODORHEIUL SECUIESC": "POINT(25.29 46.3)",
            "OLTENITA": "POINT(26.64 44.09)",
            "ORADEA": "POINT(21.92 47.07)",
            "ORAVITA": "POINT(21.68 45.03)",
            "PADES APA NEAGRA": "POINT(22.86 45.0)",
            "PALTINIS": "POINT(23.93 45.66)",
            "PARANG": "POINT(23.56 45.34)",
            "PATARLAGELE": "POINT(26.36 45.32)",
            "PENTELEU": "POINT(26.41 45.60)",
            "PETROSANI": "POINT(23.37 45.42)",
            "PIATRA NEAMT": "POINT(26.37 46.93)",
            "PITESTI": "POINT(24.88 44.86)",
            "PLOIESTI": "POINT(26.02 44.94)",
            "POIANA STAMPEI": "POINT(25.14 47.32)",
            "POLOVRAGI": "POINT(23.81 45.17)",
            "PREDEAL": "POINT(25.58 45.5)",
            "RADAUTI": "POINT(25.92 47.84)",
            "RAMNICU SARAT": "POINT(27.06 45.38)",
            "RAMNICU VALCEA": "POINT(24.38 45.1)",
            "RESITA": "POINT(21.89 45.3)",
            "ROMAN": "POINT(26.92 46.92)",
            "ROSIA MONTANA": "POINT(23.13 46.31)",
            "ROSIORII DE VEDE": "POINT(24.99 44.11)",
            "SACUIENI": "POINT(22.11 47.34)",
            "SANNICOLAU MARE": "POINT(20.63 46.07)",
            "SARMASU": "POINT(24.16 46.75)",
            "SATU MARE": "POINT(22.88 47.8)",
            "SEBES ALBA": "POINT(23.57 45.96)",
            "SEMENIC": "POINT(21.96 45.15)",
            "SFANTU GHEORGHE DELTA": "POINT(29.59 44.9)",
            "SFANTU GHEORGHE MUNTE": None,
            "SIBIU": "POINT(24.15 45.79)",
            "SIGHETUL MARMATIEI": "POINT(23.89 47.93)",
            "SINAIA 1500": "POINT(24.33 46.16)",
            "SIRIA": "POINT(21.63 46.26)",
            "SLATINA": "POINT(24.37 44.42)",
            "SLOBOZIA": "POINT(27.37 44.56)",
            "STANA DE VALE": "POINT(26.08 44.41)",
            "STEFANESTI STANCA": "POINT(27.2 47.82)",
            "STEI PETRU GROZA": "POINT(22.47 46.53)",
            "STOLNICI": "POINT(24.78 44.57)",
            "SUCEAVA": "POINT(26.26 47.65)",
            "SULINA": "POINT(29.65 45.16)",
            "SUPURU DE JOS": "POINT(22.79 47.47)",
            "TARCU": None,
            "TARGOVISTE": "POINT(21.83 45.82)",
            "TARGU JIU": "POINT(23.28 45.04)",
            "TARGU LAPUS": "POINT(23.86 47.45)",
            "TARGU LOGRESTI": "POINT(23.71 44.87)",
            "TARGU MURES": "POINT(24.56 46.54)",
            "TARGU NEAMT": "POINT(26.36 47.2)",
            "TARGU OCNA": "POINT(26.62 46.28)",
            "TARGU SECUIESC": "POINT(26.14 46.0)",
            "TARNAVENI BOBOHALMA": "POINT(24.24 46.35)",
            "TEBEA": "POINT(22.73 46.17)",
            "TECUCI": "POINT(27.43 45.85)",
            "TIMISOARA": "POINT(21.23 45.76)",
            "TITU": "POINT(25.57 44.66)",
            "TOPLITA": "POINT(25.35 46.92)",
            "TULCEA": "POINT(28.79 45.17)",
            "TURDA": "POINT(23.79 46.57)",
            "TURNU MAGURELE": "POINT(24.87 43.75)",
            "URZICENI": "POINT(26.64 44.72)",
            "VARADIA DE MURES": "POINT(22.16 46.01)",
            "VARFUL OMU": "POINT(25.45 45.44)",
            "VASLUI": "POINT(27.73 46.64)",
            "VIDELE": "POINT(25.53 44.28)",
            "VLADEASA 1400": None,
            "VLADEASA 1800": "POINT(24.51 46.52)",
            "VOINEASA": "POINT(23.96 45.42)",
            "ZALAU": "POINT(23.05 47.18)",
            "ZIMNICEA": "POINT(25.37 43.65)"
        }

        for _id in locations:
            sensordescription = basesensordescription.deepcopy()
            sensordescription.source = "http://www.bamct.siemens.ro:9000/brasovDataCollector/MeteoRomaniaView?location=" + urllib.quote_plus(_id)
            sensordescription.sensorName = "romania_weather_mr_%s" % (niceFilename(_id),)
            sensordescription.sensorID = "%s" % (_id,)
            sensordescription.fullSensorID = basesensordescription.namespace + "romania/weather/mr/" + niceFilename(sensordescription.sensorID)
            sensordescription.location = locations[sensordescription.sensorID] if locations[sensordescription.sensorID] else "POINT(25.600581 45.654376)"
            sensordescription.messagebus.routingKey = "Romania.Weather." + sensordescription.sensorID
            self.addWrapper(InternalWeatherMRWrapper(sensordescription))
    def __init__(self):
        super(AarhusParkingWrapper, self).__init__()
        metadatafile = AbstractComposedWrapper.getFileObject(__file__, "aarhus_parking-address.csv", "rU")

        basesensordescription = SensorDescription()
        basesensordescription.source = "http://www.odaa.dk/api/action/datastore_search?resource_id=2a82a145-0195-4081-a13c-b0e587e9b89c"
        basesensordescription.namespace = "http://ict-citypulse.eu/"
        basesensordescription.author = "cityofaarhus"
        basesensordescription.sensorType = "Aarhus_Road_Parking"
        basesensordescription.graphName = "aarhus_road_parking#"
        basesensordescription.sourceType = "pull_http"
        basesensordescription.sourceFormat = "application/xml"
        basesensordescription.information = "Parking data for the City of Aarhus"
        basesensordescription.cityName = "Aarhus"
        basesensordescription.countryName = "Denmark"
        basesensordescription.movementBuffer = 3
        basesensordescription.maxLatency = 2
        basesensordescription.updateInterval = 60
        # basesensordescription.fields = ["vehicleCount", "totalSpaces", "garageCode"]
        basesensordescription.fields = ["vehicleCount", "totalSpaces"]

        # basesensordescription.field.garageCode.propertyName = "Property"
        # basesensordescription.field.garageCode.propertyPrefix = "ssn"
        # basesensordescription.field.garageCode.propertyURI = basesensordescription.namespace + "city#Garagecode"
        # basesensordescription.field.garageCode.min = ""
        # basesensordescription.field.garageCode.max = ""
        # basesensordescription.field.garageCode.dataType = "str"

        basesensordescription.field.totalSpaces.propertyName = "ParkingCapacity"
        basesensordescription.field.totalSpaces.propertyURI = basesensordescription.namespace + "city#TotalSpaces"
        # basesensordescription.field.totalSpaces.unit = "http://muo.net/Number"
        basesensordescription.field.totalSpaces.min = 0
        basesensordescription.field.totalSpaces.max = 10000
        basesensordescription.field.totalSpaces.dataType = "int"
        basesensordescription.field.totalSpaces.showOnCityDashboard = True
        basesensordescription.field.totalSpaces.aggregationMethod = None

        basesensordescription.field.vehicleCount.propertyName = "ParkingVehicleCount"
        basesensordescription.field.vehicleCount.propertyURI = basesensordescription.namespace + "city#ParkingVehicleCount"
        basesensordescription.field.vehicleCount.unit = basesensordescription.namespace + "unit:number-of-vehicle-per-1min"
        basesensordescription.field.vehicleCount.min = 0
        basesensordescription.field.vehicleCount.max = "@totalSpaces"
        basesensordescription.field.vehicleCount.dataType = "int"
        basesensordescription.field.vehicleCount.showOnCityDashboard = True
        basesensordescription.field.vehicleCount.aggregationMethod = "sax"
        basesensordescription.field.vehicleCount.aggregationConfiguration = {"alphabet_size": 5, "word_length": 3,
                                                                        "unit_of_window": "hours", "window_duration": 1}

        # basesensordescription.timestamp.inField = "updatetime"
        basesensordescription.timestamp.format = "%Y-%m-%d %H:%M:%S"

        metadata = csv.DictReader(metadatafile)

        for row in metadata:
            sensordescription = basesensordescription.deepcopy()
            sensordescription.sensorName = "aarhus_road_parking_" + nicename(row['garagecode'])
            sensordescription.sensorID = nicename(row['garagecode'])
            sensordescription.fullSensorID = basesensordescription.namespace + "sensor/" + sensordescription.sensorID
            sensordescription.location = "POINT(%s %s)" % (row['longitude'], row['latitude'])
            sensordescription.messagebus.routingKey = "Aarhus.Road.Parking." + sensordescription.sensorID
            sensordescription.streetName = self.__getattr(row, "street", "n/a")
            sensordescription.postalCode = self.__getattr(row, "postalcode", "n/a")

            # garage code only as sensorID embedded in an URI. Possibilities to read it unknown at this point.
            # sensordescription.staticproperties.garageCode.propertyName = "Property"
            # sensordescription.staticproperties.garageCode.propertyPrefix = "ssn"
            # sensordescription.staticproperties.garageCode.propertyURI = basesensordescription.namespace + "city#Garagecode"
            # sensordescription.staticproperties.garageCode.dataType = "str"
            # sensordescription.staticproperties.garageCode.value = sensordescription.sensorID

            self.addWrapper(InternalWrapper(sensordescription))

        self.connection = HttpPullConnection(self, basesensordescription.source)
        self.splitter = AarhusParkingSplitterJson(self)