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

File SafeCoreExtensionRepository.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart5.png
74% of files have more coverage

Code metrics

0
8
8
1
96
52
8
1
1
8
1

Classes

Class Line # Actions
SafeCoreExtensionRepository 38 8 0% 8 8
0.550%
 

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.script.internal.safe;
21   
22    import java.util.Collection;
23   
24    import org.xwiki.context.Execution;
25    import org.xwiki.extension.CoreExtension;
26    import org.xwiki.extension.ExtensionDependency;
27    import org.xwiki.extension.ExtensionId;
28    import org.xwiki.extension.repository.CoreExtensionRepository;
29    import org.xwiki.script.internal.safe.ScriptSafeProvider;
30   
31    /**
32    * Provide a public script access to a core extension repository.
33    *
34    * @param <T>
35    * @version $Id: c06061d6f686a23f2571beda9aa1bc70cde5ec68 $
36    * @since 4.0M2
37    */
 
38    public class SafeCoreExtensionRepository<T extends CoreExtensionRepository> extends
39    SafeAdvancedSearchableExtensionRepository<T> implements CoreExtensionRepository
40    {
41    /**
42    * @param repository wrapped repository
43    * @param safeProvider the provider of instances safe for public scripts
44    * @param execution provide access to the current context
45    * @param hasProgrammingRight does the caller script has programming right
46    */
 
47  1185 toggle public SafeCoreExtensionRepository(T repository, ScriptSafeProvider<?> safeProvider, Execution execution,
48    boolean hasProgrammingRight)
49    {
50  1185 super(repository, safeProvider, execution, hasProgrammingRight);
51    }
52   
53    // CoreExtensionRepository
54   
 
55  0 toggle @Override
56    public int countExtensions()
57    {
58  0 return getWrapped().countExtensions();
59    }
60   
 
61  0 toggle @Override
62    public Collection<CoreExtension> getCoreExtensions()
63    {
64  0 return safe(getWrapped().getCoreExtensions());
65    }
66   
 
67  0 toggle @Override
68    public CoreExtension getCoreExtension(String id)
69    {
70  0 return safe(getWrapped().getCoreExtension(id));
71    }
72   
 
73  0 toggle @Override
74    public boolean exists(String id)
75    {
76  0 return getWrapped().exists(id);
77    }
78   
 
79  77 toggle @Override
80    public CoreExtension resolve(ExtensionDependency extensionDependency)
81    {
82  77 return (CoreExtension) super.resolve(extensionDependency);
83    }
84   
 
85  161 toggle @Override
86    public CoreExtension resolve(ExtensionId extensionId)
87    {
88  161 return (CoreExtension) super.resolve(extensionId);
89    }
90   
 
91  666 toggle @Override
92    public CoreExtension getEnvironmentExtension()
93    {
94  666 return safe(getWrapped().getEnvironmentExtension());
95    }
96    }