-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: clean up ids-api-multipart-endpoint-v1
#1715
refactor: clean up ids-api-multipart-endpoint-v1
#1715
Conversation
19be7aa
to
189ede4
Compare
...in/java/org/eclipse/dataspaceconnector/ids/api/multipart/controller/MultipartController.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/dataspaceconnector/ids/api/multipart/controller/MultipartController.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/dataspaceconnector/ids/api/multipart/controller/MultipartController.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/dataspaceconnector/ids/api/multipart/handler/ArtifactRequestHandler.java
Outdated
Show resolved
Hide resolved
.connectorId(connectorId) | ||
.assetId(contractAgreement.getAssetId()) | ||
.contractId(contractAgreement.getId()) | ||
.properties(props) | ||
.connectorAddress(idsWebhookAddress) | ||
.build(); | ||
|
||
var result = transferProcessManager.initiateProviderRequest(dataRequest); | ||
// Initiate a transfer process for the request | ||
var transferInitiateResult = transferProcessManager.initiateProviderRequest(dataRequest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note for the future (after project structure review), here the TransferProcessService
should be used instead of the manager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @ronjaquensel, this aligns with our discussion to encapsulate some of the policy evaluation as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronjaquensel Can we either create an issue or add a TODO for this comment and the one regarding the ContractNegotiationService
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I added TODOs.
} | ||
|
||
// TODO get hash from message | ||
var output = result.getContent(); | ||
var processId = message.getTransferContract(); | ||
var negotiationResponse = negotiationManager.confirmed(claimToken, | ||
var negotiationConfirmResult = negotiationManager.confirmed(claimToken, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note for the future (after project structure review), here the ContractNegotiationService
should be used instead of the manager
...main/java/org/eclipse/dataspaceconnector/ids/api/multipart/handler/ContractOfferHandler.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
var transformedEdr = transformationResult.getContent(); | ||
|
||
// Apply all endpoint data reference receivers to the endpoint data reference | ||
var receiveResult = receiverRegistry.receiveAll(transformedEdr).join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not for this PR, but join
s should be avoided, we should think about making the handlers async to avoid blocking code
...n/java/org/eclipse/dataspaceconnector/ids/api/multipart/IdsMultipartApiServiceExtension.java
Outdated
Show resolved
Hide resolved
* | ||
* @param header the message. | ||
*/ | ||
private DynamicAttributeToken getToken(Message header) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a method that may be also needed by the MultipartSender classes? As the sender needs a DAT, too. Maybe this could be in a utils oder MessageFunctions
class in ids-core.message
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I stumbled over other duplications as well, e.g. the resolveConnectorId
method in both extension classes. Probably moving all these to ids-core
would be something for another PR, to restrict this one to the endpoint module, but I'll open an issue.
* chore: remove IdsResponseMessageFactory * chore: remove unused exceptions * chore: merge response and rejection util classes * chore: remove class IdsClientCredentialsScope * chore: do not use description sub-handlers * chore: remove sub-handler classes * chore: remove DescriptionRequestHandler interface * chore: remove DescriptionResponseMessageUtil * chore: move util classes to util package * chore: add token to all response headers * chore: add Javadoc to MultipartController * chore: move method for building description response to util * chore: return RequestInProcessMessage for artifact requests * chore: make response depend on status result from state machine * chore: do not build message in ArtifactRequestHandler * chore: rename DescriptionRequestHandler * chore: align parameter order in ResponseMessageUtil * docs: add Javadoc for ResponseMessageUtil * chore: remove unused method * docs: add Javadoc for MultipartResponseUtil * refactor: remove duplicated methods from handlers * refactor: remove MultipartResponseUtil * refactor: process status result in contract handlers * refactor: remove notification sub-handlers * chore: remove check for connector payload in MultipartController * refactor: remove superfluous claim token parameter * refactor: remove internal handle method from DescriptionRequestHandler * docs: add comments and Javadoc * refactor: make handleRequest in Handler @NotNull * chore: change rejection reason in EDR handler * chore: add required fields to test messages * test: update handler tests * test: replace tests for DescriptionRequestHandler * refactor: rename RequestUtil * chore: only store secret if TP initialized successfully * docs: update CHANGELOG.md * test: update ResponseUtilTest * chore: fix import order * chore: fix import order * refactor: return FormDataMultiPart from MultipartController * refactor: return token from method in MultipartController * chore: remove unused contract offer handler * chore: remove superfluous requireNonNull checks * refactor: inject monitor into IdsMultipartApiServiceExtension * chore: add TODOs for after project structure review
What this PR changes/adds
Cleans-up the
ids-api-multipart-endpoint-v1
module.Further notes
Changes the message type returned by the
ArtifactRequestHandler
fromResponseMessage
toRequestInProcessMessage
.Linked Issue(s)
Closes #1610
Checklist
no-changelog
)