package org.oransc.ric.portal.dashboard.config;
import java.lang.invoke.MethodHandles;
+import java.net.MalformedURLException;
+import java.net.URL;
import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
import org.oransc.ric.e2mgr.client.api.NodebApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
-import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
/**
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
// Populated by the autowired constructor
- private final String e2mgrBasepath;
+ private final String e2mgrUrl;
@Autowired
- public E2ManagerConfiguration(@Value("${e2mgr.basepath}") final String e2mgrBasepath) {
- Assert.notNull(e2mgrBasepath, "base path must not be null");
- logger.info("Configuring E2 Manager at base path {}", e2mgrBasepath);
- this.e2mgrBasepath = e2mgrBasepath;
+ public E2ManagerConfiguration(@Value("${e2mgr.url}") final String url) throws MalformedURLException {
+ logger.info("Configuring E2 Manager at base URL {}", url);
+ new URL(url);
+ this.e2mgrUrl = url;
}
private ApiClient apiClient() {
ApiClient apiClient = new ApiClient(new RestTemplate());
- apiClient.setBasePath(e2mgrBasepath);
+ apiClient.setBasePath(e2mgrUrl);
return apiClient;
}
@Bean
- public HealthCheckApi e2HealthCheckApi() {
+ // The bean (method) name must be globally unique
+ public HealthCheckApi e2MgrHealthCheckApi() {
return new HealthCheckApi(apiClient());
}
@Bean
- public NodebApi e2NodebApi() {
+ // The bean (method) name must be globally unique
+ public NodebApi e2MgrNodebApi() {
return new NodebApi(apiClient());
}