1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.internal.script

File DebugInternalScriptService.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

4
9
3
1
92
45
5
0.56
3
3
1.67

Classes

Class Line # Actions
DebugInternalScriptService 45 9 0% 5 4
0.7575%
 

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 com.xpn.xwiki.internal.script;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.configuration.ConfigurationSource;
28    import org.xwiki.container.Container;
29    import org.xwiki.context.Execution;
30    import org.xwiki.context.ExecutionContext;
31    import org.xwiki.job.event.status.JobProgress;
32    import org.xwiki.script.service.ScriptService;
33   
34    import com.xpn.xwiki.web.XWikiAction;
35   
36    /**
37    * Various internal debug tools.
38    *
39    * @version $Id: 2fd8bdc141567e8d401a3658e0c3ed414ad1bf86 $
40    * @since 7.1M2
41    */
42    @Component
43    @Singleton
44    @Named("debug")
 
45    public class DebugInternalScriptService implements ScriptService
46    {
47    @Inject
48    private Execution execution;
49   
50    @Inject
51    @Named("xwikiproperties")
52    private ConfigurationSource properties;
53   
54    @Inject
55    private Container container;
56   
57    /**
58    * @return is debug enabled in the current execution context
59    */
 
60  1061 toggle public boolean isEnabled()
61    {
62  1058 return getActionProgress() != null;
63    }
64   
65    /**
66    * @return the detailed progress of the current action
67    */
 
68  1058 toggle public JobProgress getActionProgress()
69    {
70  1060 ExecutionContext econtext = this.execution.getContext();
71   
72  1061 if (econtext != null) {
73  1059 return (JobProgress) econtext.getProperty(XWikiAction.ACTION_PROGRESS);
74    }
75   
76  0 return null;
77    }
78   
79    /**
80    * @return true if resources should be minified when possible
81    * @since 7.1RC1
82    */
 
83  2127 toggle public boolean isMinify()
84    {
85  2126 String minifyString = (String) this.container.getRequest().getProperty("minify");
86  2127 if (minifyString != null) {
87  0 return Boolean.valueOf(minifyString);
88    }
89   
90  2127 return this.properties.getProperty("debug.minify", true);
91    }
92    }