Search in sources :

Example 11 with FederationKey

use of org.platformlayer.ids.FederationKey in project platformlayer by platformlayer.

the class FederationMap method buildRules.

private void buildRules(FederationConfiguration config) {
    for (FederationRule federationRule : config.rules) {
        Rule rule = new Rule();
        rule.mappedItems = PlatformLayerKey.fromServiceAndItem(federationRule.serviceType, null);
        for (PlatformLayerConnectionConfiguration system : config.systems) {
            if (Objects.equal(system.key, federationRule.target)) {
                if (rule.targetKey != null) {
                    throw new IllegalStateException();
                }
                FederationKey host = FederationKey.build(system.authenticationEndpoint);
                ProjectId project = new ProjectId(system.tenant);
                rule.targetKey = new FederationMapping(host, project);
            }
        }
        if (rule.targetKey == null) {
            throw new IllegalStateException();
        }
        addRule(rule);
    }
}
Also used : FederationRule(org.platformlayer.federation.model.FederationRule) PlatformLayerConnectionConfiguration(org.platformlayer.federation.model.PlatformLayerConnectionConfiguration) ProjectId(org.platformlayer.ids.ProjectId) FederationRule(org.platformlayer.federation.model.FederationRule) FederationKey(org.platformlayer.ids.FederationKey)

Example 12 with FederationKey

use of org.platformlayer.ids.FederationKey in project platformlayer by platformlayer.

the class FederationMap method buildDefault.

private FederationMapping buildDefault(PlatformLayerKey original) {
    FederationKey targetHost = original.getHost();
    if (targetHost == null) {
        targetHost = FederationKey.LOCAL;
    }
    ProjectId targetProject = original.getProject();
    return new FederationMapping(targetHost, targetProject);
}
Also used : ProjectId(org.platformlayer.ids.ProjectId) FederationKey(org.platformlayer.ids.FederationKey)

Aggregations

FederationKey (org.platformlayer.ids.FederationKey)12 ProjectId (org.platformlayer.ids.ProjectId)11 ServiceType (org.platformlayer.ids.ServiceType)6 PlatformLayerKey (org.platformlayer.core.model.PlatformLayerKey)5 ItemType (org.platformlayer.ids.ItemType)5 ManagedItemId (org.platformlayer.ids.ManagedItemId)4 ServiceInfo (org.platformlayer.core.model.ServiceInfo)2 PlatformLayerConnectionConfiguration (org.platformlayer.federation.model.PlatformLayerConnectionConfiguration)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Map (java.util.Map)1 PlatformLayerClient (org.platformlayer.PlatformLayerClient)1 RepositoryException (org.platformlayer.RepositoryException)1 TypedPlatformLayerClient (org.platformlayer.TypedPlatformLayerClient)1 FederatedPlatformLayerClient (org.platformlayer.federation.FederatedPlatformLayerClient)1 FederationMap (org.platformlayer.federation.FederationMap)1 FederationMapping (org.platformlayer.federation.FederationMapping)1 FederationConfiguration (org.platformlayer.federation.model.FederationConfiguration)1 FederationRule (org.platformlayer.federation.model.FederationRule)1 ProjectAuthorization (org.platformlayer.model.ProjectAuthorization)1