improved comments to some methods

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/ckan-util-library@131100 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-09-05 07:46:00 +00:00
parent e101fe9786
commit 336b41f723
1 changed files with 20 additions and 0 deletions

View File

@ -16,6 +16,12 @@ public class CkanUtilsFactory {
private static CkanUtilsFactory instance = new CkanUtilsFactory();
private static ConcurrentHashMap<String, CacheBean> cache;
/**
* Private constructor for the hashmap's object values
* @author Costantino Perciante at ISTI-CNR
* (costantino.perciante@isti.cnr.it)
*
*/
private class CacheBean{
CKanUtilsImpl utils;
long ttl;
@ -26,6 +32,9 @@ public class CkanUtilsFactory {
}
}
/**
* Private constructor
*/
private CkanUtilsFactory(){
logger.debug("Ckan factory object build");
@ -42,6 +51,12 @@ public class CkanUtilsFactory {
return instance;
}
/**
* Retrieve the ckan utils information for the given scope
* @param scope
* @return
* @throws Exception
*/
public CKanUtilsImpl getUtilsPerScope(String scope) throws Exception{
if(scope == null || scope.isEmpty())
throw new IllegalArgumentException("Invalid scope given!");
@ -57,6 +72,11 @@ public class CkanUtilsFactory {
}
}
/**
* Check if the ckan information must be retrieved again.
* @param cacheBean
* @return
*/
private boolean expired(CacheBean cacheBean) {
boolean expired = (cacheBean.ttl + MAX_LIFETIME <= System.currentTimeMillis());
logger.debug("expired is " + expired);