Line 36... |
Line 36... |
36 |
import net.brutex.xservices.types.scmfindings.FindingType;
|
36 |
import net.brutex.xservices.types.scmfindings.FindingType;
|
37 |
import net.brutex.xservices.types.scmfindings.FindingsListType;
|
37 |
import net.brutex.xservices.types.scmfindings.FindingsListType;
|
38 |
import net.brutex.xservices.types.scmfindings.GroupMatchListType;
|
38 |
import net.brutex.xservices.types.scmfindings.GroupMatchListType;
|
39 |
import net.brutex.xservices.types.scmfindings.ObjectFactory;
|
39 |
import net.brutex.xservices.types.scmfindings.ObjectFactory;
|
40 |
import net.brutex.xservices.ws.rs.CVSInfoImpl;
|
40 |
import net.brutex.xservices.ws.rs.CVSInfoImpl;
|
- |
|
41 |
|
41 |
import org.apache.commons.configuration.ConfigurationException;
|
42 |
import org.apache.commons.configuration2.PropertiesConfiguration;
|
42 |
import org.apache.commons.configuration.PropertiesConfiguration;
|
43 |
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
43 |
import org.apache.jcs.JCS;
|
44 |
import org.apache.commons.configuration2.ex.ConfigurationException;
|
44 |
import org.apache.jcs.access.exception.CacheException;
|
45 |
import org.apache.commons.jcs.access.exception.CacheException;
|
- |
|
46 |
import org.apache.logging.log4j.LogManager;
|
45 |
import org.apache.log4j.Logger;
|
47 |
import org.apache.logging.log4j.Logger;
|
Line 46... |
Line 48... |
46 |
|
48 |
|
47 |
/**
|
49 |
/**
|
48 |
* @author Brian Rosenberger, bru(at)brutex.de
|
50 |
* @author Brian Rosenberger, bru(at)brutex.de
|
49 |
*
|
51 |
*
|
Line 50... |
Line 52... |
50 |
*/
|
52 |
*/
|
Line 51... |
Line 53... |
51 |
|
53 |
|
52 |
public class FindingsCacheServlet extends HttpServlet {
|
54 |
public class FindingsCacheServlet extends HttpServlet {
|
53 |
|
- |
|
54 |
private static final long serialVersionUID = 4041338473949999960L;
|
55 |
|
55 |
private final static Logger logger = Logger
|
56 |
private static final long serialVersionUID = 4041338473949999960L;
|
56 |
.getLogger(FindingsCacheServlet.class);
|
57 |
private static final Logger logger = LogManager.getLogger();
|
Line 57... |
Line 58... |
57 |
private final List<File> configfiles = new ArrayList<File>();
|
58 |
private final List<File> configfiles = new ArrayList<File>();
|
Line 68... |
Line 69... |
68 |
if(! this.initConfigFindings()) return;
|
69 |
if(! this.initConfigFindings()) return;
|
Line 69... |
Line 70... |
69 |
|
70 |
|
70 |
int i = 1;
|
71 |
int i = 1;
|
71 |
for(File f: configfiles) {
|
72 |
for(File f: configfiles) {
|
72 |
//Initialise configuration bean using default values
|
73 |
//Initialise configuration bean using default values
|
73 |
FindingsConfigBean cbean = new FindingsConfigBean(i, Logger.getLogger("worker-"+i+ "." + this.getClass().getName()));
|
74 |
FindingsConfigBean cbean = new FindingsConfigBean(i, LogManager.getLogger("worker-"+i+ "." + this.getClass().getName()));
|
Line 74... |
Line 75... |
74 |
i++;
|
75 |
i++;
|
Line 84... |
Line 85... |
84 |
} catch (NumberFormatException e) {
|
85 |
} catch (NumberFormatException e) {
|
85 |
logger.warn("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '"
|
86 |
logger.warn("Could not read parameter 'cvs-cache-interval' from web.xml. Using default value '"
|
86 |
+ cbean.getCacheinterval()+ "' minutes");
|
87 |
+ cbean.getCacheinterval()+ "' minutes");
|
87 |
}
|
88 |
}
|
Line -... |
Line 89... |
- |
|
89 |
|
88 |
|
90 |
Configurations configs = new Configurations();
|
89 |
PropertiesConfiguration config = null;
|
91 |
PropertiesConfiguration config = null;
|
90 |
try {
|
92 |
try {
|
91 |
config = new PropertiesConfiguration(f);
|
93 |
config = configs.properties(f);
|
92 |
} catch (ConfigurationException e) {
|
94 |
} catch (ConfigurationException e) {
|
93 |
logger.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
|
95 |
logger.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
|
94 |
return;
|
96 |
return;
|