Class ModuleKeys.ExternalResolver
- All Implemented Interfaces:
ModuleKey,ReaderBase
- Enclosing class:
ModuleKeys
-
Method Summary
Modifier and TypeMethodDescriptiongetUri()Returns the absolute URI of this module.booleanhasElement(SecurityManager securityManager, URI elementUri) Tells if this module key or resource reader has an element atelementUri.booleanTells if the URIs represented by this module key or resource reader should be interpreted as hierarchical.booleanTells if this module key or resource reader supports globbing.booleanisLocal()Tells if the modules represented by this module key is local to the environment.listElements(SecurityManager securityManager, URI baseUri) List elements within a base URI.resolve(SecurityManager securityManager) Resolves this module to a canonical form suitable for loading and caching the module.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pkl.core.module.ModuleKey
getFileCacheLocation, isCached, resolveUriMethods inherited from interface org.pkl.core.runtime.ReaderBase
hasFragmentPaths, resolveUri
-
Method Details
-
isLocal
public boolean isLocal()Description copied from interface:ModuleKeyTells if the modules represented by this module key is local to the environment.A module that is local, and also
ReaderBase.hasHierarchicalUris(), supports triple-dot imports.As a best practice, a module key should be considered local if its source can be loaded in a low latency environment (for example, from disk or from memory). On the flip-side, a module loaded from a remove server should not be considered local.
-
hasHierarchicalUris
public boolean hasHierarchicalUris()Description copied from interface:ReaderBaseTells if the URIs represented by this module key or resource reader should be interpreted as hierarchical.- Specified by:
hasHierarchicalUrisin interfaceReaderBase
-
isGlobbable
public boolean isGlobbable()Description copied from interface:ReaderBaseTells if this module key or resource reader supports globbing.- Specified by:
isGlobbablein interfaceReaderBase
-
getUri
Description copied from interface:ModuleKeyReturns the absolute URI of this module. This URI is used for identifying the module in user facing messages, for example stack traces. Typically, this URI contains all information necessary for resolving and loading the module. -
listElements
public List<PathElement> listElements(SecurityManager securityManager, URI baseUri) throws IOException, SecurityManagerException Description copied from interface:ReaderBaseList elements within a base URI.This method is called by the
GlobResolverwhen resolving glob expressions ifReaderBase.isGlobbable()returns true.This method does not need to be implemented if
ReaderBase.isGlobbable()returns false.If
ReaderBase.hasHierarchicalUris()returns false,URIis effectively an empty URI and should be ignored. In this case, this method is expected to list all elements represented by this reader.- Specified by:
listElementsin interfaceReaderBase- Throws:
IOExceptionSecurityManagerException
-
resolve
public ResolvedModuleKey resolve(SecurityManager securityManager) throws IOException, SecurityManagerException Description copied from interface:ModuleKeyResolves this module to a canonical form suitable for loading and caching the module. This may involve I/O. ThrowsFileNotFoundExceptionif this module cannot be found.- Specified by:
resolvein interfaceModuleKey- Throws:
IOExceptionSecurityManagerException
-
hasElement
public boolean hasElement(SecurityManager securityManager, URI elementUri) throws IOException, SecurityManagerException Description copied from interface:ReaderBaseTells if this module key or resource reader has an element atelementUri.This method only needs to be implemented if
ReaderBase.hasHierarchicalUris()returns true, and if eitherReaderBase.isGlobbable()orModuleKey.isLocal()returns true.- Specified by:
hasElementin interfaceReaderBase- Throws:
IOExceptionSecurityManagerException
-