JarModuleRootResolver

class JarModuleRootResolver(    val name: String,     val uri: URI,     val fileManager: FileManager) : ModuleRootResolver

JarModuleRootResolver is a ModuleRootResolver used for accessing a ModuleRoot that is provided as a jar file.

Author

Mark van Gulik

Parameters

name

The name of the module root.

uri

The URI that identifies the location of the jar file containing all source modules for a ModuleRoot.

fileManager

The FileManager used to manage the files accessed via this JarModuleRootResolver.

Constructors

Link copied to clipboard
fun JarModuleRootResolver(    name: String,     uri: URI,     fileManager: FileManager)

Functions

Link copied to clipboard
open override fun close()

Close this ModuleRootResolver. Should be called at shutdown to ensure proper clean up of any open resources.

Link copied to clipboard
open override fun createDirectory(    qualifiedName: String,     completion: () -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Create a directory.

Link copied to clipboard
open override fun createFile(    qualifiedName: String,     mimeType: String,     completion: () -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Create a file.

Link copied to clipboard
open override fun createPackage(    qualifiedName: String,     completion: () -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Create a package and its representative Avail module.

Link copied to clipboard
open override fun deleteResource(    qualifiedName: String,     completion: () -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

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.

Link copied to clipboard
open fun executeTask(task: () -> Unit)

Asynchronously execute the provided task.

Link copied to clipboard
fun fileWrapper(id: UUID, reference: ResolverReference): AbstractFileWrapper

Answer a AbstractFileWrapper for the targeted file.

Link copied to clipboard
open fun find(    qualifiedName: ModuleName,     initialCanonicalName: ModuleName,     moduleNameResolver: ModuleNameResolver): ModuleNameResolver.ModuleNameResolutionResult?

Answer a ModuleNameResolver.ModuleNameResolutionResult when attempting to locate a module in this ModuleRootResolver.

Link copied to clipboard
fun fullResourceURI(qualifiedName: String): URI

Answer the URI for a resource in the source moduleRoot given a qualified name. There is no guarantee the target exists.

Link copied to clipboard
fun getQualifiedName(targetURI: String): String

Answer a qualified name for the given URI that points to a file in the moduleRoot.

Link copied to clipboard
open fun getResolverReference(qualifiedName: String): ResolverReference?

Answer the ResolverReference for the given qualified file name for a a file in moduleRoot.

Link copied to clipboard
open fun provideModuleRootTree(successHandler: (ResolverReference) -> Unit, failureHandler: (ErrorCode, Throwable?) -> Unit)

Provide the non-nullResolverReference 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.

Link copied to clipboard
open fun provideResolverReference(    qualifiedName: String,     withReference: (ResolverReference) -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Provide the ResolverReference for the given qualified file name for a file in moduleRoot.

Link copied to clipboard
open override fun readFile(    bypassFileManager: Boolean,     reference: ResolverReference,     withContents: (ByteArray, UUID?) -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Retrieve the resource and provide it with a request to obtain the raw file bytes.

Link copied to clipboard
fun referencesMatchingAbbreviation(abbreviation: String, ignoreCase: Boolean = false): List<ResolverReference>

Answer all the ResolverReferences known by this ModuleRootResolver that have a qualified name that matches the supplied abbreviation.

Link copied to clipboard
open override fun refreshResolverMetaData(    reference: ResolverReference,     successHandler: (Long) -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Specifically refresh the ResolverReference mutable state:

Link copied to clipboard
open override fun refreshResolverReferenceDigest(    reference: ResolverReference,     successHandler: (ByteArray, Long) -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

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:

Link copied to clipboard
open override fun resolve(successHandler: (ResolverReference) -> Unit, failureHandler: (ErrorCode, Throwable?) -> Unit)

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.

Link copied to clipboard
open override fun resolvesToValidModuleRoot(): Boolean
Link copied to clipboard
open override fun rootManifest(    forceRefresh: Boolean,     withList: (List<ResolverReference>) -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Provide the full list of all ResolverReferences in this ModuleRootResolver.

Link copied to clipboard
open override fun saveFile(    reference: ResolverReference,     fileContents: ByteArray,     successHandler: () -> Unit,     failureHandler: (ErrorCode, Throwable?) -> Unit)

Save the file to where it is stored.

Link copied to clipboard
fun subscribeRootWatcher(watchAction: (ModuleRootResolver.WatchEventType, ResolverReference) -> Unit): UUID

Subscribe to receive notifications of WatchEventTypes occurring to this ModuleRoot.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun unsubscribeRootWatcher(id: UUID)

Remove a watch subscription.

Properties

Link copied to clipboard
open override val canSave: Boolean

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.

Link copied to clipboard
val fileManager: FileManager

The FileManager used for pooling I/O requests for this root.

Link copied to clipboard
val moduleRoot: ModuleRoot

The ModuleRoot this ModuleRootResolver resolves to.

Link copied to clipboard
val name: String

The name of this root.

Link copied to clipboard
val uri: URI

The URI that identifies the location of the ModuleRoot.

Link copied to clipboard

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.