Add error handling to improve user experience
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / controller / AnrXappController.java
index dae8ae2..2449caa 100644 (file)
@@ -70,11 +70,14 @@ public class AnrXappController {
        private final NcrtApi ncrtApi;
 
        @Autowired
-       public AnrXappController(final HealthApi healthApi, final NcrtApi ncrtApi) {
-               Assert.notNull(healthApi, "API must not be null");
-               Assert.notNull(ncrtApi, "API must not be null");
-               this.healthApi = healthApi;
-               this.ncrtApi = ncrtApi;
+       public AnrXappController(final HealthApi anrHealthApi, final NcrtApi anrNcrtApi) {
+               Assert.notNull(anrHealthApi, "API must not be null");
+               Assert.notNull(anrNcrtApi, "API must not be null");
+               this.healthApi = anrHealthApi;
+               this.ncrtApi = anrNcrtApi;
+               if (logger.isDebugEnabled())
+                       logger.debug("ctor: configured with client types {} and {}", anrHealthApi.getClass().getName(),
+                                       anrNcrtApi.getClass().getName());
        }
 
        @ApiOperation(value = "Gets the ANR client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
@@ -85,14 +88,16 @@ public class AnrXappController {
 
        @ApiOperation(value = "Performs a liveness probe on the ANR xApp, result expressed as the response code.")
        @RequestMapping(value = "/health/alive", method = RequestMethod.GET)
-       public void getAnrXappHealthAlive(HttpServletResponse response) {
+       public void getHealthAlive(HttpServletResponse response) {
+               logger.debug("getHealthAlive");
                healthApi.getHealthAlive();
                response.setStatus(healthApi.getApiClient().getStatusCode().value());
        }
 
        @ApiOperation(value = "Performs a readiness probe on the ANR xApp, result expressed as the response code.")
        @RequestMapping(value = "/health/ready", method = RequestMethod.GET)
-       public void getAnrXappHealthReady(HttpServletResponse response) {
+       public void getHealthReady(HttpServletResponse response) {
+               logger.debug("getHealthReady");
                healthApi.getHealthReady();
                response.setStatus(healthApi.getApiClient().getStatusCode().value());
        }
@@ -100,6 +105,7 @@ public class AnrXappController {
        @ApiOperation(value = "Returns list of gNodeB IDs based on NCRT in ANR", response = GgNodeBTable.class)
        @RequestMapping(value = "/gnodebs", method = RequestMethod.GET)
        public GgNodeBTable getGnodebs() {
+               logger.debug("getGnodebs");
                return ncrtApi.getgNodeB();
        }