Package oracle.rules.sdk2.repository
Interface RuleRepository
public interface RuleRepository
A common API to access rule dictionaries stored in repository.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the repository so that resources it holds are released.booleanDetermine whether a dictionary with the specified package and name exists in the repository.booleanDetermine whether a dictionary with the specified package and name exists in the repository. packageScopedSearch true will search only mentioned dictionarybooleanexists(DictionaryFQN fqn) Determine whether a dictionary identified by theDictionaryFQNexists in the repository.booleanexists(DictionaryFQN fqn, boolean packageScopedSearch) Determine whether a dictionary identified by theDictionaryFQNexists in the repository. packageScopedSearch true will search only mentioned dictionaryReturns the repository's dictionary finder.Get the fully qualfied names of dictionaries stored in the repository that match the specified dictionary package and name.getNames(DictionaryFQN fqn) Get the fully qualfied names of dictionaries stored in the repository that match the dictionary package and name specified in theDictionaryFQN.Get the context for this repository.Get the rule repository type.voidinit(RepositoryContext ctx) Initialize the repository by passing security and configuration information.booleanCheck if a newer version of a dictionary is available.booleanisStale(DictionaryFQN fqn) Check if a newer version of a dictionary is available.Load a dictionary from the repository.load(DictionaryFQN fqn) Load a dictionary from the repository.voidRegister a listener for dictionary changes.voidRemove the dictionary identified by the package and name from repository.voidremove(DictionaryFQN fqn) Remove the dictionary identified by its fully qualified name from repository.voidRename a dictionary in the repository.voidrename(RuleDictionary dictionary, String newPkg, String newName, boolean overwrite) Rename the specified dictionary in the repository.voidrename(RuleDictionary dictionary, DictionaryFQN newFQN, boolean overwrite) Rename the specified dictionary in the repository.voidrename(DictionaryFQN fqn, DictionaryFQN newFQN, boolean overwrite) Rename a dictionary in the repository.voidsave(RuleDictionary dictionary) Save a dictionary to the repository.voidsaveAs(RuleDictionary dictionary, String pkg, String name, boolean overwrite) Save a dictionary to repository with a new identity.voidsaveAs(RuleDictionary dictionary, DictionaryFQN fqn, boolean overwrite) Save a dictionary to repository with a new identity.voidsetDictionaryFinder(DictionaryFinder finder) Sets the repository's dictionary finder.voidUnregister a listener for dictionary changes.
-
Method Details
-
init
Initialize the repository by passing security and configuration information. This method must be invoked before performing any repository operations.- Parameters:
ctx- an instance of theRepositoryContextclass which contains security and repository configuration information.- Throws:
RepositoryException- if error is encountered in repository initialization
-
getRepositoryContext
RepositoryContext getRepositoryContext()Get the context for this repository.- Returns:
- the RepositoryContext object
-
getRepositoryType
RepositoryType getRepositoryType()Get the rule repository type. It identifies the underlying repository and provides methods for discovery of the repository configuration parameters.- Returns:
- type of the repository
-
getNames
Get the fully qualfied names of dictionaries stored in the repository that match the specified dictionary package and name.- Parameters:
pkg- the dictionary package. A null value means "don't care" and all dictionary packages in the repository will match.name- the dictionary name. A null value means "don't care" and all dictionary names in the repository will match.- Returns:
- An array of fully qualified dictionary names. If no dictionaries in the repository match the specified package and name, a 0 length array is returned.
- Throws:
RepositoryException- if error when accessing the repository
-
getNames
Get the fully qualfied names of dictionaries stored in the repository that match the dictionary package and name specified in theDictionaryFQN.- Parameters:
fqn- theDictionaryFQNthat specifies the desired dictionary package and name. A null value for any of these means "don't care" and any corresponding value will match.- Returns:
- An array of fully qualified dictionary names. Each property
in the specified
DictionaryFQNmay be null indicating that any value may match that property. If no dictionaries in the repository match the specifiedDictionaryFQN, a 0 length array is returned. - Throws:
RepositoryException- if error occurs when accessing the repository
-
exists
Determine whether a dictionary with the specified package and name exists in the repository.- Parameters:
pkg- the dictionary packagename- the dictionary name- Returns:
- true if a dictionary with given package and name exists in the repository, otherwise false.
- Throws:
RepositoryException- if error occurs accessing the repository
-
exists
Determine whether a dictionary identified by theDictionaryFQNexists in the repository.- Parameters:
fqn- the fully qualified name of the dictionary.- Returns:
- true if a dictionary with given fully qualified name exists in the repository, otherwise false.
- Throws:
RepositoryException- if error occurs accessing the repository
-
load
Load a dictionary from the repository.- Parameters:
pkg- the dictionary packagename- the dictionary name- Returns:
- an instance of
RuleDictionaryfor the dictionary identified by the dictionary package and name. - Throws:
RepositoryException- if error when loading the dictionarySDKException
-
load
Load a dictionary from the repository.- Parameters:
fqn- the fully qualified name of the dictionary.- Returns:
- an instance of
RuleDictionaryfor the dictionary identified by the fully qualified name. - Throws:
RepositoryException- if error occurred loading the dictionary from the repository.SDKException- if error occurred creating the RuleDictionary object.
-
save
Save a dictionary to the repository. If the dictionary does not exist in the repository, it will be created. If the dictionary exists in the repository, it is updated with the new dictionary content.- Parameters:
dictionary- the rule dictionary to save- Throws:
RepositoryException- an error occured in the attempt to save the dictionary.SDKException- if an error occured serializing the dictionary to XML.
-
saveAs
void saveAs(RuleDictionary dictionary, String pkg, String name, boolean overwrite) throws RepositoryException, SDKException Save a dictionary to repository with a new identity. If a dictionary with the same package and name exists in the repository, a DictionaryAlreadyExistsException will be thrown. Otherwise, the dictionary content will be saved with the new package and name. The dictionary stored with the old identity is unmodified by this operation.- Parameters:
dictionary- the rule dictionary to savepkg- the new dictionary package.name- the new dictionary name.overwrite- a value of true will allow overwriting an existing dictionary with the name composed frompkgandname. Otherwise, an exception is thrown if the dictionary already exists.- Throws:
DictionaryAlreadyExistsException- a dictionary with the same package and name already exists in the repository.RepositoryException- an exception occured during the attempt to save the dictionary in the repository.SDKException- if an error occured serializing the dictionary to XML or in the in-memory dictionary rename.
-
saveAs
void saveAs(RuleDictionary dictionary, DictionaryFQN fqn, boolean overwrite) throws RepositoryException, SDKException Save a dictionary to repository with a new identity. If a dictionary identified by the new fully qualified name exists in the repository, a DictionaryAlreadyExistsException will be thrown. Otherwise, the dictionary content will be saved with the new identity. The dictionary stored with the old identity is unmodified by this operation.- Parameters:
dictionary- the rule dictionary to savefqn- the new fully qualified name for the dictionary.overwrite- a value of true will allow overwriting an existing dictionary with the namefqn. Otherwise, an exception is thrown if the dictionary already exists.- Throws:
DictionaryAlreadyExistsException- a dictionary with the same fully qualified name already exists in the repository.RepositoryException- an exception occured during the attempt to save the dictionary in the repository.SDKException- if an error occured serializing the dictionary to XML or in the in-memory dictionary rename.
-
remove
Remove the dictionary identified by the package and name from repository.- Parameters:
pkg- the dictionary packagename- the dictionary name- Throws:
RepositoryException- an exception occured attempting to remove the dictionary
-
remove
Remove the dictionary identified by its fully qualified name from repository.- Parameters:
fqn- the fully qualified name- Throws:
RepositoryException- an exception occured attempting to remove the dictionary
-
rename
void rename(String pkg, String name, String newPkg, String newName, boolean overwrite) throws SDKException Rename a dictionary in the repository.- Parameters:
pkg- the dictionary packagename- name of the dictionary to renamenewPkg- the new dictionary packagenewName- the new name of the dictionaryoverwrite- a value of true will allow overwriting an existing dictionary with the name composed fromnewPkgandnewName. Otherwise, an exception is thrown if the dictionary exists.- Throws:
DictionaryNotFoundException- a dictionary with the packageoldPkgand nameoldNamedoes not exist in the repository.DictionaryAlreadyExistsException- a dictionary with the packagenewPkgand namenewNamealready exists in the repository.RepositoryException- thrown if the dictionary can not be renamedSDKException- if an error occured renaming the dictionary itself.
-
rename
Rename a dictionary in the repository.- Parameters:
fqn- the current fully qualified name of the dictionarynewFQN- the new fully qualified name.overwrite- a value of true will allow overwriting an existing dictionary with the namenewFQN. Otherwise, an exception is thrown if the dictionary exists.- Throws:
DictionaryNotFoundException- a dictionary with the qualified nameoldFQNdoes not exist in the repository.DictionaryAlreadyExistsException- a dictionary with the qualified namenewFQNalready exists in the repository.RepositoryException- thrown if the dictionary can not be renamedSDKException- if an error occured renaming the dictionary itself.
-
rename
void rename(RuleDictionary dictionary, String newPkg, String newName, boolean overwrite) throws SDKException Rename the specified dictionary in the repository. The specified dictionary will be removed in the repository and stored under the new package and name.- Parameters:
dictionary- the dictionary to be renamed.newPkg- the new dictionary packagenewName- the new name of the dictionaryoverwrite- a value of true will allow overwriting an existing dictionary with the name composed fromnewPkgandnewName. Otherwise, an exception is thrown if the dictionary exists.- Throws:
DictionaryNotFoundException- the specified dictionary does not exist in the repository.DictionaryAlreadyExistsException- a dictionary with the packagenewPkgand namenewNamealready exists in the repository.RepositoryException- thrown if the dictionary can not be renamedSDKException- if an error occured renaming the dictionary itself.
-
rename
Rename the specified dictionary in the repository. The specified dictionary will be removed in the repository and stored under the new fully qualified name.- Parameters:
dictionary- the dictionary to be renamed.newFQN- the new fully qualified name.overwrite- a value of true will allow overwriting an existing dictionary with the namenewFQN. Otherwise, an exception is thrown if the dictionary exists.- Throws:
DictionaryNotFoundException- the specified dictionary does not exist in the repository.DictionaryAlreadyExistsException- a dictionary with the qualified namenewFQNalready exists in the repository.RepositoryException- thrown if the dictionary can not be renamedSDKException- if an error occured renaming the dictionary itself.
-
isStale
Check if a newer version of a dictionary is available.- Parameters:
pkg- the dictionary packagename- the dictionary name- Returns:
trueif- the dictionary has been modified since it was loaded, or
- the dictionary was never loaded, or
- the underlying store doesn't support this operation.
false.- Throws:
RepositoryException- an error occured in the check
-
isStale
Check if a newer version of a dictionary is available.- Parameters:
fqn- the fully qualified name of the dictionary- Returns:
trueif- the dictionary has been modified since it was loaded, or
- the dictionary was never loaded, or
- the underlying store doesn't support this operation.
false.- Throws:
RepositoryException- an error occured in the check
-
registerChangeListener
Register a listener for dictionary changes.- Throws:
RepositoryException- an error occured in the check
-
unregisterChangeListener
Unregister a listener for dictionary changes.- Throws:
RepositoryException- an error occured in the check
-
close
Close the repository so that resources it holds are released.- Throws:
RepositoryException- an exception occured during closing the repository
-
getDictionaryFinder
DictionaryFinder getDictionaryFinder()Returns the repository's dictionary finder.- Returns:
- the repository's dictionary finder.
-
setDictionaryFinder
Sets the repository's dictionary finder. This supplied finder should be a chain ofDictionaryFinders that contains theDictionaryFinderreturned bygetDictionaryFinder().- Parameters:
finder- the DictionaryFinder
-
exists
Determine whether a dictionary with the specified package and name exists in the repository. packageScopedSearch true will search only mentioned dictionary- Parameters:
pkg-name-packageScopedSearch-- Returns:
- Throws:
RepositoryException
-
exists
Determine whether a dictionary identified by theDictionaryFQNexists in the repository. packageScopedSearch true will search only mentioned dictionary- Parameters:
fqn-packageScopedSearch-- Returns:
- Throws:
RepositoryException
-