- String module, String instance) {
- try {
- ObjectName on = ta.createModule(module, instance);
- logger.debug("New instance for {} {} created under name {}", module, instance, on);
- executeStrategy(configuration, ta, on);
- } catch (InstanceAlreadyExistsException e) {
- logger.warn("Error creating instance {}:{}, replace failed", module, instance, e);
- throw new IllegalStateException("Unable to create new instance for " + module + " : " + instance, e);
+ String module, String instance, ServiceRegistryWrapper services) {
+ throw new IllegalStateException(
+ "Unable to handle missing instance, no missing instances should appear at this point, missing: "
+ + module + ":" + instance);
+ }
+
+ 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);