Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit fa1f5d8

Browse files
Merge pull request #26 from datacrop/system
System and Location continued
2 parents 428fbe3 + 0ef4266 commit fa1f5d8

File tree

53 files changed

+2574
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2574
-105
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Here follows a short introduction of the current directory's contents:
1414
* **[documentation](documentation)**: documentation of the component's [API](https://en.wikipedia.org/wiki/Application_programming_interface), as well as a [Swagger](https://swagger.io/) export in [JSON](https://en.wikipedia.org/wiki/JSON) format.
1515
* **[model-repository-server](model-repository-server)**: the [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) [Spring Framework](https://spring.io/) project with the actual code of the component.
1616
* **[pictures](pictures)**: pictures folder for the present documentation.
17-
* **[quick-dev-tools](quick-dev-tools)**: quick setup helpers for development-only purposes on local machine.
17+
* **[deployment-scripts](deployment-scripts)**: deployment yaml files for component's deployment.
1818
* **[samples](samples)**: sample data models of the basic logical entities in JSON format,
1919
as well as an exported collection of sample [Postman](https://www.postman.com/) [HTTP](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol) requests for the API.
2020
* **[CHANGELOG.md](CHANGELOG.md)**: document to keep track of the notable versions of the Data Collection component.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: '3.3'
2+
3+
services:
4+
mongo-storage:
5+
image: 'mongo:latest'
6+
container_name: mongo
7+
ports:
8+
- '27020:27017'
9+
expose:
10+
- '27020'
11+
volumes:
12+
- 'model-repository-mongo:/data/model-repository-mongo'
13+
environment:
14+
MONGO_INITDB_ROOT_USERNAME: admin
15+
MONGO_INITDB_ROOT_PASSWORD: admin
16+
MONGO_INITDB_DATABASE: maize-model-repository
17+
networks:
18+
- model-repository-net
19+
restart: on-failure
20+
21+
maize-model-repository:
22+
image: 'datacrop/maize-model-repository:0.2.0'
23+
container_name: model-repository
24+
depends_on:
25+
- mongo-storage
26+
environment:
27+
SPRING_PROFILES_ACTIVE: 'devmongo'
28+
SERVER_ADDRESS: '0.0.0.0'
29+
LOGGING_LEVEL_EU_DATACROP_MAIZE_MODEL_REPOSITORY: DEBUG
30+
# Swagger configuration
31+
SWAGGERUI.CONTACT.NAME: 'DataCROP Development Team'
32+
SWAGGERUI.CONTACT.URL: 'http://datacrop.eu/'
33+
SWAGGERUI.CONTACT.EMAIL: 'datacrop@googlegroups.com'
34+
# MongoDB configuration
35+
SPRING_DATA_MONGODB_HOST: mongo-storage
36+
SPRING_DATA_MONGODB_PORT: 27017
37+
SPRING_DATA_MONGODB_AUTHENTICATION_DATABASE: admin
38+
SPRING_DATA_MONGODB_DATABASE: maize-model-repository
39+
SPRING_DATA_MONGODB_USERNAME: admin
40+
SPRING_DATA_MONGODB_PASSWORD: admin
41+
ports:
42+
- 8087:8087
43+
expose:
44+
- '8087'
45+
networks:
46+
- model-repository-net
47+
restart: on-failure:10
48+
49+
volumes:
50+
model-repository-mongo: null
51+
model-repository-mysql: null
52+
53+
networks:
54+
model-repository-net:
55+
external: false

deployment-scripts/javadoc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mvn javadoc:javadoc -Dshow=private

documentation/.gitkeep

Whitespace-only changes.
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
{
2+
"info": {
3+
"_postman_id": "a340b019-46b4-4528-b08e-76e134c4991e",
4+
"name": "DataCROP",
5+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
6+
"_exporter_id": "3949221"
7+
},
8+
"item": [
9+
{
10+
"name": "System",
11+
"item": [
12+
{
13+
"name": "Persist new System",
14+
"request": {
15+
"method": "POST",
16+
"header": [],
17+
"body": {
18+
"mode": "raw",
19+
"raw": "{\r\n \"name\": \"Phygital Centrifuge 4.0\",\r\n \"description\": \"A cyberphysical system revolving around an automatic disc centrifuge.\",\r\n \"location\": {\r\n \"geoLocation\": {\r\n \"latitude\": 52.15425526446103,\r\n \"longitude\": 9.95084586033136\r\n },\r\n \"virtualLocation\": \"\"\r\n },\r\n \"organization\": \"ACME Explosives\",\r\n \"additionalInformation\": [\r\n {\r\n \"manufacturer\": \"SpinningTop Inc.\",\r\n \"latest_service\": \"2022-09-01T12:00:00.020\"\r\n }\r\n ]\r\n}",
20+
"options": {
21+
"raw": {
22+
"language": "json"
23+
}
24+
}
25+
},
26+
"url": {
27+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/",
28+
"protocol": "{{httpType}}",
29+
"host": [
30+
"{{base_url}}"
31+
],
32+
"path": [
33+
"model_repository",
34+
"v1",
35+
"asset_management",
36+
"system",
37+
""
38+
]
39+
}
40+
},
41+
"response": []
42+
},
43+
{
44+
"name": "Update System by UUID",
45+
"request": {
46+
"method": "PUT",
47+
"header": [],
48+
"body": {
49+
"mode": "raw",
50+
"raw": "{\r\n \"name\": \"Phygital Centrifuge 4.0\",\r\n \"description\": \"A cyberphysical system revolving around an automatic disc centrifuge.\",\r\n \"location\": {\r\n \"geoLocation\": {\r\n \"latitude\": 52.15425526446103,\r\n \"longitude\": 9.95084586033136\r\n },\r\n \"virtualLocation\": \"\"\r\n },\r\n \"organization\": \"ACME Explosives\",\r\n \"additionalInformation\": [\r\n {\r\n \"manufacturer\": \"SpinningTop Inc.\",\r\n \"latest_service\": \"2022-09-01T12:00:00.020\"\r\n }\r\n ]\r\n}",
51+
"options": {
52+
"raw": {
53+
"language": "json"
54+
}
55+
}
56+
},
57+
"url": {
58+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/{{systemID}}/id/",
59+
"protocol": "{{httpType}}",
60+
"host": [
61+
"{{base_url}}"
62+
],
63+
"path": [
64+
"model_repository",
65+
"v1",
66+
"asset_management",
67+
"system",
68+
"{{systemID}}",
69+
"id",
70+
""
71+
]
72+
}
73+
},
74+
"response": []
75+
},
76+
{
77+
"name": "Retrieve System by UUID",
78+
"request": {
79+
"method": "GET",
80+
"header": [],
81+
"url": {
82+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/{{systemID}}/id/",
83+
"protocol": "{{httpType}}",
84+
"host": [
85+
"{{base_url}}"
86+
],
87+
"path": [
88+
"model_repository",
89+
"v1",
90+
"asset_management",
91+
"system",
92+
"{{systemID}}",
93+
"id",
94+
""
95+
]
96+
}
97+
},
98+
"response": []
99+
},
100+
{
101+
"name": "Retrieve System by Name",
102+
"request": {
103+
"method": "GET",
104+
"header": [],
105+
"url": {
106+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/{{name}}/name/",
107+
"protocol": "{{httpType}}",
108+
"host": [
109+
"{{base_url}}"
110+
],
111+
"path": [
112+
"model_repository",
113+
"v1",
114+
"asset_management",
115+
"system",
116+
"{{name}}",
117+
"name",
118+
""
119+
]
120+
}
121+
},
122+
"response": []
123+
},
124+
{
125+
"name": "Retrieve all Systems",
126+
"request": {
127+
"method": "GET",
128+
"header": [],
129+
"url": {
130+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/?page=0&size=8",
131+
"protocol": "{{httpType}}",
132+
"host": [
133+
"{{base_url}}"
134+
],
135+
"path": [
136+
"model_repository",
137+
"v1",
138+
"asset_management",
139+
"system",
140+
""
141+
],
142+
"query": [
143+
{
144+
"key": "page",
145+
"value": "0",
146+
"description": "Default is 0."
147+
},
148+
{
149+
"key": "size",
150+
"value": "8",
151+
"description": "Default is 10."
152+
}
153+
]
154+
}
155+
},
156+
"response": []
157+
},
158+
{
159+
"name": "Delete System by UUID",
160+
"request": {
161+
"method": "DELETE",
162+
"header": [],
163+
"url": {
164+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/{{systemID}}/id/",
165+
"protocol": "{{httpType}}",
166+
"host": [
167+
"{{base_url}}"
168+
],
169+
"path": [
170+
"model_repository",
171+
"v1",
172+
"asset_management",
173+
"system",
174+
"{{systemID}}",
175+
"id",
176+
""
177+
]
178+
}
179+
},
180+
"response": []
181+
},
182+
{
183+
"name": "Delete all Systems",
184+
"request": {
185+
"method": "DELETE",
186+
"header": [],
187+
"url": {
188+
"raw": "{{httpType}}://{{base_url}}/model_repository/v1/asset_management/system/",
189+
"protocol": "{{httpType}}",
190+
"host": [
191+
"{{base_url}}"
192+
],
193+
"path": [
194+
"model_repository",
195+
"v1",
196+
"asset_management",
197+
"system",
198+
""
199+
]
200+
}
201+
},
202+
"response": []
203+
}
204+
]
205+
},
206+
{
207+
"name": "Health Checks",
208+
"item": [
209+
{
210+
"name": "Health Check",
211+
"request": {
212+
"method": "GET",
213+
"header": [],
214+
"url": {
215+
"raw": "{{base_url}}/actuator/health/",
216+
"host": [
217+
"{{base_url}}"
218+
],
219+
"path": [
220+
"actuator",
221+
"health",
222+
""
223+
]
224+
}
225+
},
226+
"response": []
227+
},
228+
{
229+
"name": "Uptime Check",
230+
"request": {
231+
"method": "GET",
232+
"header": [],
233+
"url": {
234+
"raw": "{{base_url}}/actuator/metrics/process.uptime/",
235+
"host": [
236+
"{{base_url}}"
237+
],
238+
"path": [
239+
"actuator",
240+
"metrics",
241+
"process.uptime",
242+
""
243+
]
244+
}
245+
},
246+
"response": []
247+
}
248+
]
249+
}
250+
]
251+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"id": "88c44b3e-2f7e-4121-9227-3912e570cc54",
3+
"name": "DataCROP",
4+
"values": [
5+
{
6+
"key": "base_url",
7+
"value": "localhost:8087",
8+
"type": "default",
9+
"enabled": true
10+
},
11+
{
12+
"key": "systemID",
13+
"value": "1de4d55b-7ae9-4b2c-850c-5d3e6fcf59e9",
14+
"type": "default",
15+
"enabled": true
16+
},
17+
{
18+
"key": "httpType",
19+
"value": "http",
20+
"type": "default",
21+
"enabled": true
22+
},
23+
{
24+
"key": "name",
25+
"value": "MyTestSystem",
26+
"type": "default",
27+
"enabled": true
28+
}
29+
],
30+
"_postman_variable_scope": "environment",
31+
"_postman_exported_at": "2022-11-05T21:20:05.417Z",
32+
"_postman_exported_using": "Postman/10.1.1"
33+
}

documentation/swagger/api-docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.0.1","info":{"title":"Model Repository","description":"DataCROP Model Repository RESTful API","contact":{"name":"DataCROP Development Team","url":"http://datacrop.eu/","email":"datacrop@googlegroups.com"},"license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0"},"version":"1.0.0"},"servers":[{"url":"http://localhost:8087","description":"Generated server url"}],"tags":[{"name":"System","description":"An Internet-Of-Things System that is monitored for various purposes."}],"paths":{"/model_repository/v1/asset_management/system/{systemID}/id/":{"get":{"tags":["System"],"summary":"Retrieve System By UUID","description":"Retrieves an existing System using its UUID as unique identifier.","operationId":"retrieveSystemByID","parameters":[{"name":"systemID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad_Request ~ Erroneous request operation on System to be aborted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"200":{"description":"OK ~ System has been successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemResponseDto"}}}},"404":{"description":"Not_Found ~ No System with the specified identifier has been found available to retrieve.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"put":{"tags":["System"],"summary":"Update System By UUID","description":"Updates an existing System using its UUID as unique identifier.","operationId":"updateSystem","parameters":[{"name":"systemID","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemRequestDto"}}},"required":true},"responses":{"400":{"description":"Bad_Request ~ Erroneous request operation on System to be aborted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"409":{"description":"Conflict ~ System update aborted due to Name conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"200":{"description":"OK ~ System has been successfully updated.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SystemResponseDto"}}}}},"404":{"description":"Not_Found ~ No System with the specified identifier has been found available to update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"delete":{"tags":["System"],"summary":"Delete System By UUID","description":"Deletes an existing System using its UUID as unique identifier.","operationId":"deleteSystem","parameters":[{"name":"systemID","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad_Request ~ Erroneous request operation on System to be aborted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"404":{"description":"Not_Found ~ No System with the specified identifier has been found available to delete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"200":{"description":"OK ~ System has been successfully deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemResponseDto"}}}}}}},"/model_repository/v1/asset_management/system/":{"get":{"tags":["System"],"summary":"Retrieve all Systems","description":"Retrieves all Systems ever persisted.","operationId":"retrieveAllSystems","parameters":[{"name":"page","in":"query","description":"Page number, default is 0","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","description":"Size of page, default is 10","required":false,"schema":{"type":"integer","format":"int32","default":10}}],"responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"404":{"description":"Not_Found ~ No Systems have been found available to retrieve.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"200":{"description":"OK ~ Systems have been successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SystemResponseDto"}}}}}}},"post":{"tags":["System"],"summary":"Persist new System","description":"Persists a new System.","operationId":"createSystem","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemRequestDto"}}},"required":true},"responses":{"400":{"description":"Bad_Request ~ Erroneous request operation on System to be aborted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"201":{"description":"CREATED ~ System has been successfully created.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SystemResponseDto"}}}}},"409":{"description":"Conflict ~ System creation aborted due to Name conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"delete":{"tags":["System"],"summary":"Delete All Systems","description":"Deletes all Systems that have been ever persisted.","operationId":"deleteAllSystems","responses":{"400":{"description":"Bad Request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"204":{"description":"OK ~ All Systems have been successfully deleted.","content":{"application/json":{"schema":{"type":"string"}}}},"404":{"description":"Not_Found ~ No System has been found available to delete.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}}},"/model_repository/v1/asset_management/system/{name}/name/":{"get":{"tags":["System"],"summary":"Retrieve System By Name","description":"Retrieves an existing System using its Name as unique identifier.","operationId":"retrieveSystemByName","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"400":{"description":"Bad_Request ~ Erroneous request operation on System to be aborted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"description":"Internal_Server_Error ~ Internal Server Error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"200":{"description":"OK ~ System has been successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemResponseDto"}}}},"404":{"description":"Not_Found ~ No System with the specified identifier has been found available to retrieve.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}}}},"components":{"schemas":{"ErrorMessage":{"type":"object","properties":{"httpCode":{"type":"integer","format":"int32"},"httpText":{"type":"string"},"message":{"type":"string"},"messageKey":{"type":"string"},"href":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}}},"GeoLocationRequestDto":{"type":"object","properties":{"latitude":{"type":"number","format":"double","writeOnly":true},"longitude":{"type":"number","format":"double","writeOnly":true}}},"LocationRequestDto":{"type":"object","properties":{"geoLocation":{"$ref":"#/components/schemas/GeoLocationRequestDto"},"virtualLocation":{"type":"string"},"latitude":{"type":"number","format":"double"},"longitude":{"type":"number","format":"double"}}},"SystemRequestDto":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"location":{"$ref":"#/components/schemas/LocationRequestDto"},"organization":{"type":"string"},"additionalInformation":{"uniqueItems":true,"type":"array","items":{"type":"object"}}}},"GeoLocationResponseDto":{"type":"object","properties":{"latitude":{"type":"number","format":"double"},"longitude":{"type":"number","format":"double"}}},"LocationResponseDto":{"type":"object","properties":{"geoLocation":{"$ref":"#/components/schemas/GeoLocationResponseDto"},"virtualLocation":{"type":"string"}}},"SystemResponseDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"location":{"$ref":"#/components/schemas/LocationResponseDto"},"organization":{"type":"string"},"additionalInformation":{"uniqueItems":true,"type":"array","items":{"type":"object"}},"creationDate":{"type":"string","format":"date-time"},"latestUpdateDate":{"type":"string","format":"date-time"}}}}}}

model-repository-server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,4 @@ gradle-app.setting
320320
# GitIgnore
321321
.gitignore
322322

323+
!/deploy_commands.txt

model-repository-server/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM openjdk:17
2+
3+
ADD ./api/target/api-0.2.0.jar /api-0.2.0.jar
4+
5+
EXPOSE 8087
6+
7+
RUN sh -c 'touch /api-0.2.0.jar'
8+
9+
ENTRYPOINT ["java","-jar","/api-0.2.0.jar"]

0 commit comments

Comments
 (0)