Skip to content

Commit a1419aa

Browse files
authored
cgmes-gl-server can now be requested through the gateway (#67)
1 parent 09f3ffc commit a1419aa

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

src/main/java/org/gridsuite/gateway/GatewayConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.gridsuite.gateway;
88

9+
import org.gridsuite.gateway.endpoints.CgmesGlServer;
910
import org.gridsuite.gateway.endpoints.*;
1011
import org.springframework.cloud.gateway.route.RouteLocator;
1112
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
@@ -49,6 +50,7 @@ public RouteLocator myRoutes(RouteLocatorBuilder builder, ApplicationContext con
4950
.route(p -> context.getBean(NetworkConversionServer.class).getRoute(p))
5051
.route(p -> context.getBean(OdreServer.class).getRoute(p))
5152
.route(p -> context.getBean(GeoDataServer.class).getRoute(p))
53+
.route(p -> context.getBean(CgmesGlServer.class).getRoute(p))
5254
.build();
5355
}
5456
}

src/main/java/org/gridsuite/gateway/ServiceURIsConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ public class ServiceURIsConfig {
7777

7878
@Value("${backing-services.geo-data-server.base-uri:http://geo-data-server/}")
7979
String geoDataServerBaseUri;
80+
81+
@Value("${backing-services.cgmes-gl-server.base-uri:http://cgmes-gl-server/}")
82+
String cgmesGlServerBaseUri;
8083
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright (c) 2022, RTE (http://www.rte-france.com)
3+
This Source Code Form is subject to the terms of the Mozilla Public
4+
License, v. 2.0. If a copy of the MPL was not distributed with this
5+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.gateway.endpoints;
8+
9+
import org.gridsuite.gateway.ServiceURIsConfig;
10+
import org.springframework.stereotype.Component;
11+
12+
/**
13+
* @author bendaamerahm <ahmed.bendaamer at rte-france.com>
14+
*/
15+
@Component(value = CgmesGlServer.ENDPOINT_NAME)
16+
public class CgmesGlServer implements EndPointServer {
17+
18+
public static final String ENDPOINT_NAME = "cgmes-gl";
19+
20+
private final ServiceURIsConfig servicesURIsConfig;
21+
22+
public CgmesGlServer(ServiceURIsConfig servicesURIsConfig) {
23+
this.servicesURIsConfig = servicesURIsConfig;
24+
}
25+
26+
@Override
27+
public String getEndpointBaseUri() {
28+
return servicesURIsConfig.getCgmesGlServerBaseUri();
29+
}
30+
31+
@Override
32+
public String getEndpointName() {
33+
return ENDPOINT_NAME;
34+
}
35+
}

src/main/resources/application-local.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ backing-services:
4040
base-uri: http://localhost:8090
4141
geo-data-server:
4242
base-uri: http://localhost:8087
43+
cgmes-gl-server:
44+
base-uri: http://localhost:8095
4345

0 commit comments

Comments
 (0)