public final class SystemDirectiveRegistry extends Object implements DirectiveRegistry
DirectiveRegistry for maintaining a registry
of system provided directives. The directives maintained within this registry and
present and loaded by the Classloader that is responsible for loading this
class.
In order to load the directives, this class scans through all classes that
implement the interface Directive. Instead of scanning entire JAR, it uses the
package name a starting point for scanning the classes that implement the Directive
interface.
For every class found, this scan will create a instance of DirectiveInfo
object and store it in the registry.
| Constructor and Description |
|---|
SystemDirectiveRegistry() |
SystemDirectiveRegistry(List<String> namespaces)
This constructor uses the user provided namespace as starting pointing
for scanning classes that implement the interface
Directive. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes any resources acquired during initialization or otherwise.
|
DirectiveInfo |
get(String namespace,
String name)
Given the name of the directive, returns the information related to the directive.
|
Iterable<DirectiveInfo> |
list(String namespace)
List the directives in the specified namespace
|
void |
reload(String namespace)
This method reloads the directives from the artifacts into the registry.
|
public SystemDirectiveRegistry()
throws DirectiveLoadException
DirectiveLoadExceptionpublic SystemDirectiveRegistry(List<String> namespaces) throws DirectiveLoadException
Directive.namespaces - that is used as starting point for scanning classes.DirectiveLoadException - thrown if there are any issue loading the directive.public DirectiveInfo get(String namespace, String name)
get in interface DirectiveRegistryname - of the directive to be retrieved from the registry.namespace - the namespace of the directiveDirectiveInfo if found, else null.public void reload(String namespace)
DirectiveRegistryreload in interface DirectiveRegistrynamespace - the namespace to reload directives inpublic Iterable<DirectiveInfo> list(String namespace)
DirectiveRegistrylist in interface DirectiveRegistrynamespace - the namespace to list fromDirectiveInfo objects
maintained within the registry.public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2020 CDAP Licensed under the Apache License, Version 2.0.