public static RuleBase newRuleBase(final String rulebaseId, final int type) { return RuleBaseFactory.newRuleBase( rulebaseId, type, null ); }
/** Create a new default rule base (RETEOO type engine) */ public static RuleBase newRuleBase() { return RuleBaseFactory.newRuleBase( RuleBase.RETEOO, null ); }
public static RuleBase newRuleBase( final String rulebaseId ) { return RuleBaseFactory.newRuleBase( rulebaseId, RuleBase.RETEOO, null ); }
/** * This will create a new default rulebase (which is initially empty). * Optional parent classLoader for the Package's internal ClassLoader * is Thread.currentThread.getContextClassLoader() */ public BinaryRuleBaseLoader() { this( RuleBaseFactory.newRuleBase(), null ); }
public static RuleBase newRuleBase(final String rulebaseId, final RuleBaseConfiguration config) { return RuleBaseFactory.newRuleBase( rulebaseId, RuleBase.RETEOO, config ); }
public static RuleBase newRuleBase(final int type) { return RuleBaseFactory.newRuleBase( type, null ); }
public static RuleBase newRuleBase(final RuleBaseConfiguration config) { return RuleBaseFactory.newRuleBase( RuleBase.RETEOO, config ); }
/** Create a new RuleBase of the appropriate type */ public static RuleBase newRuleBase(final int type, final RuleBaseConfiguration config) { return RuleBaseFactory.newRuleBase( UUID.randomUUID().toString(), type, config ); }
public KnowledgeBase newKnowledgeBase(String kbaseId, KnowledgeBaseConfiguration conf) { return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase( kbaseId, ( RuleBaseConfiguration ) conf ) ); }
public KnowledgeBase newKnowledgeBase( String kbaseId ) { return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase(kbaseId) ); }
public KnowledgeBase newKnowledgeBase() { return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase() ); }
public KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) { return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase( ( RuleBaseConfiguration ) conf ) ); }
private synchronized PackageChangeInfo checkForChanges(PackageProvider prov) { listener.debug( "SCANNING FOR CHANGE " + prov.toString() ); if ( this.ruleBase == null ) ruleBase = RuleBaseFactory.newRuleBase( this.ruleBaseConf ); PackageChangeInfo info = prov.loadPackageChanges(); return info; }
/** * Drools initialization */ protected void doInit() { // Workaround for https://issues.jboss.org/browse/DROOLS-329 TODO: Remove when not needed or move to better place System.setProperty("drools.dialect.java.compiler", "JANINO"); RuleBaseConfiguration ruleBaseConfig = new RuleBaseConfiguration(DroolsPolicy.class.getClassLoader()); this.ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfig); this.packageBuilder = new PackageBuilder(this.ruleBase); // Add DRL with functions InputStream functionsFileStream = DroolsPolicy.class.getClassLoader().getResourceAsStream("templates/DroolsPolicyFunctions.drl"); Reader functionsFileReader = new InputStreamReader(functionsFileStream); addPackage(functionsFileReader); }
listener.info( "Creating a new rulebase as per settings." ); this.ruleBase = RuleBaseFactory.newRuleBase( this.ruleBaseConf );
private RuleBase makeRuleBase(final PackageBuilder builder) throws CheckedDroolsException { if ( builder.hasErrors() ) { throw new CheckedDroolsException( "There were errors in the rule source: " + builder.getErrors().toString() ); } final Package binaryPackage = builder.getPackage(); final RuleBase rb = RuleBaseFactory.newRuleBase( RuleBaseLoader.engineType ); try { rb.addPackage( binaryPackage ); } catch ( final Exception e ) { throw new CheckedDroolsException( "Unable to add compiled package to rulebase. Nested error is: " + e.getMessage() ); } return rb; }
/** * Return a wm ready to go based on the rules in a drl at the specified uri (in the classpath). */ public StatefulSession getWorkingMemory(String uri) throws DroolsParserException, IOException, Exception { PackageBuilder builder = new PackageBuilder(); builder.addPackageFromDrl(new InputStreamReader(this.getClass() .getResourceAsStream(uri))); assertFalse(builder.getErrors().toString(), builder.hasErrors()); RuleBase rb = RuleBaseFactory.newRuleBase(); rb.addPackage(builder.getPackage()); SessionConfiguration conf = new SessionConfiguration(); conf.setClockType( ClockType.PSEUDO_CLOCK ); StatefulSession wm = rb.newStatefulSession( conf, null ); return wm; } }
RuleBaseConfiguration rbconf = new RuleBaseConfiguration(); rbconf.setConsequenceExceptionHandler(consequenceExceptionHandler.getValue().toString()); ruleBase = RuleBaseFactory.newRuleBase( rbconf ); ruleBase = RuleBaseFactory.newRuleBase();