View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.repository.legacy.metadata;
20  
21  import java.util.List;
22  import org.apache.maven.artifact.Artifact;
23  import org.apache.maven.artifact.repository.ArtifactRepository;
24  import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
25  import org.apache.maven.artifact.repository.RepositoryRequest;
26  import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
27  
28  /**
29   * Forms a request to retrieve artifact metadata.
30   *
31   * @author Benjamin Bentmann
32   */
33  public class DefaultMetadataResolutionRequest implements MetadataResolutionRequest {
34  
35      private Artifact artifact;
36  
37      private boolean resolveManagedVersions;
38  
39      private RepositoryRequest repositoryRequest;
40  
41      public DefaultMetadataResolutionRequest() {
42          repositoryRequest = new DefaultRepositoryRequest();
43      }
44  
45      public DefaultMetadataResolutionRequest(RepositoryRequest repositoryRequest) {
46          this.repositoryRequest = new DefaultRepositoryRequest(repositoryRequest);
47      }
48  
49      public DefaultMetadataResolutionRequest(ArtifactResolutionRequest resolutionRequest) {
50          this.repositoryRequest = new DefaultRepositoryRequest(resolutionRequest);
51      }
52  
53      public Artifact getArtifact() {
54          return artifact;
55      }
56  
57      public DefaultMetadataResolutionRequest setArtifact(Artifact artifact) {
58          this.artifact = artifact;
59  
60          return this;
61      }
62  
63      public ArtifactRepository getLocalRepository() {
64          return repositoryRequest.getLocalRepository();
65      }
66  
67      public DefaultMetadataResolutionRequest setLocalRepository(ArtifactRepository localRepository) {
68          repositoryRequest.setLocalRepository(localRepository);
69  
70          return this;
71      }
72  
73      public List<ArtifactRepository> getRemoteRepositories() {
74          return repositoryRequest.getRemoteRepositories();
75      }
76  
77      public DefaultMetadataResolutionRequest setRemoteRepositories(List<ArtifactRepository> remoteRepositories) {
78          repositoryRequest.setRemoteRepositories(remoteRepositories);
79  
80          return this;
81      }
82  
83      public boolean isResolveManagedVersions() {
84          return resolveManagedVersions;
85      }
86  
87      public DefaultMetadataResolutionRequest setResolveManagedVersions(boolean resolveManagedVersions) {
88          this.resolveManagedVersions = resolveManagedVersions;
89  
90          return this;
91      }
92  
93      public boolean isOffline() {
94          return repositoryRequest.isOffline();
95      }
96  
97      public DefaultMetadataResolutionRequest setOffline(boolean offline) {
98          repositoryRequest.setOffline(offline);
99  
100         return this;
101     }
102 
103     public boolean isForceUpdate() {
104         return repositoryRequest.isForceUpdate();
105     }
106 
107     public DefaultMetadataResolutionRequest setForceUpdate(boolean forceUpdate) {
108         repositoryRequest.setForceUpdate(forceUpdate);
109 
110         return this;
111     }
112 }