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

File DefaultJobManagerConfiguration.java

 

Coverage histogram

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

Code metrics

4
8
3
1
91
41
5
0.62
2.67
3
1.67

Classes

Class Line # Actions
DefaultJobManagerConfiguration 41 8 0% 5 2
0.866666786.7%
 

Contributing tests

This file is covered by 113 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.job.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.job.JobManagerConfiguration;
32   
33    /**
34    * Default implementation of {@link JobManagerConfiguration}.
35    *
36    * @version $Id: 7852c5a95ba7ef89dd5397947c20f02d9301a751 $
37    * @since 4.0M1
38    */
39    @Component
40    @Singleton
 
41    public class DefaultJobManagerConfiguration implements JobManagerConfiguration
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    // Cache
56   
57    /**
58    * @see DefaultJobManagerConfiguration#getStorage()
59    */
60    private File store;
61   
62    /**
63    * @return job manager home folder
64    */
 
65  191 toggle private File getHome()
66    {
67  191 return new File(this.environment.getPermanentDirectory(), "jobs/");
68    }
69   
 
70  40655 toggle @Override
71    public File getStorage()
72    {
73  40664 if (this.store == null) {
74  191 String localRepositoryPath = this.configuration.get().getProperty("job.statusFolder");
75   
76  191 if (localRepositoryPath == null) {
77  191 this.store = new File(getHome(), "status/");
78    } else {
79  0 this.store = new File(localRepositoryPath);
80    }
81    }
82   
83  40661 return this.store;
84    }
85   
 
86  191 toggle @Override
87    public int getJobStatusCacheSize()
88    {
89  191 return this.configuration.get().getProperty("job.statusCacheSize", 50);
90    }
91    }