Skip to content

Commit a58fba3

Browse files
authored
Merge branch 'main' into GitlabCommitMonitor
2 parents 7c3c389 + 61b8ad3 commit a58fba3

12 files changed

Lines changed: 514 additions & 8 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
46+
uses: github/codeql-action/init@v2
4747
with:
4848
languages: ${{ matrix.language }}
4949
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +54,7 @@ jobs:
5454
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5555
# If this step fails, then you should remove it and run the build manually (see below)
5656
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
57+
uses: github/codeql-action/autobuild@v2
5858

5959
# ℹ️ Command-line programs to run using the OS shell.
6060
# 📚 https://git.io/JvXDl
@@ -68,4 +68,4 @@ jobs:
6868
# make release
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
71+
uses: github/codeql-action/analyze@v2

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,119 @@
11
# smartclide-context
22
SmartCLIDE Context Handling Component
3+
4+
## Preconditions to build and run Context Handling
5+
6+
To build and run Context Handling, the following software is required:
7+
8+
- Java (at least version 11)
9+
- Apache Maven (at least version 3.5.4)
10+
- Docker (for running tests and deploying Context Handling on the SmartCLIDE cluster)
11+
- docker-compose (for running local sample instance only)
12+
13+
## How to build Context Handling
14+
15+
Context Handling can be built using maven with the following command:
16+
17+
```shell
18+
mvn install
19+
```
20+
21+
In order to build and push a container image that can be deployed, the following command can be used:
22+
23+
```shell
24+
mvn install
25+
mvn jib:build -pl smartclide-monitoring -Djib.to.image="${IMAGE_NAME:IMAGE_TAG}" -Djib.to.auth.username="${CONTAINER_REGISTRY_USERNAME}" -Djib.to.auth.password="${CONTAINER_REGISTRY_TOKEN}"
26+
```
27+
28+
## How to run Context Handling
29+
30+
A sample configuration and docker-compose file can be found in the [samples folder](samples).
31+
32+
You can run the sample with the following command:
33+
34+
```shell
35+
docker-compose -f samples/docker-compose.yml up
36+
```
37+
38+
## How to configure Context Handling
39+
40+
### Monitoring Config
41+
42+
**monitoring-config.xml**
43+
44+
An example monitoring configuration can be found here: [monitoring-config.xml](samples/config/monitoring-config.xml)
45+
46+
**monitoring-config.xsd**
47+
48+
The corresponding XSD file can be found here: [monitoring-config.xsd](samples/config/monitoring-config.xsd)
49+
50+
### Description
51+
52+
#### indexes
53+
54+
Each index entry has the following mandatory attributes
55+
56+
- id: The unique name of the index
57+
- location: The URI of the location the index is stored
58+
59+
#### datasources
60+
61+
Each datasource entry has the following mandatory attributes
62+
63+
- id:The unique name of the datasource
64+
- type:The type of the datasource. Possible values are: filesystem, webservice, database, messageBroker
65+
- monitor:The class of the monitor to be used. Possible values are:
66+
- package de.atb.context.monitoring.monitors.database.DatabaseMonitor
67+
- package de.atb.context.monitoring.monitors.file.FileSystemMonitor
68+
- package de.atb.context.monitoring.monitors.file.FilePairSystemMonitor
69+
- package de.atb.context.monitoring.monitors.file.FileTripletSystemMonitor
70+
- package de.atb.context.monitoring.monitors.webservice.MessageBrokerMonitor
71+
- package de.atb.context.monitoring.monitors.webservice.WebServiceMonitor
72+
- package de.atb.context.monitoring.monitors.GitlabCommitMonitor
73+
- package de.atb.context.monitoring.monitors.GitMonitor
74+
- options: Options for the datasource can be entered using this value. The options are dependent on the datasource to be used
75+
- uri:The uri of the data source to be monitored
76+
- class:The following datasource implementations are available
77+
- package de.atb.context.monitoring.config.models.datasources.DatabaseDataSource
78+
- package de.atb.context.monitoring.config.models.datasources.FilePairSystemDataSource
79+
- package de.atb.context.monitoring.config.models.datasources.FileSystemDataSource
80+
- package de.atb.context.monitoring.config.models.datasources.FileTripletSystemDataSource
81+
- package de.atb.context.monitoring.config.models.datasources.MessageBrokerDataSource
82+
- package de.atb.context.monitoring.config.models.datasources.WebServiceDataSource
83+
- package de.atb.context.monitoring.config.models.datasources.GitlabDataSource
84+
85+
#### interpreters
86+
87+
Each interpreter entry has the following mandatory attributes
88+
89+
- id: The unique name of the interpreter
90+
- configuration
91+
- analyser: The analyser class to be used. The following implementations are available:
92+
- package de.atb.context.monitoring.analyser.database.DatabaseAnalyser
93+
- package de.atb.context.monitoring.analyser.file.FileAnalyser
94+
- package de.atb.context.monitoring.analyser.file.FilePairAnalyser
95+
- package de.atb.context.monitoring.analyser.file.FileTripletAnalyser
96+
- package de.atb.context.monitoring.analyser.webservice.MessageBrokerAnalyser
97+
- package de.atb.context.monitoring.analyser.webservice.WebServiceAnalyser
98+
- package de.atb.context.monitoring.analyser.webserviceGitAnalyser
99+
- package de.atb.context.monitoring.analyser.webservice.GitlabCommitAnalyser
100+
- parser: The parser class to be used. The following implementations are available:
101+
- package de.atb.context.monitoring.parser.database.DatabaseParser
102+
- package de.atb.context.monitoring.parser.file.FileParser
103+
- package de.atb.context.monitoring.parser.file.FilePairParser
104+
- package de.atb.context.monitoring.parser.file.FileTripletParser
105+
- package de.atb.context.monitoring.parser.webservice.MessageBrokerParser
106+
- package de.atb.context.monitoring.parser.webservice.WebServiceParser
107+
- package de.atb.context.monitoring.parser.GitlabCommitParser
108+
- package de.atb.context.monitoring.parser.GitParser
109+
110+
- type: Currently only used for File analyser and parser. Defines the file extensions to be used.
111+
112+
#### monitors
113+
114+
Each monitor entry has the following mandatory attributes
115+
116+
- id: The unique name of the monitor
117+
- datasource: The id of one previously defined datasource (see above)
118+
- interpreter: The id of one previously defined interpreter (see above)
119+
- index: The id of one previously defined index (see above)

context-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<name>ATB Context Extraction Core Lib</name>
1717

1818
<properties>
19-
<cxf.version>3.5.1</cxf.version>
20-
<jena.version>4.4.0</jena.version>
19+
<cxf.version>3.5.2</cxf.version>
20+
<jena.version>4.5.0</jena.version>
2121
</properties>
2222

2323
<dependencies>
@@ -107,7 +107,7 @@
107107
<dependency>
108108
<groupId>org.projectlombok</groupId>
109109
<artifactId>lombok</artifactId>
110-
<version>1.18.22</version>
110+
<version>1.18.24</version>
111111
</dependency>
112112

113113
<!-- API, java.xml.bind module -->

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2525
<maven.version>3.5.4</maven.version>
2626
<java.version>11</java.version>
27-
<testcontainers.version>1.16.3</testcontainers.version>
27+
<testcontainers.version>1.17.1</testcontainers.version>
2828
</properties>
2929

3030
<build>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<config xmlns="http://www.atb-bremen.de"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.atb-bremen.de monitoring-config.xsd">
5+
6+
<indexes>
7+
<index id="index-git" location="target/indexes/git"/>
8+
</indexes>
9+
10+
<datasources>
11+
<datasource id="datasource-git" type="messagebroker"
12+
monitor="de.atb.context.monitoring.monitors.GitMonitor"
13+
uri=""
14+
options="server=rabbitmq&amp;port=5672&amp;exchange=smartclide-monitoring&amp;topic=monitoring.git.*&amp;dle-topic=dle.git.commits"
15+
class="de.atb.context.monitoring.config.models.datasources.MessageBrokerDataSource"/>
16+
</datasources>
17+
18+
<interpreters>
19+
<interpreter id="interpreter-git">
20+
<configuration type="*"
21+
parser="de.atb.context.monitoring.parser.GitParser"
22+
analyser="de.atb.context.monitoring.analyser.GitAnalyser"/>
23+
</interpreter>
24+
</interpreters>
25+
26+
<monitors>
27+
<monitor id="monitor-git" datasource="datasource-git" interpreter="interpreter-git" index="index-git"/>
28+
</monitors>
29+
</config>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.atb-bremen.de" xmlns="http://www.atb-bremen.de">
3+
<xs:element name="config">
4+
<xs:complexType>
5+
<xs:sequence>
6+
<xs:element ref="indexes"/>
7+
<xs:element ref="datasources"/>
8+
<xs:element ref="interpreters"/>
9+
<xs:element ref="monitors"/>
10+
</xs:sequence>
11+
</xs:complexType>
12+
</xs:element>
13+
<xs:element name="indexes">
14+
<xs:complexType>
15+
<xs:sequence>
16+
<xs:element maxOccurs="unbounded" minOccurs="1" ref="index"/>
17+
</xs:sequence>
18+
</xs:complexType>
19+
</xs:element>
20+
<xs:element name="index">
21+
<xs:complexType>
22+
<xs:attribute name="id" use="required" type="xs:ID"/>
23+
<xs:attribute name="location" use="required" type="xs:anyURI"/>
24+
</xs:complexType>
25+
</xs:element>
26+
<xs:element name="monitors">
27+
<xs:complexType>
28+
<xs:sequence>
29+
<xs:element maxOccurs="unbounded" minOccurs="1" ref="monitor"/>
30+
</xs:sequence>
31+
</xs:complexType>
32+
</xs:element>
33+
<xs:element name="monitor">
34+
<xs:complexType>
35+
<xs:attribute name="id" use="required" type="xs:ID"/>
36+
<xs:attribute name="datasource" use="required" type="xs:IDREF"/>
37+
<xs:attribute name="index" use="required" type="xs:IDREF"/>
38+
<xs:attribute name="interpreter" use="required" type="xs:IDREF"/>
39+
</xs:complexType>
40+
</xs:element>
41+
<xs:element name="datasources">
42+
<xs:complexType>
43+
<xs:sequence>
44+
<xs:element maxOccurs="unbounded" minOccurs="1" ref="datasource"/>
45+
</xs:sequence>
46+
</xs:complexType>
47+
</xs:element>
48+
<xs:element name="datasource">
49+
<xs:complexType>
50+
<xs:attribute name="class" use="required"/>
51+
<xs:attribute name="id" use="required" type="xs:ID"/>
52+
<xs:attribute name="monitor" use="required"/>
53+
<xs:attribute name="options" use="required"/>
54+
<xs:attribute name="type" use="required" type="xs:NCName"/>
55+
<xs:attribute name="uri" use="required" type="xs:anyURI"/>
56+
</xs:complexType>
57+
</xs:element>
58+
<xs:element name="interpreters">
59+
<xs:complexType>
60+
<xs:sequence>
61+
<xs:element maxOccurs="unbounded" minOccurs="1" ref="interpreter"/>
62+
</xs:sequence>
63+
</xs:complexType>
64+
</xs:element>
65+
<xs:element name="interpreter">
66+
<xs:complexType>
67+
<xs:sequence>
68+
<xs:element maxOccurs="unbounded" minOccurs="1" ref="configuration"/>
69+
</xs:sequence>
70+
<xs:attribute name="id" use="required" type="xs:ID"/>
71+
</xs:complexType>
72+
</xs:element>
73+
<xs:element name="configuration">
74+
<xs:complexType>
75+
<xs:attribute name="analyser" use="required"/>
76+
<xs:attribute name="parser" use="required"/>
77+
<xs:attribute name="type" use="required"/>
78+
</xs:complexType>
79+
</xs:element>
80+
</xs:schema>

samples/config/services-config.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<config xmlns="http://www.atb-bremen.de"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://www.atb-bremen.de services-config.xsd">
5+
6+
<services>
7+
<service id="AmIMonitoring">
8+
<host>localhost</host>
9+
<location>http://localhost:19001</location>
10+
<name>AmIMonitoringService</name>
11+
<server>de.atb.context.services.AmIMonitoringService</server>
12+
<proxy>de.atb.context.services.IAmIMonitoringService</proxy>
13+
</service>
14+
<service id="AmI-repository">
15+
<host>localhost</host>
16+
<location>http://localhost:19002</location>
17+
<name>AmIMonitoringDataRepositoryService</name>
18+
<server>de.atb.context.services.AmIMonitoringDataRepositoryService</server>
19+
<proxy>de.atb.context.services.IAmIMonitoringDataRepositoryService</proxy>
20+
</service>
21+
<service id="PersistenceUnitService">
22+
<host>localhost</host>
23+
<location>http://localhost:19004</location>
24+
<name>PersistenceUnitService</name>
25+
<server>de.atb.context.services.PersistenceUnitService</server>
26+
<proxy>de.atb.core.services.IPersistenceUnitService</proxy>
27+
</service>
28+
</services>
29+
</config>

samples/config/services-config.xsd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.atb-bremen.de" xmlns:xs="http://www.w3.org/2001/XMLSchema">
2+
<xs:element name="config">
3+
<xs:complexType>
4+
<xs:sequence>
5+
<xs:element name="services">
6+
<xs:complexType>
7+
<xs:sequence>
8+
<xs:element name="service" maxOccurs="unbounded" minOccurs="0">
9+
<xs:complexType>
10+
<xs:sequence>
11+
<xs:element type="xs:string" name="host"/>
12+
<xs:element type="xs:anyURI" name="location"/>
13+
<xs:element type="xs:string" name="name"/>
14+
<xs:element type="xs:string" name="server"/>
15+
<xs:element type="xs:string" name="proxy"/>
16+
</xs:sequence>
17+
<xs:attribute type="xs:string" name="id" use="optional"/>
18+
</xs:complexType>
19+
</xs:element>
20+
</xs:sequence>
21+
</xs:complexType>
22+
</xs:element>
23+
</xs:sequence>
24+
</xs:complexType>
25+
</xs:element>
26+
</xs:schema>

samples/docker-compose.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: "3.8"
2+
3+
services:
4+
# rabbitmq - this is the datasource configured in config/monitoring-config.xml
5+
rabbitmq:
6+
image: rabbitmq:3.10.0-alpine
7+
hostname: rabbitmq
8+
ports:
9+
- "5672:5672"
10+
networks:
11+
- smartclide-monitoring
12+
# smartclide-monitoring
13+
smartclide-monitoring:
14+
image: ghcr.io/eclipse-researchlabs/smartclide/smartclide-monitoring:latest
15+
depends_on:
16+
- rabbitmq
17+
volumes:
18+
# configuration files are mounted to '/opt/smartclide/config'
19+
# see eu.smartclide.contexthandling.ServiceMain for other options
20+
- ./config:/opt/smartclide/config
21+
# waits for rabbitmq datasource to be available before starting smartclide-monitoring
22+
entrypoint:
23+
[
24+
"/entrypoint.d/wait-for-it.sh",
25+
"rabbitmq:5672",
26+
"--strict",
27+
"-t",
28+
"30",
29+
"--",
30+
"java",
31+
"-Djava.security.egd=file:/dev/./urandom",
32+
"-cp",
33+
"app/libs/*:app/resources:app/classes",
34+
"eu.smartclide.contexthandling.ServiceMain",
35+
]
36+
networks:
37+
- smartclide-monitoring
38+
39+
networks:
40+
smartclide-monitoring:
41+
name: smartclide-monitoring

smartclide-monitoring/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<to>
4747
<image>ghcr.io/eclipse-researchlabs/smartclide/${project.artifactId}:latest</image>
4848
</to>
49+
<extraDirectories>
50+
<permissions>
51+
<permission>
52+
<file>/entrypoint.d/wait-for-it.sh</file>
53+
<mode>755</mode>
54+
</permission>
55+
</permissions>
56+
</extraDirectories>
4957
<container>
5058
<ports>
5159
<port>19001</port>

0 commit comments

Comments
 (0)