Migrate GOPACS UFTP Participants API from V2 to V3#31
Conversation
Replaces the deprecated v2 list-by-EAN endpoint with the v3 lookup-by-domain
endpoint (GET /uftp-participants/v3/participants/{uftpDomainName}). The
response is now JSON with an Authorization header carrying a Bearer token.
- Default base URL changes from clc-message-broker.gopacs-services.eu to api.gopacs-services.eu (override via GOPACS_PARTICIPANT_URL, e.g. api.acc.gopacs-services.eu for acceptance). - getParticipantInformation now calls the v3 by-domain endpoint with a Bearer token instead of listing all participants for an EAN. Adds 404 handling for unknown domains; other non-2xx statuses log at SEVERE. - Extract fetchBearerToken() so Shapeshifter's getAuthorizationHeader and the participant lookup share one OAuth2 flow. - v3 ParticipantView has no endpoint field so the cached UftpParticipantInformation is constructed with endpoint=null.
Verified against shapeshifter-core 3.2.2 and 3.5.0 sources: the outbound send path does new URI(participantInformation.endpoint()) with no null guard, so endpoint=null NPEs every FlexOffer / FlexRequestResponse / FlexOrderResponse. The NPE escapes the send service's try/catch. Also corrects the library version (3.5.0 exists; it does not fix this).
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR migrates the EMS GOPACS UFTP participant lookup from the deprecated V2 XML address book endpoint to the V3 JSON participants API, aligning the integration with the upcoming V2 removal deadline. It also updates outbound routing by synthesizing a broker endpoint (since V3 participant responses no longer include an endpoint) and bumps the Shapeshifter dependency accordingly.
Changes:
- Switch participant lookup to
GET /uftp-participants/v3/participants/{uftpDomainName}(JSON) and addParticipantViewDTO for the V3 schema. - Extract OAuth2 client-credentials token acquisition into a shared
fetchBearerToken()helper and use it for participant API authorization. - Introduce
GOPACS_BROKER_URL(with default) and construct outbound send endpoint as${GOPACS_BROKER_URL}/shapeshifter/api/v3/message; bumpshapeshifterVersionto 3.5.0.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
gradle.properties |
Bumps Shapeshifter dependency version to support/align with the V3 migration. |
ems/src/main/java/org/openremote/extension/ems/manager/gopacs/ParticipantView.java |
Adds a DTO matching the V3 participant response fields used by the handler. |
ems/src/main/java/org/openremote/extension/ems/manager/gopacs/GOPACSHandler.java |
Implements V3 participant lookup with Bearer auth, introduces broker URL fallback, and reuses token acquisition logic. |
ems/src/main/java/org/openremote/extension/ems/manager/gopacs/GOPACSAddressBookResource.java |
Updates the JAX-RS client interface to the V3 by-domain endpoint with JSON + Authorization header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0da0342fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
It looks good to me but you might want to address the AI findings @Miggets7? Do you want to add test coverage in this PR or another one? |
- Re-assert contracted-EAN scoping in processRawMessage: the V3 participant lookup resolves any sender domain, so a validly signed flex message from a participant outside this handler's contracted EAN could be applied to the asset. Drop FlexMessageType messages whose congestion point does not match the contracted EAN before any asset mutation or outbound reply. - Skip the participant API call and return empty when no OAuth2 bearer token is available, instead of sending an invalid Authorization header. - Warn when the outbound authorization header has no bearer token. - Strip trailing slashes from GOPACS_BROKER_URL so the synthesised endpoint never contains a double slash.
|
Thanks @wborn. Addressed the AI findings in 6479c1b:
Test coverage will follow in a separate PR. |
Closes #28.
Summary
GOPACSHandlerparticipant lookup from the V2 XML address book (/v2/participants/DSO?contractedEan=...) to the V3 JSON endpoint (GET /uftp-participants/v3/participants/{uftpDomainName}), with a Bearer token from the existing OAuth2 client-credentials flow (extracted into a sharedfetchBearerToken()helper).ParticipantViewDTO mirroring the V3 response schema and updateGOPACSAddressBookResourceto the new endpoint and JSON content type.DEFAULT_GOPACS_PARTICIPANT_URLtohttps://api.gopacs-services.eu(V3 host).GOPACS_BROKER_URL(defaulthttps://clc-message-broker.gopacs-services.eu) and synthesise the per-participant outbound endpoint as${GOPACS_BROKER_URL}/shapeshifter/api/v3/message. V3'sParticipantViewno longer carries anendpointfield, so without this fallbackUftpSendMessageService.sendwould NPE on outbound messages.shapeshifterVersion3.2.2 → 3.5.0.Per-ContractID / per-role handler registration via
GET /participants/contracts/{contractId}/roles/{uftpRole}is intentionally out of scope (see issue #28) and can follow up if we ever need per-Capacity-Steering-Contract handling.Deployment note
Any deployment that overrides
GOPACS_PARTICIPANT_URLmust be updated to the new V3 host:GOPACS_PARTICIPANT_URL=https://api.gopacs-services.eu(or unset to use the default).GOPACS_PARTICIPANT_URL=https://api.acc.gopacs-services.eu.If the broker host differs from the default, also set
GOPACS_BROKER_URLaccordingly.