View Javadoc

1   package org.apache.maven.artifact.manager;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.metadata.ArtifactMetadata;
24  import org.apache.maven.artifact.repository.ArtifactRepository;
25  import org.apache.maven.wagon.ResourceDoesNotExistException;
26  import org.apache.maven.wagon.TransferFailedException;
27  import org.apache.maven.wagon.UnsupportedProtocolException;
28  import org.apache.maven.wagon.Wagon;
29  import org.apache.maven.wagon.authentication.AuthenticationInfo;
30  import org.apache.maven.wagon.events.TransferListener;
31  import org.apache.maven.wagon.proxy.ProxyInfo;
32  import org.apache.maven.wagon.repository.Repository;
33  import org.apache.maven.wagon.repository.RepositoryPermissions;
34  import org.codehaus.plexus.PlexusContainer;
35  import org.codehaus.plexus.util.xml.Xpp3Dom;
36  
37  import java.io.File;
38  import java.util.Collection;
39  import java.util.List;
40  
41  /**
42   * Manages <a href="http://maven.apache.org/wagon">Wagon</a> related operations in Maven.
43   *
44   * @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
45   * @version $Id: WagonManager.java 798706 2009-07-28 20:50:02Z brett $
46   */
47  public interface WagonManager
48  {
49      String ROLE = WagonManager.class.getName();
50  
51      /**
52       * Get a Wagon provider that understands the protocol passed as argument.
53       * It doesn't configure the Wagon.
54       *
55       * @param protocol the protocol the {@link Wagon} will handle
56       * @return the {@link Wagon} instance able to handle the protocol provided
57       * @throws UnsupportedProtocolException if there is no provider able to handle the protocol
58       * @deprecated prone to errors. use {@link #getWagon(Repository)} instead.
59       */
60      Wagon getWagon( String protocol )
61          throws UnsupportedProtocolException;
62  
63      /**
64       * Get a Wagon provider for the provided repository.
65       * It will configure the Wagon for that repository.
66       *
67       * @param repository the repository
68       * @return the {@link Wagon} instance that can be used to connect to the repository
69       * @throws UnsupportedProtocolException if there is no provider able to handle the protocol
70       * @throws WagonConfigurationException  if the wagon can't be configured for the repository
71       */
72      Wagon getWagon( Repository repository )
73          throws UnsupportedProtocolException, WagonConfigurationException;
74  
75      void getArtifact( Artifact artifact, List remoteRepositories )
76          throws TransferFailedException, ResourceDoesNotExistException;
77  
78      void getArtifact( Artifact artifact, ArtifactRepository repository )
79          throws TransferFailedException, ResourceDoesNotExistException;
80  
81      void putArtifact( File source, Artifact artifact, ArtifactRepository deploymentRepository )
82          throws TransferFailedException;
83  
84      void putArtifactMetadata( File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository )
85          throws TransferFailedException;
86  
87      void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination,
88                                String checksumPolicy )
89          throws TransferFailedException, ResourceDoesNotExistException;
90  
91      void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository,
92                                                        File file, String checksumPolicyWarn )
93          throws TransferFailedException, ResourceDoesNotExistException;
94  
95      void setOnline( boolean online );
96  
97      boolean isOnline();
98  
99      void addProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts );
100 
101     void addAuthenticationInfo( String repositoryId, String username, String password, String privateKey,
102                                 String passphrase );
103 
104     void addMirror( String id, String mirrorOf, String url );
105 
106     void setDownloadMonitor( TransferListener downloadMonitor );
107 
108     void addPermissionInfo( String repositoryId, String filePermissions, String directoryPermissions );
109 
110     ProxyInfo getProxy( String protocol );
111 
112     AuthenticationInfo getAuthenticationInfo( String id );
113 
114     /**
115      * Set the configuration for a repository
116      *
117      * @param repositoryId  id of the repository to set the configuration to
118      * @param configuration dom tree of the xml with the configuration for the {@link Wagon}
119      */
120     void addConfiguration( String repositoryId, Xpp3Dom configuration );
121 
122     void setInteractive( boolean interactive );
123 
124     void registerWagons( Collection wagons, PlexusContainer extensionContainer );
125 
126     void setDefaultRepositoryPermissions( RepositoryPermissions permissions );
127 
128     ArtifactRepository getMirrorRepository( ArtifactRepository repository );
129 }