001    package org.apache.archiva.dependency.tree.maven2;
002    /*
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     *   http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    
021    import org.slf4j.Logger;
022    import org.slf4j.LoggerFactory;
023    import org.sonatype.aether.RepositorySystemSession;
024    import org.sonatype.aether.connector.file.FileRepositoryConnectorFactory;
025    import org.sonatype.aether.repository.RemoteRepository;
026    import org.sonatype.aether.spi.connector.ArtifactDownload;
027    import org.sonatype.aether.spi.connector.ArtifactUpload;
028    import org.sonatype.aether.spi.connector.MetadataDownload;
029    import org.sonatype.aether.spi.connector.MetadataUpload;
030    import org.sonatype.aether.spi.connector.RepositoryConnector;
031    import org.sonatype.aether.transfer.NoRepositoryConnectorException;
032    
033    import java.util.Collection;
034    
035    /**
036     * @author Olivier Lamy
037     * @since 1.4-M3
038     */
039    public class ArchivaRepositoryConnectorFactory
040        extends FileRepositoryConnectorFactory
041    {
042        public ArchivaRepositoryConnectorFactory()
043        {
044            // no op but empty constructor needed by aether
045        }
046    
047        public RepositoryConnector newInstance( RepositorySystemSession session, RemoteRepository repository )
048            throws NoRepositoryConnectorException
049        {
050            try
051            {
052                return super.newInstance( session, repository );
053            }
054            catch ( NoRepositoryConnectorException e )
055            {
056    
057            }
058    
059            return new RepositoryConnector()
060            {
061    
062                private Logger log = LoggerFactory.getLogger( getClass() );
063    
064                public void get( Collection<? extends ArtifactDownload> artifactDownloads,
065                                 Collection<? extends MetadataDownload> metadataDownloads )
066                {
067                    log.debug( "get" );
068                }
069    
070                public void put( Collection<? extends ArtifactUpload> artifactUploads,
071                                 Collection<? extends MetadataUpload> metadataUploads )
072                {
073                    log.debug( "put" );
074                }
075    
076                public void close()
077                {
078                    log.debug( "close" );
079                }
080            };
081        }
082    }