staplus-client 0.3.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- staplus_client/__init__.py +47 -0
- staplus_client/__version__.py +8 -0
- staplus_client/dao/__init__.py +18 -0
- staplus_client/dao/actuator.py +30 -0
- staplus_client/dao/base.py +70 -0
- staplus_client/dao/campaign.py +25 -0
- staplus_client/dao/datastream.py +35 -0
- staplus_client/dao/features_of_interest.py +36 -0
- staplus_client/dao/historical_location.py +35 -0
- staplus_client/dao/license.py +25 -0
- staplus_client/dao/location.py +35 -0
- staplus_client/dao/multi_datastream.py +36 -0
- staplus_client/dao/observation.py +55 -0
- staplus_client/dao/observation_group.py +25 -0
- staplus_client/dao/observedproperty.py +35 -0
- staplus_client/dao/party.py +25 -0
- staplus_client/dao/relation.py +57 -0
- staplus_client/dao/sensor.py +35 -0
- staplus_client/dao/task.py +30 -0
- staplus_client/dao/tasking_capability.py +30 -0
- staplus_client/dao/thing.py +36 -0
- staplus_client/model/__init__.py +29 -0
- staplus_client/model/campaign.py +417 -0
- staplus_client/model/datastream.py +166 -0
- staplus_client/model/entity.py +29 -0
- staplus_client/model/ext/__init__.py +0 -0
- staplus_client/model/ext/entity_list.py +75 -0
- staplus_client/model/ext/entity_type.py +142 -0
- staplus_client/model/ext/unitofmeasurement.py +5 -0
- staplus_client/model/feature_of_interest.py +17 -0
- staplus_client/model/historical_location.py +21 -0
- staplus_client/model/license.py +301 -0
- staplus_client/model/location.py +22 -0
- staplus_client/model/multi_datastream.py +160 -0
- staplus_client/model/observation.py +218 -0
- staplus_client/model/observation_group.py +399 -0
- staplus_client/model/observedproperty.py +20 -0
- staplus_client/model/party.py +315 -0
- staplus_client/model/relation.py +246 -0
- staplus_client/model/sensor.py +16 -0
- staplus_client/model/thing.py +110 -0
- staplus_client/query/__init__.py +0 -0
- staplus_client/query/query.py +109 -0
- staplus_client/service/BearerAuth.py +23 -0
- staplus_client/service/__init__.py +17 -0
- staplus_client/service/auth_handler.py +23 -0
- staplus_client/service/staplusservice.py +162 -0
- staplus_client/utils.py +64 -0
- staplus_client-0.3.3.dist-info/LICENSE +165 -0
- staplus_client-0.3.3.dist-info/METADATA +470 -0
- staplus_client-0.3.3.dist-info/RECORD +53 -0
- staplus_client-0.3.3.dist-info/WHEEL +5 -0
- staplus_client-0.3.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client import model
|
|
17
|
+
from staplus_client import dao
|
|
18
|
+
from staplus_client import service
|
|
19
|
+
from staplus_client import query
|
|
20
|
+
|
|
21
|
+
from staplus_client.model.party import Party
|
|
22
|
+
from staplus_client.model.license import License
|
|
23
|
+
from staplus_client.model.thing import Thing
|
|
24
|
+
from staplus_client.model.datastream import Datastream
|
|
25
|
+
from staplus_client.model.multi_datastream import MultiDatastream
|
|
26
|
+
from staplus_client.model.campaign import Campaign
|
|
27
|
+
from staplus_client.model.relation import Relation
|
|
28
|
+
from staplus_client.model.observation_group import ObservationGroup
|
|
29
|
+
from staplus_client.model.observation import Observation
|
|
30
|
+
from staplus_client.model.feature_of_interest import FeatureOfInterest
|
|
31
|
+
from staplus_client.model.location import Location
|
|
32
|
+
from staplus_client.model.sensor import Sensor
|
|
33
|
+
from staplus_client.model.observedproperty import ObservedProperty
|
|
34
|
+
from staplus_client.model.historical_location import HistoricalLocation
|
|
35
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
36
|
+
from staplus_client.model.ext.unitofmeasurement import UnitOfMeasurement
|
|
37
|
+
from staplus_client.service.staplusservice import STAplusService
|
|
38
|
+
|
|
39
|
+
import jsonpickle
|
|
40
|
+
import demjson3
|
|
41
|
+
|
|
42
|
+
jsonpickle.load_backend('demjson3', 'encode', 'decode', 'JSONDecodeError')
|
|
43
|
+
jsonpickle.set_preferred_backend('demjson3')
|
|
44
|
+
jsonpickle.set_decoder_options("demjson3", decode_float=float)
|
|
45
|
+
|
|
46
|
+
from .__version__ import (__title__, __version__, __license__, __author__, __contact__, __url__,
|
|
47
|
+
__description__, __copyright__)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
__title__ = 'staplus-client'
|
|
2
|
+
__version__ = '0.3.3'
|
|
3
|
+
__license__ = 'LGPL3'
|
|
4
|
+
__author__ = 'Andreas Matheus'
|
|
5
|
+
__copyright__ = 'Secure Dimensions'
|
|
6
|
+
__contact__ = 'andreas.matheus@secure-dimensions.de'
|
|
7
|
+
__url__ = 'https://github.com/securedimensions/STAplus-Python-Client'
|
|
8
|
+
__description__ = 'A client library to facilitate interaction with a STAplus Server'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
__all__ = ['actuator', 'datastream', 'features_of_interest', 'historical_location', 'location', 'multi_datastream',
|
|
17
|
+
'observation', 'observedproperty', 'sensor', 'task', 'tasking_capability', 'thing', 'historical_location',
|
|
18
|
+
'features_of_interest', 'observation_group', 'license', 'party', 'campaign', 'relation']
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.actuator import ActuatorDao as STAActuatorDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
|
|
19
|
+
class ActuatorDao(STAActuatorDao):
|
|
20
|
+
def __init__(self, service):
|
|
21
|
+
"""
|
|
22
|
+
A data access object for operations with the Actuator entity
|
|
23
|
+
"""
|
|
24
|
+
super().__init__(service)
|
|
25
|
+
|
|
26
|
+
def query(self):
|
|
27
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
28
|
+
|
|
29
|
+
def create(self, entity):
|
|
30
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
import staplus_client.query.query
|
|
17
|
+
import staplus_client.utils
|
|
18
|
+
|
|
19
|
+
import logging
|
|
20
|
+
import requests
|
|
21
|
+
from furl import furl
|
|
22
|
+
|
|
23
|
+
from frost_sta_client.utils import extract_value
|
|
24
|
+
from frost_sta_client.dao.base import BaseDao as STABaseDao
|
|
25
|
+
import staplus_client.utils
|
|
26
|
+
|
|
27
|
+
class BaseDao(STABaseDao):
|
|
28
|
+
"""
|
|
29
|
+
The STAplus extension
|
|
30
|
+
"""
|
|
31
|
+
APPLICATION_JSON_PATCH = {'Content-type': 'application/json-patch+json'}
|
|
32
|
+
|
|
33
|
+
def __init__(self, service, entitytype):
|
|
34
|
+
super().__init__(service, entitytype)
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def service(self):
|
|
38
|
+
return self._service
|
|
39
|
+
|
|
40
|
+
@service.setter
|
|
41
|
+
def service(self, value):
|
|
42
|
+
if value is None or isinstance(value, staplus_client.service.staplusservice.STAplusService):
|
|
43
|
+
self._service = value
|
|
44
|
+
return
|
|
45
|
+
raise ValueError('service should be of type STAplusService')
|
|
46
|
+
|
|
47
|
+
def create(self, entity):
|
|
48
|
+
url = furl(self.service.url)
|
|
49
|
+
url.path.add(self.entitytype_plural)
|
|
50
|
+
logging.debug('Posting to ' + str(url.url))
|
|
51
|
+
json_dict = staplus_client.utils.transform_entity_to_json_dict(entity)
|
|
52
|
+
try:
|
|
53
|
+
response = self.service.execute('post', url, json=json_dict)
|
|
54
|
+
except requests.exceptions.HTTPError as e:
|
|
55
|
+
error_json = e.response.json()
|
|
56
|
+
error_message = error_json['message']
|
|
57
|
+
logging.error("Creating {} failed with status-code {}, {}".format(type(entity).__name__,
|
|
58
|
+
e.response.status_code,
|
|
59
|
+
error_message))
|
|
60
|
+
raise e
|
|
61
|
+
entity.id = extract_value(response.headers['location'])
|
|
62
|
+
entity.service = self.service
|
|
63
|
+
id = "('" + entity.id + "')" if type(entity.id) == str else'(' + str(entity.id) + ')'
|
|
64
|
+
entity.self_link = url.url + id
|
|
65
|
+
logging.debug('Received response: ' + str(response.status_code))
|
|
66
|
+
return entity.id
|
|
67
|
+
|
|
68
|
+
def query(self):
|
|
69
|
+
return staplus_client.query.query.Query(self.service, self.entitytype, self.entitytype_plural,
|
|
70
|
+
self.entity_class, self.parent)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client.dao import base
|
|
17
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CampaignDao(base.BaseDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the Campaign entity
|
|
24
|
+
"""
|
|
25
|
+
base.BaseDao.__init__(self, service, EntityTypes["Campaign"])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.datastream import DatastreamDao as STADatastreamDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
class DatastreamDao(STADatastreamDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the Datastream entity
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(service)
|
|
26
|
+
entitytype = EntityTypes["Datastream"]
|
|
27
|
+
self.entitytype = entitytype["singular"]
|
|
28
|
+
self.entitytype_plural = entitytype["plural"]
|
|
29
|
+
self.entity_class = entitytype["class"]
|
|
30
|
+
|
|
31
|
+
def query(self):
|
|
32
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
33
|
+
|
|
34
|
+
def create(self, entity):
|
|
35
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.features_of_interest import FeaturesOfInterestDao as STAFeaturesOfInterestDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class FeaturesOfInterestDao(STAFeaturesOfInterestDao):
|
|
22
|
+
def __init__(self, service):
|
|
23
|
+
"""
|
|
24
|
+
A data access object for operations with the FeatureOfInterest entity
|
|
25
|
+
"""
|
|
26
|
+
super().__init__(service)
|
|
27
|
+
entitytype = EntityTypes["FeatureOfInterest"]
|
|
28
|
+
self.entitytype = entitytype["singular"]
|
|
29
|
+
self.entitytype_plural = entitytype["plural"]
|
|
30
|
+
self.entity_class = entitytype["class"]
|
|
31
|
+
|
|
32
|
+
def query(self):
|
|
33
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
34
|
+
|
|
35
|
+
def create(self, entity):
|
|
36
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.historical_location import HistoricalLocationDao as STAHistoricalLocationDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
class HistoricalLocationDao(STAHistoricalLocationDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the HistoricalLocation entity
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(service)
|
|
26
|
+
entitytype = EntityTypes["HistoricalLocation"]
|
|
27
|
+
self.entitytype = entitytype["singular"]
|
|
28
|
+
self.entitytype_plural = entitytype["plural"]
|
|
29
|
+
self.entity_class = entitytype["class"]
|
|
30
|
+
|
|
31
|
+
def query(self):
|
|
32
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
33
|
+
|
|
34
|
+
def create(self, entity):
|
|
35
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client.dao import base
|
|
17
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class LicenseDao(base.BaseDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the License entity
|
|
24
|
+
"""
|
|
25
|
+
base.BaseDao.__init__(self, service, EntityTypes["License"])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.location import LocationDao as STALocationDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
class LocationDao(STALocationDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the Location entity
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(service)
|
|
26
|
+
entitytype = EntityTypes["Location"]
|
|
27
|
+
self.entitytype = entitytype["singular"]
|
|
28
|
+
self.entitytype_plural = entitytype["plural"]
|
|
29
|
+
self.entity_class = entitytype["class"]
|
|
30
|
+
|
|
31
|
+
def query(self):
|
|
32
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
33
|
+
|
|
34
|
+
def create(self, entity):
|
|
35
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from frost_sta_client.dao.multi_datastream import MultiDatastreamDao as STAMultiDatastreamDao
|
|
17
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
18
|
+
from staplus_client.query.query import Query
|
|
19
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
20
|
+
|
|
21
|
+
class MultiDatastreamDao(STAMultiDatastreamDao):
|
|
22
|
+
def __init__(self, service):
|
|
23
|
+
"""
|
|
24
|
+
A data access object for operations with the MultiDatastream entity
|
|
25
|
+
"""
|
|
26
|
+
super().__init__(service)
|
|
27
|
+
entitytype = EntityTypes["MultiDatastream"]
|
|
28
|
+
self.entitytype = entitytype["singular"]
|
|
29
|
+
self.entitytype_plural = entitytype["plural"]
|
|
30
|
+
self.entity_class = entitytype["class"]
|
|
31
|
+
|
|
32
|
+
def query(self):
|
|
33
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
34
|
+
|
|
35
|
+
def create(self, entity):
|
|
36
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from frost_sta_client.dao.observation import ObservationDao as STAObservationDao
|
|
2
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
3
|
+
from staplus_client.query.query import Query
|
|
4
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
5
|
+
|
|
6
|
+
class ObservationDao(STAObservationDao):
|
|
7
|
+
def __init__(self, service):
|
|
8
|
+
"""
|
|
9
|
+
A data access object for operations with the Observation entity
|
|
10
|
+
"""
|
|
11
|
+
super().__init__(service)
|
|
12
|
+
entitytype = EntityTypes["Observation"]
|
|
13
|
+
self.entitytype = entitytype["singular"]
|
|
14
|
+
self.entitytype_plural = entitytype["plural"]
|
|
15
|
+
self.entity_class = entitytype["class"]
|
|
16
|
+
|
|
17
|
+
def query(self):
|
|
18
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
19
|
+
|
|
20
|
+
def create(self, entity):
|
|
21
|
+
return STAplusBaseDao.create(self, entity)
|
|
22
|
+
|
|
23
|
+
class ObjectDao(ObservationDao):
|
|
24
|
+
def __init__(self, service):
|
|
25
|
+
"""
|
|
26
|
+
A data access object for operations with the Object entity
|
|
27
|
+
"""
|
|
28
|
+
super().__init__(service)
|
|
29
|
+
entitytype = {
|
|
30
|
+
'singular': 'Object',
|
|
31
|
+
'plural': 'Relations',
|
|
32
|
+
'class': 'staplus_client.model.observation.Observation',
|
|
33
|
+
'relations_list': ['Subjects']
|
|
34
|
+
}
|
|
35
|
+
self.entitytype = entitytype["singular"]
|
|
36
|
+
self.entitytype_plural = entitytype["plural"]
|
|
37
|
+
self.entity_class = entitytype["class"]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class SubjectDao(ObservationDao):
|
|
41
|
+
def __init__(self, service):
|
|
42
|
+
"""
|
|
43
|
+
A data access object for operations with the Subject entity
|
|
44
|
+
"""
|
|
45
|
+
super().__init__(service)
|
|
46
|
+
entitytype = {
|
|
47
|
+
'singular': 'Subject',
|
|
48
|
+
'plural': 'Relations',
|
|
49
|
+
'class': 'staplus_client.model.observation.Observation',
|
|
50
|
+
'relations_list': ['Objects']
|
|
51
|
+
}
|
|
52
|
+
self.entitytype = entitytype["singular"]
|
|
53
|
+
self.entitytype_plural = entitytype["plural"]
|
|
54
|
+
self.entity_class = entitytype["class"]
|
|
55
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client.dao import base
|
|
17
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ObservationGroupDao(base.BaseDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the ObservationGroup entity
|
|
24
|
+
"""
|
|
25
|
+
base.BaseDao.__init__(self, service, EntityTypes["ObservationGroup"])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.observedproperty import ObservedPropertyDao as STAObservedPropertyDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
class ObservedPropertyDao(STAObservedPropertyDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the ObservedProperty entity
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(service)
|
|
26
|
+
entitytype = EntityTypes["ObservedProperty"]
|
|
27
|
+
self.entitytype = entitytype["singular"]
|
|
28
|
+
self.entitytype_plural = entitytype["plural"]
|
|
29
|
+
self.entity_class = entitytype["class"]
|
|
30
|
+
|
|
31
|
+
def query(self):
|
|
32
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
33
|
+
|
|
34
|
+
def create(self, entity):
|
|
35
|
+
return STAplusBaseDao.create(self, entity)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client.dao import base
|
|
17
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PartyDao(base.BaseDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the Party entity
|
|
24
|
+
"""
|
|
25
|
+
base.BaseDao.__init__(self, service, EntityTypes["Party"])
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
|
|
16
|
+
from staplus_client.dao import base
|
|
17
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
18
|
+
from staplus_client.query.query import Query
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class RelationDao(base.BaseDao):
|
|
22
|
+
def __init__(self, service):
|
|
23
|
+
"""
|
|
24
|
+
A data access object for operations with the Relation entity
|
|
25
|
+
"""
|
|
26
|
+
base.BaseDao.__init__(self, service, EntityTypes["Relation"])
|
|
27
|
+
|
|
28
|
+
class SubjectsDao(base.BaseDao):
|
|
29
|
+
def __init__(self, service):
|
|
30
|
+
"""
|
|
31
|
+
A data access object for operations with the Subjects entity
|
|
32
|
+
"""
|
|
33
|
+
base.BaseDao.__init__(self, service, {
|
|
34
|
+
'singular': '-',
|
|
35
|
+
'plural': 'Subjects',
|
|
36
|
+
'class': 'staplus_client.model.relation.Relation',
|
|
37
|
+
'relations_list': ['Object']
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
def query(self):
|
|
41
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ObjectsDao(base.BaseDao):
|
|
45
|
+
def __init__(self, service):
|
|
46
|
+
"""
|
|
47
|
+
A data access object for operations with the Objects entity
|
|
48
|
+
"""
|
|
49
|
+
base.BaseDao.__init__(self, service, {
|
|
50
|
+
'singular': '-',
|
|
51
|
+
'plural': 'Objects',
|
|
52
|
+
'class': 'staplus_client.model.relation.Relation',
|
|
53
|
+
'relations_list': ['Subject']
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
def query(self):
|
|
57
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Copyright (C) 2023-2024 Secure Dimensions GmbH, Munich, Germany.
|
|
2
|
+
#
|
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
# (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
# GNU Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
+
from frost_sta_client.dao.sensor import SensorDao as STASensorDao
|
|
16
|
+
from staplus_client.dao.base import BaseDao as STAplusBaseDao
|
|
17
|
+
from staplus_client.query.query import Query
|
|
18
|
+
from staplus_client.model.ext.entity_type import EntityTypes
|
|
19
|
+
|
|
20
|
+
class SensorDao(STASensorDao):
|
|
21
|
+
def __init__(self, service):
|
|
22
|
+
"""
|
|
23
|
+
A data access object for operations with the Sensor entity
|
|
24
|
+
"""
|
|
25
|
+
super().__init__(service)
|
|
26
|
+
entitytype = EntityTypes["Sensor"]
|
|
27
|
+
self.entitytype = entitytype["singular"]
|
|
28
|
+
self.entitytype_plural = entitytype["plural"]
|
|
29
|
+
self.entity_class = entitytype["class"]
|
|
30
|
+
|
|
31
|
+
def query(self):
|
|
32
|
+
return Query(self.service, self.entitytype, self.entitytype_plural, self.entity_class, self.parent)
|
|
33
|
+
|
|
34
|
+
def create(self, entity):
|
|
35
|
+
return STAplusBaseDao.create(self, entity)
|