Commit Graph
481 Commits
Author SHA1 Message Date
Henry ZhangandClaude Fable 5 73ff48bcb9 style: reformat codebase (backend java/xml, docs, web) (#175)
* style(backend): reformat and rearrange java/xml sources

Apply code cleanup across dc3-common and dc3-driver: whitespace and
indent normalization, import sorting, member rearrangement, and javadoc
normalization. No semantic changes; compilation verified.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* style(docs): reformat vitepress vue diagram components

Expand compact svg templates and normalize formatting across diagram
components, the seo module, and the theme stylesheet. No behavior
changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* style(docs): reformat markdown pages

Normalize markdown formatting. Restore the <script setup> component
imports that an earlier unused-import pass had wrongly stripped; every
<Diagram> tag now resolves to a backing import again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* style: reformat point view and trim pom whitespace

Normalize whitespace in the point view and drop trailing whitespace in
pom.xml. No behavior changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-06 12:13:36 +08:00
pnoker 056bd9ae21 Merge remote-tracking branch 'origin/develop' into chore/promote-develop-main-3 2026-08-03 21:57:03 +08:00
Henry Zhang 00c67406b0 refactor(quality): fix unused-param/confusing-sig/local-temp/js-comparison (12) (#163)
- unused-parameter (7 private/non-override): drop unused params in
  Snmp getConnector/buildTarget, Sl651 handleSl651Message,
  PointCommandValidator.validateWriteValue, TypedValueConverter
  finiteFloat/finiteDouble (+ cascade callers). 3 interface default
  methods kept (contract).
- confusing-method-signature (1): AuthenticGatewayFilterFactory
  <Object> → dedicated Config type; apply(Object)→apply(Config)
- local-temp-file-info-disclosure (1): FileUtil creates temp dirs
  with owner-only rwx------ via PosixFilePermissions (Windows fallback)
- js/comparison-between-incompatible-types (1): isNull drop redundant
  val === undefined (== null loose already covers it)

Behavior-preserving. Compile + test-compile clean.
2026-08-03 21:55:13 +08:00
Henry Zhang 4e2c5bc770 refactor(quality): fix 27 medium-risk CodeQL alerts (null/exception/boundary/exposure) (#162)
- non-null-boxed (7): GroupServiceImpl extract Byte→byte; DashboardServiceImpl
  Long→long for primitive id fields
- uncaught-number-format (7): try-catch parse failures in FINS/EthernetIP/BACnet/
  Dashboard (fall back to 0 / skip, matching existing pattern); remove dead
  unreachable outer catch in BACnet
- dereferenced-null (4): DeviceMetadata expand MapUtils.isEmpty to explicit
  null check for short-circuit clarity
- ignored-error-status (4): ConcurrentLinkedQueue.offer→add (unbounded, offer
  always true; add's boolean is "modified", not error)
- index-out-of-bounds (2): orderedMap(Object...) guard odd-length → IAE
- internal-rep-exposure (3): CoverageGapVO/Pages/DriverMetadata return
  unmodifiable views + addX/removeX mutators; migrate all callers + tests

Behavior-preserving. Compile clean (except bacnet4j pre-existing mirror miss).
2026-08-03 21:49:22 +08:00
Henry Zhang 852f0682d3 refactor(quality): fix 21 low-risk CodeQL quality alerts (#160)
- local-variable-is-never-read (3): dead host/port/database locals in
  AbstractJdbcDriverCustomService (subclasses read config themselves)
- unused-container (2): unused `valid` set in AlarmRuleTriggerServiceImpl;
  unused driverSenderService field/ctor param in CanDriver (+ test)
- unknown-javadoc-parameter (12): dangling ctor Javadoc on
  @RequiredArgsConstructor classes / stale @param
- call-to-object-tostring (3): @ToString on MessageHeader (root cause);
  field-log MetadataEventDTO instead of hash
- constant-comparison (1): DriverInitRunner == → >= (defensive)

No behavior change. Compile clean (agentic/can/data/auth/mqtt/driver/sql).
2026-08-03 21:49:03 +08:00
pnoker 4cd16d23d1 Merge remote-tracking branch 'origin/develop' into chore/promote-develop-main-2 2026-08-03 20:24:41 +08:00
Henry Zhang fa1cd49bac fix(security): harden log-injection + CAN command injection (#158)
* fix(security): sanitize agentic assistant HTML with DOMPurify (XSS)

RenderedAssistantMessage rendered model output via v-html after a
hand-rolled regex sanitizer that CodeQL flagged 5 ways: bad-tag-filter,
incomplete-multi-character-sanitization (on* attributes, javascript:),
incomplete-url-scheme-check (data:/vbscript:). Replace with DOMPurify,
which covers all these plus mutation XSS. Fixes CodeQL #2146-2150.

* fix(security): harden log-injection + CAN command injection

log-injection (7): pass user-derived log args (conversationId, model,
candidate/fallback) through LogSanitizer.sanitize in AgenticChatServiceImpl,
ChatClientFactory, AgenticChatRequestPreparer — strips CR/LF that could
forge log lines.

relative-path-command / command injection (2, CanDriver): executeCommand
runs `sh -c` with a command built from driver config (interfaceName) and
request data (canId/frame), so add a CAN_COMMAND_PATTERN whitelist
(^[A-Za-z0-9 _#,.=%/-]+$) rejecting shell metacharacters, and validate
interfaceName against ^[A-Za-z0-9_]+$ at all 3 entry points. Fixes
CodeQL #2173,#2172,#2120,#1514,#1513,#1022,#1017,#1016,#1014.

Verified: mvn compile agentic+can clean.
2026-08-03 19:46:42 +08:00
Henry Zhang 4dd477163e build(deps): bump californium 4.0.0-M3 → 4.0.0-M6 + adapt CoapExchange import (#156)
M6 relocated CoapExchange from core.server.resources to core (verified
via compile). dc3-driver-coap uses only the core CoAP API
(CoapClient/Server/Endpoint/Resource/Configuration) and avoids the
DTLS/observe/MessageObserver areas where M3→M6 broke, so this single
import is the whole adaptation. Supersedes dependabot #81.

Gains: M4-M6 bugfixes (deferred CID records, CON notify reliability,
anonymous cipher-suite), Java 21 virtual-thread support, RFC 7252
compliance. 4.0.0 GA has no timeline; no reason to stall on M3.
2026-08-03 14:23:28 +08:00
pnoker 7bf615b3b1 feat(driver): configure driver buffer and mount container volume
28 driver application.yml add dc3.driver.buffer; Dockerfile each stage adds dc3/data dir and VOLUME; docker-compose main/dev add driver_data named volume
2026-07-26 00:13:31 +08:00
dependabot[bot] ca359f6fc1 build(deps): bump com.infiniteautomation:bacnet4j from 6.0.1 to 6.1.0 (#110)
Bumps [com.infiniteautomation:bacnet4j](https://github.com/infiniteautomation/BACnet4J) from 6.0.1 to 6.1.0.
- [Release notes](https://github.com/infiniteautomation/BACnet4J/releases)
- [Commits](https://github.com/infiniteautomation/BACnet4J/compare/v6.0.1...v6.1.0)

---
updated-dependencies:
- dependency-name: com.infiniteautomation:bacnet4j
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-19 20:30:24 +08:00
dependabot[bot] af02d90024 build(deps): bump org.snmp4j:snmp4j from 3.7.4 to 3.12.2 (#109)
Bumps org.snmp4j:snmp4j from 3.7.4 to 3.12.2.

---
updated-dependencies:
- dependency-name: org.snmp4j:snmp4j
  dependency-version: 3.12.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-19 20:30:18 +08:00
pnokerandClaude 741ad7cc44 feat(security): redact identifiers and model names in logs
Add LogSanitizer and apply it to agentic conversationId/model and the listening-virtual netty deviceName so they are not emitted verbatim in log output.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-16 20:03:59 +08:00
pnokerandClaude 3f083e7ee8 fix: guard numeric parsing against NumberFormatException
Wrap unchecked Integer/Long/Byte.parse* calls in topic/dashboard/oauth/facade and the BACnet-IP, Ethernet-IP, FINS, SNMP drivers plus the agentic action payload, so malformed values fall back to a safe default instead of aborting.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-16 20:03:42 +08:00
pnokerandClaude 0ff5f7a14f style(opc-da): add missing @Override to openscada adapter methods
Annotate overriding methods in the vendored org.openscada OPC-DA adapter with @Override.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-16 20:03:41 +08:00
pnokerandClaude fe28d41803 refactor(config): drop redundant YAML blocks covered by shared profile bases
Remove configuration duplicated verbatim by the auto-activated shared profile bases: the dc3-center-manager gRPC channel in several drivers, the management.* block in center/gateway services, the gateway swagger-ui.path, duplicate logging sub-packages, and dead dc3.driver.mqtt config in dc3-center-data (no dc3-common-mqtt dependency). spring.env/spring.group are kept (consumed by RabbitmqEnvironmentConfig/WebFluxSecurityConfig/HmacAuthConfig). Effective configuration unchanged; validated via YAML parse + Maven process-resources.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-16 19:45:16 +08:00
pnokerandClaude Fable 5 3a031073ca fix(driver-coap): bind CoAP server to the configured serverHost
The server was constructed with only CoapConfig.COAP_PORT set, so
Californium created a default endpoint bound to 0.0.0.0 (all
interfaces) — coapProperties.serverHost was never applied, yet the
startup log printed it as the listen host. Setting serverHost to a
specific interface silently failed to restrict binding. Add an explicit
CoapEndpoint bound to InetSocketAddress(serverHost, serverPort) so the
property takes effect and the log is accurate.

Verified: dc3-driver-coap compiles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 17:47:32 +08:00
pnokerandClaude Fable 5 b01b2802db fix(driver-fins): correct 32-bit read length and FLOAT write encoding
Two runtime bugs in the FINS driver:

1. read() hardcoded a 1-word (2-byte) memory-read request regardless of
   dataType, so INT32/UINT32/FLOAT decodes (which need 4 bytes) always
   threw BufferUnderflowException — 32-bit points could never be read.
   Derive the word count from dataType (2 words for 32-bit types).

2. encodeWriteData grouped FLOAT with INT32/UINT32, doing
   Integer.parseInt + putInt. Writing "3.14" threw NumberFormatException
   and "3" was written as int bits (read back as ~4.2E-45 via getFloat).
   Give FLOAT its own branch using Float.parseFloat + putFloat.

Relaxed encodeWriteData/decodeValue/wordCount to package-private and
added round-trip tests (FLOAT, INT32) plus wordCount coverage.
Verified: dc3-driver-fins 7 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 17:45:18 +08:00
pnoker d52b106660 style: align Javadoc @param tags and docs table formatting
- Align @param tag indentation in AgenticChatResponseCodec, GrpcFacadeSupport, PlcS7DriverCustomServiceImpl
- Align markdown table columns in docs/en and docs/zh architecture, technology-stack, operation, quickstart
- Reformat vitepress config group items for readability
2026-07-13 14:22:38 +08:00
pnoker 398026fc95 docs(drivers): document plcs7 and melsec protocol helpers
- PlcS7DriverCustomServiceImpl: document getS7PLC/buildVariable/
  readByType/writeByType/invalidateConnection/closeConnection
- MelsecDriverCustomServiceImpl: document the same six helpers
  (McPLC variant); both drivers shared the undocumented helper pattern
  while modbus-tcp/mqtt/opc-ua already documented theirs
2026-07-10 12:14:22 +08:00
pnoker 0fd8d5b6b3 docs(drivers): align since tags with version across protocol drivers
Fix @since 2026.6.2 -> @since 2026.5.22 on 40 files across 17 protocol
drivers (serial, dlms, fins, mysql, ethernet-ip, zigbee, bacnet-ip,
snmp, ble, can, oracle, postgresql, iec104, lwm2m, tcp-udp, http,
sqlserver). The @since value was later than @version 2026.5.22, which
is impossible — a class cannot exist in 5.22 yet be introduced in 6.2.
2026-07-09 19:18:28 +08:00
pnokerandClaude f263164039 style: rename unused catch parameters to 'ignored'
Replace unused catch exception parameter names ('e', 'ex', etc.) with
the conventional 'ignored' identifier to suppress IDE warnings across
the codebase. This is a purely mechanical rename — no behavioral change.

Affected modules: enums (40+), drivers (12+), common-data, common-driver,
common-manager, common-auth, common-public, common-agentic, common-web,
common-resource-registrar, and all driver implementations.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-09 12:48:14 +08:00
Henry Zhang 91d8717231 fix(driver): resolve 4 real defects in OPC-UA and MQTT drivers (#112)
* fix(driver-mqtt): report real broker connection state in driver health

* fix(driver-opc-ua): expose certificate-degraded marker in health description

* fix(driver-opc-ua): use x509 identity provider when certificate is configured

* fix(driver-opc-ua): add connection backoff to prevent connect storms on unreachable devices
2026-07-01 14:27:35 +08:00
pnoker d18bf4d03d style: fix table alignment and whitespace in README files 2026-06-26 13:17:38 +08:00
pnoker a6c63a9c3d style: fix formatting in Java source files and tests 2026-06-26 13:17:33 +08:00
pnoker 46f8243c07 test(driver): add postgresql testcontainers integration test for jdbc io
Add the first driver integration test: spins a real PostgreSQL container and
verifies the shared JDBC read path returns stored values and that the write
path binds the point value as a parameter — a SQL-injection payload is stored
verbatim and cannot drop the table, confirming the parameterised-write fix
end-to-end. Set the Failsafe classesDirectory so integration tests run against
the plain compiled classes instead of the Spring Boot repackaged fat jar.
2026-06-22 18:49:49 +08:00
pnoker 452ed896f3 test(driver): add minimal unit tests for 13 previously untested drivers
Add offline MockitoExtension tests for bacnet-ip, can, ethernet-ip, fins, http,
lwm2m, mysql, oracle, postgresql, serial, snmp, sqlserver, and tcp-udp. Each
covers configuration validation (validate/validatePoint flag missing required
attributes) and deterministic lifecycle behavior. Network/hardware paths
(read/write/getConnector) are deliberately excluded to keep the suite fast and
deterministic. Takes these drivers from zero tests to baseline coverage.
2026-06-22 18:09:01 +08:00
pnoker 9aa5a6bdb9 security(driver): bind jdbc write value as a parameter to prevent sql injection
The shared JDBC driver base interpolated the point value into the write SQL via
writeQuery.replace("${value}", ...), allowing a crafted write command value to
alter the statement. Bind the value with PreparedStatement#setString against a
single ? placeholder instead. Update the mysql/oracle/postgresql/sqlserver
writeQuery attribute docs to the ? convention and add the module's first test.
2026-06-22 17:59:50 +08:00
pnoker ec52b1a7fa fix(driver): fail fast in dlms/iec104 stubs instead of fabricating read/write success
The DLMS and IEC 104 drivers are work-in-progress skeletons whose protocol I/O
is unimplemented. They previously returned a null-valued ReadPointValue / cached
echo and reported write success, so the SDK emitted fabricated point values and
masked that the drivers do not work. Make read/write throw Read/WritePointException
so the SDK records failures and applies backoff. Remove the dead connection
scaffolding and add the drivers' first unit tests.
2026-06-22 17:13:40 +08:00
pnoker a3032fbc6d fix(driver): set coap driver type to DRIVER_CLIENT
The CoAP driver implementation is a Californium client (GET/PUT), but
its config declared type: DRIVER_SERVER. Correct it to DRIVER_CLIENT.
2026-06-22 16:56:29 +08:00
pnoker ad7973e08f fix(driver): stop mqtt validate() requiring point attributes as driver config
validate(driverConfig) required commandTopic/commandQos, but those are
per-point attributes read from pointConfig in write(), so driver-level
validation always failed. Drop the misplaced checks (and the now-unused
helper); this driver declares no required driver-level attributes.
2026-06-22 16:56:29 +08:00
pnoker 98f0ac3128 docs(readme): add READMEs for previously undocumented modules
Document 31 modules that had no README: dc3-center-agentic, dc3-e2e,
common modules (agentic, sql, test, resource-registrar) and the facade
subsystem (api/grpc/local-auth/local-data/local-manager), plus 21
drivers. Content is grounded in each module's pom/yaml/source; WIP
skeleton drivers (can, dlms, ethernet-ip, iec104, lwm2m, zigbee) are
flagged as such.
2026-06-22 16:50:08 +08:00
pnoker 7320b99183 docs(driver): fix attribute classification and flag WIP mqtt driver
Move misclassified point attributes out of the driver-attribute tables
(modbus-tcp Slave ID, virtual Tag, listening-virtual), drop plcs7's
fabricated Data Length and add the required PLC Type, document
command/event attributes, and flag the mqtt driver as a WIP skeleton.
2026-06-22 16:49:29 +08:00
pnoker 5df7998d41 docs(common): tighten javadoc and drop redundant comments across modules
Part of the x-dc3-ai annotation-standard rollout. Complete method/param javadoc (TokenService, RepositoryService, RuleEngine, ...), flag work-in-progress utilities and drivers (X509Util, MQTT/CAN/DLMS/... ) with explicit WARNING notes, and remove redundant inline comments / blank lines from query/VO/ext/constant classes plus mapper indentation. Comment/doc only, no behavior change.
2026-06-22 12:08:11 +08:00
Vickey d2c897846c refactor(common): split ResponseEnum into SuccessCode/ErrorCode and align body code with HTTP status
Replace the mixed-purpose ResponseEnum with a ResponseCode interface implemented
by SuccessCode (OK/ADD/DELETE/UPDATE) and ErrorCode (NOT_FOUND/UNAUTHORIZED/
TOKEN_INVALID/IP_INVALID/FORBIDDEN/PASSWORD_*/VALIDATION/OUT_OF_RANGE/FAILURE),
each carrying its HTTP status so the envelope body code and transport status no
longer diverge.

- Introduce abstract BusinessException carrying an ErrorCode; all 23 business
  exceptions extend it and bind a fixed code. ExceptionConfig reads the carried
  code to set both body code and HTTP status (404->R404, 401->R401, 422->R422).
- Add GrpcRFactory (ok/fail/notFound) and remove the hand-written GrpcR builder
  boilerplate across 19 gRPC servers.
- Drop the dead @EnumValue index and ofIndex/ofCode/ofName lookups; OUT_OF_RANGE
  is now carried by OutRangeException.
- Update R factory methods to accept ResponseCode; migrate 90+ controllers,
  11 gRPC facades, OpenAPI specs and README to the split enums.

Also fix several pre-existing red tests surfaced by the full suite:
- OAuthMcpRuntimeServiceImplTest: setUp set @Value fields refactored into
  OAuthProperties; inject the properties object instead.
- DriverReadServiceImplTest: reset leaked ConnectionBackoff static state via a
  new clear() in @BeforeEach.
- modbus-rtu/tcp: make the static modbusFactory non-final so tests can swap it.
- ble: override no-arg health() to report OFFLINE before initialization.
- PlcS7/facade-local tests: expect the thrown exception / use the single-arg
  overload matching production behaviour.
- Remove a duplicate dc3-common-constant dependency in dc3-common-data/pom.xml.
2026-06-18 23:53:41 +08:00
pnoker 0f1245f00e refactor(driver): centralize http driver json constants 2026-06-12 22:17:08 +08:00
Vickey 1b00e74346 test: align tests with enum rename and fix pre-existing failures
- Update test references to the renamed *TypeEnum/RuleStatusEnum.
- Add the new builder/PermissionProvider constructor args to the affected
  service-impl test setups.
- Fix pre-existing failures unrelated to this work: String-vs-Long assertions
  (DriverStatusServiceImplTest), save->saveBatch (EntityStateExpiryScannerTest),
  List.of(null) NPE (AlarmRulePipelineServiceImplTest), and the cache/batch
  refactor expectations (PointValueServiceImplTest).
2026-06-09 15:52:12 +08:00
pnoker 72515d9f31 refactor(model): standardize domain enums and object boundaries
Align the DO/BO/VO model and enums with the project domain-modeling rules:

- Rename 24 multi-valued *FlagEnum to *TypeEnum (closed classifications) and
  RuleStateFlagEnum to RuleStatusEnum (state machine); keep true 0/1 toggles as
  *FlagEnum (EnableFlagEnum/DefaultFlagEnum/ConfirmFlagEnum). Add the new
  ConfirmFlagEnum.
- Give every enum the consistent triplet + ofIndex/ofCode/ofName (fill the two
  Agentic enums) and switch underscore codes to hyphen-case.
- Replace bare Byte/Integer/String flag fields on VOs with their domain enums
  (EventHistory, AlertItem, ...); centralize index/code<->enum conversion in the
  MapStruct builders instead of services; drop ad-hoc (byte) enum casts.
- Stop leaking DO out of the data history services/controllers: the command /
  point-command / event history services now return VO, converting inside the
  service via the builder.
- Add @Schema (description + example/required, verified enum constants) across
  VO/BO/Query DTOs and the entity/ext nested beans; @Schema the R<T> wrapper;
  exclude credential fields from @ToString.
2026-06-09 15:51:35 +08:00
pnoker be88efc379 feat(driver): add DriverValidator SPI for protocol-level sandbox validation
Introduce DriverValidator SPI with validate(), validateDevice(), validatePoint(),
and simulate() default methods. All 28 protocol drivers now implement per-driver
and per-point configuration validation, checking that required attributes are
present before attempting device I/O.

- Add ValidationReport DTO with structured AttributeIssue / IssueLevel reporting
- Add DriverValidator SPI interface with sensible defaults
- Integrate DriverValidator into DriverCustomService aggregate SPI
- Implement validation for all 28 drivers (Modbus TCP, OPC UA, BACnet, MQTT, etc.)
- Add validation contract tests for Modbus TCP driver
2026-06-07 01:11:07 +08:00
pnoker 5730f7c137 feat: update pom version 2026-06-06 13:00:39 +08:00
pnoker b5ef7a8501 fix(pom): clean up dependency management and plugin configuration
- Replace obsolete nexus-staging-maven-plugin with central-publishing-
  maven-plugin in dc3-api and dc3-common
- Remove 20 redundant version declarations from dc3-coverage dependencies
- Fix snmp4j version from non-existent 3.8.3 to available 3.7.4
2026-06-06 00:40:18 +08:00
pnoker 23b90a9c04 fix: add missing final to static fields, prevent runtime mutation
Add final to ~30 public static fields in RabbitConstant — without final,
any code could reassign exchange/queue/routing-key constants at runtime,
silently corrupting messaging routes across the entire distributed system.

Add final to ModbusFactory static fields in ModbusRtu/Tcp drivers and
Random field in OPC-DA Group class.

Replace System.setProperty-based tag isolation in RabbitmqEnvironmentConfig
with a static initializer block in RabbitConstant to preserve immutability.
2026-06-06 00:39:39 +08:00
pnoker 639687a44d refactor: fix variable naming inconsistencies
- Rename DriverProperties DeviceHealthProperties.enable→enabled and
  ScheduleConfig.enable→enabled (boolean fields use adjective form)
- Rename firstFailTime→firstFailureTime (avoid abbreviation in 3 drivers)
2026-06-06 00:03:28 +08:00
pnoker 038d0c092d refactor: fix low-severity code convention violations
- Replace e.getMessage() with exception object in 12 SLF4J log calls
  across 8 files to preserve full stack traces
- Replace hardcoded date pattern in @JsonFormat with TimeConstant
  reference in LatestPointValueVO and TimeseriesPointVO
- Standardize TopicVO: replace @Data with @Getter/@Setter/@ToString,
  add @NoArgsConstructor/@AllArgsConstructor, @JsonInclude, Serializable
- Replace fully-qualified class names with imports in DashboardController
2026-06-05 23:25:33 +08:00
pnoker 80c45456b9 refactor(driver): replace log string concatenation with parameterized placeholders
Replace string concatenation in SLF4J log calls with {} placeholders
across 13 driver implementations. Parameterized logging avoids string
construction when the log level is disabled, reducing CPU overhead.

Affected: listening-virtual (6 files), virtual, modbus-tcp, modbus-rtu,
opc-da, opc-ua, mqtt, coap.
2026-06-05 23:24:54 +08:00
pnoker 233e279db7 test(driver): add test helpers and update driver configuration formatting
Add driverConfig() helper methods and static factory swapping utilities
for Melsec and Modbus RTU driver test classes. Reorder mockito imports.
Normalize YAML array literal whitespace in driver application.yml files.
2026-06-05 22:41:30 +08:00
pnoker cdea07e3d6 refactor(driver): clean up unused imports and dead code in protocol drivers
Remove unused imports, dead constructors, redundant fields, and unreferenced
local variables across 16 protocol driver implementations and supporting
classes. Add type-specific Encodable creation for BACnet write operations.
2026-06-05 22:41:16 +08:00
pnoker 7654401f33 fix(driver): prevent write-echo double-scaling and add connection resilience
Prevent PointValue double-scaling on write echo by adding a static
ofRawValue() factory method that skips the ReadPointValue.calculate()
pipeline. Write values are already in final device-level form and must
not have point scaling (base/multiple/decimal) re-applied.

Add ConnectionBackoff with per-device exponential backoff (1s initial,
2x multiplier, 5min cap) to prevent reconnection storms during device
or network recovery. Integrated transparently into DriverReadServiceImpl
and DriverWriteServiceImpl — applies to all driver types.

Add Modbus TCP connect/read timeout (5s via ModbusMaster.setTimeout)
replacing OS-level default 60-120s timeout that blocked Quartz threads.

Override health() in OPC UA and MQTT drivers to check live connectivity
rather than defaulting to ONLINE. OPC UA uses a 1-second connect() probe;
MQTT marks a TODO for Spring Integration CachingConnectionFactory access.
2026-06-05 22:37:31 +08:00
pnoker f5743a89fc security(auth): remove hardcoded default keys, secrets, and password fallbacks
Remove DEFAULT_KEY and DEFAULT_PASSWORD constants from AlgorithmConstant.
Require DC3_SECURITY_KEY env var at startup — fail with IllegalStateException
if not configured instead of silently falling back to a well-known string.

Remove hardcoded default HMAC secret from HmacAuthProperties. Log a warning
when request signing is disabled in WebFilterConfig.

Require DC3_SECURITY_DEFAULT_PASSWORD for password reset operations instead
of falling back to the hardcoded 'dc3dc3dc3'.

Replace all YAML password fallback values (dc3dc3dc3) with empty defaults so
misconfigured deployments fail at connection time with a clear error rather
than silently connecting with a well-known password.
2026-06-05 22:35:50 +08:00
pnoker 26f6e91a64 feat(driver): add 17 protocol drivers to extend IoT connectivity coverage
## Common Foundation
- dc3-common-sql: AbstractJdbcDriverCustomService base class with HikariCP
  pool management and JDBC template methods

## Serial & General-Purpose (3)
- Serial: RS232/RS485/RS422 with configurable frame parsing (CRC16/XOR)
- HTTP: REST Client using Spring WebClient with JSON path extraction
- TCP/UDP Raw: generic socket driver with pluggable frame protocol

## Database Drivers (4)
- MySQL, PostgreSQL, Oracle (SID/ServiceName), SQL Server

## IoT & Wireless Protocols (3)
- LwM2M: Eclipse Leshan 2.0.0-M14 with CoAP server and device observation
- Zigbee: Z-Smart Systems 1.4.16.1 with Telegesis dongle support
- BLE: Sputnikdev Bluetooth Manager 1.5.3 with TinyB transport

## Building Automation & Smart Metering (2)
- BACnet IP: BACnet4J 6.0.1 with ReadProperty/WriteProperty support
- DLMS/COSEM: Gurux DLMS 4.0.79 for smart metering (TCP/Serial transport)

## Industrial & Power Protocols (4)
- IEC 104: OpenMUC j60870 1.7.2 for power telecontrol
- SNMP: SNMP4J 3.7.4 for network device monitoring
- EtherNet/IP: CIP Data Table Read/Write for Rockwell AB PLCs
- FINS: Omron PLC memory area read/write over TCP

## Automotive & Fieldbus (1)
- CAN Bus: SocketCAN interface with standard/extended frame support

## Build
- Register all 17 driver modules and dc3-common-sql in parent POMs
- Add version properties and dependencyManagement entries
2026-06-02 09:54:13 +08:00
pnoker c87f25d0ab feat(driver-sl651): forward telemetry as point values via reflective SL651 API
Match incoming station addresses against device code/name, look up the
configured byte index per point, and ship element values through
DriverSenderService instead of only logging them. Load the xingshuangs
SL651 server and listener through reflection so the driver still starts
when the optional protocol library is absent, logging a warning instead
of failing.
2026-05-26 22:01:34 +08:00