Пример #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);
  }
Пример #2
0
 private InternalKieModule buildArtifact(Artifact artifact, ArtifactResolver resolver) {
   DependencyDescriptor dependencyDescriptor = new DependencyDescriptor(artifact);
   ReleaseId releaseId = dependencyDescriptor.getReleaseId();
   if (releaseId.isSnapshot()) {
     ((ReleaseIdImpl) releaseId).setSnapshotVersion(artifact.getVersion());
   }
   ZipKieModule kieModule = createZipKieModule(releaseId, artifact.getFile());
   if (kieModule != null) {
     addDependencies(
         kieModule, resolver, resolver.getArtifactDependecies(dependencyDescriptor.toString()));
     build(kieModule);
   }
   return kieModule;
 }
  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);
      }
    }
  }