Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.metaformsystems.redline.infrastructure.client.management.ManagementApiClient;
import com.metaformsystems.redline.infrastructure.client.management.dto.Asset;
import com.metaformsystems.redline.infrastructure.client.management.dto.Catalog;
import com.metaformsystems.redline.infrastructure.client.management.dto.CatalogRequest;
import com.metaformsystems.redline.infrastructure.client.management.dto.CelExpression;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractNegotiation;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractRequest;
Expand Down Expand Up @@ -253,7 +254,13 @@ public byte[] downloadData(Long participantId, String fileId, String authToken)
}

private CacheableEntry<Catalog> fetchCatalog(String participantId, String did) {
return new CacheableEntry<>(managementApiClient.getCatalog(participantId, did), Instant.now());
var counterPartyAddress = webDidResolver.resolveProtocolEndpoints(did);
var request = CatalogRequest.Builder.newInstance()
.counterPartyId(did)
.counterPartyAddress(counterPartyAddress)
.build();

return new CacheableEntry<>(managementApiClient.getCatalog(participantId, request), Instant.now());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.metaformsystems.redline.infrastructure.client.management.dto.Asset;
import com.metaformsystems.redline.infrastructure.client.management.dto.Catalog;
import com.metaformsystems.redline.infrastructure.client.management.dto.CatalogRequest;
import com.metaformsystems.redline.infrastructure.client.management.dto.CelExpression;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractAgreement;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractNegotiation;
Expand Down Expand Up @@ -77,14 +78,11 @@ public interface ManagementApiClient {
TransferProcess getTransferProcess(String participantContextId, String transferProcessId);

// Catalog
Catalog getCatalog(String participantContextId, String counterPartyId);
Catalog getCatalog(String participantContextId, CatalogRequest request);

// others
void prepareDataplane(String participantContextId, DataplaneRegistration dataplaneRegistration);

Object getData(String participantContextId, String counterPartyId, String offerId);


List<ContractNegotiation> listContracts(String participantContextId);

ContractAgreement getAgreement(String participantContextId, String negotiationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.metaformsystems.redline.domain.repository.ParticipantRepository;
import com.metaformsystems.redline.infrastructure.client.management.dto.Asset;
import com.metaformsystems.redline.infrastructure.client.management.dto.Catalog;
import com.metaformsystems.redline.infrastructure.client.management.dto.CatalogRequest;
import com.metaformsystems.redline.infrastructure.client.management.dto.CelExpression;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractAgreement;
import com.metaformsystems.redline.infrastructure.client.management.dto.ContractNegotiation;
Expand Down Expand Up @@ -274,11 +275,11 @@ public TransferProcess getTransferProcess(String participantContextId, String tr
}

@Override
public Catalog getCatalog(String participantContextId, String counterPartyDid) {
public Catalog getCatalog(String participantContextId, CatalogRequest request) {
return controlPlaneWebClient.post()
.uri("/v1alpha/participants/%s/catalog".formatted(participantContextId))
.uri("/v5beta/participants/%s/catalog/request".formatted(participantContextId))
.header("Authorization", "Bearer " + getToken(participantContextId))
.bodyValue(Map.of("counterPartyDid", counterPartyDid))
.bodyValue(request)
.retrieve()
.bodyToMono(Catalog.class)
.block();
Expand All @@ -296,20 +297,6 @@ public void prepareDataplane(String participantContextId, DataplaneRegistration
.block();
}

@Override
public Object getData(String participantContextId, String counterPartyId, String policyId) {
return controlPlaneWebClient.post()
.uri("/v1alpha/participants/%s/data".formatted(participantContextId))
.header("Authorization", "Bearer " + getToken(participantContextId))
.bodyValue(Map.of(
"providerId", counterPartyId,
"policyId", policyId))
.retrieve()
.bodyToMono(new ParameterizedTypeReference<>() {
})
.block();
}

@Override
public List<ContractNegotiation> listContracts(String participantContextId) {
return controlPlaneWebClient.post()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2026 Metaform Systems, Inc.
*
* 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:
* Metaform Systems, Inc. - initial API and implementation
*
*/

package com.metaformsystems.redline.infrastructure.client.management.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Map;

public class CatalogRequest {
@JsonProperty("@context")
private final String[] context = new String[]{
"https://w3id.org/edc/connector/management/v2",
};
@JsonProperty("@type")
private final String type = "CatalogRequest";
private String protocol = "dataspace-protocol-http:2025-1";
private String counterPartyAddress;
private String counterPartyId;

public String[] getContext() {
return context;
}

public String getType() {
return type;
}

public String getCounterPartyAddress() {
return counterPartyAddress;
}

public String getProtocol() {
return protocol;
}

public String getCounterPartyId() {
return counterPartyId;
}

public static final class Builder {
private final CatalogRequest transferRequest;

private Builder() {
transferRequest = new CatalogRequest();
}

public static Builder newInstance() {
return new Builder();
}

public Builder counterPartyAddress(String counterPartyAddress) {
transferRequest.counterPartyAddress = counterPartyAddress;
return this;
}

public Builder protocol(String protocol) {
transferRequest.protocol = protocol;
return this;
}

public Builder counterPartyId(String counterPartyId) {
transferRequest.counterPartyId = counterPartyId;
return this;
}

public CatalogRequest build() {
return transferRequest;
}
}
}
Loading
Loading