org.sonatype.aether.impl.internal
Class DefaultRepositorySystem

java.lang.Object
  extended by org.sonatype.aether.impl.internal.DefaultRepositorySystem
All Implemented Interfaces:
RepositorySystem, Service

@Component(role=RepositorySystem.class)
public class DefaultRepositorySystem
extends Object
implements RepositorySystem, Service

Author:
Benjamin Bentmann

Constructor Summary
DefaultRepositorySystem()
           
DefaultRepositorySystem(Logger logger, VersionResolver versionResolver, VersionRangeResolver versionRangeResolver, ArtifactResolver artifactResolver, MetadataResolver metadataResolver, ArtifactDescriptorReader artifactDescriptorReader, DependencyCollector dependencyCollector, Installer installer, Deployer deployer, LocalRepositoryProvider localRepositoryProvider, SyncContextFactory syncContextFactory)
           
 
Method Summary
 CollectResult collectDependencies(RepositorySystemSession session, CollectRequest request)
          Collects the transitive dependencies of an artifact and builds a dependency graph.
 DeployResult deploy(RepositorySystemSession session, DeployRequest request)
          Uploads a collection of artifacts and their accompanying metadata to a remote repository.
 void initService(ServiceLocator locator)
          Provides the opportunity to initialize this service and to acquire other services for its operation from the locator.
 InstallResult install(RepositorySystemSession session, InstallRequest request)
          Installs a collection of artifacts and their accompanying metadata to the local repository.
 LocalRepositoryManager newLocalRepositoryManager(LocalRepository localRepository)
          Creates a new manager for the specified local repository.
 SyncContext newSyncContext(RepositorySystemSession session, boolean shared)
          Creates a new synchronization context.
 ArtifactDescriptorResult readArtifactDescriptor(RepositorySystemSession session, ArtifactDescriptorRequest request)
          Gets information about an artifact like its direct dependencies and potential relocations.
 ArtifactResult resolveArtifact(RepositorySystemSession session, ArtifactRequest request)
          Resolves the paths for an artifact.
 List<ArtifactResult> resolveArtifacts(RepositorySystemSession session, Collection<? extends ArtifactRequest> requests)
          Resolves the paths for a collection of artifacts.
 List<ArtifactResult> resolveDependencies(RepositorySystemSession session, CollectRequest request, DependencyFilter filter)
          Collects the transitive dependencies of an artifact and resolves the paths for the artifacts referenced by the specified dependency graph.
 List<ArtifactResult> resolveDependencies(RepositorySystemSession session, DependencyNode node, DependencyFilter filter)
          Resolves the paths for the artifacts referenced by the specified dependency graph.
 DependencyResult resolveDependencies(RepositorySystemSession session, DependencyRequest request)
          Collects and resolves the transitive dependencies of an artifact.
 List<MetadataResult> resolveMetadata(RepositorySystemSession session, Collection<? extends MetadataRequest> requests)
          Resolves the paths for a collection of metadata.
 VersionResult resolveVersion(RepositorySystemSession session, VersionRequest request)
          Resolves an artifact's meta version (if any) to a concrete version.
 VersionRangeResult resolveVersionRange(RepositorySystemSession session, VersionRangeRequest request)
          Expands a version range to a list of matching versions, in ascending order.
 DefaultRepositorySystem setArtifactDescriptorReader(ArtifactDescriptorReader artifactDescriptorReader)
           
 DefaultRepositorySystem setArtifactResolver(ArtifactResolver artifactResolver)
           
 DefaultRepositorySystem setDependencyCollector(DependencyCollector dependencyCollector)
           
 DefaultRepositorySystem setDeployer(Deployer deployer)
           
 DefaultRepositorySystem setInstaller(Installer installer)
           
 DefaultRepositorySystem setLocalRepositoryProvider(LocalRepositoryProvider localRepositoryProvider)
           
 DefaultRepositorySystem setLogger(Logger logger)
           
 DefaultRepositorySystem setMetadataResolver(MetadataResolver metadataResolver)
           
 DefaultRepositorySystem setSyncContextFactory(SyncContextFactory syncContextFactory)
           
 DefaultRepositorySystem setVersionRangeResolver(VersionRangeResolver versionRangeResolver)
           
 DefaultRepositorySystem setVersionResolver(VersionResolver versionResolver)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRepositorySystem

public DefaultRepositorySystem()

DefaultRepositorySystem

public DefaultRepositorySystem(Logger logger,
                               VersionResolver versionResolver,
                               VersionRangeResolver versionRangeResolver,
                               ArtifactResolver artifactResolver,
                               MetadataResolver metadataResolver,
                               ArtifactDescriptorReader artifactDescriptorReader,
                               DependencyCollector dependencyCollector,
                               Installer installer,
                               Deployer deployer,
                               LocalRepositoryProvider localRepositoryProvider,
                               SyncContextFactory syncContextFactory)
Method Detail

initService

public void initService(ServiceLocator locator)
Description copied from interface: Service
Provides the opportunity to initialize this service and to acquire other services for its operation from the locator. A service must not save the reference to the provided service locator.

Specified by:
initService in interface Service
Parameters:
locator - The service locator, must not be null.

setLogger

public DefaultRepositorySystem setLogger(Logger logger)

setVersionResolver

public DefaultRepositorySystem setVersionResolver(VersionResolver versionResolver)

setVersionRangeResolver

public DefaultRepositorySystem setVersionRangeResolver(VersionRangeResolver versionRangeResolver)

setArtifactResolver

public DefaultRepositorySystem setArtifactResolver(ArtifactResolver artifactResolver)

setMetadataResolver

public DefaultRepositorySystem setMetadataResolver(MetadataResolver metadataResolver)

setArtifactDescriptorReader

public DefaultRepositorySystem setArtifactDescriptorReader(ArtifactDescriptorReader artifactDescriptorReader)

setDependencyCollector

public DefaultRepositorySystem setDependencyCollector(DependencyCollector dependencyCollector)

setInstaller

public DefaultRepositorySystem setInstaller(Installer installer)

setDeployer

public DefaultRepositorySystem setDeployer(Deployer deployer)

setLocalRepositoryProvider

public DefaultRepositorySystem setLocalRepositoryProvider(LocalRepositoryProvider localRepositoryProvider)

setSyncContextFactory

public DefaultRepositorySystem setSyncContextFactory(SyncContextFactory syncContextFactory)

resolveVersion

public VersionResult resolveVersion(RepositorySystemSession session,
                                    VersionRequest request)
                             throws VersionResolutionException
Description copied from interface: RepositorySystem
Resolves an artifact's meta version (if any) to a concrete version. For example, resolves "1.0-SNAPSHOT" to "1.0-20090208.132618-23".

Specified by:
resolveVersion in interface RepositorySystem
Parameters:
session - The repository session, must not be null.
request - The version request, must not be null
Returns:
The version result, never null.
Throws:
VersionResolutionException - If the metaversion could not be resolved.

resolveVersionRange

public VersionRangeResult resolveVersionRange(RepositorySystemSession session,
                                              VersionRangeRequest request)
                                       throws VersionRangeResolutionException
Description copied from interface: RepositorySystem
Expands a 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"].

Specified by:
resolveVersionRange in interface RepositorySystem
Parameters:
session - The repository session, must not be null.
request - The version range request, must not be null
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.

readArtifactDescriptor

public ArtifactDescriptorResult readArtifactDescriptor(RepositorySystemSession session,
                                                       ArtifactDescriptorRequest request)
                                                throws ArtifactDescriptorException
Description copied from interface: RepositorySystem
Gets information about an artifact like its direct dependencies and potential relocations.

Specified by:
readArtifactDescriptor in interface RepositorySystem
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:
RepositorySystemSession.isIgnoreInvalidArtifactDescriptor(), RepositorySystemSession.isIgnoreMissingArtifactDescriptor()

resolveArtifact

public ArtifactResult resolveArtifact(RepositorySystemSession session,
                                      ArtifactRequest request)
                               throws ArtifactResolutionException
Description copied from interface: RepositorySystem
Resolves the paths for an artifact. The artifact will be downloaded if necessary. An artifacts that is already resolved will be skipped and is not re-resolved. Note that this method assumes that any relocations have already been processed.

Specified by:
resolveArtifact in interface RepositorySystem
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:
Artifact.getFile()

resolveArtifacts

public List<ArtifactResult> resolveArtifacts(RepositorySystemSession session,
                                             Collection<? extends ArtifactRequest> requests)
                                      throws ArtifactResolutionException
Description copied from interface: RepositorySystem
Resolves the paths for a collection of artifacts. Artifacts will be downloaded if necessary. Artifacts that are already resolved will be skipped and are not re-resolved. Note that this method assumes that any relocations have already been processed.

Specified by:
resolveArtifacts in interface RepositorySystem
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:
Artifact.getFile()

resolveMetadata

public List<MetadataResult> resolveMetadata(RepositorySystemSession session,
                                            Collection<? extends MetadataRequest> requests)
Description copied from interface: RepositorySystem
Resolves the paths for a collection of metadata. Metadata will be downloaded if necessary.

Specified by:
resolveMetadata in interface RepositorySystem
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:
Metadata.getFile()

collectDependencies

public CollectResult collectDependencies(RepositorySystemSession session,
                                         CollectRequest request)
                                  throws DependencyCollectionException
Description copied from interface: RepositorySystem
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, use RepositorySystem.resolveDependencies(RepositorySystemSession, DependencyRequest).

Specified by:
collectDependencies in interface RepositorySystem
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:
RepositorySystemSession.getDependencyTraverser(), RepositorySystemSession.getDependencyManager(), RepositorySystemSession.getDependencySelector(), RepositorySystemSession.getDependencyGraphTransformer()

resolveDependencies

public DependencyResult resolveDependencies(RepositorySystemSession session,
                                            DependencyRequest request)
                                     throws DependencyResolutionException
Description copied from interface: RepositorySystem
Collects and resolves the transitive dependencies of an artifact. This operation is essentially a combination of RepositorySystem.collectDependencies(RepositorySystemSession, CollectRequest) and RepositorySystem.resolveArtifacts(RepositorySystemSession, Collection).

Specified by:
resolveDependencies in interface RepositorySystem
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.

resolveDependencies

public List<ArtifactResult> resolveDependencies(RepositorySystemSession session,
                                                DependencyNode node,
                                                DependencyFilter filter)
                                         throws ArtifactResolutionException
Description copied from interface: RepositorySystem
Resolves the paths for the artifacts referenced by the specified dependency graph. The dependency graph will be updated to reflect each successfully resolved artifact. Artifacts will be downloaded if necessary. Artifacts that are already resolved will be skipped and are not re-resolved.

Specified by:
resolveDependencies in interface RepositorySystem
Parameters:
session - The repository session, must not be null.
node - The root node of the dependency graph whose artifacts shall be resolved, must not be null
filter - The node filter to use to select the actual nodes to resolve, may be null to resolve all nodes.
Returns:
The resolution results, never null.
Throws:
ArtifactResolutionException - If any artifact could not be resolved.
See Also:
Artifact.getFile()

resolveDependencies

public List<ArtifactResult> resolveDependencies(RepositorySystemSession session,
                                                CollectRequest request,
                                                DependencyFilter filter)
                                         throws DependencyCollectionException,
                                                ArtifactResolutionException
Description copied from interface: RepositorySystem
Collects the transitive dependencies of an artifact and resolves the paths for the artifacts referenced by the specified dependency graph. This is a convenience method that combines RepositorySystem.collectDependencies(RepositorySystemSession, CollectRequest) and RepositorySystem.resolveDependencies(RepositorySystemSession, DependencyNode, DependencyFilter).

Specified by:
resolveDependencies in interface RepositorySystem
Parameters:
session - The repository session, must not be null.
request - The collection request, must not be null
filter - The node filter to use to select the actual nodes to resolve, may be null to resolve all nodes.
Returns:
The resolution results, never null.
Throws:
DependencyCollectionException - If the dependency tree could not be built.
ArtifactResolutionException - If any artifact could not be resolved.

install

public InstallResult install(RepositorySystemSession session,
                             InstallRequest request)
                      throws InstallationException
Description copied from interface: RepositorySystem
Installs a collection of artifacts and their accompanying metadata to the local repository.

Specified by:
install in interface RepositorySystem
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.

deploy

public DeployResult deploy(RepositorySystemSession session,
                           DeployRequest request)
                    throws DeploymentException
Description copied from interface: RepositorySystem
Uploads a collection of artifacts and their accompanying metadata to a remote repository.

Specified by:
deploy in interface RepositorySystem
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.

newLocalRepositoryManager

public LocalRepositoryManager newLocalRepositoryManager(LocalRepository localRepository)
Description copied from interface: RepositorySystem
Creates a new manager for the specified local repository. If the specified local repository has no type, the default repository type will be used.

Specified by:
newLocalRepositoryManager in interface RepositorySystem
Parameters:
localRepository - The local repository to create a manager for, must not be null.
Returns:
The local repository manager, never null.

newSyncContext

public SyncContext newSyncContext(RepositorySystemSession session,
                                  boolean shared)
Description copied from interface: RepositorySystem
Creates a new synchronization context.

Specified by:
newSyncContext in interface RepositorySystem
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.


Copyright © 2010-2012. All Rights Reserved.