Skip to content

Commit c249b6e

Browse files
authored
odre-server and geo-data-server can now be requested through the gateway (#64)
* odre-server and geo-data-server can now be requested through the gateway Signed-off-by: bendaamerahm <[email protected]>
1 parent bac4741 commit c249b6e

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-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
@@ -47,6 +47,8 @@ public RouteLocator myRoutes(RouteLocatorBuilder builder, ApplicationContext con
4747
.route(p -> context.getBean(ReportServer.class).getRoute(p))
4848
.route(p -> context.getBean(NetworkModificationServer.class).getRoute(p))
4949
.route(p -> context.getBean(NetworkConversionServer.class).getRoute(p))
50+
.route(p -> context.getBean(OdreServer.class).getRoute(p))
51+
.route(p -> context.getBean(GeoDataServer.class).getRoute(p))
5052
.build();
5153
}
5254
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ public class ServiceURIsConfig {
7171

7272
@Value("${backing-services.network-conversion-server.base-uri:http://network-conversion-server/}")
7373
String networkConversionServerBaseUri;
74+
75+
@Value("${backing-services.odre-server.base-uri:http://odre-server/}")
76+
String odreServerBaseUri;
77+
78+
@Value("${backing-services.geo-data-server.base-uri:http://geo-data-server/}")
79+
String geoDataServerBaseUri;
7480
}
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 = GeoDataServer.ENDPOINT_NAME)
16+
public class GeoDataServer implements EndPointServer {
17+
18+
public static final String ENDPOINT_NAME = "geo-data";
19+
20+
private final ServiceURIsConfig servicesURIsConfig;
21+
22+
public GeoDataServer(ServiceURIsConfig servicesURIsConfig) {
23+
this.servicesURIsConfig = servicesURIsConfig;
24+
}
25+
26+
@Override
27+
public String getEndpointBaseUri() {
28+
return servicesURIsConfig.getGeoDataServerBaseUri();
29+
}
30+
31+
@Override
32+
public String getEndpointName() {
33+
return ENDPOINT_NAME;
34+
}
35+
}
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 = OdreServer.ENDPOINT_NAME)
16+
public class OdreServer implements EndPointServer {
17+
18+
public static final String ENDPOINT_NAME = "odre";
19+
20+
private final ServiceURIsConfig servicesURIsConfig;
21+
22+
public OdreServer(ServiceURIsConfig servicesURIsConfig) {
23+
this.servicesURIsConfig = servicesURIsConfig;
24+
}
25+
26+
@Override
27+
public String getEndpointBaseUri() {
28+
return servicesURIsConfig.getOdreServerBaseUri();
29+
}
30+
31+
@Override
32+
public String getEndpointName() {
33+
return ENDPOINT_NAME;
34+
}
35+
}

src/main/resources/application-local.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,8 @@ backing-services:
3636
base-uri: http://localhost:5007
3737
network-conversion-server:
3838
base-uri: http://localhost:5003
39+
odre-server:
40+
base-uri: http://localhost:8090
41+
geo-data-server:
42+
base-uri: http://localhost:8087
3943

0 commit comments

Comments
 (0)