Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
 public String getExtensionBeanNameFromComponent(Component component) {
   Component.Extension extension =
       component.getExtensionByExtensionInterface(ExtensionInterface.CONFIGURATION_LOADER);
   if (extension == null) {
     log.error(
         "Encountered a custom component with no configuration loader extension: " + component);
     throw new InitializationException(
         "Unable to load configuration for custom component " + component.getName());
   }
   return extension.getImplementationKey();
 }
Exemplo n.º 3
0
  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);
  }