Interface RepositorySystem
- All Superinterfaces:
- AutoCloseable,- Closeable
- All Known Implementing Classes:
- DefaultRepositorySystem
 When the repository system or the application integrating it is about to exit, invoke the shutdown() to let
 resolver system perform possible resource cleanups.
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddOnSystemEndedHandler(Runnable handler) Registers an "on repository system end" handler, executed after repository system is shut down.default voidclose()Closes this instance, invokesshutdown().collectDependencies(RepositorySystemSession session, CollectRequest request) Collects the transitive dependencies of an artifact and builds a dependency graph.Creates a brand-new session builder instance that produces "top level" (root) session.deploy(RepositorySystemSession session, DeployRequest request) Uploads a collection of artifacts and their accompanying metadata to a remote repository.flattenDependencyNodes(RepositorySystemSession session, DependencyNode root, DependencyFilter filter) Flattens the provided graph asDependencyNodeinto aList<DependencyNode>according to session configuration.install(RepositorySystemSession session, InstallRequest request) Installs a collection of artifacts and their accompanying metadata to the local repository.newDeploymentRepository(RepositorySystemSession session, RemoteRepository repository) Forms a remote repository suitable for artifact deployment by applying the session's authentication selector and similar network configuration to the given repository prototype.newLocalRepositoryManager(RepositorySystemSession session, List<LocalRepository> localRepositories) Creates a new manager for the specified local repositories.newLocalRepositoryManager(RepositorySystemSession session, LocalRepository localRepository) Creates a new manager for the specified local repository.newLocalRepositoryManager(RepositorySystemSession session, LocalRepository... localRepositories) Creates a new manager for the specified local repositories.newResolutionRepositories(RepositorySystemSession session, List<RemoteRepository> repositories) Forms remote repositories suitable for artifact resolution by applying the session's authentication selector and similar network configuration to the given repository prototypes.newSyncContext(RepositorySystemSession session, boolean shared) Creates a new synchronization context.readArtifactDescriptor(RepositorySystemSession session, ArtifactDescriptorRequest request) Gets information about an artifact like its direct dependencies and potential relocations.resolveArtifact(RepositorySystemSession session, ArtifactRequest request) Resolves the path for an artifact.resolveArtifacts(RepositorySystemSession session, Collection<? extends ArtifactRequest> requests) Resolves the paths for a collection of artifacts.resolveDependencies(RepositorySystemSession session, DependencyRequest request) Collects and resolves the transitive dependencies of an artifact.resolveMetadata(RepositorySystemSession session, Collection<? extends MetadataRequest> requests) Resolves the paths for a collection of metadata.resolveVersion(RepositorySystemSession session, VersionRequest request) Resolves an artifact's meta version (if any) to a concrete version.resolveVersionRange(RepositorySystemSession session, VersionRangeRequest request) Expands an artifact's version range to a list of matching versions, in ascending order.voidshutdown()Signals to repository system to shut down.
- 
Method Details- 
resolveVersionRangeVersionRangeResult resolveVersionRange(RepositorySystemSession session, VersionRangeRequest request) throws VersionRangeResolutionException Expands an artifact's version range to a list of matching versions, in ascending order. For example, resolves "[3.8,4.0)" to "3.8", "3.8.1", "3.8.2". Note that the returned list of versions is only dependent on the configured repositories and their contents, the list is not processed by thesession's version filter.The supplied request may also refer to a single concrete version rather than a version range. In this case though, the result contains simply the (parsed) input version, regardless of the repositories and their contents. - Parameters:
- session- The repository session, must not be- null.
- request- The version range request, must not be- null. It holds the- Artifactwhose version range to resolve.
- Returns:
- The version range result, never null.
- Throws:
- VersionRangeResolutionException- If the requested range could not be parsed. Note that an empty range does not raise an exception.
- See Also:
 
- 
resolveVersionVersionResult resolveVersion(RepositorySystemSession session, VersionRequest request) throws VersionResolutionException Resolves an artifact's meta version (if any) to a concrete version. For example, resolves "1.0-SNAPSHOT" to "1.0-20090208.132618-23".- Parameters:
- session- The repository session, must not be- null.
- request- The version request, must not be- null. It holds the- Artifactwhose version to resolve.
- Returns:
- The version result, never null.
- Throws:
- VersionResolutionException- If the metaversion could not be resolved.
- See Also:
 
- 
readArtifactDescriptorArtifactDescriptorResult readArtifactDescriptor(RepositorySystemSession session, ArtifactDescriptorRequest request) throws ArtifactDescriptorException Gets information about an artifact like its direct dependencies and potential relocations.- Parameters:
- session- The repository session, must not be- null.
- request- The descriptor request, must not be- null.
- Returns:
- The descriptor result, never null.
- Throws:
- ArtifactDescriptorException- If the artifact descriptor could not be read.
- See Also:
 
- 
collectDependenciesCollectResult collectDependencies(RepositorySystemSession session, CollectRequest request) throws DependencyCollectionException Collects the transitive dependencies of an artifact and builds a dependency graph. Note that this operation is only concerned about determining the coordinates of the transitive dependencies. To also resolve the actual artifact files, useresolveDependencies(RepositorySystemSession, DependencyRequest).- Parameters:
- session- The repository session, must not be- null.
- request- The collection request, must not be- null.
- Returns:
- The collection result, never null.
- Throws:
- DependencyCollectionException- If the dependency tree could not be built.
- See Also:
 
- 
resolveDependenciesDependencyResult resolveDependencies(RepositorySystemSession session, DependencyRequest request) throws DependencyResolutionException Collects and resolves the transitive dependencies of an artifact. This operation is essentially a combination ofcollectDependencies(RepositorySystemSession, CollectRequest)andresolveArtifacts(RepositorySystemSession, Collection).- Parameters:
- session- The repository session, must not be- null.
- request- The dependency request, must not be- null.
- Returns:
- The dependency result, never null.
- Throws:
- DependencyResolutionException- If the dependency tree could not be built or any dependency artifact could not be resolved.
- See Also:
 
- 
flattenDependencyNodesList<DependencyNode> flattenDependencyNodes(RepositorySystemSession session, DependencyNode root, DependencyFilter filter) Flattens the provided graph asDependencyNodeinto aList<DependencyNode>according to session configuration.- Parameters:
- session- The repository session, must not be- null.
- root- The dependency node root of the graph, must not be- null.
- filter- The filter to apply, may be- null.
- Returns:
- The flattened list of dependency nodes, never null.
- Since:
- 2.0.0
 
- 
resolveArtifactArtifactResult resolveArtifact(RepositorySystemSession session, ArtifactRequest request) throws ArtifactResolutionException Resolves the path for an artifact. The artifact will be downloaded to the local repository if necessary. An artifact that is already resolved will be skipped and is not re-resolved. In general, callers must not assume any relationship between an artifact's resolved filename and its coordinates. Note that this method assumes that any relocations have already been processed.- Parameters:
- session- The repository session, must not be- null.
- request- The resolution request, must not be- null.
- Returns:
- The resolution result, never null.
- Throws:
- ArtifactResolutionException- If the artifact could not be resolved.
- See Also:
 
- 
resolveArtifactsList<ArtifactResult> resolveArtifacts(RepositorySystemSession session, Collection<? extends ArtifactRequest> requests) throws ArtifactResolutionException Resolves the paths for a collection of artifacts. Artifacts will be downloaded to the local repository if necessary. Artifacts that are already resolved will be skipped and are not re-resolved. In general, callers must not assume any relationship between an artifact's filename and its coordinates. Note that this method assumes that any relocations have already been processed.- Parameters:
- session- The repository session, must not be- null.
- requests- The resolution requests, must not be- null.
- Returns:
- The resolution results (in request order), never null.
- Throws:
- ArtifactResolutionException- If any artifact could not be resolved.
- See Also:
 
- 
resolveMetadataList<MetadataResult> resolveMetadata(RepositorySystemSession session, Collection<? extends MetadataRequest> requests) Resolves the paths for a collection of metadata. Metadata will be downloaded to the local repository if necessary, e.g. because it hasn't been cached yet or the cache is deemed outdated.- Parameters:
- session- The repository session, must not be- null.
- requests- The resolution requests, must not be- null.
- Returns:
- The resolution results (in request order), never null.
- See Also:
 
- 
installInstallResult install(RepositorySystemSession session, InstallRequest request) throws InstallationException Installs a collection of artifacts and their accompanying metadata to the local repository.- Parameters:
- session- The repository session, must not be- null.
- request- The installation request, must not be- null.
- Returns:
- The installation result, never null.
- Throws:
- InstallationException- If any artifact/metadata from the request could not be installed.
 
- 
deployDeployResult deploy(RepositorySystemSession session, DeployRequest request) throws DeploymentException Uploads a collection of artifacts and their accompanying metadata to a remote repository.- Parameters:
- session- The repository session, must not be- null.
- request- The deployment request, must not be- null.
- Returns:
- The deployment result, never null.
- Throws:
- DeploymentException- If any artifact/metadata from the request could not be deployed.
- See Also:
 
- 
newLocalRepositoryManagerLocalRepositoryManager newLocalRepositoryManager(RepositorySystemSession session, LocalRepository localRepository) Creates a new manager for the specified local repository. If the specified local repository has no type, the default local repository type of the system will be used. Note: It is expected that this method invocation is one of the last steps of setting up a new session, in particular any configuration properties should have been set already.- Parameters:
- session- The repository system session from which to configure the manager, must not be- null.
- localRepository- The local repository to create a manager for, must not be- null.
- Returns:
- The local repository manager, never null.
- Throws:
- IllegalArgumentException- If the specified repository type is not recognized or no base directory is given.
 
- 
newLocalRepositoryManagerLocalRepositoryManager newLocalRepositoryManager(RepositorySystemSession session, LocalRepository... localRepositories) Creates a new manager for the specified local repositories. If the specified local repository has no type, the default local repository type of the system will be used. Note: It is expected that this method invocation is one of the last steps of setting up a new session, in particular any configuration properties should have been set already. Note: this method accepts multiple local repositories, in which case it creates chained local repository.- Parameters:
- session- The repository system session from which to configure the manager, must not be- null.
- localRepositories- The local repositories to create a manager for, must not be- nullnor empty array.
- Returns:
- The local repository manager, never null.
- Throws:
- IllegalArgumentException- If the specified repository type is not recognized or no base directory is given.
- Since:
- 2.0.0
 
- 
newLocalRepositoryManagerLocalRepositoryManager newLocalRepositoryManager(RepositorySystemSession session, List<LocalRepository> localRepositories) Creates a new manager for the specified local repositories. If the specified local repository has no type, the default local repository type of the system will be used. Note: It is expected that this method invocation is one of the last steps of setting up a new session, in particular any configuration properties should have been set already. Note: this method accepts multiple local repositories, in which case it creates chained local repository.- Parameters:
- session- The repository system session from which to configure the manager, must not be- null.
- localRepositories- The local repositories to create a manager for, must not be- nullnor empty.
- Returns:
- The local repository manager, never null.
- Throws:
- IllegalArgumentException- If the specified repository type is not recognized or no base directory is given.
- Since:
- 2.0.0
 
- 
newSyncContextCreates a new synchronization context.- Parameters:
- session- The repository session during which the context will be used, must not be- null.
- shared- A flag indicating whether access to the artifacts/metadata associated with the new context can be shared among concurrent readers or whether access needs to be exclusive to the calling thread.
- Returns:
- The synchronization context, never null.
 
- 
newResolutionRepositoriesList<RemoteRepository> newResolutionRepositories(RepositorySystemSession session, List<RemoteRepository> repositories) Forms remote repositories suitable for artifact resolution by applying the session's authentication selector and similar network configuration to the given repository prototypes. As noted forRepositorySystemSession.getAuthenticationSelector()etc. the remote repositories passed to e.g.resolveArtifact()are used as is and expected to already carry any required authentication or proxy configuration. This method can be used to apply the authentication/proxy configuration from a session to a bare repository definition to obtain the complete repository definition for use in the resolution request.- Parameters:
- session- The repository system session from which to configure the repositories, must not be- null.
- repositories- The repository prototypes from which to derive the resolution repositories, must not be- nullor contain- nullelements.
- Returns:
- The resolution repositories, never null. Note that there is generally no 1:1 relationship of the obtained repositories to the original inputs due to mirror selection potentially aggregating multiple repositories.
- See Also:
 
- 
newDeploymentRepositoryRemoteRepository newDeploymentRepository(RepositorySystemSession session, RemoteRepository repository) Forms a remote repository suitable for artifact deployment by applying the session's authentication selector and similar network configuration to the given repository prototype. As noted forRepositorySystemSession.getAuthenticationSelector()etc. the remote repository passed todeploy()is used as is and expected to already carry any required authentication or proxy configuration. This method can be used to apply the authentication/proxy configuration from a session to a bare repository definition to obtain the complete repository definition for use in the deployment request.- Parameters:
- session- The repository system session from which to configure the repository, must not be- null.
- repository- The repository prototype from which to derive the deployment repository, must not be- null.
- Returns:
- The deployment repository, never null.
- See Also:
 
- 
addOnSystemEndedHandlerRegisters an "on repository system end" handler, executed after repository system is shut down.- Parameters:
- handler- The handler, must not be- null.
- Since:
- 1.9.0
 
- 
createSessionBuilderCreates a brand-new session builder instance that produces "top level" (root) session. Top level sessions are associated with its creatorRepositorySysteminstance, and may be used only with that given instance and only within the lifespan of it, and after use should be closed.- Since:
- 2.0.0
 
- 
shutdownvoid shutdown()Signals to repository system to shut down. Shut down instance is not usable anymore.Repository system may perform some resource cleanup, if applicable. Not using this method may cause leaks or unclean shutdown of some subsystem. When shutdown happens, all the registered on-close handlers will be invoked (even if some throws), and at end of operation a MultiRuntimeExceptionmay be thrown, signaling that some handler(s) failed. This exception may be ignored, is at the discretion of caller.- Since:
- 1.9.0
 
- 
closeCloses this instance, invokesshutdown().- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Since:
- 2.0.0
 
 
-