Class ModuleKeys.ProjectPackage
- All Implemented Interfaces:
ModuleKey,ReaderBase
- Enclosing class:
ModuleKeys
projectpackage scheme.
The projectpackage scheme is what project-local dependencies resolve to when
imported using dependency notation (for example, import "@foo/bar.pkl"). This scheme is
an internal implementation detail, and we do not expect a module to declare this.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String, ? extends Dependency> getUri()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 relative paths of this URI should be resolved fromURI.getFragment(), rather thanURI.getPath().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.resolveUri(URI baseUri, URI importUri) 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, resolveUri
-
Field Details
-
packageAssetUri
-
-
Method Details
-
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.- Throws:
IOExceptionSecurityManagerException
-
listElements
public List<PathElement> listElements(SecurityManager securityManager, URI baseUri) throws IOException, SecurityManagerException, ExternalReaderProcessException 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. -
hasElement
public boolean hasElement(SecurityManager securityManager, URI elementUri) throws IOException, SecurityManagerException, ExternalReaderProcessException 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. -
getDependencies
protected Map<String,? extends Dependency> getDependencies() throws IOException, SecurityManagerException- Throws:
IOExceptionSecurityManagerException
-
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
-
hasFragmentPaths
public boolean hasFragmentPaths()Description copied from interface:ReaderBaseTells if relative paths of this URI should be resolved fromURI.getFragment(), rather thanURI.getPath().- Specified by:
hasFragmentPathsin interfaceReaderBase
-
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.
-
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. -
resolveUri
- Specified by:
resolveUriin interfaceReaderBase- Throws:
IOExceptionSecurityManagerException
-