maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [41/53] [abbrv] [partial] maven-resolver git commit: [MNG-6007] renamed Aether to Maven Artifact Resolver
Date Sun, 15 Jan 2017 19:24:15 GMT
http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
deleted file mode 100644
index 27f2285..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnector.java
+++ /dev/null
@@ -1,595 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.aether.ConfigurationProperties;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.ArtifactDownload;
-import org.eclipse.aether.spi.connector.ArtifactUpload;
-import org.eclipse.aether.spi.connector.MetadataDownload;
-import org.eclipse.aether.spi.connector.MetadataUpload;
-import org.eclipse.aether.spi.connector.RepositoryConnector;
-import org.eclipse.aether.spi.connector.checksum.ChecksumPolicy;
-import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayoutProvider;
-import org.eclipse.aether.spi.connector.transport.GetTask;
-import org.eclipse.aether.spi.connector.transport.PeekTask;
-import org.eclipse.aether.spi.connector.transport.PutTask;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.spi.connector.transport.TransporterProvider;
-import org.eclipse.aether.spi.io.FileProcessor;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.transfer.ChecksumFailureException;
-import org.eclipse.aether.transfer.NoRepositoryConnectorException;
-import org.eclipse.aether.transfer.NoRepositoryLayoutException;
-import org.eclipse.aether.transfer.NoTransporterException;
-import org.eclipse.aether.transfer.TransferEvent;
-import org.eclipse.aether.transfer.TransferResource;
-import org.eclipse.aether.util.ChecksumUtils;
-import org.eclipse.aether.util.ConfigUtils;
-import org.eclipse.aether.util.concurrency.RunnableErrorForwarder;
-import org.eclipse.aether.util.concurrency.WorkerThreadFactory;
-
-/**
- */
-final class BasicRepositoryConnector
-    implements RepositoryConnector
-{
-
-    private static final String CONFIG_PROP_THREADS = "aether.connector.basic.threads";
-
-    private static final String CONFIG_PROP_RESUME = "aether.connector.resumeDownloads";
-
-    private static final String CONFIG_PROP_RESUME_THRESHOLD = "aether.connector.resumeThreshold";
-
-    private static final String CONFIG_PROP_SMART_CHECKSUMS = "aether.connector.smartChecksums";
-
-    private final Logger logger;
-
-    private final FileProcessor fileProcessor;
-
-    private final RemoteRepository repository;
-
-    private final RepositorySystemSession session;
-
-    private final Transporter transporter;
-
-    private final RepositoryLayout layout;
-
-    private final ChecksumPolicyProvider checksumPolicyProvider;
-
-    private final PartialFile.Factory partialFileFactory;
-
-    private final int maxThreads;
-
-    private final boolean smartChecksums;
-
-    private final boolean persistedChecksums;
-
-    private Executor executor;
-
-    private boolean closed;
-
-    public BasicRepositoryConnector( RepositorySystemSession session, RemoteRepository repository,
-                                     TransporterProvider transporterProvider, RepositoryLayoutProvider layoutProvider,
-                                     ChecksumPolicyProvider checksumPolicyProvider, FileProcessor fileProcessor,
-                                     Logger logger )
-        throws NoRepositoryConnectorException
-    {
-        try
-        {
-            layout = layoutProvider.newRepositoryLayout( session, repository );
-        }
-        catch ( NoRepositoryLayoutException e )
-        {
-            throw new NoRepositoryConnectorException( repository, e.getMessage(), e );
-        }
-        try
-        {
-            transporter = transporterProvider.newTransporter( session, repository );
-        }
-        catch ( NoTransporterException e )
-        {
-            throw new NoRepositoryConnectorException( repository, e.getMessage(), e );
-        }
-        this.checksumPolicyProvider = checksumPolicyProvider;
-
-        this.session = session;
-        this.repository = repository;
-        this.fileProcessor = fileProcessor;
-        this.logger = logger;
-
-        maxThreads = ConfigUtils.getInteger( session, 5, CONFIG_PROP_THREADS, "maven.artifact.threads" );
-        smartChecksums = ConfigUtils.getBoolean( session, true, CONFIG_PROP_SMART_CHECKSUMS );
-        persistedChecksums =
-            ConfigUtils.getBoolean( session, ConfigurationProperties.DEFAULT_PERSISTED_CHECKSUMS,
-                                    ConfigurationProperties.PERSISTED_CHECKSUMS );
-
-        boolean resumeDownloads =
-            ConfigUtils.getBoolean( session, true, CONFIG_PROP_RESUME + '.' + repository.getId(), CONFIG_PROP_RESUME );
-        long resumeThreshold =
-            ConfigUtils.getLong( session, 64 * 1024, CONFIG_PROP_RESUME_THRESHOLD + '.' + repository.getId(),
-                                 CONFIG_PROP_RESUME_THRESHOLD );
-        int requestTimeout =
-            ConfigUtils.getInteger( session, ConfigurationProperties.DEFAULT_REQUEST_TIMEOUT,
-                                    ConfigurationProperties.REQUEST_TIMEOUT + '.' + repository.getId(),
-                                    ConfigurationProperties.REQUEST_TIMEOUT );
-        partialFileFactory = new PartialFile.Factory( resumeDownloads, resumeThreshold, requestTimeout, logger );
-    }
-
-    private Executor getExecutor( Collection<?> artifacts, Collection<?> metadatas )
-    {
-        if ( maxThreads <= 1 )
-        {
-            return DirectExecutor.INSTANCE;
-        }
-        int tasks = safe( artifacts ).size() + safe( metadatas ).size();
-        if ( tasks <= 1 )
-        {
-            return DirectExecutor.INSTANCE;
-        }
-        if ( executor == null )
-        {
-            executor =
-                new ThreadPoolExecutor( maxThreads, maxThreads, 3, TimeUnit.SECONDS,
-                                        new LinkedBlockingQueue<Runnable>(),
-                                        new WorkerThreadFactory( getClass().getSimpleName() + '-'
-                                            + repository.getHost() + '-' ) );
-        }
-        return executor;
-    }
-
-    @Override
-    protected void finalize()
-        throws Throwable
-    {
-        try
-        {
-            close();
-        }
-        finally
-        {
-            super.finalize();
-        }
-    }
-
-    public void close()
-    {
-        if ( !closed )
-        {
-            closed = true;
-            if ( executor instanceof ExecutorService )
-            {
-                ( (ExecutorService) executor ).shutdown();
-            }
-            transporter.close();
-        }
-    }
-
-    public void get( Collection<? extends ArtifactDownload> artifactDownloads,
-                     Collection<? extends MetadataDownload> metadataDownloads )
-    {
-        if ( closed )
-        {
-            throw new IllegalStateException( "connector closed" );
-        }
-
-        Executor executor = getExecutor( artifactDownloads, metadataDownloads );
-        RunnableErrorForwarder errorForwarder = new RunnableErrorForwarder();
-
-        for ( MetadataDownload transfer : safe( metadataDownloads ) )
-        {
-            URI location = layout.getLocation( transfer.getMetadata(), false );
-
-            TransferResource resource = newTransferResource( location, transfer.getFile(), transfer.getTrace() );
-            TransferEvent.Builder builder = newEventBuilder( resource, false, false );
-            MetadataTransportListener listener = new MetadataTransportListener( transfer, repository, builder );
-
-            ChecksumPolicy checksumPolicy = newChecksumPolicy( transfer.getChecksumPolicy(), resource );
-            List<RepositoryLayout.Checksum> checksums = null;
-            if ( checksumPolicy != null )
-            {
-                checksums = layout.getChecksums( transfer.getMetadata(), false, location );
-            }
-
-            Runnable task = new GetTaskRunner( location, transfer.getFile(), checksumPolicy, checksums, listener );
-            executor.execute( errorForwarder.wrap( task ) );
-        }
-
-        for ( ArtifactDownload transfer : safe( artifactDownloads ) )
-        {
-            URI location = layout.getLocation( transfer.getArtifact(), false );
-
-            TransferResource resource = newTransferResource( location, transfer.getFile(), transfer.getTrace() );
-            TransferEvent.Builder builder = newEventBuilder( resource, false, transfer.isExistenceCheck() );
-            ArtifactTransportListener listener = new ArtifactTransportListener( transfer, repository, builder );
-
-            Runnable task;
-            if ( transfer.isExistenceCheck() )
-            {
-                task = new PeekTaskRunner( location, listener );
-            }
-            else
-            {
-                ChecksumPolicy checksumPolicy = newChecksumPolicy( transfer.getChecksumPolicy(), resource );
-                List<RepositoryLayout.Checksum> checksums = null;
-                if ( checksumPolicy != null )
-                {
-                    checksums = layout.getChecksums( transfer.getArtifact(), false, location );
-                }
-
-                task = new GetTaskRunner( location, transfer.getFile(), checksumPolicy, checksums, listener );
-            }
-            executor.execute( errorForwarder.wrap( task ) );
-        }
-
-        errorForwarder.await();
-    }
-
-    public void put( Collection<? extends ArtifactUpload> artifactUploads,
-                     Collection<? extends MetadataUpload> metadataUploads )
-    {
-        if ( closed )
-        {
-            throw new IllegalStateException( "connector closed" );
-        }
-
-        for ( ArtifactUpload transfer : safe( artifactUploads ) )
-        {
-            URI location = layout.getLocation( transfer.getArtifact(), true );
-
-            TransferResource resource = newTransferResource( location, transfer.getFile(), transfer.getTrace() );
-            TransferEvent.Builder builder = newEventBuilder( resource, true, false );
-            ArtifactTransportListener listener = new ArtifactTransportListener( transfer, repository, builder );
-
-            List<RepositoryLayout.Checksum> checksums = layout.getChecksums( transfer.getArtifact(), true, location );
-
-            Runnable task = new PutTaskRunner( location, transfer.getFile(), checksums, listener );
-            task.run();
-        }
-
-        for ( MetadataUpload transfer : safe( metadataUploads ) )
-        {
-            URI location = layout.getLocation( transfer.getMetadata(), true );
-
-            TransferResource resource = newTransferResource( location, transfer.getFile(), transfer.getTrace() );
-            TransferEvent.Builder builder = newEventBuilder( resource, true, false );
-            MetadataTransportListener listener = new MetadataTransportListener( transfer, repository, builder );
-
-            List<RepositoryLayout.Checksum> checksums = layout.getChecksums( transfer.getMetadata(), true, location );
-
-            Runnable task = new PutTaskRunner( location, transfer.getFile(), checksums, listener );
-            task.run();
-        }
-    }
-
-    private static <T> Collection<T> safe( Collection<T> items )
-    {
-        return ( items != null ) ? items : Collections.<T>emptyList();
-    }
-
-    private TransferResource newTransferResource( URI path, File file, RequestTrace trace )
-    {
-        return new TransferResource( repository.getUrl(), path.toString(), file, trace );
-    }
-
-    private TransferEvent.Builder newEventBuilder( TransferResource resource, boolean upload, boolean peek )
-    {
-        TransferEvent.Builder builder = new TransferEvent.Builder( session, resource );
-        if ( upload )
-        {
-            builder.setRequestType( TransferEvent.RequestType.PUT );
-        }
-        else if ( !peek )
-        {
-            builder.setRequestType( TransferEvent.RequestType.GET );
-        }
-        else
-        {
-            builder.setRequestType( TransferEvent.RequestType.GET_EXISTENCE );
-        }
-        return builder;
-    }
-
-    private ChecksumPolicy newChecksumPolicy( String policy, TransferResource resource )
-    {
-        return checksumPolicyProvider.newChecksumPolicy( session, repository, resource, policy );
-    }
-
-    @Override
-    public String toString()
-    {
-        return String.valueOf( repository );
-    }
-
-    abstract class TaskRunner
-        implements Runnable
-    {
-
-        protected final URI path;
-
-        protected final TransferTransportListener<?> listener;
-
-        public TaskRunner( URI path, TransferTransportListener<?> listener )
-        {
-            this.path = path;
-            this.listener = listener;
-        }
-
-        public void run()
-        {
-            try
-            {
-                listener.transferInitiated();
-                runTask();
-                listener.transferSucceeded();
-            }
-            catch ( Exception e )
-            {
-                listener.transferFailed( e, transporter.classify( e ) );
-            }
-        }
-
-        protected abstract void runTask()
-            throws Exception;
-
-    }
-
-    class PeekTaskRunner
-        extends TaskRunner
-    {
-
-        public PeekTaskRunner( URI path, TransferTransportListener<?> listener )
-        {
-            super( path, listener );
-        }
-
-        protected void runTask()
-            throws Exception
-        {
-            transporter.peek( new PeekTask( path ) );
-        }
-
-    }
-
-    class GetTaskRunner
-        extends TaskRunner
-        implements PartialFile.RemoteAccessChecker, ChecksumValidator.ChecksumFetcher
-    {
-
-        private final File file;
-
-        private final ChecksumValidator checksumValidator;
-
-        public GetTaskRunner( URI path, File file, ChecksumPolicy checksumPolicy,
-                              List<RepositoryLayout.Checksum> checksums, TransferTransportListener<?> listener )
-        {
-            super( path, listener );
-            this.file = file;
-            checksumValidator =
-                new ChecksumValidator( logger, file, fileProcessor, this, checksumPolicy, safe( checksums ) );
-        }
-
-        public void checkRemoteAccess()
-            throws Exception
-        {
-            transporter.peek( new PeekTask( path ) );
-        }
-
-        public boolean fetchChecksum( URI remote, File local )
-            throws Exception
-        {
-            try
-            {
-                transporter.get( new GetTask( remote ).setDataFile( local ) );
-            }
-            catch ( Exception e )
-            {
-                if ( transporter.classify( e ) == Transporter.ERROR_NOT_FOUND )
-                {
-                    return false;
-                }
-                throw e;
-            }
-            return true;
-        }
-
-        protected void runTask()
-            throws Exception
-        {
-            if ( file == null )
-            {
-                throw new IllegalArgumentException( "destination file has not been specified" );
-            }
-            fileProcessor.mkdirs( file.getParentFile() );
-
-            PartialFile partFile = partialFileFactory.newInstance( file, this );
-            if ( partFile == null )
-            {
-                logger.debug( "Concurrent download of " + file + " just finished, skipping download" );
-                return;
-            }
-
-            try
-            {
-                File tmp = partFile.getFile();
-                listener.setChecksumCalculator( checksumValidator.newChecksumCalculator( tmp ) );
-                for ( int firstTrial = 0, lastTrial = 1, trial = firstTrial;; trial++ )
-                {
-                    boolean resume = partFile.isResume() && trial <= firstTrial;
-                    GetTask task = new GetTask( path ).setDataFile( tmp, resume ).setListener( listener );
-                    transporter.get( task );
-                    try
-                    {
-                        checksumValidator.validate( listener.getChecksums(), smartChecksums ? task.getChecksums()
-                                        : null );
-                        break;
-                    }
-                    catch ( ChecksumFailureException e )
-                    {
-                        boolean retry = trial < lastTrial && e.isRetryWorthy();
-                        if ( !retry && !checksumValidator.handle( e ) )
-                        {
-                            throw e;
-                        }
-                        listener.transferCorrupted( e );
-                        if ( retry )
-                        {
-                            checksumValidator.retry();
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-                }
-                fileProcessor.move( tmp, file );
-                if ( persistedChecksums )
-                {
-                    checksumValidator.commit();
-                }
-            }
-            finally
-            {
-                partFile.close();
-                checksumValidator.close();
-            }
-        }
-
-    }
-
-    class PutTaskRunner
-        extends TaskRunner
-    {
-
-        private final File file;
-
-        private final Collection<RepositoryLayout.Checksum> checksums;
-
-        public PutTaskRunner( URI path, File file, List<RepositoryLayout.Checksum> checksums,
-                              TransferTransportListener<?> listener )
-        {
-            super( path, listener );
-            this.file = file;
-            this.checksums = safe( checksums );
-        }
-
-        protected void runTask()
-            throws Exception
-        {
-            if ( file == null )
-            {
-                throw new IllegalArgumentException( "source file has not been specified" );
-            }
-            transporter.put( new PutTask( path ).setDataFile( file ).setListener( listener ) );
-            uploadChecksums( file, path );
-        }
-
-        private void uploadChecksums( File file, URI location )
-        {
-            if ( checksums.isEmpty() )
-            {
-                return;
-            }
-            try
-            {
-                Set<String> algos = new HashSet<String>();
-                for ( RepositoryLayout.Checksum checksum : checksums )
-                {
-                    algos.add( checksum.getAlgorithm() );
-                }
-                Map<String, Object> sumsByAlgo = ChecksumUtils.calc( file, algos );
-                for ( RepositoryLayout.Checksum checksum : checksums )
-                {
-                    uploadChecksum( checksum.getLocation(), sumsByAlgo.get( checksum.getAlgorithm() ) );
-                }
-            }
-            catch ( IOException e )
-            {
-                String msg = "Failed to upload checksums for " + file + ": " + e.getMessage();
-                if ( logger.isDebugEnabled() )
-                {
-                    logger.warn( msg, e );
-                }
-                else
-                {
-                    logger.warn( msg );
-                }
-            }
-        }
-
-        private void uploadChecksum( URI location, Object checksum )
-        {
-            try
-            {
-                if ( checksum instanceof Exception )
-                {
-                    throw (Exception) checksum;
-                }
-                transporter.put( new PutTask( location ).setDataString( (String) checksum ) );
-            }
-            catch ( Exception e )
-            {
-                String msg = "Failed to upload checksum " + location + ": " + e.getMessage();
-                if ( logger.isDebugEnabled() )
-                {
-                    logger.warn( msg, e );
-                }
-                else
-                {
-                    logger.warn( msg );
-                }
-            }
-        }
-
-    }
-
-    private static class DirectExecutor
-        implements Executor
-    {
-
-        static final Executor INSTANCE = new DirectExecutor();
-
-        public void execute( Runnable command )
-        {
-            command.run();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory.java
deleted file mode 100644
index 8338daf..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/BasicRepositoryConnectorFactory.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.RepositoryConnector;
-import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
-import org.eclipse.aether.spi.connector.checksum.ChecksumPolicyProvider;
-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.spi.log.Logger;
-import org.eclipse.aether.spi.log.LoggerFactory;
-import org.eclipse.aether.spi.log.NullLoggerFactory;
-import org.eclipse.aether.transfer.NoRepositoryConnectorException;
-
-/**
- * A repository connector factory that employs pluggable
- * {@link org.eclipse.aether.spi.connector.transport.TransporterFactory transporters} and
- * {@link org.eclipse.aether.spi.connector.layout.RepositoryLayoutFactory repository layouts} for the transfers.
- */
-@Named( "basic" )
-public final class BasicRepositoryConnectorFactory
-    implements RepositoryConnectorFactory, Service
-{
-
-    private Logger logger = NullLoggerFactory.LOGGER;
-
-    private TransporterProvider transporterProvider;
-
-    private RepositoryLayoutProvider layoutProvider;
-
-    private ChecksumPolicyProvider checksumPolicyProvider;
-
-    private 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,
-                                     LoggerFactory loggerFactory )
-    {
-        setTransporterProvider( transporterProvider );
-        setRepositoryLayoutProvider( layoutProvider );
-        setChecksumPolicyProvider( checksumPolicyProvider );
-        setFileProcessor( fileProcessor );
-        setLoggerFactory( loggerFactory );
-    }
-
-    public void initService( ServiceLocator locator )
-    {
-        setLoggerFactory( locator.getService( LoggerFactory.class ) );
-        setTransporterProvider( locator.getService( TransporterProvider.class ) );
-        setRepositoryLayoutProvider( locator.getService( RepositoryLayoutProvider.class ) );
-        setChecksumPolicyProvider( locator.getService( ChecksumPolicyProvider.class ) );
-        setFileProcessor( locator.getService( FileProcessor.class ) );
-    }
-
-    /**
-     * Sets the logger factory to use for this component.
-     * 
-     * @param loggerFactory The logger factory to use, may be {@code null} to disable logging.
-     * @return This component for chaining, never {@code null}.
-     */
-    public BasicRepositoryConnectorFactory setLoggerFactory( LoggerFactory loggerFactory )
-    {
-        this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, BasicRepositoryConnector.class );
-        return this;
-    }
-
-    /**
-     * 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 )
-    {
-        if ( transporterProvider == null )
-        {
-            throw new IllegalArgumentException( "transporter provider has not been specified" );
-        }
-        this.transporterProvider = transporterProvider;
-        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 )
-    {
-        if ( layoutProvider == null )
-        {
-            throw new IllegalArgumentException( "repository layout provider has not been specified" );
-        }
-        this.layoutProvider = layoutProvider;
-        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 )
-    {
-        if ( checksumPolicyProvider == null )
-        {
-            throw new IllegalArgumentException( "checksum policy provider has not been specified" );
-        }
-        this.checksumPolicyProvider = checksumPolicyProvider;
-        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 )
-    {
-        if ( fileProcessor == null )
-        {
-            throw new IllegalArgumentException( "file processor has not been specified" );
-        }
-        this.fileProcessor = fileProcessor;
-        return this;
-    }
-
-    public float getPriority()
-    {
-        return priority;
-    }
-
-    /**
-     * Sets the priority of this component.
-     * 
-     * @param priority The priority.
-     * @return This component for chaining, never {@code null}.
-     */
-    public BasicRepositoryConnectorFactory setPriority( float priority )
-    {
-        this.priority = priority;
-        return this;
-    }
-
-    public RepositoryConnector newInstance( RepositorySystemSession session, RemoteRepository repository )
-        throws NoRepositoryConnectorException
-    {
-        return new BasicRepositoryConnector( session, repository, transporterProvider, layoutProvider,
-                                             checksumPolicyProvider, fileProcessor, logger );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
deleted file mode 100644
index e76f8a9..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumCalculator.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
-import org.eclipse.aether.util.ChecksumUtils;
-
-/**
- * Calculates checksums for a downloaded file.
- */
-final class ChecksumCalculator
-{
-
-    static class Checksum
-    {
-        final String algorithm;
-
-        final MessageDigest digest;
-
-        Exception error;
-
-        public Checksum( String algorithm )
-        {
-            this.algorithm = algorithm;
-            MessageDigest digest = null;
-            try
-            {
-                digest = MessageDigest.getInstance( algorithm );
-            }
-            catch ( NoSuchAlgorithmException e )
-            {
-                error = e;
-            }
-            this.digest = digest;
-        }
-
-        public void update( ByteBuffer buffer )
-        {
-            if ( digest != null )
-            {
-                digest.update( buffer );
-            }
-        }
-
-        public void reset()
-        {
-            if ( digest != null )
-            {
-                digest.reset();
-                error = null;
-            }
-        }
-
-        public void error( Exception error )
-        {
-            if ( digest != null )
-            {
-                this.error = error;
-            }
-        }
-
-        public Object get()
-        {
-            if ( error != null )
-            {
-                return error;
-            }
-            return ChecksumUtils.toHexString( digest.digest() );
-        }
-
-    }
-
-    private final List<Checksum> checksums;
-
-    private final File targetFile;
-
-    public static ChecksumCalculator newInstance( File targetFile, Collection<RepositoryLayout.Checksum> checksums )
-    {
-        if ( checksums == null || checksums.isEmpty() )
-        {
-            return null;
-        }
-        return new ChecksumCalculator( targetFile, checksums );
-    }
-
-    private ChecksumCalculator( File targetFile, Collection<RepositoryLayout.Checksum> checksums )
-    {
-        this.checksums = new ArrayList<Checksum>();
-        Set<String> algos = new HashSet<String>();
-        for ( RepositoryLayout.Checksum checksum : checksums )
-        {
-            String algo = checksum.getAlgorithm();
-            if ( algos.add( algo ) )
-            {
-                this.checksums.add( new Checksum( algo ) );
-            }
-        }
-        this.targetFile = targetFile;
-    }
-
-    public void init( long dataOffset )
-    {
-        for ( Checksum checksum : checksums )
-        {
-            checksum.reset();
-        }
-        if ( dataOffset <= 0 )
-        {
-            return;
-        }
-        try
-        {
-            FileInputStream fis = new FileInputStream( targetFile );
-            try
-            {
-                long total = 0;
-                ByteBuffer buffer = ByteBuffer.allocate( 1024 * 32 );
-                for ( byte[] array = buffer.array(); total < dataOffset; )
-                {
-                    int read = fis.read( array );
-                    if ( read < 0 )
-                    {
-                        if ( total < dataOffset )
-                        {
-                            throw new IOException( targetFile + " contains only " + total
-                                + " bytes, cannot resume download from offset " + dataOffset );
-                        }
-                        break;
-                    }
-                    total += read;
-                    if ( total > dataOffset )
-                    {
-                        read -= total - dataOffset;
-                    }
-                    buffer.rewind();
-                    buffer.limit( read );
-                    update( buffer );
-                }
-            }
-            finally
-            {
-                try
-                {
-                    fis.close();
-                }
-                catch ( IOException e )
-                {
-                    // irrelevant
-                }
-            }
-        }
-        catch ( IOException e )
-        {
-            for ( Checksum checksum : checksums )
-            {
-                checksum.error( e );
-            }
-        }
-    }
-
-    public void update( ByteBuffer data )
-    {
-        for ( Checksum checksum : checksums )
-        {
-            data.mark();
-            checksum.update( data );
-            data.reset();
-        }
-    }
-
-    public Map<String, Object> get()
-    {
-        Map<String, Object> results = new HashMap<String, Object>();
-        for ( Checksum checksum : checksums )
-        {
-            results.put( checksum.algorithm, checksum.get() );
-        }
-        return results;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
deleted file mode 100644
index 8289997..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/ChecksumValidator.java
+++ /dev/null
@@ -1,265 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.UUID;
-
-import org.eclipse.aether.spi.connector.checksum.ChecksumPolicy;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout.Checksum;
-import org.eclipse.aether.spi.io.FileProcessor;
-import org.eclipse.aether.spi.log.Logger;
-import org.eclipse.aether.transfer.ChecksumFailureException;
-import org.eclipse.aether.util.ChecksumUtils;
-
-/**
- * Performs checksum validation for a downloaded file.
- */
-final class ChecksumValidator
-{
-
-    interface ChecksumFetcher
-    {
-
-        boolean fetchChecksum( URI remote, File local )
-            throws Exception;
-
-    }
-
-    private final Logger logger;
-
-    private final File dataFile;
-
-    private final Collection<File> tempFiles;
-
-    private final FileProcessor fileProcessor;
-
-    private final ChecksumFetcher checksumFetcher;
-
-    private final ChecksumPolicy checksumPolicy;
-
-    private final Collection<Checksum> checksums;
-
-    private final Map<File, Object> checksumFiles;
-
-    public ChecksumValidator( Logger logger, File dataFile, FileProcessor fileProcessor,
-                              ChecksumFetcher checksumFetcher, ChecksumPolicy checksumPolicy,
-                              Collection<Checksum> checksums )
-    {
-        this.logger = logger;
-        this.dataFile = dataFile;
-        this.tempFiles = new HashSet<File>();
-        this.fileProcessor = fileProcessor;
-        this.checksumFetcher = checksumFetcher;
-        this.checksumPolicy = checksumPolicy;
-        this.checksums = checksums;
-        checksumFiles = new HashMap<File, Object>();
-    }
-
-    public ChecksumCalculator newChecksumCalculator( File targetFile )
-    {
-        if ( checksumPolicy != null )
-        {
-            return ChecksumCalculator.newInstance( targetFile, checksums );
-        }
-        return null;
-    }
-
-    public void validate( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums )
-        throws ChecksumFailureException
-    {
-        if ( checksumPolicy == null )
-        {
-            return;
-        }
-        if ( inlinedChecksums != null && validateInlinedChecksums( actualChecksums, inlinedChecksums ) )
-        {
-            return;
-        }
-        if ( validateExternalChecksums( actualChecksums ) )
-        {
-            return;
-        }
-        checksumPolicy.onNoMoreChecksums();
-    }
-
-    private boolean validateInlinedChecksums( Map<String, ?> actualChecksums, Map<String, ?> inlinedChecksums )
-        throws ChecksumFailureException
-    {
-        for ( Map.Entry<String, ?> entry : inlinedChecksums.entrySet() )
-        {
-            String algo = entry.getKey();
-            Object calculated = actualChecksums.get( algo );
-            if ( !( calculated instanceof String ) )
-            {
-                continue;
-            }
-
-            String actual = String.valueOf( calculated );
-            String expected = entry.getValue().toString();
-            checksumFiles.put( getChecksumFile( algo ), expected );
-
-            if ( !isEqualChecksum( expected, actual ) )
-            {
-                checksumPolicy.onChecksumMismatch( algo, ChecksumPolicy.KIND_UNOFFICIAL,
-                                                   new ChecksumFailureException( expected, actual ) );
-            }
-            else if ( checksumPolicy.onChecksumMatch( algo, ChecksumPolicy.KIND_UNOFFICIAL ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean validateExternalChecksums( Map<String, ?> actualChecksums )
-        throws ChecksumFailureException
-    {
-        for ( Checksum checksum : checksums )
-        {
-            String algo = checksum.getAlgorithm();
-            Object calculated = actualChecksums.get( algo );
-            if ( calculated instanceof Exception )
-            {
-                checksumPolicy.onChecksumError( algo, 0, new ChecksumFailureException( (Exception) calculated ) );
-                continue;
-            }
-            try
-            {
-                File checksumFile = getChecksumFile( checksum.getAlgorithm() );
-                File tmp = createTempFile( checksumFile );
-                try
-                {
-                    if ( !checksumFetcher.fetchChecksum( checksum.getLocation(), tmp ) )
-                    {
-                        continue;
-                    }
-                }
-                catch ( Exception e )
-                {
-                    checksumPolicy.onChecksumError( algo, 0, new ChecksumFailureException( e ) );
-                    continue;
-                }
-
-                String actual = String.valueOf( calculated );
-                String expected = ChecksumUtils.read( tmp );
-                checksumFiles.put( checksumFile, tmp );
-
-                if ( !isEqualChecksum( expected, actual ) )
-                {
-                    checksumPolicy.onChecksumMismatch( algo, 0, new ChecksumFailureException( expected, actual ) );
-                }
-                else if ( checksumPolicy.onChecksumMatch( algo, 0 ) )
-                {
-                    return true;
-                }
-            }
-            catch ( IOException e )
-            {
-                checksumPolicy.onChecksumError( algo, 0, new ChecksumFailureException( e ) );
-            }
-        }
-        return false;
-    }
-
-    private static boolean isEqualChecksum( String expected, String actual )
-    {
-        return expected.equalsIgnoreCase( actual );
-    }
-
-    private File getChecksumFile( String algorithm )
-    {
-        String ext = algorithm.replace( "-", "" ).toLowerCase( Locale.ENGLISH );
-        return new File( dataFile.getPath() + '.' + ext );
-    }
-
-    private File createTempFile( File path )
-        throws IOException
-    {
-        File file =
-            File.createTempFile( path.getName() + "-"
-                + UUID.randomUUID().toString().replace( "-", "" ).substring( 0, 8 ), ".tmp", path.getParentFile() );
-        tempFiles.add( file );
-        return file;
-    }
-
-    private void clearTempFiles()
-    {
-        for ( File file : tempFiles )
-        {
-            if ( !file.delete() && file.exists() )
-            {
-                logger.debug( "Could not delete temorary file " + file );
-            }
-        }
-        tempFiles.clear();
-    }
-
-    public void retry()
-    {
-        checksumPolicy.onTransferRetry();
-        checksumFiles.clear();
-        clearTempFiles();
-    }
-
-    public boolean handle( ChecksumFailureException exception )
-    {
-        return checksumPolicy.onTransferChecksumFailure( exception );
-    }
-
-    public void commit()
-    {
-        for ( Map.Entry<File, Object> entry : checksumFiles.entrySet() )
-        {
-            File checksumFile = entry.getKey();
-            Object tmp = entry.getValue();
-            try
-            {
-                if ( tmp instanceof File )
-                {
-                    fileProcessor.move( (File) tmp, checksumFile );
-                    tempFiles.remove( tmp );
-                }
-                else
-                {
-                    fileProcessor.write( checksumFile, String.valueOf( tmp ) );
-                }
-            }
-            catch ( IOException e )
-            {
-                logger.debug( "Failed to write checksum file " + checksumFile + ": " + e.getMessage(), e );
-            }
-        }
-        checksumFiles.clear();
-    }
-
-    public void close()
-    {
-        clearTempFiles();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/MetadataTransportListener.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/MetadataTransportListener.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/MetadataTransportListener.java
deleted file mode 100644
index 7f8bc6d..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/MetadataTransportListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.spi.connector.MetadataTransfer;
-import org.eclipse.aether.spi.connector.transport.Transporter;
-import org.eclipse.aether.transfer.MetadataNotFoundException;
-import org.eclipse.aether.transfer.MetadataTransferException;
-import org.eclipse.aether.transfer.TransferEvent;
-
-final class MetadataTransportListener
-    extends TransferTransportListener<MetadataTransfer>
-{
-
-    private final RemoteRepository repository;
-
-    public MetadataTransportListener( MetadataTransfer transfer, RemoteRepository repository,
-                                      TransferEvent.Builder eventBuilder )
-    {
-        super( transfer, eventBuilder );
-        this.repository = repository;
-    }
-
-    @Override
-    public void transferFailed( Exception exception, int classification )
-    {
-        MetadataTransferException e;
-        if ( classification == Transporter.ERROR_NOT_FOUND )
-        {
-            e = new MetadataNotFoundException( getTransfer().getMetadata(), repository );
-        }
-        else
-        {
-            e = new MetadataTransferException( getTransfer().getMetadata(), repository, exception );
-        }
-        getTransfer().setException( e );
-        super.transferFailed( e, classification );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/PartialFile.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/PartialFile.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/PartialFile.java
deleted file mode 100644
index ad428d4..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/PartialFile.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileLock;
-import java.nio.channels.OverlappingFileLockException;
-import java.util.UUID;
-
-import org.eclipse.aether.spi.log.Logger;
-
-/**
- * A partially downloaded file with optional support for resume. If resume is enabled, a well-known location is used for
- * the partial file in combination with a lock file to prevent concurrent requests from corrupting it (and wasting
- * network bandwith). Otherwise, a (non-locked) unique temporary file is used.
- */
-final class PartialFile
-    implements Closeable
-{
-
-    static final String EXT_PART = ".part";
-
-    static final String EXT_LOCK = ".lock";
-
-    interface RemoteAccessChecker
-    {
-
-        void checkRemoteAccess()
-            throws Exception;
-
-    }
-
-    static class LockFile
-    {
-
-        private final File lockFile;
-
-        private final FileLock lock;
-
-        private final boolean concurrent;
-
-        public LockFile( File partFile, int requestTimeout, RemoteAccessChecker checker, Logger logger )
-            throws Exception
-        {
-            lockFile = new File( partFile.getPath() + EXT_LOCK );
-            boolean[] concurrent = { false };
-            lock = lock( lockFile, partFile, requestTimeout, checker, logger, concurrent );
-            this.concurrent = concurrent[0];
-        }
-
-        private static FileLock lock( File lockFile, File partFile, int requestTimeout, RemoteAccessChecker checker,
-                                      Logger logger, boolean[] concurrent )
-            throws Exception
-        {
-            boolean interrupted = false;
-            try
-            {
-                for ( long lastLength = -1, lastTime = 0;; )
-                {
-                    FileLock lock = tryLock( lockFile );
-                    if ( lock != null )
-                    {
-                        return lock;
-                    }
-
-                    long currentLength = partFile.length();
-                    long currentTime = System.currentTimeMillis();
-                    if ( currentLength != lastLength )
-                    {
-                        if ( lastLength < 0 )
-                        {
-                            concurrent[0] = true;
-                            /*
-                             * NOTE: We're going with the optimistic assumption that the other thread is downloading the
-                             * file from an equivalent repository. As a bare minimum, ensure the repository we are given
-                             * at least knows about the file and is accessible to us.
-                             */
-                            checker.checkRemoteAccess();
-                            logger.debug( "Concurrent download of " + partFile + " in progress, awaiting completion" );
-                        }
-                        lastLength = currentLength;
-                        lastTime = currentTime;
-                    }
-                    else if ( requestTimeout > 0 && currentTime - lastTime > Math.max( requestTimeout, 3 * 1000 ) )
-                    {
-                        throw new IOException( "Timeout while waiting for concurrent download of " + partFile
-                            + " to progress" );
-                    }
-
-                    try
-                    {
-                        Thread.sleep( 100 );
-                    }
-                    catch ( InterruptedException e )
-                    {
-                        interrupted = true;
-                    }
-                }
-            }
-            finally
-            {
-                if ( interrupted )
-                {
-                    Thread.currentThread().interrupt();
-                }
-            }
-        }
-
-        private static FileLock tryLock( File lockFile )
-            throws IOException
-        {
-            RandomAccessFile raf = new RandomAccessFile( lockFile, "rw" );
-            try
-            {
-                FileLock lock = raf.getChannel().tryLock( 0, 1, false );
-                if ( lock == null )
-                {
-                    close( raf );
-                }
-                return lock;
-            }
-            catch ( OverlappingFileLockException e )
-            {
-                close( raf );
-                return null;
-            }
-            catch ( RuntimeException e )
-            {
-                close( raf );
-                lockFile.delete();
-                throw e;
-            }
-            catch ( IOException e )
-            {
-                close( raf );
-                lockFile.delete();
-                throw e;
-            }
-        }
-
-        private static void close( Closeable file )
-        {
-            try
-            {
-                file.close();
-            }
-            catch ( IOException e )
-            {
-                // irrelevant
-            }
-        }
-
-        public boolean isConcurrent()
-        {
-            return concurrent;
-        }
-
-        public void close()
-        {
-            close( lock.channel() );
-            lockFile.delete();
-        }
-
-        @Override
-        public String toString()
-        {
-            return lockFile + " - " + lock.isValid();
-        }
-
-    }
-
-    static class Factory
-    {
-
-        private final boolean resume;
-
-        private final long resumeThreshold;
-
-        private final int requestTimeout;
-
-        private final Logger logger;
-
-        public Factory( boolean resume, long resumeThreshold, int requestTimeout, Logger logger )
-        {
-            this.resume = resume;
-            this.resumeThreshold = resumeThreshold;
-            this.requestTimeout = requestTimeout;
-            this.logger = logger;
-        }
-
-        public PartialFile newInstance( File dstFile, RemoteAccessChecker checker )
-            throws Exception
-        {
-            if ( resume )
-            {
-                File partFile = new File( dstFile.getPath() + EXT_PART );
-
-                long reqTimestamp = System.currentTimeMillis();
-                LockFile lockFile = new LockFile( partFile, requestTimeout, checker, logger );
-                if ( lockFile.isConcurrent() && dstFile.lastModified() >= reqTimestamp - 100 )
-                {
-                    lockFile.close();
-                    return null;
-                }
-                try
-                {
-                    if ( !partFile.createNewFile() && !partFile.isFile() )
-                    {
-                        throw new IOException( partFile.exists() ? "Path exists but is not a file" : "Unknown error" );
-                    }
-                    return new PartialFile( partFile, lockFile, resumeThreshold, logger );
-                }
-                catch ( IOException e )
-                {
-                    lockFile.close();
-                    logger.debug( "Cannot create resumable file " + partFile.getAbsolutePath() + ": " + e );
-                    // fall through and try non-resumable/temporary file location
-                }
-            }
-
-            File tempFile =
-                File.createTempFile( dstFile.getName() + '-' + UUID.randomUUID().toString().replace( "-", "" ), ".tmp",
-                                     dstFile.getParentFile() );
-            return new PartialFile( tempFile, logger );
-        }
-
-    }
-
-    private final File partFile;
-
-    private final LockFile lockFile;
-
-    private final long threshold;
-
-    private final Logger logger;
-
-    private PartialFile( File partFile, Logger logger )
-    {
-        this( partFile, null, 0, logger );
-    }
-
-    private PartialFile( File partFile, LockFile lockFile, long threshold, Logger logger )
-    {
-        this.partFile = partFile;
-        this.lockFile = lockFile;
-        this.threshold = threshold;
-        this.logger = logger;
-    }
-
-    public File getFile()
-    {
-        return partFile;
-    }
-
-    public boolean isResume()
-    {
-        return lockFile != null && partFile.length() >= threshold;
-    }
-
-    public void close()
-    {
-        if ( partFile.exists() && !isResume() )
-        {
-            if ( !partFile.delete() && partFile.exists() )
-            {
-                logger.debug( "Could not delete temorary file " + partFile );
-            }
-        }
-        if ( lockFile != null )
-        {
-            lockFile.close();
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return String.valueOf( getFile() );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/TransferTransportListener.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/TransferTransportListener.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/TransferTransportListener.java
deleted file mode 100644
index bd95577..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/TransferTransportListener.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.Map;
-
-import org.eclipse.aether.spi.connector.Transfer;
-import org.eclipse.aether.spi.connector.transport.TransportListener;
-import org.eclipse.aether.transfer.TransferCancelledException;
-import org.eclipse.aether.transfer.TransferEvent;
-import org.eclipse.aether.transfer.TransferEvent.EventType;
-import org.eclipse.aether.transfer.TransferListener;
-
-class TransferTransportListener<T extends Transfer>
-    extends TransportListener
-{
-
-    private final T transfer;
-
-    private final TransferListener listener;
-
-    private final TransferEvent.Builder eventBuilder;
-
-    private ChecksumCalculator checksumCalculator;
-
-    protected TransferTransportListener( T transfer, TransferEvent.Builder eventBuilder )
-    {
-        this.transfer = transfer;
-        this.listener = transfer.getListener();
-        this.eventBuilder = eventBuilder;
-    }
-
-    protected T getTransfer()
-    {
-        return transfer;
-    }
-
-    public void transferInitiated()
-        throws TransferCancelledException
-    {
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.INITIATED );
-            listener.transferInitiated( eventBuilder.build() );
-        }
-    }
-
-    @Override
-    public void transportStarted( long dataOffset, long dataLength )
-        throws TransferCancelledException
-    {
-        if ( checksumCalculator != null )
-        {
-            checksumCalculator.init( dataOffset );
-        }
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.STARTED ).setTransferredBytes( dataOffset );
-            TransferEvent event = eventBuilder.build();
-            event.getResource().setContentLength( dataLength ).setResumeOffset( dataOffset );
-            listener.transferStarted( event );
-        }
-    }
-
-    @Override
-    public void transportProgressed( ByteBuffer data )
-        throws TransferCancelledException
-    {
-        if ( checksumCalculator != null )
-        {
-            checksumCalculator.update( data );
-        }
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.PROGRESSED ).addTransferredBytes( data.remaining() ).setDataBuffer( data );
-            listener.transferProgressed( eventBuilder.build() );
-        }
-    }
-
-    public void transferCorrupted( Exception exception )
-        throws TransferCancelledException
-    {
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.CORRUPTED ).setException( exception );
-            listener.transferCorrupted( eventBuilder.build() );
-        }
-    }
-
-    public void transferFailed( Exception exception, int classification )
-    {
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.FAILED ).setException( exception );
-            listener.transferFailed( eventBuilder.build() );
-        }
-    }
-
-    public void transferSucceeded()
-    {
-        if ( listener != null )
-        {
-            eventBuilder.resetType( EventType.SUCCEEDED );
-            listener.transferSucceeded( eventBuilder.build() );
-        }
-    }
-
-    public Map<String, Object> getChecksums()
-    {
-        if ( checksumCalculator == null )
-        {
-            return Collections.emptyMap();
-        }
-        return checksumCalculator.get();
-    }
-
-    public void setChecksumCalculator( ChecksumCalculator checksumCalculator )
-    {
-        this.checksumCalculator = checksumCalculator;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/package-info.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/package-info.java b/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/package-info.java
deleted file mode 100644
index df86897..0000000
--- a/aether-connector-basic/src/main/java/org/eclipse/aether/connector/basic/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// CHECKSTYLE_OFF: RegexpHeader
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * Support for downloads/uploads using remote repositories that have a URI-based content structure/layout.
- */
-package org.eclipse.aether.connector.basic;
-

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/site/site.xml
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/site/site.xml b/aether-connector-basic/src/site/site.xml
deleted file mode 100644
index 25a0b9d..0000000
--- a/aether-connector-basic/src/site/site.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-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
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"
-  name="Connector Basic">
-  <body>
-    <menu name="Overview">
-      <item name="Introduction" href="index.html"/>
-      <item name="JavaDocs" href="apidocs/index.html"/>
-      <item name="Source Xref" href="xref/index.html"/>
-      <!--item name="FAQ" href="faq.html"/-->
-    </menu>
-
-    <menu ref="parent"/>
-    <menu ref="reports"/>
-  </body>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-resolver/blob/3a1b8ae0/aether-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
----------------------------------------------------------------------
diff --git a/aether-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java b/aether-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
deleted file mode 100644
index 0dc43af..0000000
--- a/aether-connector-basic/src/test/java/org/eclipse/aether/connector/basic/ChecksumCalculatorTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.aether.connector.basic;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.nio.ByteBuffer;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.aether.internal.test.util.TestFileUtils;
-import org.eclipse.aether.spi.connector.layout.RepositoryLayout;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ChecksumCalculatorTest
-{
-
-    private static final String SHA1 = "SHA-1";
-
-    private static final String MD5 = "MD5";
-
-    private File file;
-
-    private ChecksumCalculator newCalculator( String... algos )
-    {
-        List<RepositoryLayout.Checksum> checksums = new ArrayList<RepositoryLayout.Checksum>();
-        for ( String algo : algos )
-        {
-            checksums.add( new RepositoryLayout.Checksum( algo, URI.create( "irrelevant" ) ) );
-        }
-        return ChecksumCalculator.newInstance( file, checksums );
-    }
-
-    private ByteBuffer toBuffer( String data )
-    {
-        try
-        {
-            return ByteBuffer.wrap( data.getBytes( "UTF-8" ) );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            throw new IllegalStateException( e );
-        }
-    }
-
-    @Before
-    public void init()
-        throws Exception
-    {
-        file = TestFileUtils.createTempFile( "Hello World!" );
-    }
-
-    @Test
-    public void testNoOffset()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.init( 0 );
-        calculator.update( toBuffer( "Hello World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertEquals( "ed076287532e86365e841e92bfc50d8c", digests.get( MD5 ) );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testWithOffset()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.init( 6 );
-        calculator.update( toBuffer( "World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertEquals( "ed076287532e86365e841e92bfc50d8c", digests.get( MD5 ) );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testWithExcessiveOffset()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.init( 100 );
-        calculator.update( toBuffer( "World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertTrue( digests.get( SHA1 ) instanceof IOException );
-        assertTrue( digests.get( MD5 ) instanceof IOException );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testUnknownAlgorithm()
-    {
-        ChecksumCalculator calculator = newCalculator( "unknown", SHA1 );
-        calculator.init( 0 );
-        calculator.update( toBuffer( "Hello World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertTrue( digests.get( "unknown" ) instanceof NoSuchAlgorithmException );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testNoInitCall()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.update( toBuffer( "Hello World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertEquals( "ed076287532e86365e841e92bfc50d8c", digests.get( MD5 ) );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testRestart()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.init( 0 );
-        calculator.update( toBuffer( "Ignored" ) );
-        calculator.init( 0 );
-        calculator.update( toBuffer( "Hello World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertEquals( "ed076287532e86365e841e92bfc50d8c", digests.get( MD5 ) );
-        assertEquals( 2, digests.size() );
-    }
-
-    @Test
-    public void testRestartAfterError()
-    {
-        ChecksumCalculator calculator = newCalculator( SHA1, MD5 );
-        calculator.init( 100 );
-        calculator.init( 0 );
-        calculator.update( toBuffer( "Hello World!" ) );
-        Map<String, Object> digests = calculator.get();
-        assertNotNull( digests );
-        assertEquals( "2ef7bde608ce5404e97d5f042f95f89f1c232871", digests.get( SHA1 ) );
-        assertEquals( "ed076287532e86365e841e92bfc50d8c", digests.get( MD5 ) );
-        assertEquals( 2, digests.size() );
-    }
-
-}


Mime
View raw message