Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -56,9 +56,9 @@

/**
* The main entry point to the repository system and its functionality. Note that obtaining a concrete implementation of
* this interface (e.g. via dependency injection, service locator, etc.) is dependent on the application and its
* this interface (e.g. via dependency injection, etc.) is dependent on the application and its
* specific needs, please consult the online documentation for examples and directions on booting the system.
*
*
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
Expand All @@ -73,7 +73,7 @@ public interface RepositorySystem
* <p>
* 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.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The version range request, must not be {@code null}.
* @return The version range result, never {@code null}.
Expand All @@ -87,7 +87,7 @@ VersionRangeResult resolveVersionRange( RepositorySystemSession session, Version
/**
* Resolves an artifact's meta version (if any) to a concrete version. For example, resolves "1.0-SNAPSHOT" to
* "1.0-20090208.132618-23".
*
*
* @param session The repository session, must not be {@code null}.
* @param request The version request, must not be {@code null}.
* @return The version result, never {@code null}.
Expand All @@ -99,7 +99,7 @@ VersionResult resolveVersion( RepositorySystemSession session, VersionRequest re

/**
* Gets information about an artifact like its direct dependencies and potential relocations.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The descriptor request, must not be {@code null}.
* @return The descriptor result, never {@code null}.
Expand All @@ -115,7 +115,7 @@ ArtifactDescriptorResult readArtifactDescriptor( RepositorySystemSession session
* 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 {@link #resolveDependencies(RepositorySystemSession, DependencyRequest)}.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The collection request, must not be {@code null}.
* @return The collection result, never {@code null}.
Expand All @@ -134,7 +134,7 @@ CollectResult collectDependencies( RepositorySystemSession session, CollectReque
* Collects and resolves the transitive dependencies of an artifact. This operation is essentially a combination of
* {@link #collectDependencies(RepositorySystemSession, CollectRequest)} and
* {@link #resolveArtifacts(RepositorySystemSession, Collection)}.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The dependency request, must not be {@code null}.
* @return The dependency result, never {@code null}.
Expand All @@ -150,7 +150,7 @@ DependencyResult resolveDependencies( RepositorySystemSession session, Dependenc
* 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.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The resolution request, must not be {@code null}.
* @return The resolution result, never {@code null}.
Expand All @@ -166,7 +166,7 @@ ArtifactResult resolveArtifact( RepositorySystemSession session, ArtifactRequest
* 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.
*
*
* @param session The repository session, must not be {@code null}.
* @param requests The resolution requests, must not be {@code null}.
* @return The resolution results (in request order), never {@code null}.
Expand All @@ -181,7 +181,7 @@ List<ArtifactResult> resolveArtifacts( RepositorySystemSession session,
/**
* 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.
*
*
* @param session The repository session, must not be {@code null}.
* @param requests The resolution requests, must not be {@code null}.
* @return The resolution results (in request order), never {@code null}.
Expand All @@ -193,7 +193,7 @@ List<MetadataResult> resolveMetadata( RepositorySystemSession session,

/**
* Installs a collection of artifacts and their accompanying metadata to the local repository.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The installation request, must not be {@code null}.
* @return The installation result, never {@code null}.
Expand All @@ -204,7 +204,7 @@ InstallResult install( RepositorySystemSession session, InstallRequest request )

/**
* Uploads a collection of artifacts and their accompanying metadata to a remote repository.
*
*
* @param session The repository session, must not be {@code null}.
* @param request The deployment request, must not be {@code null}.
* @return The deployment result, never {@code null}.
Expand All @@ -219,7 +219,7 @@ DeployResult deploy( RepositorySystemSession session, DeployRequest request )
* default local repository type of the system will be used. <em>Note:</em> 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.
*
*
* @param session The repository system session from which to configure the manager, must not be {@code null}.
* @param localRepository The local repository to create a manager for, must not be {@code null}.
* @return The local repository manager, never {@code null}.
Expand All @@ -231,7 +231,7 @@ LocalRepositoryManager newLocalRepositoryManager( RepositorySystemSession sessio

/**
* Creates a new synchronization context.
*
*
* @param session The repository session during which the context will be used, must not be {@code null}.
* @param 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.
Expand All @@ -247,7 +247,7 @@ LocalRepositoryManager newLocalRepositoryManager( RepositorySystemSession sessio
* 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.
*
*
* @param session The repository system session from which to configure the repositories, must not be {@code null}.
* @param repositories The repository prototypes from which to derive the resolution repositories, must not be
* {@code null} or contain {@code null} elements.
Expand All @@ -267,7 +267,7 @@ List<RemoteRepository> newResolutionRepositories( RepositorySystemSession sessio
* 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 deploy request.
*
*
* @param session The repository system session from which to configure the repository, must not be {@code null}.
* @param repository The repository prototype from which to derive the deployment repository, must not be
* {@code null}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider;
import org.eclipse.aether.spi.connector.transport.TransporterProvider;
import org.eclipse.aether.spi.io.FileProcessor;
import org.eclipse.aether.spi.locator.Service;
import org.eclipse.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.transfer.NoRepositoryConnectorException;

/**
Expand All @@ -43,95 +41,35 @@
*/
@Named( "basic" )
public final class BasicRepositoryConnectorFactory
implements RepositoryConnectorFactory, Service
implements RepositoryConnectorFactory
{
private TransporterProvider transporterProvider;
private final TransporterProvider transporterProvider;

private RepositoryLayoutProvider layoutProvider;
private final RepositoryLayoutProvider layoutProvider;

private ChecksumPolicyProvider checksumPolicyProvider;
private final ChecksumPolicyProvider checksumPolicyProvider;

private FileProcessor fileProcessor;
private final FileProcessor fileProcessor;

private float priority;

/**
* Creates an (uninitialized) instance of this connector factory. <em>Note:</em> In case of manual instantiation by
* clients, the new factory needs to be configured via its various mutators before first use or runtime errors will
* occur.
*/
public BasicRepositoryConnectorFactory()
{
// enables default constructor
}

@Inject
BasicRepositoryConnectorFactory( TransporterProvider transporterProvider, RepositoryLayoutProvider layoutProvider,
ChecksumPolicyProvider checksumPolicyProvider, FileProcessor fileProcessor )
{
setTransporterProvider( transporterProvider );
setRepositoryLayoutProvider( layoutProvider );
setChecksumPolicyProvider( checksumPolicyProvider );
setFileProcessor( fileProcessor );
}

public void initService( ServiceLocator locator )
{
setTransporterProvider( locator.getService( TransporterProvider.class ) );
setRepositoryLayoutProvider( locator.getService( RepositoryLayoutProvider.class ) );
setChecksumPolicyProvider( locator.getService( ChecksumPolicyProvider.class ) );
setFileProcessor( locator.getService( FileProcessor.class ) );
}

/**
* Sets the transporter provider to use for this component.
*
* @param transporterProvider The transporter provider to use, must not be {@code null}.
* @return This component for chaining, never {@code null}.
*/
public BasicRepositoryConnectorFactory setTransporterProvider( TransporterProvider transporterProvider )
{
this.transporterProvider = requireNonNull( transporterProvider, "transporter provider cannot be null" );
return this;
}

/**
* Sets the repository layout provider to use for this component.
*
* @param layoutProvider The repository layout provider to use, must not be {@code null}.
* @return This component for chaining, never {@code null}.
*/
public BasicRepositoryConnectorFactory setRepositoryLayoutProvider( RepositoryLayoutProvider layoutProvider )
{
this.layoutProvider = requireNonNull( layoutProvider, "repository layout provider cannot be null" );
return this;
}

/**
* Sets the checksum policy provider to use for this component.
*
* @param checksumPolicyProvider The checksum policy provider to use, must not be {@code null}.
* @return This component for chaining, never {@code null}.
*/
public BasicRepositoryConnectorFactory setChecksumPolicyProvider( ChecksumPolicyProvider checksumPolicyProvider )
public BasicRepositoryConnectorFactory( TransporterProvider transporterProvider,
RepositoryLayoutProvider layoutProvider,
ChecksumPolicyProvider checksumPolicyProvider,
FileProcessor fileProcessor )
{
this.transporterProvider = requireNonNull(
transporterProvider, "transporter provider cannot be null" );
this.layoutProvider = requireNonNull(
layoutProvider, "repository layout provider cannot be null" );
this.checksumPolicyProvider = requireNonNull(
checksumPolicyProvider, "checksum policy provider cannot be null" );
return this;
}

/**
* Sets the file processor to use for this component.
*
* @param fileProcessor The file processor to use, must not be {@code null}.
* @return This component for chaining, never {@code null}.
*/
public BasicRepositoryConnectorFactory setFileProcessor( FileProcessor fileProcessor )
{
this.fileProcessor = requireNonNull( fileProcessor, "file processor cannot be null" );
return this;
checksumPolicyProvider, "checksum policy provider cannot be null" );
this.fileProcessor = requireNonNull(
fileProcessor, "file processor cannot be null" );
}

@Override
public float getPriority()
{
return priority;
Expand All @@ -149,6 +87,7 @@ public BasicRepositoryConnectorFactory setPriority( float priority )
return this;
}

@Override
public RepositoryConnector newInstance( RepositorySystemSession session, RemoteRepository repository )
throws NoRepositoryConnectorException
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public class Booter

public static RepositorySystem newRepositorySystem()
{
return org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
// return org.apache.maven.resolver.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
// return org.apache.maven.resolver.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
return org.apache.maven.resolver.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
}

public static DefaultRepositorySystemSession newRepositorySystemSession( RepositorySystem system )
Expand Down
5 changes: 5 additions & 0 deletions maven-resolver-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
<artifactId>maven-resolver-test-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Loading