+ private void validateRegistrationInfo(ServiceRegistrationInfo registrationInfo)
+ throws ServiceException, MalformedURLException {
+ if (registrationInfo.serviceName.isEmpty()) {
+ throw new ServiceException("Missing mandatory parameter 'serviceName'");
+ }
+ if (registrationInfo.keepAliveIntervalSeconds < 0) {
+ throw new ServiceException("Keepalive interval shoul be greater or equal to 0");
+ }
+ if (!registrationInfo.callbackUrl.isEmpty()) {
+ new URL(registrationInfo.callbackUrl);
+ }
+ }
+
+ @ApiOperation(value = "Register a service")
+ @ApiResponses(
+ value = { //
+ @ApiResponse(code = 200, message = "Service updated", response = String.class),
+ @ApiResponse(code = 201, message = "Service created", response = String.class), //
+ @ApiResponse(code = 400, message = "The ServiceRegistrationInfo is not accepted", response = String.class)})