Subversion Repositories XServices

Rev

Rev 175 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 175 Rev 185
Line 31... Line 31...
31
import java.util.List;
31
import java.util.List;
32
import javax.ws.rs.core.HttpHeaders;
32
import javax.ws.rs.core.HttpHeaders;
33
import javax.ws.rs.core.Response;
33
import javax.ws.rs.core.Response;
34
import javax.ws.rs.core.UriInfo;
34
import javax.ws.rs.core.UriInfo;
Line -... Line 35...
-
 
35
 
-
 
36
import org.apache.commons.configuration2.PropertiesConfiguration;
-
 
37
import org.apache.commons.configuration2.builder.fluent.Configurations;
-
 
38
import org.apache.commons.configuration2.ex.ConfigurationException;
-
 
39
import org.apache.commons.jcs.JCS;
-
 
40
import org.apache.commons.jcs.access.CacheAccess;
-
 
41
import org.apache.commons.jcs.access.exception.CacheException;
-
 
42
import org.apache.logging.log4j.LogManager;
-
 
43
import org.apache.logging.log4j.Logger;
35
 
44
 
36
import net.brutex.xservices.cmtypes.ItemType;
45
import net.brutex.xservices.cmtypes.ItemType;
37
import net.brutex.xservices.cmtypes.ItemTypeList;
46
import net.brutex.xservices.cmtypes.ItemTypeList;
38
import net.brutex.xservices.types.FileInfoType;
47
import net.brutex.xservices.types.FileInfoType;
Line 39... Line -...
39
import net.brutex.xservices.util.FileWalker;
-
 
40
 
-
 
41
import org.apache.commons.configuration.ConfigurationException;
-
 
42
import org.apache.commons.configuration.PropertiesConfiguration;
-
 
43
import org.apache.jcs.JCS;
-
 
Line 44... Line 48...
44
import org.apache.jcs.access.exception.CacheException;
48
import net.brutex.xservices.util.FileWalker;
45
import org.apache.log4j.Logger;
49
 
46
 
50
 
Line 74... Line 78...
74
 * 
78
 * 
75
 * @author Brian Rosenberger, bru(at)brutex.de
79
 * @author Brian Rosenberger, bru(at)brutex.de
76
 */
80
 */
77
public class DIMCMInfoImpl implements DIMCMInfo {
81
public class DIMCMInfoImpl implements DIMCMInfo {
Line 78... Line 82...
78
 
82
 
Line 79... Line 83...
79
	Logger logger = Logger.getLogger(DIMCMInfoImpl.class);
83
	Logger logger = LogManager.getLogger();
80
 
84
 
81
	/*
85
	/*
82
	 * (non-Javadoc)
86
	 * (non-Javadoc)
Line 91... Line 95...
91
 
95
 
92
		
96
		
93
		/*
97
		/*
94
		 * try to hit cache first
98
		 * try to hit cache first
95
		 */
99
		 */
96
		JCS cache = JCS.getInstance("DIMCM");
100
		CacheAccess<Object, Object> cache = JCS.getInstance("DIMCM");
97
		String cachekey = projSpec + directory + String.valueOf(recursive);
101
		String cachekey = projSpec + directory + String.valueOf(recursive);
98
		if(useCache) {
102
		if(useCache) {
99
				ItemTypeList cacheresult = (ItemTypeList) cache.get(cachekey);
103
				ItemTypeList cacheresult = (ItemTypeList) cache.get(cachekey);
Line 326... Line 330...
326
		/*
330
		/*
327
		 * Create a new connection from property file
331
		 * Create a new connection from property file
328
		 */
332
		 */
329
		PropertiesConfiguration props;
333
		PropertiesConfiguration props;
330
		try {
334
		try {
-
 
335
			
331
			props = new PropertiesConfiguration(this.getClass()
336
			props = new Configurations().properties(this.getClass()
332
					.getClassLoader().getResource("/../dimcm.properties"));
337
					.getClassLoader().getResource("/../dimcm.properties"));
333
		} catch (ConfigurationException e) {
338
		} catch (ConfigurationException e) {
334
			e.printStackTrace();
339
			e.printStackTrace();
335
			return null;
340
			return null;
336
		}
341
		}
Line 347... Line 352...
347
	}
352
	}
Line 348... Line 353...
348
 
353
 
349
	private String getBaseURL() {
354
	private String getBaseURL() {
350
		final String CACHE_BASEURL = "DIMCM.conf.baseurl";
355
		final String CACHE_BASEURL = "DIMCM.conf.baseurl";
351
	try {
356
	try {
352
		JCS cache = JCS.getInstance("DIMCM");
357
		CacheAccess<Object, Object> cache = JCS.getInstance("DIMCM");
353
		String baseurl = (String) cache.get(CACHE_BASEURL);
358
		String baseurl = (String) cache.get(CACHE_BASEURL);
Line -... Line 359...
-
 
359
		if(baseurl != null) return baseurl;
-
 
360
		
354
		if(baseurl != null) return baseurl;
361
		Configurations configs = new Configurations();
355
		
362
		
356
		PropertiesConfiguration	props = new PropertiesConfiguration(this.getClass().getClassLoader().getResource("/../dimcm.properties"));
363
		PropertiesConfiguration	props = configs.properties((this.getClass().getClassLoader().getResource("/../dimcm.properties")));
357
		baseurl = props.getString("baseurl");
364
		baseurl = props.getString("baseurl");
Line 358... Line 365...
358
		cache.put(CACHE_BASEURL, baseurl);
365
		cache.put(CACHE_BASEURL, baseurl);