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;
20  
21  import java.util.List;
22  import java.util.Map;
23  import java.util.Set;
24  
25  import org.apache.maven.artifact.Artifact;
26  import org.apache.maven.artifact.repository.ArtifactRepository;
27  
28  /**
29   *
30   *
31   *
32   */
33  @Deprecated
34  public class MetadataResolutionRequest {
35      private MavenArtifactMetadata mad;
36  
37      private String scope;
38  
39      // Needs to go away
40      private Set<Artifact> artifactDependencies;
41  
42      private ArtifactRepository localRepository;
43  
44      private List<ArtifactRepository> remoteRepositories;
45  
46      // This is like a filter but overrides all transitive versions
47      private Map managedVersionMap;
48  
49      /** result type - flat list; the default */
50      private boolean asList = true;
51  
52      /** result type - dirty tree */
53      private boolean asDirtyTree = false;
54  
55      /** result type - resolved tree */
56      private boolean asResolvedTree = false;
57  
58      /** result type - graph */
59      private boolean asGraph = false;
60  
61      public MetadataResolutionRequest() {}
62  
63      public MetadataResolutionRequest(
64              MavenArtifactMetadata md, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories) {
65          this.mad = md;
66          this.localRepository = localRepository;
67          this.remoteRepositories = remoteRepositories;
68      }
69  
70      public MavenArtifactMetadata getArtifactMetadata() {
71          return mad;
72      }
73  
74      public MetadataResolutionRequest setArtifactMetadata(MavenArtifactMetadata md) {
75          this.mad = md;
76  
77          return this;
78      }
79  
80      public MetadataResolutionRequest setArtifactDependencies(Set<Artifact> artifactDependencies) {
81          this.artifactDependencies = artifactDependencies;
82  
83          return this;
84      }
85  
86      public Set<Artifact> getArtifactDependencies() {
87          return artifactDependencies;
88      }
89  
90      public ArtifactRepository getLocalRepository() {
91          return localRepository;
92      }
93  
94      public MetadataResolutionRequest setLocalRepository(ArtifactRepository localRepository) {
95          this.localRepository = localRepository;
96  
97          return this;
98      }
99  
100     /**
101      * @deprecated instead use {@link #getRemoteRepositories()}
102      */
103     @Deprecated
104     public List<ArtifactRepository> getRemoteRepostories() {
105         return remoteRepositories;
106     }
107 
108     public List<ArtifactRepository> getRemoteRepositories() {
109         return getRemoteRepostories();
110     }
111 
112     /**
113      * @deprecated instead use {@link #setRemoteRepositories(List)}
114      */
115     @Deprecated
116     public MetadataResolutionRequest setRemoteRepostories(List<ArtifactRepository> remoteRepositories) {
117         this.remoteRepositories = remoteRepositories;
118 
119         return this;
120     }
121 
122     public MetadataResolutionRequest setRemoteRepositories(List<ArtifactRepository> remoteRepositories) {
123         return setRemoteRepostories(remoteRepositories);
124     }
125 
126     public Map getManagedVersionMap() {
127         return managedVersionMap;
128     }
129 
130     public MetadataResolutionRequest setManagedVersionMap(Map managedVersionMap) {
131         this.managedVersionMap = managedVersionMap;
132 
133         return this;
134     }
135 
136     public String toString() {
137         StringBuilder sb = new StringBuilder()
138                 .append("REQUEST: ")
139                 .append("\n")
140                 .append("artifact: ")
141                 .append(mad)
142                 .append("\n")
143                 .append(artifactDependencies)
144                 .append("\n")
145                 .append("localRepository: ")
146                 .append(localRepository)
147                 .append("\n")
148                 .append("remoteRepositories: ")
149                 .append(remoteRepositories)
150                 .append("\n");
151 
152         return sb.toString();
153     }
154 
155     public boolean isAsList() {
156         return asList;
157     }
158 
159     public MetadataResolutionRequest setAsList(boolean asList) {
160         this.asList = asList;
161         return this;
162     }
163 
164     public boolean isAsDirtyTree() {
165         return asDirtyTree;
166     }
167 
168     public MetadataResolutionRequest setAsDirtyTree(boolean asDirtyTree) {
169         this.asDirtyTree = asDirtyTree;
170         return this;
171     }
172 
173     public boolean isAsResolvedTree() {
174         return asResolvedTree;
175     }
176 
177     public MetadataResolutionRequest setAsResolvedTree(boolean asResolvedTree) {
178         this.asResolvedTree = asResolvedTree;
179         return this;
180     }
181 
182     public boolean isAsGraph() {
183         return asGraph;
184     }
185 
186     public MetadataResolutionRequest setAsGraph(boolean asGraph) {
187         this.asGraph = asGraph;
188         return this;
189     }
190 
191     public MetadataResolutionRequest setScope(String scope) {
192         this.scope = scope;
193         return this;
194     }
195 
196     public String getScope() {
197         return scope;
198     }
199 }