Skip to content

Commit

Permalink
Add SM interfaces for getting subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
vthglyk committed Jul 27, 2018
1 parent 2b97c23 commit 823e6e5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
24 changes: 20 additions & 4 deletions src/main/java/eu/h2020/symbiote/client/feign/FeignSMClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import eu.h2020.symbiote.security.communication.ApacheCommonsLogger4Feign;
import eu.h2020.symbiote.security.communication.payloads.AAM;
import eu.h2020.symbiote.security.handler.ISecurityHandler;
import feign.Feign;
import feign.Headers;
import feign.Logger;
import feign.RequestLine;
import feign.*;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -57,9 +55,27 @@ public void subscribe(Subscription subscription) {
this.smClient.subscribe(subscription);
}

@Override
public List<Subscription> getAllSubscriptions() {
return this.smClient.getAllSubscriptions();
}

@Override
public Subscription getPlatformSubscription(String platformId) {
return this.smClient.getPlatformSubscription(platformId);
}

private interface SubscriptionManagerI {
@RequestLine("POST /subscribe ")
@Headers({"Accept: application/json", "Content-Type: application/json"})
void subscribe(Subscription subscription);

@RequestLine("GET /subscriptions ")
@Headers({"Accept: application/json", "Content-Type: application/json"})
List<Subscription> getAllSubscriptions();

@RequestLine("GET /subscription/{platformId} ")
@Headers({"Accept: application/json", "Content-Type: application/json"})
Subscription getPlatformSubscription(@Param("platformId") String platformId);
}
}
19 changes: 18 additions & 1 deletion src/main/java/eu/h2020/symbiote/client/interfaces/SMClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import eu.h2020.symbiote.cloud.model.internal.Subscription;

import java.util.List;

/**
* Interface for querying the platform Subscription Manager component
*
Expand All @@ -10,9 +12,24 @@
public interface SMClient {

/**
* Queries the Platform Registry component with home token
* Queries the Subscription Manager component
*
* @param subscription the subscription request send to the Subscription Manager
*/
void subscribe(Subscription subscription);

/**
* Queries the Subscription Manager component about the current subscriptions
*
* @return the list of current subscriptions
*/
List<Subscription> getAllSubscriptions();

/**
* Queries Subscription Manager for the subscription of the specified platform
*
* @param platformId the id of the platform
* @return the current platform subscription
*/
Subscription getPlatformSubscription(String platformId);
}

0 comments on commit 823e6e5

Please sign in to comment.