use of org.drools.core.factmodel.ClassBuilderFactory in project drools by kiegroup.
the class AbstractTraitFactory method setMode.
protected static void setMode(VirtualPropertyMode newMode, KieComponentFactory rcf) {
ClassBuilderFactory cbf = rcf.getClassBuilderFactory();
rcf.getTraitFactory().mode = newMode;
switch(newMode) {
case MAP:
if (!(cbf.getPropertyWrapperBuilder() instanceof TraitMapProxyClassBuilderImpl)) {
cbf.setPropertyWrapperBuilder(new TraitMapPropertyWrapperClassBuilderImpl());
}
if (!(cbf.getTraitProxyBuilder() instanceof TraitMapProxyClassBuilderImpl)) {
cbf.setTraitProxyBuilder(new TraitMapProxyClassBuilderImpl());
}
break;
case TRIPLES:
if (!(cbf.getPropertyWrapperBuilder() instanceof TraitTriplePropertyWrapperClassBuilderImpl)) {
cbf.setPropertyWrapperBuilder(new TraitTriplePropertyWrapperClassBuilderImpl());
}
if (!(cbf.getTraitProxyBuilder() instanceof TraitTripleProxyClassBuilderImpl)) {
cbf.setTraitProxyBuilder(new TraitTripleProxyClassBuilderImpl());
}
break;
default:
throw new RuntimeException(" This should not happen : unexpected property wrapping method " + newMode);
}
}
use of org.drools.core.factmodel.ClassBuilderFactory 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();
}
Aggregations