Codota Logo
KnowledgeBuilderConfiguration
Code IndexAdd Codota to your IDE (free)

How to use
KnowledgeBuilderConfiguration
in
org.drools.builder

Best Java code snippets using org.drools.builder.KnowledgeBuilderConfiguration (Showing top 5 results out of 315)

  • Common ways to obtain KnowledgeBuilderConfiguration
private void myMethod () {
KnowledgeBuilderConfiguration k =
  • Codota IconKnowledgeBuilderFactory knowledgeBuilderFactory;knowledgeBuilderFactory.getKnowledgeBuilderServiceFactory().newKnowledgeBuilderConfiguration()
  • Codota IconKnowledgeBuilderFactory knowledgeBuilderFactory;Properties properties;ClassLoader[] classLoader;knowledgeBuilderFactory.getKnowledgeBuilderServiceFactory().newKnowledgeBuilderConfiguration(properties, classLoader)
  • Smart code suggestions by Codota
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Void execute(Context context) {
  KnowledgeBuilderConfiguration kconf = (KnowledgeBuilderConfiguration) context.get(kbuilderConfId);
  kconf.setProperty(this.name, this.value);
  return null;
}
origin: org.ow2.jasmine.drools/jasmine-drools-api

/**
 * @param classLoader
 */
protected void initKnowledgeBuilderConfiguration(final ClassLoader classLoader) {
  Properties props = new Properties();
  props.setProperty("drools.dialect.java.compiler", "JANINO");
  this.knowledgeBuilderConf = newKnowledgeBuilderConfiguration(props, classLoader);
  // In development, dump drools generated files
  if (Boolean.getBoolean("jonas.developer")) {
    File dumpDir = new File(System.getProperty("java.io.tmpdir"), "drools_dump");
    boolean exists = dumpDir.exists();
    if (!exists) {
      exists = dumpDir.mkdir();
    }
    if (exists && dumpDir.isDirectory()) {
      debug("WorkingMemory[<name>] Drools dump directory set to {0}", dumpDir);
      knowledgeBuilderConf.setOption(DumpDirOption.get(dumpDir));
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public ConfigurableSeverityResult(Resource resource, KnowledgeBuilderConfiguration config) {
  super(resource);
  severity = config.getOption(KBuilderSeverityOption.class, getOptionKey()).getSeverity();
}

origin: org.drools/drools-grid-impl

  public String execute(Context context) {
    KnowledgeBuilderConfiguration kconf = (KnowledgeBuilderConfiguration) context.getContextManager().getContext("__TEMP__").get(identifier);
    return kconf.getProperty(propertyName);
  }
}
origin: org.drools/drools-grid-impl

  public Void execute(Context context) {
    KnowledgeBuilderConfiguration kconf = (KnowledgeBuilderConfiguration) context.getContextManager().getContext("__TEMP__").get(identifier);
    kconf.setProperty(propertyName, propertyValue);
    return null;
  }
}
org.drools.builderKnowledgeBuilderConfiguration

Javadoc

This class configures the knowledge package builder and compiler. Dialects and their DialectConfigurations are handled by the DialectRegistry Normally you will not need to look at this class, unless you want to override the defaults.

This class will automatically load default values from a number of places, accumulating properties from each location. This list of locations, in given priority is: System properties, home directory, working directory, META-INF/ of optionally provided classLoader META-INF/ of Thread.currentThread().getContextClassLoader() and META-INF/ of ClassLoader.getSystemClassLoader()

So if you want to set a default configuration value for all your new KnowledgeBuilder, you can simply set the property as a System property.

This class is not thread safe and it also contains state. After the KnowledgeBuilder is created, it makes the configuration immutable and there is no way to make it mutable again. This is to avoid inconsistent behaviour inside KnowledgeBuilder.

  • drools.dialect.default = <String>
  • drools.accumulate.function.<function name> = <qualified class>
  • drools.evaluator.<ident> = <qualified class>
  • drools.dump.dir = <String>
  • drools.parser.processStringEscapes = <true|false>

Two dialects are supported, Java and MVEL. Java is the default dialect.
The Java dialect supports the following configurations:

  • drools.dialect.java.compiler = <ECLIPSE|JANINO>
  • drools.dialect.java.compiler.lnglevel = <1.5|1.6>
And MVEL supports the following configurations:
  • drools.dialect.mvel.strict = <true|false>

So for example if we wanted to create a new KnowledgeBuilder that used Janino as the default compiler we would do the following:

 
KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); 
config.setProperty("drools.dialect.java.compiler", "JANINO"); 
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder( config ); 

Remember the KnowledgeBuilderConfiguration could have taken a Properties instance with that setting in it at constructor time, or it could also discover from a disk based properties file too.

Available pre-configured Accumulate functions are:

  • drools.accumulate.function.average = org.drools.core.base.accumulators.AverageAccumulateFunction
  • drools.accumulate.function.max = org.drools.core.base.accumulators.MaxAccumulateFunction
  • drools.accumulate.function.min = org.drools.core.base.accumulators.MinAccumulateFunction
  • drools.accumulate.function.count = org.drools.core.base.accumulators.CountAccumulateFunction
  • drools.accumulate.function.sum = org.drools.core.base.accumulators.SumAccumulateFunction
  • drools.accumulate.function.collectSet = org.drools.core.base.accumulators.CollectSetAccumulateFunction
  • drools.accumulate.function.collectList = org.drools.core.base.accumulators.CollectListAccumulateFunction

Most used methods

  • setProperty
  • getOption
  • getProperty
  • setOption

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • Notification (javax.management)
  • JList (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now