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

File ExtensionXWikiOrgExtensionRepositorySource.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

2
7
2
1
87
43
4
0.57
3.5
2
2

Classes

Class Line # Actions
ExtensionXWikiOrgExtensionRepositorySource 47 7 0% 4 5
0.5454545654.5%
 

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