public KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration() { return new PackageBuilderConfiguration(); }
public KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties, ClassLoader... classLoaders) { return new PackageBuilderConfiguration(properties, classLoaders); }
private KnowledgeBuilder getConfiguredBuilder() { Properties properties = new Properties(); properties.setProperty("drools.dialect.java.compiler", "JANINO"); PackageBuilderConfiguration conf = new PackageBuilderConfiguration(properties); KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf); return builder; } }
private KnowledgeBuilder getConfiguredBuilder() { Properties properties = new Properties(); properties.setProperty("drools.dialect.java.compiler", "JANINO"); PackageBuilderConfiguration conf = new PackageBuilderConfiguration(properties); KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf); return builder; } }
ClassLoader classLoader = this.getClass().getClassLoader(); PackageBuilderConfiguration configuration = new PackageBuilderConfiguration(); configuration.setClassLoader(classLoader); PackageBuilder builder = new PackageBuilder(configuration); builder.addPackageFromDrl(source); RuleBaseConfiguration ruleBaseConfiguration = new RuleBaseConfiguration(); ruleBaseConfiguration.setClassLoader(classLoader); ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfiguration); ruleBase.addPackage(builder.getPackage());
public PackageBuilder( RuleBase ruleBase, PackageBuilderConfiguration configuration ) { if (configuration == null) { this.configuration = new PackageBuilderConfiguration(); } else { this.configuration = configuration; } if (ruleBase != null) { this.rootClassLoader = ( (InternalRuleBase) ruleBase ).getRootClassLoader(); } else { this.rootClassLoader = this.configuration.getClassLoader(); } this.rootClassLoader.addClassLoader(getClass().getClassLoader()); this.dateFormats = null;//(DateFormats) this.environment.get( EnvironmentName.DATE_FORMATS ); if (this.dateFormats == null) { this.dateFormats = new DateFormatsImpl(); //this.environment.set( EnvironmentName.DATE_FORMATS , this.dateFormats ); } // FIXME, we need to get drools to support "default" namespace. //this.defaultNamespace = pkg.getName(); this.defaultDialect = this.configuration.getDefaultDialect(); this.pkgRegistryMap = new LinkedHashMap<String, PackageRegistry>(); this.results = new ArrayList<KnowledgeBuilderResult>(); this.ruleBase = (ReteooRuleBase) ruleBase; globals = new HashMap<String, Class<?>>(); processBuilder = createProcessBuilder(); builtinTypes = new HashMap<String, TypeDeclaration>(); initBuiltinTypeDeclarations(); }
public PackageBuilder( Package pkg, PackageBuilderConfiguration configuration ) { if (configuration == null) { this.configuration = new PackageBuilderConfiguration(); } else { this.configuration = configuration; } this.dateFormats = null;//(DateFormats) this.environment.get( EnvironmentName.DATE_FORMATS ); if (this.dateFormats == null) { this.dateFormats = new DateFormatsImpl(); //this.environment.set( EnvironmentName.DATE_FORMATS , this.dateFormats ); } this.rootClassLoader = this.configuration.getClassLoader(); this.rootClassLoader.addClassLoader( getClass().getClassLoader() ); this.defaultDialect = this.configuration.getDefaultDialect(); this.pkgRegistryMap = new LinkedHashMap<String, PackageRegistry>(); this.results = new ArrayList<KnowledgeBuilderResult>(); PackageRegistry pkgRegistry = new PackageRegistry( this, pkg ); pkgRegistry.setDialect( this.defaultDialect ); this.pkgRegistryMap.put( pkg.getName(), pkgRegistry ); globals = new HashMap<String, Class<?>>(); processBuilder = createProcessBuilder(); builtinTypes = new HashMap<String, TypeDeclaration>(); initBuiltinTypeDeclarations(); }
@Create public void compileRuleBase() throws Exception PackageBuilderConfiguration conf = new PackageBuilderConfiguration(); PackageBuilder builder = new PackageBuilder(conf);