-
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(dsp-negotiation): implement spi module
- Loading branch information
1 parent
116a591
commit a9005e6
Showing
4 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...on-spi/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/spi/NegotiationApiPath.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,27 @@ | ||
/* | ||
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering | ||
* | ||
* 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: | ||
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.spi; | ||
|
||
public interface NegotiationApiPath { | ||
|
||
String BASE_PATH = "/negotiations/"; | ||
String INITIAL_CONTRACT_REQUEST = "request"; | ||
String CONTRACT_REQUEST = "/request"; | ||
String CONTRACT_OFFER = "/offers"; | ||
String EVENT = "/events"; | ||
String AGREEMENT = "/agreement"; | ||
String VERIFICATION = "/verification"; | ||
String TERMINATION = "/termination"; | ||
} |
22 changes: 22 additions & 0 deletions
22
...n-spi/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/spi/NegotiationProperty.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,22 @@ | ||
/* | ||
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering | ||
* | ||
* 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: | ||
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.spi; | ||
|
||
public interface NegotiationProperty { | ||
|
||
String DELIMITER = ":"; | ||
String PROCESS_ID = "processId"; | ||
String EVENT_TYPE = "eventType"; | ||
} |
86 changes: 86 additions & 0 deletions
86
...pi/src/main/java/org/eclipse/edc/protocol/dsp/negotiation/spi/types/NegotiationError.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,86 @@ | ||
/* | ||
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering | ||
* | ||
* 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: | ||
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.spi.types; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@JsonTypeName("dspace:ContractNegotiationError") | ||
@JsonDeserialize(builder = NegotiationError.Builder.class) | ||
public class NegotiationError { | ||
|
||
private String processId; | ||
|
||
private String code; | ||
|
||
private List<String> reasons; // TODO should be object? | ||
|
||
@JsonProperty("dspace:processId") | ||
public String getProcessId() { | ||
return processId; | ||
} | ||
|
||
@JsonProperty("dspace:code") | ||
public String getCode() { | ||
return code; | ||
} | ||
|
||
@JsonProperty("dspace:reason") | ||
public List<String> getReasons() { | ||
return reasons; | ||
} | ||
|
||
@JsonPOJOBuilder(withPrefix = "") | ||
public static class Builder { | ||
private final NegotiationError error; | ||
|
||
private Builder() { | ||
error = new NegotiationError(); | ||
} | ||
|
||
@JsonCreator | ||
public static NegotiationError.Builder newInstance() { | ||
return new NegotiationError.Builder(); | ||
} | ||
|
||
public NegotiationError.Builder processId(String processId) { | ||
error.processId = processId; | ||
return this; | ||
} | ||
|
||
public NegotiationError.Builder code(String code) { | ||
error.code = code; | ||
return this; | ||
} | ||
|
||
public NegotiationError.Builder reasons(List<String> reasons) { | ||
error.reasons = reasons; | ||
return this; | ||
} | ||
|
||
public NegotiationError build() { | ||
Objects.requireNonNull(error.processId, "The processId must be specified"); | ||
Objects.requireNonNull(error.code, "The code must be specified"); | ||
|
||
return error; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...rc/main/java/org/eclipse/edc/protocol/dsp/negotiation/spi/types/NegotiationEventType.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,22 @@ | ||
/* | ||
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering | ||
* | ||
* 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: | ||
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.negotiation.spi.types; | ||
|
||
public interface NegotiationEventType { | ||
|
||
String ACCEPTED = "ACCEPTED"; | ||
String FINALIZED = "FINALIZED"; | ||
|
||
} |