Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2696

KnowledgeBaseDefinitionParser Should Always Create KnowledgeBaseOptionsConfiguration

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Low

    Description

      KnowledgeBaseOptionsConfiguration:

      • <p>
      • This class will automatically load default values from a number of places, accumulating properties from each location.
      • This list of locations, in given priority is:
      • System properties, home directory, working directory, META-INF/ of optionally provided classLoader
      • META-INF/ of Thread.currentThread().getContextClassLoader() and META-INF/ of ClassLoader.getSystemClassLoader()
      • </p>

      Since this properties are only read when "RuleBaseConfiguration" ( KnowledgeBaseOptionsConfiguration implementor ) is constructed, this does not apply/work in case KnowledgeBase is defined via Spring without a <drools:configuration> due to the current sequence of events in "KnowledgeBaseDefinitionParser":

      Element kbaseConf = DomUtils.getChildElementByTagName(element, "configuration");
      if ( kbaseConf != null )

      { BeanDefinitionBuilder rbaseConfBuilder = BeanDefinitionBuilder.rootBeanDefinition( RuleBaseConfiguration.class ); // ... ... ... factory.addPropertyValue( "conf", rbaseConfBuilder.getBeanDefinition() ); }

      To fix it, RuleBaseConfiguration ( which implements KnowledgeBaseOptionsConfiguration ) should be created even though "<drools:configuration>" was not provided ( kbaseConf == null ):

      Element kbaseConf = DomUtils.getChildElementByTagName(element, "configuration");
      BeanDefinitionBuilder rbaseConfBuilder = BeanDefinitionBuilder.rootBeanDefinition( RuleBaseConfiguration.class );
      if ( kbaseConf != null )

      { // ... ... ... }

      factory.addPropertyValue( "conf", rbaseConfBuilder.getBeanDefinition() );

      Thank you,
      /Anatoly

      Attachments

        Activity

          People

            salaboy@gmail.com Mauricio Salatino (Inactive)
            Anat0ly Anatoly Polinsky (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                PagerDuty