[jboss-jira] [JBoss JIRA] Created: (JBRULES-2696) KnowledgeBaseDefinitionParser Should Always Create KnowledgeBaseOptionsConfiguration

Anatoly Polinsky (JIRA) jira-events at lists.jboss.org
Wed Sep 15 14:42:28 EDT 2010


KnowledgeBaseDefinitionParser Should Always Create KnowledgeBaseOptionsConfiguration
------------------------------------------------------------------------------------

                 Key: JBRULES-2696
                 URL: https://jira.jboss.org/browse/JBRULES-2696
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: All
    Affects Versions: 5.1.1.FINAL
         Environment: N/A
            Reporter: Anatoly Polinsky
            Assignee: Mark Proctor


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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list