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

File NexusXWikiOrgExtensionRepositorySource.java

 

Coverage histogram

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

Code metrics

2
8
2
1
87
45
4
0.5
4
2
2

Classes

Class Line # Actions
NexusXWikiOrgExtensionRepositorySource 48 8 0% 4 1
0.916666791.7%
 

Contributing tests

No tests hitting this source file were found.

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.net.URI;
23    import java.net.URISyntaxException;
24    import java.util.ArrayList;
25    import java.util.Collection;
26    import java.util.Collections;
27   
28    import javax.inject.Inject;
29    import javax.inject.Named;
30    import javax.inject.Singleton;
31   
32    import org.xwiki.component.annotation.Component;
33    import org.xwiki.extension.ExtensionManagerConfiguration;
34    import org.xwiki.extension.repository.AbstractExtensionRepositorySource;
35    import org.xwiki.extension.repository.DefaultExtensionRepositoryDescriptor;
36    import org.xwiki.extension.repository.ExtensionRepositoryDescriptor;
37    import org.xwiki.extension.repository.ExtensionRepositoryManager;
38   
39    /**
40    * Extensions repositories identifier stored in the configuration.
41    *
42    * @version $Id: b63923543ce9ac1ed006c22bb620fe1eebee9cfc $
43    * @since 4.0M1
44    */
45    @Component
46    @Singleton
47    @Named("default.aether")
 
48    public class NexusXWikiOrgExtensionRepositorySource extends AbstractExtensionRepositorySource
49    {
50    /**
51    * The priority of nexus.xwiki.org repository.
52    */
53    public static final int PRIORITY = ExtensionRepositoryManager.DEFAULT_PRIORITY + 100;
54   
55    /**
56    * Used to get configuration properties containing repositories.
57    */
58    @Inject
59    private ExtensionManagerConfiguration configuration;
60   
 
61  1 toggle @Override
62    public int getPriority()
63    {
64  1 return PRIORITY;
65    }
66   
 
67  24 toggle @Override
68    public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors()
69    {
70  24 Collection<ExtensionRepositoryDescriptor> configuredRepositories =
71    this.configuration.getExtensionRepositoryDescriptors();
72   
73  24 Collection<ExtensionRepositoryDescriptor> repositories = new ArrayList<ExtensionRepositoryDescriptor>();
74   
75  24 if (configuredRepositories == null) {
76  1 try {
77  1 repositories.add(new DefaultExtensionRepositoryDescriptor("maven-xwiki", "maven",
78    new URI("http://nexus.xwiki.org/nexus/content/groups/public")));
79    } catch (URISyntaxException e) {
80    // Should never happen
81  0 return Collections.emptyList();
82    }
83    }
84   
85  24 return repositories;
86    }
87    }