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