Module Root Resolver
ModuleRootResolver declares an interface for accessing Avail ModuleRoots given a URI. It is responsible for asynchronously retrieving, creating, deleting, and saving files and packages where the ModuleRoot is stored.
It is responsible for producing ResolverReferences, the object linking a resource in a module root to its actual file at the URI location of the module root.
All file actions are conducted via the ModuleRootResolver.fileManager. Given the files may originate anywhere from the local file system to a remote database accessed via network API, a REST-ful webserver, etc., all file requests must be handled asynchronously.
A ModuleRootResolver establishes access to a ModuleRoot based upon the URI.scheme given the appropriate ModuleRootResolver that supports the scheme. A ModuleRootResolver is created by a corresponding ModuleRootResolverFactory. For each ModuleRootResolver type implemented a ModuleRootResolverFactory must be implemented to enable resolver creation. The ModuleRootResolverFactory must be registered in the ModuleRootResolverRegistry. A ModuleRootResolver cannot be created if the factory has not been registered. Only one registered ModuleRootResolverFactory is allowed per URI scheme.
Author
Richard Arriaga
Inheritors
Types
A WatchEventType indicates the types of events that can occur to resources at the represented ModuleRoot source location.
Properties
The qualified names of all the modules known by this resolver.
Answer whether data can be written to modules under this resolver. Note that this may be further restricted by choosing to use the root as a read-only source. See AvailWorkbench.getProjectRoot.
The FileManager used for pooling I/O requests for this root.
The ModuleRoot this ModuleRootResolver resolves to.
The URI that identifies the location of the ModuleRoot.
The Map from a UUID that represents an interested party to a lambda that accepts a WatchEventType that describes the event that occurred at the source location and a ResolverReference that identifies to what the event occurred to.
Functions
Close this ModuleRootResolver. Should be called at shutdown to ensure proper clean up of any open resources.
Delete the ResourceType linked to the qualified name. If the ResourceType is a ResourceType.PACKAGE or a ResourceType.DIRECTORY, all of its children should be deleted as well. All deleted references should be removed from the reference tree.
Asynchronously execute the provided task.
Answer a AbstractFileWrapper for the targeted file.
Answer a ModuleNameResolver.ModuleNameResolutionResult when attempting to locate a module in this ModuleRootResolver.
Answer the URI for a resource in the source moduleRoot given a qualified name. There is no guarantee the target exists.
Answer a qualified name for the given URI that points to a file in the moduleRoot.
Answer the ResolverReference for the given qualified file name for a a file in moduleRoot.
Provide the non-null ResolverReference that represents the moduleRoot. There is no guarantee made by this interface as to how this should be run. It can be all executed on the calling thread or it can be executed on a separate thread.
Provide the ResolverReference for the given qualified file name for a file in moduleRoot.
Answer all the ResolverReferences known by this ModuleRootResolver that have a qualified name that matches the supplied abbreviation.
Specifically refresh the ResolverReference mutable state:
Specifically refresh the ResolverReference.digest in the Repository.ModuleArchive for the most recent ResolverReference.lastModified timestamp. This also refreshes the metrics (mutable state) of the provided ResolverReference. It should refresh:
Connect to the source of the moduleRoot and populate this resolver with all the ResolverReferences from the module root. This is not required nor expected to be executed in the calling thread.
Provide the full list of all ResolverReferences in this ModuleRootResolver.
Subscribe to receive notifications of WatchEventTypes occurring to this ModuleRoot.
Remove a watch subscription.