Пример #1
0
  private static InternalKieModule fetchKModule(URL url, String fixedURL) {
    if (url.getPath().endsWith("-spring.xml")) {
      // the entire kmodule creation is happening in the kie-spring module,
      // hence we force a null return
      fetchKModuleFromSpring(url, fixedURL);
      return null;
    }
    KieModuleModel kieProject = KieModuleModelImpl.fromXML(url);

    setDefaultsforEmptyKieModule(kieProject);

    String pomProperties = getPomProperties(fixedURL);
    if (pomProperties == null) {
      log.warn(
          "Cannot find maven pom properties for this project. Using the container's default ReleaseId");
    }

    ReleaseId releaseId =
        pomProperties != null
            ? ReleaseIdImpl.fromPropertiesString(pomProperties)
            : KieServices.Factory.get().getRepository().getDefaultReleaseId();

    String rootPath = fixedURL;
    if (rootPath.lastIndexOf(':') > 0) {
      rootPath = IoUtils.asSystemSpecificPath(rootPath, rootPath.lastIndexOf(':'));
    }

    return createInternalKieModule(url, fixedURL, kieProject, releaseId, rootPath);
  }
  public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
      throws BeansException {
    log.info(":: BeanFactoryPostProcessor::postProcessBeanFactory called ::");
    if (releaseId == null && configFilePath != null) {
      fixConfigFilePathForVfs();
      String pomProperties = ClasspathKieProject.getPomProperties(configFilePath);
      releaseId = ReleaseIdImpl.fromPropertiesString(pomProperties);
      KieSpringUtils.setDefaultReleaseId(releaseId);
    }

    for (String beanDef : beanFactory.getBeanDefinitionNames()) {
      BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanDef);
      if (beanDefinition.getBeanClassName().equalsIgnoreCase(KModuleFactoryBean.class.getName())) {
        KieModuleModel kieModuleModel = fetchKieModuleModel(beanFactory);
        addKieModuleToRepo(kieModuleModel);
      }
    }
  }