- All Implemented Interfaces:
EventBus
KnowledgeService is a root element of every Evrete-based application.
It holds the initial Configuration, references to all
required SPI implementations, and an instance of the Java ExecutorService.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe Builder class is responsible for constructing instances of the KnowledgeService class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KnowledgeService.Builderbuilder()static KnowledgeService.Builderbuilder(Configuration configuration) getDSL(Class<? extends DSLKnowledgeProvider> dsl) Deprecated.this method is deprecated and scheduled for removal.Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, File... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, InputStream... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, Reader... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, Class<?>... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, String... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, URL... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver resolver, File... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, InputStream... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, Reader... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, Class<?>... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, URL... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String name) newKnowledge(String dsl, File... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, InputStream... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, Reader... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, Class<?>... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, String... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, URL... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, TypeResolver resolver, File... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, TypeResolver typeResolver, InputStream... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, TypeResolver typeResolver, Reader... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, TypeResolver typeResolver, Class<?>... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(String dsl, TypeResolver typeResolver, URL... resources) Deprecated.this method is deprecated and scheduled for removal.newKnowledge(TypeResolver typeResolver) Deprecated.use the defaultnewKnowledge()methodnewKnowledge(TypeResolver typeResolver, String name) Deprecated.use the defaultnewKnowledge(String)methodThis method is a shorthand fornewKnowledge().newStatefulSession()which returns an empty session instance.This method is a shorthand fornewKnowledge().newStatelessSession()which returns an empty session instance.voidsetClassLoader(ClassLoader classLoader) voidshutdown()Shuts down the service.Methods inherited from class org.evrete.runtime.AbstractKnowledgeService
getExecutor, getMessageBus, getPublisher, getServiceSubscriptions, shutdownInnerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.evrete.api.events.EventBus
subscribe, subscribe, subscribeAsync
-
Constructor Details
-
KnowledgeService
-
KnowledgeService
public KnowledgeService()
-
-
Method Details
-
builder
-
builder
-
getClassLoader
-
shutdown
public void shutdown()Shuts down the service. -
setClassLoader
-
newKnowledge
- Returns:
- an empty
Knowledgeinstance
-
newKnowledge
- Returns:
- an empty
Knowledgeinstance
-
newKnowledge
Deprecated.use the defaultnewKnowledge()method- Parameters:
typeResolver- the type resolver to use in the newly created Knowledge instance- Returns:
- an empty
Knowledgeinstance
-
newKnowledge
Deprecated.use the defaultnewKnowledge(String)method- Parameters:
typeResolver- the type resolver to use in the newly created Knowledge instance- Returns:
- an empty
Knowledgeinstance
-
getDSL
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theDSLKnowledgeProvider.load(String)utility method instead.A convenience method to load specific DSL implementation;
- Parameters:
dsl- DSL name- Returns:
- new instance of DSL provider
- Throws:
IllegalStateException- if no implementation found by the given name
-
getDSL
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theDSLKnowledgeProvider.load(String)utility method instead.A convenience method to load specific DSL implementation;
- Parameters:
dsl- DSL implementation class- Returns:
- new instance of DSL provider
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nameresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, URL... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nameresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, File... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver resolver, File... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(String dsl, TypeResolver resolver, File... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(String dsl, TypeResolver typeResolver, URL... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nametypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, URL... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classtypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nameresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, Reader... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(String dsl, TypeResolver typeResolver, Reader... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nametypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, Reader... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classtypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nameresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, InputStream... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(String dsl, TypeResolver typeResolver, InputStream... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL nametypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, InputStream... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or the- Parameters:
dsl- DSL classtypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the data sources.
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theThis is a convenience method. The implementation gets URLs of each class and calls
newKnowledge(String, URL...)- Parameters:
dsl- DSL nameresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the class sources.
-
getConfiguration
-
getMemoryFactoryProvider
-
getSourceCompilerProvider
-
getTypeResolverProvider
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, Class<?>... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theThis is a convenience method. The implementation gets URLs of each class and calls
newKnowledge(String, URL...)- Parameters:
dsl- DSL classresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the class sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(String dsl, TypeResolver typeResolver, Class<?>... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theThis is a convenience method. The implementation gets URLs of each class and calls
newKnowledge(String, TypeResolver, URL...)- Parameters:
dsl- DSL nametypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the class sources.
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, TypeResolver typeResolver, Class<?>... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theThis is a convenience method. The implementation gets URLs of each class and calls
newKnowledge(String, TypeResolver, URL...)- Parameters:
dsl- DSL classtypeResolver- TypeResolver to useresources- DSL resources- Returns:
- a
Knowledgeinstance built by DSL provider from given resources. - Throws:
IOException- if an error occurs when reading the sources.
-
newStatefulSession
This method is a shorthand for
newKnowledge().newStatefulSession()which returns an empty session instance.- Returns:
- an empty
StatefulSession
-
newStatelessSession
This method is a shorthand for
newKnowledge().newStatelessSession()which returns an empty session instance.- Returns:
- an empty
StatelessSession
-
newKnowledge
Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(String, Object)approach or theCreates a newKnowledgeinstance from provided resources.- Throws:
IOException
-
newKnowledge
@Deprecated public Knowledge newKnowledge(Class<? extends DSLKnowledgeProvider> dsl, String... resources) throws IOException Deprecated.this method is deprecated and scheduled for removal. Use the newRuntimeContext.importRules(DSLKnowledgeProvider, Object)approach or theCreates a newKnowledgeinstance from provided resources.- Throws:
IOException
-