public abstract class AbstractDictionaryFinder extends java.lang.Object implements DictionaryFinder
A concrete implementation should also override the canDetectChanges, mustPollForChanges, getModificationTime methods as necessary to reflect the behavior of the finder. These methods define how the finder interacts with the DictionaryLoader class when that class is used to load dictionaries. If the finder can not detect changes in the dictionaries it finds, then DictionaryLoader ignores it when determining if a dictionary needs to be reloaded. If mustPollForChanges returns true, then DictionaryFinder will synchronously poll the finder to see if a dictionary it found has been updated by invoking getModificationTime. Such a finder must override the getModificationTime method. Otherwise, DictionaryLoader expects asynchronous notification of changes from the finder. The finder invokes the DictionaryLoader.setReloadNeeded(DictionaryFQN fqn) method to notify that a dictionary was updated (a reference to the DictionaryLoader instance is available in this class).
It is recommended that DictionaryFinder implementations cache dictionaries that have been loaded. Caching can be enabled by invoking the enableCache method in the constructor of the implementation class. If the DictionaryFinder can detect changes to dictionaries, then it should invoke the invalidateCacheEntry method when a change is detected.
DictionaryLoader, Serialized FormserialVersionUID| Modifier and Type | Method and Description |
|---|---|
boolean |
canDetectChanges()
Indicates whether this finder is able to detect changes in the dictionaries that are found by this finder.
|
void |
close()
Close this finder to release held resources.
|
RuleDictionary |
findDictionary(DictionaryFQN fqn)
Finds a rule dictionary specified by its fully qualified name.
|
RuleDictionary |
findDictionary(java.lang.String path)
Find a dictionary given a logical, system independent path.
|
RuleDictionary |
findDictionary(java.lang.String pkg, java.lang.String name)
Finds a rule dictionary specified by the package and name.
|
RuleDictionary |
findDictionaryWithThisFinder(DictionaryFQN fqn)
Finds a rule dictionary with this finder.
|
RuleDictionary |
findDictionaryWithThisFinder(java.lang.String path)
Finds a rule dictionary with this finder.
|
AbstractDictionaryFinder |
getChild()
Returns the child finder or null if this finder does not have a child.
|
AbstractDictionaryFinder |
getLastChild()
Returns the last (leaf) child finder or this finder if this finder does not have a child.
|
long |
getModificationTime(DictionaryFQN fqn)
Returns a time in milliseconds indicating when the dictionary indentified by the
DictionaryFQN was last modified. |
long |
getModificationTime(java.lang.String path)
Returns a time in milliseconds indicating when the dictionary located by the
path was last modified. |
AbstractDictionaryFinder |
getParent()
Returns the parent finder or null if this finder does not have a parent.
|
void |
invalidateCacheEntry(DictionaryFQN fqn) |
void |
invalidateCacheEntry(java.lang.String path) |
boolean |
mustPollForChanges()
Indicates whether this finder must be polled to determine if a dictionary has been updated.
|
public AbstractDictionaryFinder getParent()
public AbstractDictionaryFinder getChild()
public AbstractDictionaryFinder getLastChild()
public RuleDictionary findDictionary(java.lang.String pkg, java.lang.String name)
findDictionary in interface DictionaryFinderpkg - fully qualified package name, e.g. foo.barname - unqualified name, e.g. MyDicpublic RuleDictionary findDictionary(DictionaryFQN fqn)
findDictionary in interface DictionaryFinderfqn - DictionaryFQNpublic RuleDictionary findDictionaryWithThisFinder(DictionaryFQN fqn)
This method is implemented by each concrete DictionaryFinder implementation. This method should always return a new handle for the dictionary it finds.
fqn - the fully qualified name of the dictionary to find.RuleDictionary.createHandle()public boolean canDetectChanges()
DictionaryLoader.DictionaryLoaderpublic boolean mustPollForChanges()
DictionaryLoader.DictionaryLoader, DictionaryLoader.setReloadNeeded(oracle.rules.sdk2.repository.DictionaryFQN)public long getModificationTime(DictionaryFQN fqn)
DictionaryFQN was last modified. The default value of 0 is returned. This method should be overridden by a finder that must be polled for changes. This method is invoked from DictionaryLoader.DictionaryLoaderpublic RuleDictionary findDictionary(java.lang.String path)
findDictionary in interface DictionaryFinderpath - the path used to find the dictionarypublic RuleDictionary findDictionaryWithThisFinder(java.lang.String path)
This method is overridden by each concrete DictionaryFinder implementation. This method should always return a new handle for the dictionary it finds.
path - the path for the dictionary to find.RuleDictionary.createHandle()public long getModificationTime(java.lang.String path)
path was last modified. The default value of 0 is returned. This method should be overridden by a finder that must be polled for changes. This method is invoked from DictionaryLoader.DictionaryLoaderpublic void close()
close in interface DictionaryFinderpublic void invalidateCacheEntry(DictionaryFQN fqn)
public void invalidateCacheEntry(java.lang.String path)