Return the list of observed properties
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param offering: filter procedures by this offering name @type offering: C{string} or C{None} @return: C{list} of C{dict} with observed property C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"name":"urn:ogc:def:parameter:x-istsos:1.0:lake:water:height"},
{ "id":2,"name":"urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall"}
]
>>> Return example:
{"type":"Point","coordinates":[8.961270000000001,46.027230000000003,344.100000000000023]}
Return the list of observed properties
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param offering: filter procedures by this offering name @type offering: C{string} or C{None} @return: C{list} of C{dict} with observed property C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"name":"urn:ogc:def:parameter:x-istsos:1.0:lake:water:height"},
{ "id":2,"name":"urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall"}
]
Return the list of procedures with observation periods
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param procedures: procedures @type procedure: C{list} of C{string} @return: C{list} of C{dict} with procedure, stime (start time) and etime (end time) keys
>>> Return example:
[
{ "procedure":"P_TRE","stime":"2000-12-31T23:00:00Z", "etime":"2012-12-31T23:00:00Z"},
{ "procedure":"P_ BOD","stime":"1986-12-31T23:00:00Z", "etime":"2012-12-31T23:00:00Z"}
]
Return the list of observed properties related to the given procedure
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param procedureID: filter procedure id @type procedure: C{string} or C{None} @return: C{list} of C{dict} with observed property C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"def":"urn:ogc:def:parameter:x-istsos:1.0:lake:water:height", "name":"lake-water-height"},
{ "id":2,"def":"urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall", "name":"lake-air-rainfall"}
]
Return the list of offerings details for a given istsos service connection
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @return: C{list} of C{dict} with offering C{id} and C{name} keys
>>> Return example:
[
{"name": "temperature","description": "descrizione 3","procedures": 12,"expiration": "22.12.2012","active": true},
{"name": "water","description": "descrizione 3","procedures": 22,"expiration": "22.12.2012","active": true},
{"name": "air","description": "descrizione 3","procedures": 3,"expiration": "22.12.2012","active": true}
]
Return the list of offerings for a give istsos service connection
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @return: C{list} of C{dict} with offering C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"name":"temporary"},
{ "id":2,"name":"water"},
{ "id":3,"name":"air"}
]
Return the list of offerings related to the given procedure
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param procedureID: filter procedure id @type procedure: C{string} or C{None} @return: C{list} of C{dict} with observed property C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"name":"urn:ogc:def:parameter:x-istsos:1.0:lake:water:height"},
{ "id":2,"name":"urn:ogc:def:parameter:x-istsos:1.0:meteo:air:rainfall"}
]
Return the list of procedures:
The list can be filtered by offering and/or observationType
@param pgdb: service connection @type pgdb: L{wa.databaseManager.PgDB} object @param service: service name @type service: L{string} @param offering: filter procedures by this offering name @type offering: C{string} or C{None} @type observationType: C{string} or C{None} @return: C{list} of C{dict} with procedure C{id} and C{name} keys
>>> Return example:
[
{ "id":1,"name":"Chiasso", "description": "", "assignedid": "1234"},
{ "id":2,"name":"Bellinzona", "description": "", "assignedid": "1235"},
{ "id":3,"name":"Lugano", "description": "", "assignedid": "1236"}
]
Return the list of istsos services
@param servicepath: path to service folder @param listonly: define if only service list is requested (optional - default L{False}) @param type: L{boolean} @return: return a list of services
>>> Return example with listonly==True :
[name1,name2,...]
>>> Return example with listonly==False:
[
{"service":name1,"path":path1},
{"service":name1,"path":path1},
...
]
Parse given sql with regex for possible malicious sql ignection
@param sql: text to parse @param type: L{string} @return: L{True} if no malicious sql ingnection was detected
Validate a service db connection parameters
@param user: user name used to authenticate @param password: password used to authenticate @param dbname: the database name (only in dsn string) @param host: database host address @param port: onnection port number (optional - defaults to 5432) @param service: service name that correspond with associated database schema (optional) @return: L{True} if connection could be estabished and the schema found (only if schema is provided)
Connect to a database
Close a database connection
Return a database connection
Bases: walib.databaseManager.Database
Connect to a PostgreSQL database
Commit current transaction
Execute an sql statement
Execute an sql statement in an open session
Insert many values at once
Mogrify an sql statement (print >> sys.stderr, the actual sql query that will be executed)
Rollback current transaction
Execute a select statement
base service configuration object to handle configuration files
>>> Class structure:
self.defaultcfgpath --> path of the default configuration file
self.servicecfgpath --> path of the service configuration file
self.sections = --> list of available sections
self.* = {} --> dictionary of the options for the * section
@note: Each section is an attribute of the waServiceConfig object and is a dictionary of option names (key) and value. Additionally each section dictionary has a special key “default” that is a boolean variable indicating if the section is set in the default or specific service configuration file.
>>> Example of section attribute
myconfig = waServiceConfig("/services","/services/myservice")
print myconfig.serviceurl
{'default': True, 'post': 'http://localhost:8099', 'get': 'http://localhost:8099'}
returns the requested section as a dictionary
@param section: configuration section @type section: C{string}
returns the requested section as a dictionary
@param section: configuration section @type section: C{string}
put new value to given option in given section
@param section: configuration section @type section: C{string} @param option: configuration option @type option: C{string} @param value: configuration value @type section: C{value}
save current configuration to appropriate files
Bases: object
Base class for istSOS Web Admin REST operations
base method to execute DELETE request
base method to execute GET request
base method to execute POST request
base method to execute PUT request
Set data in response
Set exception message in response
set message in log
Set message in response
base method to validate DELETE request
base method to validate GET request
base method to validate POST request
base method to validate PUT request
Bases: walib.resource.waResource
Extension class of istSOS Web Admin REST operations that manages Wab Admin Configuration
Bases: walib.resource.waResourceService
Execute operation DELETE for on service configuration sections
@note: it does not work on default service
Execute operation GET for on service configuration sections
Execute operation PUT for on service configuration sections and return new values
Create the the self.data object representing the istSOS SensorML from a json elemet
@param json: a json describeSensor object
Create the the self.data object representing the istSOS SensorML from a json elemet
@param json: a json describeSensor object
Create the the self.data object representing the istSOS SensorML from an XML elemet
@param json: a json describeSensor object (xml string or xml file full path)
Return the Json that represent the self.data object as L{string}
Create a SOS register sensor request String from self.procedure object
Create a SOS register sensor request DOM element from self.procedure object
Return the SensorML that represent the self.data object as L{string}
Bases: walib.resource.waResourceAdmin
Bases: walib.resource.waResourceService
Class to execute istsos/services/{serviceName}/procedures/operations/geojson/{epsg}
Set data in response
Bases: walib.resource.waResourceService
Class to execute istsos/services/{serviceName}/procedures/operations/getlist
Bases: walib.resource.waResourceService
class to handle SOS service objects, support GET and POST method
Method for executing a DELETE requests that erase a SOS procedure
- @note: This method delete:
- the given procedure
Method for executing a GET requests that rename a SOS service
“message”: “Sensor Description secessfully loaded”, “total”: 1, “data”: {
“inputs”: [], “description”: “”, “classification”: [
- {
- “definition”: “urn:ogc:def:classifier:x-istsos:1.0:systemType”, “name”: “System Type”, “value”: “insitu-fixed-point”
}, {
“definition”: “urn:ogc:def:classifier:x-istsos:1.0:sensorType”, “name”: “Sensor Type”, “value”: “temperature”}
], “characteristics”: “”, “interfaces”: “”, “keywords”: “”, “contacts”: [], “assignedSensorId”: “ec08e1f51ab879f4e1796f3c187daff6”, “documentation”: [], “system”: “DEMO_1”, “capabilities”: [], “identification”: [], “location”: {
- “geometry”: {
“type”: “Point”, “coordinates”: [
“8.88”, “45.45”]
}, “crs”: {
“type”: “name”, “properties”: {
“name”: “4326”}
}, “type”: “Feature”, “properties”: {
“name”: “lugano”}
}, “outputs”: [
- {
“definition”: “urn:ogc:def:parameter:x-istsos::time:iso8601”, “constraint”: {
“max”: “”, “interval”: [
“2007-11-03T14:00:00+01:00”, “2011-12-07T18:00:00+01:00”], “role”: “”, “valuelist”: “”, “min”: “”
}, “name”: “Time”, “uom”: “”, “description”: “”
}, {
“definition”: “urn:ogc:def:parameter:x-istsos::meteo:air:temperature”, “constraint”: {
“max”: “”, “interval”: “”, “role”: “”, “valuelist”: “”, “min”: “”}, “name”: “meteo-air-temperature”, “uom”: “deg”, “description”: “”
}
], “system_id”: “DEMO_1”, “history”: []
}, “success”: true
}
Method for executing a POST requests that create a new SOS procedure
The POST must be in Json format:
>>> {
"system_id": "P_TRE",
"system": "P_TRE",
"description": "ciao",
"keywords": "uno,due,tre",
"identification": [
{
"definition":"urn:ogc:def:identifier:OGC:P_TRE",
"name":"uniqueID",
"value":"urn:ogc:def:procedure:x-istsos:1.0:test"
}
],
"classification": [
{
"name": "System Type",
"definition": "urn:ogc:def:classifier:x-istsos:1.0:systemType",
"value": "insitu-fixed-point"
},
{
"name": "Sensor Type",
"definition": "urn:ogc:def:classifier:x-istsos:1.0:sensorType",
"value": "bukket"
}
],
"characteristics": "",
"contacts": [],
"documentation": [],
"location": {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": ["123","456"]
},
"crs": {
"type": "name",
"properties": {"name": "EPSG:21781"}
},
"properties": {"name": "LUGANO"}
},
"interfaces": "",
"inputs": [],
"history": [],
"capabilities": [
{
"name": "Memory Capacity",
"description": "",
"definition": "urn:ogc:def:classifier:x-istsos:1.0:memoryCapacity",
"uom": "Byte",
"value": "131"
},
{
"name": "Sampling time resolution",
"definition": "urn:ogc:def:classifier:x-istsos:1.0:samplingTimeResolution",
"uom": "iso8601",
"value": "PT10M"
},
{
"name": "Acquisition time resolution",
"definition": "urn:ogc:def:classifier:x-istsos:1.0:acquisitionTimeResolution",
"uom": "iso8601",
"value": "PT1H"
}
],
"outputs": [
{
"name": "Time",
"definition": "urn:ogc:def:dataType:x-istsos:1.0:time",
"uom": "iso8601",
"description": "",
"constraint": {
"role": "urn:ogc:def:classifiers:x-istsos:1.0:dataAvailability",
"min": "",
"max": "",
"interval": [123,456],
"valuelist": ""
}
},
{
"name": "Conductivity",
"definition": "urn:ogc:def:phenomenon:x-istsos:1.0:conductivity",
"uom": "Pressure",
"description": "foo bar",
"constraint": {
"role": "urn:ogc:def:classifiers:x-istsos:1.0:qualityIndex:check:reasonable",
"interval": ["12","65"]
}
}
]
}
Method for executing a PUT requests that update a SOS sensorML procedure
- @note: This method replace old sensorML with the new one, note that
database objectes are not updated. To update entirely a procedure consider to delete and recreate it.
- ...
The Put must be in Json format:
>>> { ... }
Bases: walib.resource.waResourceService
class to handle SOS unit of data quality objects, support GET and POST method
Method for executing a DELETE requests that remove an existing SOS data quality
Note
The DELETE must include code in the URL
>>> http://localhost/istsos/wa/istsos/services/demo/dataqualities/1000
Method for executing a GET requests that remove an existing SOS data quality
Note
The GET must include code in the URL
>>> http://localhost/istsos/wa/istsos/services/demo/dataqualities/1000
Method for executing a POST requests that create a new SOS data quality
Note
The POST must be in Json format with mandatory code, name and description keys
>>> http://localhost/istsos/wa/istsos/services/demo/dataqualities>>> { "code": 100, "name": "raw", "description": "the format is correct" }
Method for executing a PUT requests that updates an existing SOS data quality
Note
The PUT must be in Json format with mandatory name and description keys
>>> http://localhost/istsos/wa/istsos/services/demo/dataqualities/1000>>> { "name": "raw", "description": "the format is correct" }
Bases: walib.resource.waResourceService
class to handle SOS unit of measure objects, support GET and POST method
Method for executing a DELETE requests that remove an existing SOS observed property
Method for executing a POST requests that create a new SOS observed property
Method for executing a POST requests that create a new SOS observed property
Bases: walib.resource.waResourceConfigurator
[identification] keywords = SOS,IST,SUPSI abstract = hydro-meteorological monitoring network authority = x-ist urnversion = 1.0 fees = NONE accessConstrains = NONE title = IST Sensor Observation Service
Bases: walib.resource.waResourceConfigurator
Bases: walib.resource.waResourceConfigurator
Execute operation GET for on service configuration sections
Bases: walib.resource.waResourceConfigurator
Bases: walib.resource.waResourceService
Implementation of the operation/validatedb GET operation
Test the connection parameters in the server/service configuration
Bases: walib.resource.waResourceService
Implementation of the configsection GET operation (if non configsection setted all the sections are returned)
Bases: walib.resource.waResourceConfigurator
Bases: walib.resource.waResourceConfigurator
[provider] contactCountry = Switzerland providerName = Istituto Scienze della Terra contactCity = Lugano contactAdminArea = Canton Ticino contactVoice = +4179123456 contactEmail = clark.kent@superman.com contactDeliveryPoint = Via Cippili contactName = Pinco Pallino contactPostalCode = 6900 contactPosition = Data manager providerSite = http://istgeo.ist.supsi.ch contactFax = +4179123459
Bases: walib.resource.waResourceConfigurator
Bases: walib.resource.waResourceService
class to handle SOS service objects, support GET and POST method
Method for executing a GET requests that return a list of valid EPSG codes
Bases: walib.istsos.services.offerings.procedures.procedures.waProcedures
class to handle SOS offerings objects, support only GET method
Bases: walib.istsos.services.offerings.procedures.procedures.waProcedures
class to handle SOS offerings objects, support only GET method
Bases: walib.resource.waResourceService
class to handle SOS procedures objects in related to an offering, support GET and POST method
Method for executing a DELETE requests remove an offering procedure member
Method for executing a POST requests that initialize a new SOS service
@note: This method creates a new istSOS offering
The POST must be in Json format with mandatory offering key:
>>> [
{
"offerings": "meteo",
"procedure": "RAIN_SENSOR_2"
},{
"offerings": "meteo",
"procedure": "RAIN_SENSOR_1"
}
]
Bases: walib.resource.waResourceService
class to handle SOS offerings objects, support only GET method
Bases: walib.resource.waResourceService
class to handle SOS offerings objects, support GET, POST, PUT and DELETE method
Method for executing a DELETE requests that erase a SOS offering
@note: This method delete the offering (temporary offering cannot be deleted!)
The POST must be in Json format with mandatory service key
>>> { "service" : "service_name" }
Method for executing a GET requests that return a list of offerings details
The data is returned in this format:
>>> { "total": 1, "success": true, "message": "Offerings details data loaded correctly", "data": [ { "name": "temporary", "description": "descrizione 1", "procedures": 31, "expiration": "31.01.2012", "active": true },{...} ] }
Method for executing a POST requests that initialize a new SOS service
@note: This method creates a new istSOS offering
The POST must be in Json format with mandatory offering key:
>>> {
"offering" : "meteorology",
"description" : "meteo information"
"expiration" : "2012-12-30T12:00"
"active" : "sos_db"
}
Method for executing a PUT requests that rename a SOS service
- @note: This method renames:
- create a new service folder,
- copy content from old to new service configuration file
- rename the databse schema
- delete old service files
The POST must be in Json format with mandatory service key
>>> { "service" : "service_name" }
Bases: walib.resource.waResourceService
class to handle SOS service objects, support GET and POST method
Method for executing a DELETE requests that remove an existing SOS observed property
Method for executing a POST requests that create a new SOS observed property
Method for executing a POST requests that create a new SOS observed property