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

File AetherExtension.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
9
1
1
62
26
2
0.22
9
1
2

Classes

Class Line # Actions
AetherExtension 37 9 0% 2 1
0.916666791.7%
 

Contributing tests

This file is covered by 16 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.util.ArrayList;
23    import java.util.List;
24   
25    import org.eclipse.aether.artifact.Artifact;
26    import org.xwiki.extension.Extension;
27    import org.xwiki.extension.internal.ExtensionFactory;
28    import org.xwiki.extension.internal.maven.AbstractMavenExtension;
29    import org.xwiki.extension.repository.ExtensionRepositoryDescriptor;
30   
31    /**
32    * Add support for repositories supported by AETHER (only Maven for now).
33    *
34    * @version $Id: 5f22e0126d86071305f328f28f1a83456d580fd0 $
35    * @since 4.0M1
36    */
 
37    public class AetherExtension extends AbstractMavenExtension
38    {
39    public static final String PKEY_AETHER_ARTIFACT = "aether.Artifact";
40   
 
41  51 toggle public AetherExtension(Extension mavenExtension, Artifact artifact, AetherExtensionRepository repository,
42    ExtensionFactory factory)
43    {
44  51 super(repository, mavenExtension);
45   
46  51 setId(AetherUtils.createExtensionId(artifact, factory));
47  51 setType(artifact.getExtension());
48   
49  51 setFile(new AetherExtensionFile(artifact, repository));
50   
51    // Make sure we remember the extension repository (Extension#getRepository() will be the local extension
52    // repository when the extension is downloaded)
53  51 if (repository != null) {
54  51 List<ExtensionRepositoryDescriptor> newRepositories = new ArrayList<>(getRepositories().size() + 1);
55   
56  51 newRepositories.add(repository.getDescriptor());
57  51 newRepositories.addAll(getRepositories());
58   
59  51 setRepositories(newRepositories);
60    }
61    }
62    }