public interface LibraryResolver
Service for resolving library resources to one or more local paths for
compilation. Look up available
LibraryResolver.Provider via service loader to create
instances. Instances are not intended to be reusable and so may maintain
their own cache of previously resolved entries.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceContext providing access to existing resolved libraries and files, the Lookup for resource resolution, and a LogBuilder for reporting information and errors.static final classData type giving a resource and the additional, resolved local files that were added for that resource.static interfaceProvider interface for creating instances ofLibraryResolver.static interfaceProvider interface for pre-seeding the list of provided libraries with those built into the current PraxisCORE system. -
Method Summary
Modifier and TypeMethodDescriptiondefault voiddispose()Optional hook for disposing of cached resources.resolve(PResource resource, LibraryResolver.Context context) Resolve the provided resource to anLibraryResolver.Entrywith local files to add for compilation.
-
Method Details
-
resolve
Optional<LibraryResolver.Entry> resolve(PResource resource, LibraryResolver.Context context) throws Exception Resolve the provided resource to anLibraryResolver.Entrywith local files to add for compilation. The resolved entry will be from the first resolver to return a result. The entry should only contain additional files required to resolve the requested resource on top of the already resolved resources in the provided context.The resolver may return an alternative primary resource in the entry if an earlier resolution provides the required library, eg. at a different version. The entry may also report additional resources that have been provided by the additional files, such as additional transitive dependencies or alternative identifiers.
The resolver should throw an exception if the resource is a type it should be able to resolve but for some reason cannot.
- Parameters:
resource- library resourcecontext- context, including already resolved paths- Returns:
- optional list of paths
- Throws:
Exception- if the resolver claims the resource but cannot resolve
-
dispose
default void dispose()Optional hook for disposing of cached resources. The instance should not be used after this method has been called.
-