X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Fcontrollers%2Fr1producer%2FProducerController.java;h=29426ab02c41fdcb3beb24865896712b80839a1e;hb=366bc97828bf62e39a41318c1407a2c7c8cb5b74;hp=8d2fef9b233227100b7bc924477d2bc1fa7bebcc;hpb=495008908a7062aa8367d7ecc7dc1b91038eed77;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java index 8d2fef9b..29426ab0 100644 --- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java +++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/controllers/r1producer/ProducerController.java @@ -46,6 +46,7 @@ import org.oransc.enrichment.repository.InfoJobs; import org.oransc.enrichment.repository.InfoProducer; import org.oransc.enrichment.repository.InfoProducers; import org.oransc.enrichment.repository.InfoType; +import org.oransc.enrichment.repository.InfoTypeSubscriptions; import org.oransc.enrichment.repository.InfoTypes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; @@ -75,6 +76,9 @@ public class ProducerController { @Autowired private InfoProducers infoProducers; + @Autowired + private InfoTypeSubscriptions typeSubscriptions; + @GetMapping(path = ProducerConsts.API_ROOT + "/info-types", produces = MediaType.APPLICATION_JSON_VALUE) // @Operation(summary = "Info Type identifiers", description = "") // @ApiResponses( @@ -145,7 +149,9 @@ public class ProducerController { if (registrationInfo.jobDataSchema == null) { return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST); } - this.infoTypes.put(new InfoType(infoTypeId, registrationInfo.jobDataSchema)); + InfoType newDefinition = new InfoType(infoTypeId, registrationInfo.jobDataSchema); + this.infoTypes.put(newDefinition); + this.typeSubscriptions.notifyTypeRegistered(newDefinition); return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK); } @@ -184,6 +190,7 @@ public class ProducerController { return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE); } this.infoTypes.remove(type); + this.typeSubscriptions.notifyTypeRemoved(type); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -230,7 +237,7 @@ public class ProducerController { public ResponseEntity getInfoProducer( // @PathVariable("infoProducerId") String infoProducerId) { try { - InfoProducer producer = this.infoProducers.getProducer(infoProducerId); + InfoProducer producer = this.infoProducers.getProducer(infoProducerId); ProducerRegistrationInfo info = toProducerRegistrationInfo(producer); return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK); } catch (Exception e) {