View Javadoc
1   package org.apache.maven.repository.legacy.metadata;
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 java.util.List;
23  
24  import org.apache.maven.artifact.Artifact;
25  import org.apache.maven.artifact.repository.ArtifactRepository;
26  import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
27  import org.apache.maven.artifact.repository.RepositoryRequest;
28  import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
29  
30  /**
31   * Forms a request to retrieve artifact metadata.
32   *
33   * @author Benjamin Bentmann
34   */
35  public class DefaultMetadataResolutionRequest
36      implements MetadataResolutionRequest
37  {
38  
39      private Artifact artifact;
40  
41      private boolean resolveManagedVersions;
42  
43      private RepositoryRequest repositoryRequest;
44  
45      public DefaultMetadataResolutionRequest()
46      {
47          repositoryRequest = new DefaultRepositoryRequest();
48      }
49  
50      public DefaultMetadataResolutionRequest( RepositoryRequest repositoryRequest )
51      {
52          this.repositoryRequest = new DefaultRepositoryRequest( repositoryRequest );
53      }
54  
55      public DefaultMetadataResolutionRequest( ArtifactResolutionRequest resolutionRequest )
56      {
57          this.repositoryRequest = new DefaultRepositoryRequest( resolutionRequest );
58      }
59  
60      public Artifact getArtifact()
61      {
62          return artifact;
63      }
64  
65      public DefaultMetadataResolutionRequest setArtifact( Artifact artifact )
66      {
67          this.artifact = artifact;
68  
69          return this;
70      }
71  
72      public ArtifactRepository getLocalRepository()
73      {
74          return repositoryRequest.getLocalRepository();
75      }
76  
77      public DefaultMetadataResolutionRequest setLocalRepository( ArtifactRepository localRepository )
78      {
79          repositoryRequest.setLocalRepository( localRepository );
80  
81          return this;
82      }
83  
84      public List<ArtifactRepository> getRemoteRepositories()
85      {
86          return repositoryRequest.getRemoteRepositories();
87      }
88  
89      public DefaultMetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
90      {
91          repositoryRequest.setRemoteRepositories( remoteRepositories );
92  
93          return this;
94      }
95  
96      public boolean isResolveManagedVersions()
97      {
98          return resolveManagedVersions;
99      }
100 
101     public DefaultMetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions )
102     {
103         this.resolveManagedVersions = resolveManagedVersions;
104 
105         return this;
106     }
107 
108     public boolean isOffline()
109     {
110         return repositoryRequest.isOffline();
111     }
112 
113     public DefaultMetadataResolutionRequest setOffline( boolean offline )
114     {
115         repositoryRequest.setOffline( offline );
116 
117         return this;
118     }
119 
120     public boolean isForceUpdate()
121     {
122         return repositoryRequest.isForceUpdate();
123     }
124 
125     public DefaultMetadataResolutionRequest setForceUpdate( boolean forceUpdate )
126     {
127         repositoryRequest.setForceUpdate( forceUpdate );
128 
129         return this;
130     }
131 
132 }