This project has retired. For details please refer to its Attic page.
ArchivaRepositoryConnectorFactory xref
View Javadoc
1   package org.apache.archiva.dependency.tree.maven2;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  import org.sonatype.aether.RepositorySystemSession;
24  import org.sonatype.aether.connector.file.FileRepositoryConnectorFactory;
25  import org.sonatype.aether.repository.RemoteRepository;
26  import org.sonatype.aether.spi.connector.ArtifactDownload;
27  import org.sonatype.aether.spi.connector.ArtifactUpload;
28  import org.sonatype.aether.spi.connector.MetadataDownload;
29  import org.sonatype.aether.spi.connector.MetadataUpload;
30  import org.sonatype.aether.spi.connector.RepositoryConnector;
31  import org.sonatype.aether.transfer.NoRepositoryConnectorException;
32  
33  import java.util.Collection;
34  
35  /**
36   * @author Olivier Lamy
37   * @since 1.4-M3
38   */
39  public class ArchivaRepositoryConnectorFactory
40      extends FileRepositoryConnectorFactory
41  {
42      public ArchivaRepositoryConnectorFactory()
43      {
44          // no op but empty constructor needed by aether
45      }
46  
47      @Override
48      public RepositoryConnector newInstance( RepositorySystemSession session, RemoteRepository repository )
49          throws NoRepositoryConnectorException
50      {
51          try
52          {
53              return super.newInstance( session, repository );
54          }
55          catch ( NoRepositoryConnectorException e )
56          {
57  
58          }
59  
60          return new RepositoryConnector()
61          {
62  
63              private Logger log = LoggerFactory.getLogger( getClass() );
64  
65              @Override
66              public void get( Collection<? extends ArtifactDownload> artifactDownloads,
67                               Collection<? extends MetadataDownload> metadataDownloads )
68              {
69                  log.debug( "get" );
70              }
71  
72              @Override
73              public void put( Collection<? extends ArtifactUpload> artifactUploads,
74                               Collection<? extends MetadataUpload> metadataUploads )
75              {
76                  log.debug( "put" );
77              }
78  
79              @Override
80              public void close()
81              {
82                  log.debug( "close" );
83              }
84          };
85      }
86  }