1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.repository.aether.internal

File AetherExtensionRepository.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

56
185
26
1
577
427
77
0.42
7.12
26
2.96

Classes

Class Line # Actions
AetherExtensionRepository 94 185 0% 77 49
0.816479481.6%
 

Contributing tests

This file is covered by 21 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.extension.repository.aether.internal;
21   
22    import java.io.File;
23    import java.util.ArrayList;
24    import java.util.Arrays;
25    import java.util.Collection;
26    import java.util.Collections;
27    import java.util.Iterator;
28    import java.util.List;
29    import java.util.Map;
30    import java.util.Properties;
31   
32    import org.apache.maven.model.Model;
33    import org.apache.maven.model.building.DefaultModelBuildingRequest;
34    import org.apache.maven.model.building.ModelBuilder;
35    import org.apache.maven.model.building.ModelBuildingException;
36    import org.apache.maven.model.building.ModelBuildingRequest;
37    import org.apache.maven.repository.internal.ArtifactDescriptorUtils;
38    import org.apache.maven.repository.internal.PublicDefaultModelResolver;
39    import org.codehaus.plexus.PlexusContainer;
40    import org.eclipse.aether.RepositorySystem;
41    import org.eclipse.aether.RepositorySystemSession;
42    import org.eclipse.aether.artifact.Artifact;
43    import org.eclipse.aether.artifact.ArtifactProperties;
44    import org.eclipse.aether.artifact.ArtifactType;
45    import org.eclipse.aether.artifact.ArtifactTypeRegistry;
46    import org.eclipse.aether.artifact.DefaultArtifact;
47    import org.eclipse.aether.artifact.DefaultArtifactType;
48    import org.eclipse.aether.graph.Dependency;
49    import org.eclipse.aether.graph.Exclusion;
50    import org.eclipse.aether.impl.ArtifactDescriptorReader;
51    import org.eclipse.aether.impl.ArtifactResolver;
52    import org.eclipse.aether.impl.RemoteRepositoryManager;
53    import org.eclipse.aether.impl.RepositoryConnectorProvider;
54    import org.eclipse.aether.impl.VersionRangeResolver;
55    import org.eclipse.aether.impl.VersionResolver;
56    import org.eclipse.aether.repository.Proxy;
57    import org.eclipse.aether.repository.RemoteRepository;
58    import org.eclipse.aether.repository.RepositoryPolicy;
59    import org.eclipse.aether.resolution.ArtifactRequest;
60    import org.eclipse.aether.resolution.ArtifactResolutionException;
61    import org.eclipse.aether.resolution.ArtifactResult;
62    import org.eclipse.aether.resolution.VersionRangeRequest;
63    import org.eclipse.aether.resolution.VersionRangeResolutionException;
64    import org.eclipse.aether.resolution.VersionRangeResult;
65    import org.eclipse.aether.resolution.VersionRequest;
66    import org.eclipse.aether.resolution.VersionResolutionException;
67    import org.eclipse.aether.resolution.VersionResult;
68    import org.eclipse.aether.transfer.ArtifactNotFoundException;
69    import org.eclipse.aether.util.repository.AuthenticationBuilder;
70    import org.eclipse.aether.util.version.GenericVersionScheme;
71    import org.eclipse.aether.version.InvalidVersionSpecificationException;
72    import org.xwiki.component.manager.ComponentManager;
73    import org.xwiki.extension.Extension;
74    import org.xwiki.extension.ExtensionDependency;
75    import org.xwiki.extension.ExtensionId;
76    import org.xwiki.extension.ExtensionNotFoundException;
77    import org.xwiki.extension.ResolveException;
78    import org.xwiki.extension.internal.ExtensionFactory;
79    import org.xwiki.extension.internal.maven.MavenExtensionDependency;
80    import org.xwiki.extension.repository.AbstractExtensionRepository;
81    import org.xwiki.extension.repository.ExtensionRepositoryDescriptor;
82    import org.xwiki.extension.repository.result.CollectionIterableResult;
83    import org.xwiki.extension.repository.result.IterableResult;
84    import org.xwiki.extension.version.Version;
85    import org.xwiki.extension.version.VersionConstraint;
86    import org.xwiki.extension.version.VersionRange;
87    import org.xwiki.extension.version.internal.DefaultVersion;
88    import org.xwiki.properties.ConverterManager;
89   
90    /**
91    * @version $Id: 8d99dfb36934061e77c07931d347828866e3fb31 $
92    * @since 4.0M1
93    */
 
94    public class AetherExtensionRepository extends AbstractExtensionRepository
95    {
96    /**
97    * Used to parse the version.
98    */
99    private static final GenericVersionScheme AETHERVERSIONSCHEME = new GenericVersionScheme();
100   
101    private transient PlexusContainer plexusContainer;
102   
103    private transient RemoteRepository remoteRepository;
104   
105    private transient ArtifactDescriptorReader mavenDescriptorReader;
106   
107    private transient VersionRangeResolver versionRangeResolver;
108   
109    private transient VersionResolver versionResolver;
110   
111    private transient ModelBuilder modelBuilder;
112   
113    private transient ArtifactResolver artifactResolver;
114   
115    private transient RepositorySystem repositorySystem;
116   
117    private transient RepositoryConnectorProvider repositoryConnectorProvider;
118   
119    private transient RemoteRepositoryManager remoteRepositoryManager;
120   
121    private transient ConverterManager converter;
122   
123    private transient AetherExtensionRepositoryFactory repositoryFactory;
124   
125    private transient ExtensionFactory factory;
126   
 
127  46 toggle public AetherExtensionRepository(ExtensionRepositoryDescriptor repositoryDescriptor,
128    AetherExtensionRepositoryFactory repositoryFactory, PlexusContainer plexusContainer,
129    ComponentManager componentManager) throws Exception
130    {
131  46 super(repositoryDescriptor);
132   
133  46 this.repositoryFactory = repositoryFactory;
134  46 this.plexusContainer = plexusContainer;
135   
136  46 RemoteRepository.Builder repositoryBuilder = new RemoteRepository.Builder(repositoryDescriptor.getId(),
137    "default", repositoryDescriptor.getURI().toString());
138   
139    // Don't use cached data
140  46 repositoryBuilder.setPolicy(
141    new RepositoryPolicy(true, RepositoryPolicy.UPDATE_POLICY_ALWAYS, RepositoryPolicy.CHECKSUM_POLICY_WARN));
142   
143    // Authentication
144  46 String username = getDescriptor().getProperty("auth.user");
145  46 if (username != null) {
146  0 AuthenticationBuilder authenticationBuilder = new AuthenticationBuilder();
147  0 authenticationBuilder.addUsername(username);
148  0 authenticationBuilder.addPassword(getDescriptor().getProperty("auth.password"));
149  0 repositoryBuilder.setAuthentication(authenticationBuilder.build());
150    }
151   
152    // Proxy
153  46 Proxy proxy = XWikiRepositorySystemSession.JREPROXYSELECTOR.getProxy(repositoryBuilder.build());
154  46 repositoryBuilder.setProxy(proxy);
155   
156  46 this.remoteRepository = repositoryBuilder.build();
157   
158  46 this.converter = componentManager.getInstance(ConverterManager.class);
159  46 this.factory = componentManager.getInstance(ExtensionFactory.class);
160   
161  46 this.versionRangeResolver = this.plexusContainer.lookup(VersionRangeResolver.class);
162  46 this.versionResolver = this.plexusContainer.lookup(VersionResolver.class);
163  46 this.modelBuilder = this.plexusContainer.lookup(ModelBuilder.class);
164  46 this.artifactResolver = this.plexusContainer.lookup(ArtifactResolver.class);
165  46 this.repositorySystem = this.plexusContainer.lookup(RepositorySystem.class);
166  46 this.mavenDescriptorReader = this.plexusContainer.lookup(ArtifactDescriptorReader.class);
167  46 this.repositoryConnectorProvider = this.plexusContainer.lookup(RepositoryConnectorProvider.class);
168  46 this.remoteRepositoryManager = this.plexusContainer.lookup(RemoteRepositoryManager.class);
169    }
170   
 
171  90 toggle public RemoteRepository getRemoteRepository()
172    {
173  90 return this.remoteRepository;
174    }
175   
 
176  10 toggle public RepositorySystem getRepositorySystem()
177    {
178  10 return this.repositorySystem;
179    }
180   
 
181  10 toggle public RepositoryConnectorProvider getRepositoryConnectorProvider()
182    {
183  10 return this.repositoryConnectorProvider;
184    }
185   
 
186  126 toggle protected XWikiRepositorySystemSession createRepositorySystemSession()
187    {
188  126 XWikiRepositorySystemSession session = this.repositoryFactory.createRepositorySystemSession();
189   
190  126 session.addConfigurationProperties(getDescriptor().getProperties());
191   
192  126 return session;
193    }
194   
 
195  85 toggle @Override
196    public Extension resolve(ExtensionId extensionId) throws ResolveException
197    {
198  85 try {
199  85 if (getDescriptor().getType().equals("maven") && this.mavenDescriptorReader != null) {
200  85 return resolveMaven(extensionId);
201    } else {
202    // FIXME: impossible to resolve extension type as well as most of the information with pure Aether API
203  0 throw new ResolveException("Unsupported");
204    }
205    } catch (InvalidExtensionIdException e) {
206    // In case the id is invalid behave as if the extension simply did not exist (which is true anyway)
207  2 throw new ExtensionNotFoundException("Invalid extension id", e);
208    }
209    }
210   
 
211  12 toggle @Override
212    public Extension resolve(ExtensionDependency extensionDependency) throws ResolveException
213    {
214  12 try {
215  12 if (getDescriptor().getType().equals("maven") && this.mavenDescriptorReader != null) {
216  12 return resolveMaven(extensionDependency);
217    } else {
218    // FIXME: impossible to resolve extension type as well as most of the information with pure Aether API
219  0 throw new ResolveException("Unsupported");
220    }
221    } catch (InvalidExtensionIdException e) {
222    // In case the id is invalid behave as if the extension simply did not exist (which is true anyway)
223  1 throw new ExtensionNotFoundException("Invalid extension id", e);
224    }
225    }
226   
 
227  10 toggle @Override
228    public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException
229    {
230  10 Artifact artifact;
231  10 try {
232  10 artifact = AetherUtils.createArtifact(id, "(,)");
233    } catch (InvalidExtensionIdException e) {
234    // In case the id is invalid behave as if the extension simply did not exist (which is true anyway)
235  0 throw new ExtensionNotFoundException("Invalid extension id", e);
236    }
237   
238  10 List<org.eclipse.aether.version.Version> versions;
239  10 try (XWikiRepositorySystemSession session = createRepositorySystemSession()) {
240  10 versions = resolveVersions(artifact, session);
241    } catch (Exception e) {
242  0 throw new ResolveException("Failed to resolve versions for id [" + id + "]", e);
243    }
244   
245  10 if (versions.isEmpty()) {
246  5 throw new ExtensionNotFoundException("No versions available for id [" + id + "]");
247    }
248   
249  5 if (nb == 0 || offset >= versions.size()) {
250  0 return new CollectionIterableResult<Version>(versions.size(), offset, Collections.<Version>emptyList());
251    }
252   
253  5 int fromId = offset < 0 ? 0 : offset;
254  5 int toId = offset + nb > versions.size() || nb < 0 ? versions.size() : offset + nb;
255   
256  5 List<Version> result = new ArrayList<Version>(toId - fromId);
257  15 for (int i = fromId; i < toId; ++i) {
258  10 result.add(new DefaultVersion(versions.get(i).toString()));
259    }
260   
261  5 return new CollectionIterableResult<Version>(versions.size(), offset, result);
262    }
263   
 
264  1 toggle private org.eclipse.aether.version.Version resolveVersionConstraint(String id, VersionConstraint versionConstraint,
265    RepositorySystemSession session) throws ResolveException
266    {
267  1 if (versionConstraint.getVersion() != null) {
268  0 try {
269  0 return AETHERVERSIONSCHEME.parseVersion(versionConstraint.getVersion().getValue());
270    } catch (InvalidVersionSpecificationException e) {
271  0 throw new ResolveException("Invalid version [" + versionConstraint.getVersion() + "]", e);
272    }
273    }
274   
275  1 List<org.eclipse.aether.version.Version> commonVersions = null;
276   
277  1 for (VersionRange range : versionConstraint.getRanges()) {
278  1 List<org.eclipse.aether.version.Version> versions = resolveVersionRange(id, range, session);
279   
280  1 if (commonVersions == null) {
281  1 commonVersions = versionConstraint.getRanges().size() > 1
282    ? new ArrayList<org.eclipse.aether.version.Version>(versions) : versions;
283    } else {
284    // Find commons versions between all the ranges of the constraint
285  0 for (Iterator<org.eclipse.aether.version.Version> it = commonVersions.iterator(); it.hasNext();) {
286  0 org.eclipse.aether.version.Version version = it.next();
287  0 if (!versions.contains(version)) {
288  0 it.remove();
289    }
290    }
291    }
292    }
293   
294  1 if (commonVersions == null || commonVersions.isEmpty()) {
295  0 throw new ExtensionNotFoundException(
296    "No versions available for id [" + id + "] and version constraint [" + versionConstraint + "]");
297    }
298   
299  1 return commonVersions.get(commonVersions.size() - 1);
300    }
301   
 
302  1 toggle private List<org.eclipse.aether.version.Version> resolveVersionRange(String id, VersionRange versionRange,
303    RepositorySystemSession session) throws ResolveException
304    {
305  1 Artifact artifact = AetherUtils.createArtifact(id, versionRange.getValue());
306   
307  1 try {
308  1 List<org.eclipse.aether.version.Version> versions = resolveVersions(artifact, session);
309   
310  1 if (versions.isEmpty()) {
311  0 throw new ExtensionNotFoundException(
312    "No versions available for id [" + id + "] and version range [" + versionRange + "]");
313    }
314   
315  1 return versions;
316    } catch (Exception e) {
317  0 throw new ResolveException("Failed to resolve version range", e);
318    }
319    }
320   
 
321  2 toggle private org.eclipse.aether.version.Version resolveVersionConstraint(Artifact artifact,
322    RepositorySystemSession session) throws ResolveException
323    {
324  2 try {
325  2 List<org.eclipse.aether.version.Version> versions = resolveVersions(artifact, session);
326   
327  2 if (versions.isEmpty()) {
328  0 throw new ExtensionNotFoundException("No versions available for artifact [" + artifact + "]");
329    }
330   
331  2 return versions.get(versions.size() - 1);
332    } catch (Exception e) {
333  0 throw new ResolveException("Failed to resolve version range", e);
334    }
335    }
336   
 
337  13 toggle List<org.eclipse.aether.version.Version> resolveVersions(Artifact artifact, RepositorySystemSession session)
338    throws VersionRangeResolutionException
339    {
340  13 VersionRangeRequest rangeRequest = new VersionRangeRequest();
341  13 rangeRequest.setArtifact(artifact);
342  13 rangeRequest.setRepositories(newResolutionRepositories(session));
343   
344  13 VersionRangeResult rangeResult = this.versionRangeResolver.resolveVersionRange(session, rangeRequest);
345   
346  13 return rangeResult.getVersions();
347    }
348   
 
349  12 toggle private AetherExtension resolveMaven(ExtensionDependency extensionDependency) throws ResolveException
350    {
351  12 Artifact artifact;
352  12 String artifactExtension;
353  12 try (XWikiRepositorySystemSession session = createRepositorySystemSession()) {
354  12 if (extensionDependency instanceof AetherExtensionDependency) {
355  5 artifact = ((AetherExtensionDependency) extensionDependency).getAetherDependency().getArtifact();
356  5 artifactExtension = ((AetherExtensionDependency) extensionDependency).getAetherDependency()
357    .getArtifact().getExtension();
358   
359    // Find the right version
360  5 if (!extensionDependency.getVersionConstraint().getRanges().isEmpty()) {
361  2 artifact = artifact.setVersion(resolveVersionConstraint(artifact, session).toString());
362    }
363    } else {
364  7 artifact = AetherUtils.createArtifact(extensionDependency.getId(),
365    extensionDependency.getVersionConstraint().getValue());
366  6 artifactExtension = null;
367   
368    // Find the right version
369  6 if (!extensionDependency.getVersionConstraint().getRanges().isEmpty()) {
370  1 artifact = artifact.setVersion(resolveVersionConstraint(extensionDependency.getId(),
371    extensionDependency.getVersionConstraint(), session).toString());
372    }
373    }
374    }
375   
376  11 return resolveMaven(artifact, artifactExtension);
377    }
378   
 
379  85 toggle private AetherExtension resolveMaven(ExtensionId extensionId) throws ResolveException
380    {
381  85 Artifact artifact = AetherUtils.createArtifact(extensionId.getId(), extensionId.getVersion().getValue());
382   
383  83 return resolveMaven(artifact, null);
384    }
385   
 
386  94 toggle private AetherExtension resolveMaven(Artifact artifact, String artifactExtension) throws ResolveException
387    {
388  94 try (XWikiRepositorySystemSession session = createRepositorySystemSession()) {
389  94 return resolveMaven(artifact, artifactExtension, session);
390    }
391    }
392   
 
393  94 toggle private AetherExtension resolveMaven(Artifact artifact, String artifactExtension, RepositorySystemSession session)
394    throws ResolveException
395    {
396    // Get Maven descriptor
397   
398  94 Model model;
399  94 try {
400  94 model = loadPom(artifact, session);
401    } catch (ArtifactResolutionException e1) {
402  43 if (e1.getResult() != null && !e1.getResult().getExceptions().isEmpty()
403    && e1.getResult().getExceptions().get(0) instanceof ArtifactNotFoundException) {
404  43 throw new ExtensionNotFoundException("Could not find artifact [" + artifact + "] descriptor", e1);
405    } else {
406  0 throw new ResolveException("Failed to resolve artifact [" + artifact + "] descriptor", e1);
407    }
408    } catch (Exception e2) {
409  0 throw new ResolveException("Failed to resolve artifact [" + artifact + "] descriptor", e2);
410    }
411   
412  51 if (model == null) {
413  0 throw new ResolveException("Failed to resolve artifact [" + artifact + "] descriptor");
414    }
415   
416    // Set type
417   
418  51 if (artifactExtension == null) {
419    // Resolve extension from the pom packaging
420  46 ArtifactType artifactType = session.getArtifactTypeRegistry().get(model.getPackaging());
421  46 if (artifactType != null) {
422  32 artifactExtension = artifactType.getExtension();
423    } else {
424  14 artifactExtension = model.getPackaging();
425    }
426    }
427   
428  51 Extension mavenExtension = this.converter.convert(Extension.class, model);
429   
430  51 Artifact filerArtifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(),
431    artifact.getClassifier(), artifactExtension, artifact.getVersion());
432   
433  51 AetherExtension extension = new AetherExtension(mavenExtension, filerArtifact, this, factory);
434   
435    // Convert Maven dependencies to Aether dependencies
436  51 extension.setDependencies(toAetherDependencies(mavenExtension.getDependencies(), session));
437   
438    // Convert Managed Maven dependencies to Aether dependencies
439  51 extension.setManagedDependencies(toAetherDependencies(mavenExtension.getManagedDependencies(), session));
440   
441  51 return extension;
442    }
443   
 
444  102 toggle private List<ExtensionDependency> toAetherDependencies(Collection<ExtensionDependency> mavenDependencies,
445    RepositorySystemSession session) throws ResolveException
446    {
447  102 List<ExtensionDependency> dependencies = new ArrayList<>(mavenDependencies.size());
448   
449  102 try {
450  102 ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
451   
452  102 for (ExtensionDependency mavenDependency : mavenDependencies) {
453  1029 dependencies.add(new AetherExtensionDependency(mavenDependency,
454    convertToAether(((MavenExtensionDependency) mavenDependency).getMavenDependency(), stereotypes),
455    this.getDescriptor()));
456    }
457    } catch (Exception e) {
458  0 throw new ResolveException("Failed to resolve dependencies", e);
459    }
460   
461  102 return dependencies;
462    }
463   
 
464  1029 toggle private Dependency convertToAether(org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes)
465    {
466  1029 ArtifactType stereotype = stereotypes.get(dependency.getType());
467  1029 if (stereotype == null) {
468  15 stereotype = new DefaultArtifactType(dependency.getType());
469    }
470   
471  1029 boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
472   
473  1029 Map<String, String> props = null;
474  1029 if (system) {
475  0 props = Collections.singletonMap(ArtifactProperties.LOCAL_PATH, dependency.getSystemPath());
476    }
477   
478  1029 Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(),
479    dependency.getClassifier(), null, dependency.getVersion(), props, stereotype);
480   
481  1029 List<Exclusion> exclusions = new ArrayList<Exclusion>(dependency.getExclusions().size());
482  1029 for (org.apache.maven.model.Exclusion exclusion : dependency.getExclusions()) {
483  249 exclusions.add(convert(exclusion));
484    }
485   
486  1029 Dependency result = new Dependency(artifact, dependency.getScope(), dependency.isOptional(), exclusions);
487   
488  1029 return result;
489    }
490   
 
491  249 toggle private Exclusion convert(org.apache.maven.model.Exclusion exclusion)
492    {
493  249 return new Exclusion(exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*");
494    }
495   
 
496  94 toggle private Artifact resolveVersion(Artifact artifact, List<RemoteRepository> repositories,
497    RepositorySystemSession session) throws VersionResolutionException
498    {
499  94 Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact(artifact);
500   
501  94 VersionRequest versionRequest = new VersionRequest(artifact, repositories, "");
502  94 VersionResult versionResult = this.versionResolver.resolveVersion(session, versionRequest);
503   
504  94 return pomArtifact.setVersion(versionResult.getVersion());
505    }
506   
 
507  94 toggle private Model loadPom(Artifact artifact, RepositorySystemSession session)
508    throws VersionResolutionException, ArtifactResolutionException, ModelBuildingException
509    {
510  94 List<RemoteRepository> repositories = newResolutionRepositories(session);
511   
512  94 Artifact pomArtifact = resolveVersion(artifact, repositories, session);
513   
514    // Download pom file
515   
516  94 ArtifactRequest resolveRequest = new ArtifactRequest(pomArtifact, repositories, "");
517  94 ArtifactResult resolveResult = this.artifactResolver.resolveArtifact(session, resolveRequest);
518  51 pomArtifact = resolveResult.getArtifact();
519   
520    // Create model
521   
522  51 return createModel(pomArtifact.getFile(), session);
523    }
524   
 
525  51 toggle private Model createModel(File pomFile, RepositorySystemSession session) throws ModelBuildingException
526    {
527    // Search for parent pom in all available Aether repositories
528  51 List<RemoteRepository> repositories = newResolutionRepositories(session, true);
529   
530  51 ModelBuildingRequest modelRequest = new DefaultModelBuildingRequest();
531  51 modelRequest.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
532  51 modelRequest.setProcessPlugins(false);
533  51 modelRequest.setTwoPhaseBuilding(false);
534  51 modelRequest.setSystemProperties(toProperties(session.getUserProperties(), session.getSystemProperties()));
535  51 modelRequest.setModelResolver(new PublicDefaultModelResolver(session, null, "", this.artifactResolver,
536    this.versionRangeResolver, this.remoteRepositoryManager, repositories));
537  51 modelRequest.setPomFile(pomFile);
538   
539  51 return this.modelBuilder.build(modelRequest).getEffectiveModel();
540    }
541   
 
542  51 toggle private Properties toProperties(Map<String, String> dominant, Map<String, String> recessive)
543    {
544  51 Properties props = new Properties();
545  51 if (recessive != null) {
546  51 props.putAll(recessive);
547    }
548  51 if (dominant != null) {
549  51 props.putAll(dominant);
550    }
551  51 return props;
552    }
553   
 
554  117 toggle List<RemoteRepository> newResolutionRepositories(RepositorySystemSession session)
555    {
556  117 return newResolutionRepositories(session, false);
557    }
558   
 
559  168 toggle List<RemoteRepository> newResolutionRepositories(RepositorySystemSession session, boolean all)
560    {
561  168 List<RemoteRepository> repositories;
562   
563  168 if (all) {
564    // Get all maven repositories
565  51 repositories = this.repositoryFactory.getAllMavenRepositories(this.remoteRepository);
566    } else {
567  117 repositories = Arrays.asList(this.remoteRepository);
568    }
569   
570  168 return this.repositorySystem.newResolutionRepositories(session, repositories);
571    }
572   
 
573  0 toggle RemoteRepository newResolutionRepository(RepositorySystemSession session)
574    {
575  0 return newResolutionRepositories(session).get(0);
576    }
577    }