Skip to content

Commit 64ecb16

Browse files
authored
Merge pull request #17 from oracle-devrel/timeseris
add output module for the time series DB functionality
2 parents 5032c36 + 3c1a59e commit 64ecb16

108 files changed

Lines changed: 4249 additions & 320 deletions

File tree

Some content is hidden

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

IoTDBJDBC/.factorypath

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-inject-java/4.10.23/micronaut-inject-java-4.10.23.jar" enabled="true" runInBatchMode="false"/>
44
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar" enabled="true" runInBatchMode="false"/>
55
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-core-processor/4.10.23/micronaut-core-processor-4.10.23.jar" enabled="true" runInBatchMode="false"/>
6-
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-inject/4.10.23/micronaut-inject-4.10.23.jar" enabled="true" runInBatchMode="false"/>
7-
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/inject/jakarta.inject-api/2.0.1/jakarta.inject-api-2.0.1.jar" enabled="true" runInBatchMode="false"/>
8-
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar" enabled="true" runInBatchMode="false"/>
9-
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-core/4.10.23/micronaut-core-4.10.23.jar" enabled="true" runInBatchMode="false"/>
106
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-aop/4.10.23/micronaut-aop-4.10.23.jar" enabled="true" runInBatchMode="false"/>
117
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/javaparser/javaparser-symbol-solver-core/3.27.0/javaparser-symbol-solver-core-3.27.0.jar" enabled="true" runInBatchMode="false"/>
128
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/javaparser/javaparser-core/3.27.0/javaparser-core-3.27.0.jar" enabled="true" runInBatchMode="false"/>
@@ -21,12 +17,28 @@
2117
<factorypathentry kind="VARJAR" id="M2_REPO/org/reactivestreams/reactive-streams/1.0.4/reactive-streams-1.0.4.jar" enabled="true" runInBatchMode="false"/>
2218
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm/9.8/asm-9.8.jar" enabled="true" runInBatchMode="false"/>
2319
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-graal/4.10.23/micronaut-graal-4.10.23.jar" enabled="true" runInBatchMode="false"/>
20+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-http-validation/4.10.23/micronaut-http-validation-4.10.23.jar" enabled="true" runInBatchMode="false"/>
21+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-http-server/4.10.23/micronaut-http-server-4.10.23.jar" enabled="true" runInBatchMode="false"/>
22+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-router/4.10.23/micronaut-router-4.10.23.jar" enabled="true" runInBatchMode="false"/>
23+
<factorypathentry kind="VARJAR" id="M2_REPO/io/projectreactor/reactor-core/3.7.12/reactor-core-3.7.12.jar" enabled="true" runInBatchMode="false"/>
24+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-websocket/4.10.23/micronaut-websocket-4.10.23.jar" enabled="true" runInBatchMode="false"/>
25+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-http-client-core/4.10.23/micronaut-http-client-core-4.10.23.jar" enabled="true" runInBatchMode="false"/>
26+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-discovery-core/4.10.23/micronaut-discovery-core-4.10.23.jar" enabled="true" runInBatchMode="false"/>
27+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/jsonschema/micronaut-json-schema-processor/1.7.4/micronaut-json-schema-processor-1.7.4.jar" enabled="true" runInBatchMode="false"/>
28+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-inject/4.10.4/micronaut-inject-4.10.4.jar" enabled="true" runInBatchMode="false"/>
29+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/inject/jakarta.inject-api/2.0.1/jakarta.inject-api-2.0.1.jar" enabled="true" runInBatchMode="false"/>
30+
<factorypathentry kind="VARJAR" id="M2_REPO/jakarta/annotation/jakarta.annotation-api/2.1.1/jakarta.annotation-api-2.1.1.jar" enabled="true" runInBatchMode="false"/>
31+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-core/4.10.4/micronaut-core-4.10.4.jar" enabled="true" runInBatchMode="false"/>
32+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/jsonschema/micronaut-json-schema-annotations/1.7.4/micronaut-json-schema-annotations-1.7.4.jar" enabled="true" runInBatchMode="false"/>
33+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/jsonschema/micronaut-json-schema-common/1.7.4/micronaut-json-schema-common-1.7.4.jar" enabled="true" runInBatchMode="false"/>
34+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.19.2/jackson-databind-2.19.2.jar" enabled="true" runInBatchMode="false"/>
35+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.19.2/jackson-annotations-2.19.2.jar" enabled="true" runInBatchMode="false"/>
36+
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.19.2/jackson-core-2.19.2.jar" enabled="true" runInBatchMode="false"/>
37+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-http/4.10.4/micronaut-http-4.10.4.jar" enabled="true" runInBatchMode="false"/>
38+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-context/4.10.4/micronaut-context-4.10.4.jar" enabled="true" runInBatchMode="false"/>
39+
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-context-propagation/4.10.4/micronaut-context-propagation-4.10.4.jar" enabled="true" runInBatchMode="false"/>
2440
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/serde/micronaut-serde-processor/2.16.2/micronaut-serde-processor-2.16.2.jar" enabled="true" runInBatchMode="false"/>
2541
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/serde/micronaut-serde-api/2.16.2/micronaut-serde-api-2.16.2.jar" enabled="true" runInBatchMode="false"/>
26-
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-context/4.9.11/micronaut-context-4.9.11.jar" enabled="true" runInBatchMode="false"/>
2742
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-json-core/4.9.11/micronaut-json-core-4.9.11.jar" enabled="true" runInBatchMode="false"/>
28-
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-http/4.9.11/micronaut-http-4.9.11.jar" enabled="true" runInBatchMode="false"/>
29-
<factorypathentry kind="VARJAR" id="M2_REPO/io/micronaut/micronaut-context-propagation/4.9.11/micronaut-context-propagation-4.9.11.jar" enabled="true" runInBatchMode="false"/>
30-
<factorypathentry kind="VARJAR" id="M2_REPO/io/projectreactor/reactor-core/3.7.7/reactor-core-3.7.7.jar" enabled="true" runInBatchMode="false"/>
3143
<factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="false" runInBatchMode="false"/>
3244
</factorypath>

IoTDBJDBC/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/target/
22
/configsecure/
33
/.settings/
4+
/PrivateConfig/
5+
/config/
6+
/samples/

IoTDBJDBC/README.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,78 @@ Raw and normalized messages are handled by separate chains:
5050

5151
As with input clients, only handlers whose `@Requires` properties match the runtime configuration are created and injected. Each handler provides an order value from configuration, and the service sorts the injected handlers before processing messages. A handler returns an array of messages. Returning one or more messages passes those messages to the next handler in the chain; returning an empty array stops that branch. This allows the same mechanism to support filters, test processors, and final output handlers.
5252

53-
The raw data handler chain can include filters such as:
53+
The raw data handler chain can include these active filters:
5454

55-
- `messagehandler.filter.rawdata.contenttype.*`
56-
- `messagehandler.filter.rawdata.endpointfilter.*`
57-
- `messagehandler.filter.rawdata.devicemodelfilter.*`
55+
| Filter class | Configuration prefix | What it checks |
56+
| --- | --- | --- |
57+
| `RawDataContentTypeMessageFilter` | `messagehandler.filter.rawdata.contenttype.*` | The raw message content type. The configured `type` is compared ignoring case. |
58+
| `RawDataEndpointMessageFilter` | `messagehandler.filter.rawdata.endpointfilter.*` | A regular expression against the raw message endpoint. `findoutcome=FOUND` keeps matching endpoints; `findoutcome=NOT_FOUND` keeps endpoints that do not match. |
59+
| `RawDataDeviceModelsMessageFilter` | `messagehandler.filter.rawdata.devicemodelsfilter.*` | The device model display name for the raw message's digital twin instance. It accepts one or more configured `modelnames[...]` entries. |
5860

5961
It can also include outputs such as:
6062

6163
- text output using `messagehandler.output.rawdata.textoutput.*`
6264
- HTTP output enabled with `messagehandler.output.rawdata.httpclient.enabled`; the current code reads its order and type from `messagehandler.output.rawdata.httpclient.enabled.order` and `messagehandler.output.rawdata.httpclient.enabled.type`
6365
- NoSQL output settings under `messagehandler.output.rawdata.nosql.*`; the current code enables this bean with `messagehandler.filter.rawdata.nosql.enabled`
6466

65-
The normalized data handler chain can include filters and test processors such as:
67+
The normalized data handler chain can include these active filters and test processors:
6668

67-
- `messagehandler.filter.normalizeddata.contentpathfilter.*`
68-
- `messagehandler.filter.normalizeddata.devicemodelfilter.*`
69-
- `messagehandler.filter.normalizeddata.randomfilter.*`
70-
- `messagehandler.processor.normalizeddata.duplicator.*`
69+
| Filter or processor class | Configuration prefix | What it checks or does |
70+
| --- | --- | --- |
71+
| `NormalizedDataContentJsonTypeMessageFilter` | `messagehandler.filter.normalizeddata.contentjsontypefilter.*` | The Oracle JSON type of the normalized `value` payload, using `NormalizedData.getContentJsonType()`. `findoutcome=FOUND` keeps listed JSON types; `findoutcome=NOT_FOUND` keeps messages whose JSON type is not listed. |
72+
| `NormalizedDataContentPathsMessageFilter` | `messagehandler.filter.normalizeddata.contentpathsfilter.*` | Exact content path membership using configured `matchingcontentpath[...]` entries. It supports optional case-insensitive comparison and `findoutcome=FOUND` or `NOT_FOUND`. |
73+
| `NormalizedDataDeviceModelsMessageFilter` | `messagehandler.filter.normalizeddata.devicemodelsfilter.*` | The device model display name for the normalized message's digital twin instance. It accepts one or more configured `modelnames[...]` entries. |
74+
| `NormalizedDataRandomMessageFilter` | `messagehandler.filter.normalizeddata.randomfilter.*` | Test-only random filtering. |
75+
| `NormalizedDataDuplicatorMessageProcessor` | `messagehandler.processor.normalizeddata.duplicator.*` | Test-only message duplication before later handlers run. |
7176

7277
It can also include the diagnostic text output:
7378

7479
- `messagehandler.output.normalizeddata.textoutput.*`
7580

7681
The usual pattern is to set a handler's `.enabled` property to `true` and provide its `.order` property. Lower order values run earlier. Filters normally sit before outputs, and outputs can either pass the message through to later handlers or terminate that branch by returning no messages.
7782

83+
The current plural device-model filters replace the older single-model filter path. `RawDataDeviceModelMessageFilter`, `NormalizedDataDeviceModelMessageFilter`, and `NormalizedDataContentPathRegexpMessageFilter` are still present in the source, but their `@Requires` annotations use `.enabled.IGNORETHISONE`, so the normal `.enabled=true` property will not create those beans. Use the plural `devicemodelsfilter` entries and the exact-match `contentpathsfilter` entries described above.
84+
85+
Device-model filters use `DeviceModelMessageFilterCore` and `DeviceModelInstancesCache`. The cache opens a database connection, switches to `iotdatacache.schemaname`, and reads `digital_twin_models` and `digital_twin_instances` to map instance ids, external keys, model ids, and model display names. It keeps in-memory maps of successful lookups and sets of known missing ids so repeated messages for the same instance do not repeatedly query the database.
86+
87+
The cache needs these properties:
88+
89+
| Property | Required | Purpose |
90+
| --- | --- | --- |
91+
| `iotdatacache.schemaname` | Yes | IoT data-cache schema, normally `<IOT Domain Shortid>__iot`. The cache uses this as the current database schema. |
92+
| `devicemodelinstancescache.preloadexistingmodels` | No, defaults to `true` | Preload all model ids and display names at handler configuration time. |
93+
| `devicemodelinstancescache.preloadexistinginstances` | No, defaults to `true` | Preload all instance ids, external keys, and model ids at handler configuration time. |
94+
| `datasources.default.url` | Yes for the current DB connection supplier | JDBC URL used to connect to the IoT database. The sample builds it from `iotdatacache.ociregion` and `iotdatacache.connectionname`. |
95+
| `oci.dbtoken.scope` | Yes when using the access-token DB connection supplier | Scope used by `DBTokenRetriever` when creating the database access token. |
96+
| `oci.auth.type` | Yes when using the access-token DB connection supplier | Selects the OCI auth provider. The current values are `InstancePrinciple` or `ConfigFile`. |
97+
| `oci.auth.config.section` | No, defaults to `DEFAULT` | OCI config profile section when `oci.auth.type=ConfigFile`. |
98+
99+
Raw device-model filter example:
100+
101+
```properties
102+
messagehandler.filter.rawdata.devicemodelsfilter.enabled=true
103+
messagehandler.filter.rawdata.devicemodelsfilter.order=10
104+
messagehandler.filter.rawdata.devicemodelsfilter.modelnames[0]=homeBattery
105+
messagehandler.filter.rawdata.devicemodelsfilter.modelnames[1]=homeHeating
106+
messagehandler.filter.rawdata.devicemodelsfilter.caseinsensitive=true
107+
108+
iotdatacache.schemaname=<IOT Domain Shortid>__iot
109+
devicemodelinstancescache.preloadexistingmodels=true
110+
devicemodelinstancescache.preloadexistinginstances=true
111+
```
112+
113+
Normalized JSON value-type filter example:
114+
115+
```properties
116+
messagehandler.filter.normalizeddata.contentjsontypefilter.enabled=true
117+
messagehandler.filter.normalizeddata.contentjsontypefilter.order=10
118+
messagehandler.filter.normalizeddata.contentjsontypefilter.contentype[0]=DECIMAL
119+
messagehandler.filter.normalizeddata.contentjsontypefilter.contentype[1]=DOUBLE
120+
messagehandler.filter.normalizeddata.contentjsontypefilter.findoutcome=FOUND
121+
```
122+
123+
The `contentype` spelling in that example is deliberate: it is the property name the current constructor reads. The filter uses `findoutcome`; older sample comments that mention `filteronmatches` do not match the current code.
124+
78125
Example:
79126

80127
```properties

0 commit comments

Comments
 (0)