- String module, String instance) {
- ObjectName on;
- try {
- on = ta.createModule(module, instance);
- logger.info("New instance for {} {} created under name {}", module, instance, on);
- executeStrategy(configuration, ta, on);
- } catch (InstanceAlreadyExistsException e1) {
- throw new IllegalStateException("Unable to create instance for " + module + " : " + instance);
+ String module, String instance, ServiceRegistryWrapper services) throws NetconfConfigHandlingException {
+ throw new NetconfConfigHandlingException(
+ String.format("Unable to handle missing instance, no missing instances should appear at this point, missing: %s : %s ",
+ module,
+ instance),
+ NetconfDocumentedException.ErrorType.application,
+ NetconfDocumentedException.ErrorTag.operation_failed,
+ NetconfDocumentedException.ErrorSeverity.error);
+ }
+
+ private void addRefNames(ServiceRegistryWrapper services, Multimap<String, String> providedServices, ConfigTransactionClient ta, ObjectName on) throws InstanceNotFoundException {
+ for (Entry<String, String> namespaceToService : providedServices.entries()) {
+
+ if(services.hasRefName(namespaceToService.getKey(),
+ namespaceToService.getValue(), on)){
+ continue;
+ }
+
+ String refName = services.getNewDefaultRefName(namespaceToService.getKey(), namespaceToService.getValue(),
+ ObjectNameUtil.getFactoryName(on), ObjectNameUtil.getInstanceName(on));
+ ta.saveServiceReference(
+ ta.getServiceInterfaceName(namespaceToService.getKey(), namespaceToService.getValue()), refName, on);