Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../img/srcFileCovDistChart6.png 81% of files have more coverage
8   133   7   1.14
0   61   0.88   7
7     1  
1    
 
  DefaultRenderingConfiguration       Line # 46 8 0% 7 6 60% 0.6
 
  (117)
 
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.rendering.internal.configuration;
21   
22    import org.slf4j.Logger;
23    import org.xwiki.component.annotation.Component;
24    import org.xwiki.component.descriptor.ComponentDescriptor;
25    import org.xwiki.component.manager.ComponentManager;
26    import org.xwiki.component.phase.Initializable;
27    import org.xwiki.component.phase.InitializationException;
28    import org.xwiki.rendering.configuration.RenderingConfiguration;
29    import org.xwiki.rendering.transformation.Transformation;
30   
31    import java.util.ArrayList;
32    import java.util.List;
33    import java.util.Properties;
34   
35    import javax.inject.Inject;
36    import javax.inject.Singleton;
37   
38    /**
39    * Basic default implementation to be used when using the XWiki Rendering system standalone.
40    *
41    * @version $Id: 625407e5f886a4878b6badf7172cb3398631112f $
42    * @since 2.0M1
43    */
44    @Component
45    @Singleton
 
46    public class DefaultRenderingConfiguration implements RenderingConfiguration, Initializable
47    {
48    /**
49    * The logger to log.
50    */
51    @Inject
52    private Logger logger;
53   
54    /**
55    * Used to look up Transformations at runtime.
56    */
57    @Inject
58    private ComponentManager componentManager;
59   
60    /**
61    * Holds the names of transformations to apply (in any order, the Transformation Manager will execute them in the
62    * proper order).
63    */
64    private List<String> transformationNames = new ArrayList<String>();
65   
66    /**
67    * @see #getLinkLabelFormat()
68    */
69    private String linkLabelFormat = "%p";
70   
71    /**
72    * @see #getInterWikiDefinitions()
73    */
74    private Properties interWikiDefinitions = new Properties();
75   
 
76  296 toggle @Override
77    public void initialize() throws InitializationException
78    {
79    // Find the names of all registered Transformations.
80  296 for (ComponentDescriptor<Transformation> descriptor
81    : this.componentManager.getComponentDescriptorList(Transformation.class))
82    {
83  295 transformationNames.add(descriptor.getRoleHint());
84    }
85    }
86   
 
87  0 toggle @Override
88    public String getLinkLabelFormat()
89    {
90  0 return this.linkLabelFormat;
91    }
92   
93    /**
94    * @param linkLabelFormat the format used to decide how to display links that have no label
95    */
 
96  0 toggle public void setLinkLabelFormat(String linkLabelFormat)
97    {
98    // This method is useful for those using the XWiki Rendering in standalone mode since it allows the rendering
99    // to work even without a configuration store.
100  0 this.linkLabelFormat = linkLabelFormat;
101    }
102   
 
103  4 toggle @Override
104    public Properties getInterWikiDefinitions()
105    {
106  4 return this.interWikiDefinitions;
107    }
108   
109    /**
110    * @param interWikiAlias see {@link org.xwiki.rendering.listener.reference.InterWikiResourceReference}
111    * @param interWikiURL see {@link org.xwiki.rendering.listener.reference.InterWikiResourceReference}
112    */
 
113  180 toggle public void addInterWikiDefinition(String interWikiAlias, String interWikiURL)
114    {
115    // This method is useful for those using the XWiki Rendering in standalone mode since it allows the rendering
116    // to work even without a configuration store.
117  180 this.interWikiDefinitions.setProperty(interWikiAlias, interWikiURL);
118    }
119   
120    /**
121    * @param transformationNames the explicit list of transformation names to execute (overrides the default list)
122    */
 
123  0 toggle public void setTransformationNames(List<String> transformationNames)
124    {
125  0 this.transformationNames = transformationNames;
126    }
127   
 
128  116 toggle @Override
129    public List<String> getTransformationNames()
130    {
131  116 return this.transformationNames;
132    }
133    }