-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement validation on negotiation DSP endpoints (#3370)
- Loading branch information
Showing
18 changed files
with
737 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...clipse/edc/protocol/dsp/negotiation/api/validation/ContractAgreementMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.agreement.ContractAgreementMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractAgreementMessage} Json-LD representation | ||
*/ | ||
public class ContractAgreementMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_AGREEMENT_MESSAGE)) | ||
.build(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...rotocol/dsp/negotiation/api/validation/ContractAgreementVerificationMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.agreement.ContractAgreementVerificationMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractAgreementVerificationMessage} Json-LD representation | ||
*/ | ||
public class ContractAgreementVerificationMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_AGREEMENT_VERIFICATION_MESSAGE)) | ||
.build(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...edc/protocol/dsp/negotiation/api/validation/ContractNegotiationEventMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.agreement.ContractNegotiationEventMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractNegotiationEventMessage} Json-LD representation | ||
*/ | ||
public class ContractNegotiationEventMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_NEGOTIATION_EVENT_MESSAGE)) | ||
.build(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...otocol/dsp/negotiation/api/validation/ContractNegotiationTerminationMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractNegotiationTerminationMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractNegotiationTerminationMessage} Json-LD representation | ||
*/ | ||
public class ContractNegotiationTerminationMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_NEGOTIATION_TERMINATION_MESSAGE)) | ||
.build(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...rg/eclipse/edc/protocol/dsp/negotiation/api/validation/ContractOfferMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractOfferMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_OFFER_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractOfferMessage} Json-LD representation | ||
*/ | ||
public class ContractOfferMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_OFFER_MESSAGE)) | ||
.build(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../eclipse/edc/protocol/dsp/negotiation/api/validation/ContractRequestMessageValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.api.validation; | ||
|
||
import jakarta.json.JsonObject; | ||
import org.eclipse.edc.connector.contract.spi.types.negotiation.ContractRequestMessage; | ||
import org.eclipse.edc.validator.jsonobject.JsonObjectValidator; | ||
import org.eclipse.edc.validator.jsonobject.validators.TypeIs; | ||
import org.eclipse.edc.validator.spi.Validator; | ||
|
||
import static org.eclipse.edc.protocol.dsp.type.DspNegotiationPropertyAndTypeNames.DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE; | ||
|
||
/** | ||
* Validator for {@link ContractRequestMessage} Json-LD representation | ||
*/ | ||
public class ContractRequestMessageValidator { | ||
public static Validator<JsonObject> instance() { | ||
return JsonObjectValidator.newValidator() | ||
.verify(path -> new TypeIs(path, DSPACE_TYPE_CONTRACT_REQUEST_MESSAGE)) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.