Skip to content
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

Conversation

ronjaquensel
Copy link
Contributor

What this PR changes/adds

Cleans-up the ids-api-multipart-endpoint-v1 module.

  • Removes inheritance structure for description request handlers
  • Removes inheritance structure for notification handlers
  • Removes duplicated utility methods
  • Removes superfluous claim token parameter on handler methods
  • Unifies how responses are created

Further notes

Changes the message type returned by the ArtifactRequestHandler from ResponseMessage to RequestInProcessMessage.

Linked Issue(s)

Closes #1610

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • added relevant details to the changelog? (skip with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@ronjaquensel ronjaquensel added ids refactoring Cleaning up code and dependencies labels Jul 20, 2022
@juliapampus juliapampus requested a review from ndr-brt July 20, 2022 12:05
@ronjaquensel ronjaquensel force-pushed the chore/1610-clean-up-multipart-endpoint branch from 19be7aa to 189ede4 Compare July 20, 2022 12:15
.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);
Copy link
Member

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

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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,
Copy link
Member

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

}

var transformedEdr = transformationResult.getContent();

// Apply all endpoint data reference receivers to the endpoint data reference
var receiveResult = receiverRegistry.receiveAll(transformedEdr).join();
Copy link
Member

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 joins should be avoided, we should think about making the handlers async to avoid blocking code

@ronjaquensel ronjaquensel requested a review from ndr-brt July 20, 2022 13:32
*
* @param header the message.
*/
private DynamicAttributeToken getToken(Message header) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@ronjaquensel ronjaquensel requested a review from juliapampus July 22, 2022 07:26
@juliapampus juliapampus merged commit b71a14c into eclipse-edc:main Jul 22, 2022
@juliapampus juliapampus deleted the chore/1610-clean-up-multipart-endpoint branch July 22, 2022 12:33
diegogomez-zf pushed a commit to diegogomez-zf/DataSpaceConnector that referenced this pull request Aug 3, 2022
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Cleaning up code and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up ids-api-multipart-endpoint-v1
4 participants