View Javadoc

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