|
2 | 2 | import pathlib |
3 | 3 | import sys |
4 | 4 |
|
5 | | -from basyx.aas import model, adapter |
6 | | -from basyx.aas.adapter import aasx |
| 5 | +from basyx.aas import model |
| 6 | +from basyx.aas.adapter.aasx import AASXReader, DictSupplementaryFileContainer |
| 7 | +from basyx.aas.adapter.json import read_aas_json_file_into |
| 8 | +from basyx.aas.adapter.xml import read_aas_xml_file_into |
7 | 9 |
|
8 | 10 | from basyx.aas.backend.local_file import LocalFileObjectStore |
9 | 11 | from interfaces.repository import WSGIApp |
|
18 | 20 | wsgi_optparams["base_path"] = base_path |
19 | 21 |
|
20 | 22 | if storage_type == "LOCAL_FILE_BACKEND": |
21 | | - application = WSGIApp(LocalFileObjectStore(storage_path), aasx.DictSupplementaryFileContainer(), **wsgi_optparams) |
| 23 | + application = WSGIApp(LocalFileObjectStore(storage_path), DictSupplementaryFileContainer(), **wsgi_optparams) |
22 | 24 |
|
23 | | -elif storage_type in "LOCAL_FILE_READ_ONLY": |
| 25 | +elif storage_type == "LOCAL_FILE_READ_ONLY": |
24 | 26 | object_store: model.DictObjectStore = model.DictObjectStore() |
25 | | - file_store: aasx.DictSupplementaryFileContainer = aasx.DictSupplementaryFileContainer() |
| 27 | + file_store: DictSupplementaryFileContainer = DictSupplementaryFileContainer() |
26 | 28 |
|
27 | 29 | for file in pathlib.Path(storage_path).iterdir(): |
28 | 30 | if not file.is_file(): |
|
31 | 33 |
|
32 | 34 | if file.suffix.lower() == ".json": |
33 | 35 | with open(file) as f: |
34 | | - adapter.json.read_aas_json_file_into(object_store, f) |
| 36 | + read_aas_json_file_into(object_store, f) |
35 | 37 | elif file.suffix.lower() == ".xml": |
36 | 38 | with open(file) as f: |
37 | | - adapter.xml.read_aas_xml_file_into(object_store, file) |
| 39 | + read_aas_xml_file_into(object_store, f) |
38 | 40 | elif file.suffix.lower() == ".aasx": |
39 | | - with aasx.AASXReader(file) as reader: |
| 41 | + with AASXReader(file) as reader: |
40 | 42 | reader.read_into(object_store=object_store, file_store=file_store) |
41 | 43 |
|
42 | 44 | application = WSGIApp(object_store, file_store, **wsgi_optparams) |
|
0 commit comments