1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.extension.job.history.internal

File DefaultExtensionJobHistoryConfiguration.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

4
6
1
1
75
32
3
0.5
6
1
3

Classes

Class Line # Actions
DefaultExtensionJobHistoryConfiguration 41 6 0% 3 2
0.818181881.8%
 

Contributing tests

This file is covered by 127 tests. .

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.job.history.internal;
21   
22    import java.io.File;
23   
24    import javax.inject.Inject;
25    import javax.inject.Provider;
26    import javax.inject.Singleton;
27   
28    import org.xwiki.component.annotation.Component;
29    import org.xwiki.configuration.ConfigurationSource;
30    import org.xwiki.environment.Environment;
31    import org.xwiki.extension.job.history.ExtensionJobHistoryConfiguration;
32   
33    /**
34    * Default implementation of {@link ExtensionJobHistoryConfiguration}.
35    *
36    * @version $Id: a88fea9ab8c80ae611dff821f8dd7a2abfa29c6a $
37    * @since 7.1RC1
38    */
39    @Component
40    @Singleton
 
41    public class DefaultExtensionJobHistoryConfiguration implements ExtensionJobHistoryConfiguration
42    {
43    /**
44    * Used to get permanent directory.
45    */
46    @Inject
47    private Environment environment;
48   
49    /**
50    * The configuration.
51    */
52    @Inject
53    private Provider<ConfigurationSource> configuration;
54   
55    /**
56    * The history storage folder.
57    */
58    private File storage;
59   
 
60  367 toggle @Override
61    public File getStorage()
62    {
63  367 if (this.storage == null) {
64  298 String historyPath = this.configuration.get().getProperty("extension.historyFolder");
65   
66  298 if (historyPath == null) {
67  298 this.storage = new File(this.environment.getPermanentDirectory(), "extension/history/");
68    } else {
69  0 this.storage = new File(historyPath);
70    }
71    }
72   
73  366 return this.storage;
74    }
75    }