private BlockingService processBlockingConfiguration(MpiConfigDocument configuration) { checkConfiguration(configuration); if (configuration.getMpiConfig().getBlockingConfigurationArray() == null) { return null; } int count = configuration.getMpiConfig().getBlockingConfigurationArray().length; BlockingService blockingService = null; for (int i = 0; i < count; i++) { BlockingConfigurationType obj = configuration.getMpiConfig().getBlockingConfigurationArray(i); if (obj == null) { log.warn("No blocking service configuration has been specified."); return null; } log.debug("Object is of type: " + obj.getDomNode().getNamespaceURI()); String namespaceUriStr = obj.getDomNode().getNamespaceURI(); URI namespaceURI = getNamespaceURI(namespaceUriStr); String resourcePath = generateComponentResourcePath(namespaceURI); Component component = loadAndRegisterComponentFromNamespaceUri(resourcePath); String configurationLoaderBean = getExtensionBeanNameFromComponent(component); ConfigurationLoader loader = (ConfigurationLoader) Context.getApplicationContext().getBean(configurationLoaderBean); loader.loadAndRegisterComponentConfiguration(this, obj); Component.Extension extension = component.getExtensionByExtensionInterface(ExtensionInterface.IMPLEMENTATION); if (extension == null) { log.error( "Encountered a custom blocking component with no implementation extension: " + component); throw new InitializationException( "Unable to locate an implementation component for custom blocking component " + component.getName()); } log.debug( "Registering implementation of blocking component named " + extension.getName() + " and implementation key " + extension.getImplementationKey()); blockingService = (BlockingService) Context.getApplicationContext().getBean(extension.getImplementationKey()); String entity = loader.getComponentEntity(); log.info("Registering blocking service " + blockingService + " for entity " + entity); Context.registerCustomBlockingService(entity, blockingService); } return blockingService; }
private void processSingleBestRecordConfiguration(MpiConfigDocument configuration) { checkConfiguration(configuration); if (configuration.getMpiConfig().sizeOfSingleBestRecordArray() == 0) { log.warn("No single best record configuration has been specified."); return; } SingleBestRecordType obj = configuration.getMpiConfig().getSingleBestRecordArray(0); log.debug("Object is of type: " + obj.getDomNode().getNamespaceURI()); String namespaceUriStr = obj.getDomNode().getNamespaceURI(); URI namespaceURI = getNamespaceURI(namespaceUriStr); String resourcePath = generateComponentResourcePath(namespaceURI); Component component = loadAndRegisterComponentFromNamespaceUri(resourcePath); String configurationLoaderBean = getExtensionBeanNameFromComponent(component); ConfigurationLoader loader = (ConfigurationLoader) Context.getApplicationContext().getBean(configurationLoaderBean); loader.loadAndRegisterComponentConfiguration(this, obj); Component.Extension extension = component.getExtensionByExtensionInterface(ExtensionInterface.IMPLEMENTATION); if (extension == null) { log.error( "Encountered a custom single best record component with no implementation extension: " + component); throw new InitializationException( "Unable to locate an implementation component for custom single best record component " + component.getName()); } log.debug( "Registering implementation of single best record component named " + extension.getName() + " and implementation key " + extension.getImplementationKey()); SingleBestRecordService singleBestRecordService = (SingleBestRecordService) Context.getApplicationContext().getBean(extension.getImplementationKey()); Context.registerCustomSingleBestRecordService(singleBestRecordService); }