org.drools.builder
Class KnowledgeBuilderFactory

java.lang.Object
  extended by org.drools.builder.KnowledgeBuilderFactory

public class KnowledgeBuilderFactory
extends Object

This factory is used to build the knowledge base resources that are held collectively in KnowledgePackages. The KnowledgePackage also provides the role of 'namespacing'. An optional KnowlegeBuilderConfiguration can be supplied. The KnowledgeBuilderConfiguration is itself created from this factory. The KnowledgeBuilderConfiguration allows you to set the ClassLoader to be used along with other setting like the default dialect and compiler, as well as many other options.

 KnowledgeBuilder kbuilder = KnowlegeBuilderFactory.newKnowledgeBuilder();
 


Constructor Summary
KnowledgeBuilderFactory()
           
 
Method Summary
static DecisionTableConfiguration newDecisionTableConfiguration()
          DecisionTable resources require a ResourceConfiguration, that configuration instance is created here.
static JaxbConfiguration newJaxbConfiguration(com.sun.tools.xjc.Options xjcOpts, String systemId)
           
static KnowledgeBuilder newKnowledgeBuilder()
          Create and return a new KnowledgeBuilder, using the default KnowledgeBuilderConfigurations
static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase)
           
static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase, KnowledgeBuilderConfiguration conf)
           
static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf)
          Create and return a new KnowledgeBuilder, using he given KnowledgeBuilderConfigurations
static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration()
          Create a KnowledgeBuilderConfiguration on which properties can be set.
static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties, ClassLoader... classLoaders)
          Create a KnowledgeBuilderConfiguration on which properties can be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnowledgeBuilderFactory

public KnowledgeBuilderFactory()
Method Detail

newKnowledgeBuilder

public static KnowledgeBuilder newKnowledgeBuilder()
Create and return a new KnowledgeBuilder, using the default KnowledgeBuilderConfigurations

Returns:
The KnowledgeBuilder

newKnowledgeBuilder

public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf)
Create and return a new KnowledgeBuilder, using he given KnowledgeBuilderConfigurations

Returns:
The KnowledgeBuilder

newKnowledgeBuilder

public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase)

newKnowledgeBuilder

public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase,
                                                   KnowledgeBuilderConfiguration conf)

newKnowledgeBuilderConfiguration

public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration()
Create a KnowledgeBuilderConfiguration on which properties can be set.

Returns:
The KnowledgeBuilderConfiguration.

newKnowledgeBuilderConfiguration

public static KnowledgeBuilderConfiguration newKnowledgeBuilderConfiguration(Properties properties,
                                                                             ClassLoader... classLoaders)
Create a KnowledgeBuilderConfiguration on which properties can be set. Use the given properties file and ClassLoader - either of which can be null.

Returns:
The KnowledgeBuilderConfiguration.

newDecisionTableConfiguration

public static DecisionTableConfiguration newDecisionTableConfiguration()
DecisionTable resources require a ResourceConfiguration, that configuration instance is created here. Note that if you are passing a Reader, you must use an InputStreamReader so the encoding can be determined.
 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 DecisionTableConfiguration dtconf = KnowledgeBuilderFactory.newDecisionTableConfiguration();
 dtconf.setInputType( DecisionTableInputType.XLS );
 dtconf.setWorksheetName( "Tables_2" );
 kbuilder.add( new URL( "file://IntegrationExampleTest.xls" ),
                       ResourceType.DTABLE,
                       dtconf );
 assertFalse( kbuilder.hasErrors() );
 KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
 

Returns:

newJaxbConfiguration

public static JaxbConfiguration newJaxbConfiguration(com.sun.tools.xjc.Options xjcOpts,
                                                     String systemId)


Copyright © 2001-2011 JBoss by Red Hat. All Rights Reserved.