Package oracle.rules.sdk2.repository
Class DictionaryLoader
java.lang.Object
oracle.rules.sdk2.repository.DictionaryLoader
DictionaryLoader
is the preferred mechanism for loading
rule dictionaries for execution.
DictionaryFinder
s are added to a DictionaryLoader
instance with the addFinder
in the order in which they
will be invoked to find a dictionary.
That is, the first finder added will be the first one to attempt to find
a dictionary.
The loadDictionary
method is invoked to load a dictionary.
When a dictionary is loaded, its linked dictionary dependencies
are recorded.
Proper DictionaryFinder
implementations added with
addFinder
interact with this class to respond to dictionary
updates.
Depending on the finder implementation, updates to dictionaries are either
detected by polling a
dictionary finder or via asynchronous callback from the finder. Detection
of a dictionary update is then reflected in the dictionary dependency graph.
The reloadNeeded
method will return true for a dictionary if
it or one of the dictionaries it links to have been updated since the last
time the dictionary was loaded.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFinder
(DictionaryFinder finder) Add aDictionaryFinder
to the chain maintained by this instance.void
close()
Closes all the finders added to this loader.void
foundDictionary
(String path, RuleDictionary rd, AbstractDictionaryFinder by, RuleDictionary from) void
foundDictionary
(DictionaryFQN fqn, RuleDictionary rd, AbstractDictionaryFinder by, RuleDictionary from) Get the chain ofDictionaryFinder
's constructed by this instance.loadDictionary
(String path) Load aRuleDictionary
.Load aRuleDictionary
.boolean
reloadNeeded
(String path) Check whether theRuleDictionary
needs to be reloaded.boolean
Check whether theRuleDictionary
needs to be reloaded.void
setReloadNeeded
(String path) Indicates that the specified dictionary has been updated.void
Indicates that the specified dictionary has been updated.
-
Constructor Details
-
DictionaryLoader
public DictionaryLoader()
-
-
Method Details
-
addFinder
Add aDictionaryFinder
to the chain maintained by this instance. Finders should be added in the order they are expected to be applied. The first finder added to the chain will be the first finder asked to find a dictionary. TheDictionaryFinder
should be an extension ofAbstractDictionaryFinder
.- Parameters:
finder
- TheDictionaryFinder
to add.
-
getFinderChain
Get the chain ofDictionaryFinder
's constructed by this instance.- Returns:
- The chain of
DictionaryFinder
s.
-
loadDictionary
Load aRuleDictionary
.- Parameters:
fqn
- The fully qualified name of the rule dictionary.- Returns:
- The RuleDictionary or null if the dictionary is not found.
-
foundDictionary
public void foundDictionary(DictionaryFQN fqn, RuleDictionary rd, AbstractDictionaryFinder by, RuleDictionary from) -
reloadNeeded
Check whether theRuleDictionary
needs to be reloaded. This indicator is maintained for rule dictionaries loaded with theloadDictionary
method. It will return true if the specified dictionary or any dictionary in the set of dictionaries it is linked to (recursively) have been updated since it was last loaded by thisDictionaryLoader
.- Parameters:
fqn
- The fully qualified name of the rule dictionary.- Returns:
- true if the dictionary should be reloaded.
-
setReloadNeeded
Indicates that the specified dictionary has been updated. This method updates the dependency graph to reflect this. Generally this method will only be invoked from aDictionaryFinder
implementation.- Parameters:
fqn
- The fully qualified name of the rule dictionary.
-
loadDictionary
Load aRuleDictionary
.- Parameters:
path
- The path used to find the rule dictionary.- Returns:
- The RuleDictionary or null if the dictionary is not found.
-
foundDictionary
public void foundDictionary(String path, RuleDictionary rd, AbstractDictionaryFinder by, RuleDictionary from) -
reloadNeeded
Check whether theRuleDictionary
needs to be reloaded. This indicator is maintained for rule dictionaries loaded with theloadDictionary
method. It will return true if the specified dictionary or any dictionary in the set of dictionaries it is linked to (recursively) have been updated since it was last loaded by thisDictionaryLoader
.- Parameters:
path
- The path to used to find the rule dictionary.- Returns:
- true if the dictionary should be reloaded.
-
setReloadNeeded
Indicates that the specified dictionary has been updated. This method updates the dependency graph to reflect this. Generally this method will only be invoked from aDictionaryFinder
implementation.- Parameters:
path
- The path to used to find the rule dictionary.
-
close
public void close()Closes all the finders added to this loader.
-