Knowledge API Legacy5 Adapter 6.0.0.CR4-Pre1

org.drools.impl
Class KnowledgeBuilderImpl

java.lang.Object
  extended by org.drools.impl.KnowledgeBuilderImpl
All Implemented Interfaces:
KnowledgeBuilder, ProcessBuilder, RuleBuilder

public class KnowledgeBuilderImpl
extends Object
implements KnowledgeBuilder


Constructor Summary
KnowledgeBuilderImpl(org.drools.compiler.compiler.PackageBuilder pkgBuilder)
           
 
Method Summary
 void add(Resource resource, ResourceType type)
          Add a resource of the given ResourceType, using the default resource configuration.
 void add(Resource resource, ResourceType type, ResourceConfiguration configuration)
          Add a resource of the given ResourceType, using the provided ResourceConfiguration.
 CompositeKnowledgeBuilder batch()
          Return a CompositeKnowledgeBuilder allowing to add multiple Resources at the same time, without worrying about cross dependencies among them.
 KnowledgeBuilderErrors getErrors()
          Return errors that occurred during the build process.
 Collection<KnowledgePackage> getKnowledgePackages()
          Returns the built packages.
 KnowledgeBuilderResults getResults(ResultSeverity... severities)
          Return the knowledge builder results for the listed severities.
 boolean hasErrors()
          If errors occurred during the build process they are added here
 boolean hasResults(ResultSeverity... severities)
          Checks if the builder generated any results of the listed severities
 KnowledgeBase newKnowledgeBase()
          Creates a new KnowledgeBase from the knowledge packages that have been added to this builder.
 void undo()
          Remove the last added Resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnowledgeBuilderImpl

public KnowledgeBuilderImpl(org.drools.compiler.compiler.PackageBuilder pkgBuilder)
Method Detail

add

public void add(Resource resource,
                ResourceType type)
Description copied from interface: KnowledgeBuilder
Add a resource of the given ResourceType, using the default resource configuration.

Specified by:
add in interface KnowledgeBuilder
Parameters:
resource - the Resource to add
type - the resource type

add

public void add(Resource resource,
                ResourceType type,
                ResourceConfiguration configuration)
Description copied from interface: KnowledgeBuilder
Add a resource of the given ResourceType, using the provided ResourceConfiguration. Resources can be created by calling any of the "newX" factory methods of ResourceFactory. The kind of resource (DRL, XDRL, DSL,... CHANGE_SET) must be indicated by the second argument.

Specified by:
add in interface KnowledgeBuilder
Parameters:
resource - the Resource to add
type - the resource type
configuration - the resource configuration

getKnowledgePackages

public Collection<KnowledgePackage> getKnowledgePackages()
Description copied from interface: KnowledgeBuilder
Returns the built packages. If the KnowledgeBuilder has errors the Collection will be empty. The hasErrors() method should always be checked first, to make sure you are getting the packages that you wanted built.

Specified by:
getKnowledgePackages in interface KnowledgeBuilder
Returns:
The Collection of KnowledgePackages

newKnowledgeBase

public KnowledgeBase newKnowledgeBase()
Description copied from interface: KnowledgeBuilder
Creates a new KnowledgeBase from the knowledge packages that have been added to this builder. An exception is thrown if there are any errors.

Specified by:
newKnowledgeBase in interface KnowledgeBuilder

hasErrors

public boolean hasErrors()
Description copied from interface: KnowledgeBuilder
If errors occurred during the build process they are added here

Specified by:
hasErrors in interface KnowledgeBuilder
Returns:

getErrors

public KnowledgeBuilderErrors getErrors()
Description copied from interface: KnowledgeBuilder
Return errors that occurred during the build process.

Specified by:
getErrors in interface KnowledgeBuilder
Returns:

getResults

public KnowledgeBuilderResults getResults(ResultSeverity... severities)
Description copied from interface: KnowledgeBuilder
Return the knowledge builder results for the listed severities.

Specified by:
getResults in interface KnowledgeBuilder
Returns:

hasResults

public boolean hasResults(ResultSeverity... severities)
Description copied from interface: KnowledgeBuilder
Checks if the builder generated any results of the listed severities

Specified by:
hasResults in interface KnowledgeBuilder
Returns:

undo

public void undo()
Description copied from interface: KnowledgeBuilder
Remove the last added Resource. Can be useful in case this last addition generated some compilation problem. If multiple Resources have been added in batch using a CompositeKnowledgeBuilder, it removes all of them.

Specified by:
undo in interface KnowledgeBuilder

batch

public CompositeKnowledgeBuilder batch()
Description copied from interface: KnowledgeBuilder
Return a CompositeKnowledgeBuilder allowing to add multiple Resources at the same time, without worrying about cross dependencies among them.

Specified by:
batch in interface KnowledgeBuilder
Returns:

Knowledge API Legacy5 Adapter 6.0.0.CR4-Pre1

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