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

File StoreXWikiComExtensionRepositorySource.java

 

Coverage histogram

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

Code metrics

2
7
2
1
79
41
4
0.57
3.5
2
2

Classes

Class Line # Actions
StoreXWikiComExtensionRepositorySource 46 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   
37    /**
38    * Extensions repositories identifier stored in the configuration.
39    *
40    * @version $Id: 780915e85a240a7dfb685f823537a3f3f37e5fd0 $
41    * @since 8.3
42    */
43    @Component
44    @Singleton
45    @Named("default.xwikisas.xwiki")
 
46    public class StoreXWikiComExtensionRepositorySource extends AbstractExtensionRepositorySource
47    {
48    /**
49    * Used to get configuration properties containing repositories.
50    */
51    @Inject
52    private ExtensionManagerConfiguration configuration;
53   
 
54  0 toggle @Override
55    public int getPriority()
56    {
57  0 return ExtensionXWikiOrgExtensionRepositorySource.PRIORITY - 10;
58    }
59   
 
60  1 toggle @Override
61    public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors()
62    {
63  1 Collection<ExtensionRepositoryDescriptor> configuredRepositories =
64    this.configuration.getExtensionRepositoryDescriptors();
65   
66  1 Collection<ExtensionRepositoryDescriptor> repositories = new ArrayList<>();
67   
68  1 if (configuredRepositories == null) {
69  0 try {
70  0 repositories.add(new DefaultExtensionRepositoryDescriptor("store.xwiki.com", "xwiki",
71    new URI("https://store.xwiki.com/xwiki/rest/")));
72    } catch (URISyntaxException e) {
73    // Should never happen
74    }
75    }
76   
77  1 return repositories;
78    }
79    }