Search in sources :

Example 1 with DroolsCompilerComponentFactory

use of org.drools.compiler.rule.builder.DroolsCompilerComponentFactory in project drools by kiegroup.

the class KnowledgeBuilderConfigurationImpl method init.

private void init(Properties properties) {
    this.chainedProperties = ChainedProperties.getChainedProperties(getClassLoader());
    if (chainedProperties.getProperty("drools.dialect.java", null) == null) {
        // if it couldn't find a conf for java dialect using the project class loader
        // it means it could not load the conf file at all (very likely it is running in
        // an osgi environement) so try with the class loader of this class
        this.chainedProperties = ChainedProperties.getChainedProperties(getClass().getClassLoader());
        if (this.classLoader instanceof ProjectClassLoader) {
            ((ProjectClassLoader) classLoader).setDroolsClassLoader(getClass().getClassLoader());
        }
    }
    if (properties != null) {
        this.chainedProperties.addProperties(properties);
    }
    setProperty(ClassLoaderCacheOption.PROPERTY_NAME, this.chainedProperties.getProperty(ClassLoaderCacheOption.PROPERTY_NAME, "true"));
    setProperty(PropertySpecificOption.PROPERTY_NAME, this.chainedProperties.getProperty(PropertySpecificOption.PROPERTY_NAME, DEFAULT_PROP_SPEC_OPT.toString()));
    setProperty(LanguageLevelOption.PROPERTY_NAME, this.chainedProperties.getProperty(LanguageLevelOption.PROPERTY_NAME, DrlParser.DEFAULT_LANGUAGE_LEVEL.toString()));
    this.dialectConfigurations = new HashMap<String, DialectConfiguration>();
    buildDialectConfigurationMap();
    this.accumulateFunctions = AccumulateUtil.buildAccumulateFunctionsMap(chainedProperties, getClassLoader());
    buildEvaluatorRegistry();
    buildDumpDirectory();
    buildSeverityMap();
    setProperty(ProcessStringEscapesOption.PROPERTY_NAME, this.chainedProperties.getProperty(ProcessStringEscapesOption.PROPERTY_NAME, "true"));
    setProperty(DefaultPackageNameOption.PROPERTY_NAME, this.chainedProperties.getProperty(DefaultPackageNameOption.PROPERTY_NAME, "defaultpkg"));
    this.componentFactory = new DroolsCompilerComponentFactory();
    this.classBuilderFactory = new ClassBuilderFactory();
}
Also used : ProjectClassLoader(org.drools.core.common.ProjectClassLoader) DroolsCompilerComponentFactory(org.drools.compiler.rule.builder.DroolsCompilerComponentFactory) DialectConfiguration(org.drools.compiler.compiler.DialectConfiguration) ClassBuilderFactory(org.drools.core.factmodel.ClassBuilderFactory)

Aggregations

DialectConfiguration (org.drools.compiler.compiler.DialectConfiguration)1 DroolsCompilerComponentFactory (org.drools.compiler.rule.builder.DroolsCompilerComponentFactory)1 ProjectClassLoader (org.drools.core.common.ProjectClassLoader)1 ClassBuilderFactory (org.drools.core.factmodel.ClassBuilderFactory)1