use of org.platformlayer.service.federation.v1.FederatedServiceMap in project platformlayer by platformlayer.
the class FederatedPlatformLayerClient method buildFederationConfiguration.
// public static FederationMap buildFederationMap(HttpStrategy httpStrategy, TypedPlatformLayerClient localClient,
// TypedItemMapper mapper) throws OpsException {
// FederationConfiguration federationMapConfig = buildFederationConfiguration(localClient);
//
// FederationMap federationMap = new FederationMap(httpStrategy, mapper, federationMapConfig);
//
// if (localClient != null) {
// federationMap.addDefault(localClient);
// }
//
// return federationMap;
// }
public static FederationConfiguration buildFederationConfiguration(TypedPlatformLayerClient localClient) throws OpsException {
FederationConfiguration federationMapConfig = new FederationConfiguration();
String federationNamespace = "http://platformlayer.org/service/federation/v1.0";
boolean federationEnabled = isServiceEnabled(localClient, federationNamespace);
if (federationEnabled) {
for (FederatedService service : localClient.listItems(FederatedService.class)) {
PlatformLayerConnectionConfiguration config = new PlatformLayerConnectionConfiguration();
config.key = service.getKey();
config.secret = service.getSecret();
config.authenticationEndpoint = service.getServer();
config.tenant = service.getTenant();
config.username = service.getUsername();
config.platformlayerEndpoint = service.getServer();
federationMapConfig.systems.add(config);
}
for (FederatedServiceMap map : localClient.listItems(FederatedServiceMap.class)) {
FederationRule rule = new FederationRule();
rule.target = map.getTarget();
rule.serviceType = map.getServiceType();
federationMapConfig.rules.add(rule);
}
}
return federationMapConfig;
}
Aggregations