removed old code

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@148714 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-05-16 13:42:57 +00:00
parent bb18ce0fb9
commit 17e8af86ea
1 changed files with 17 additions and 9 deletions

View File

@ -98,7 +98,7 @@ public class GeonetworkResolver extends HttpServlet{
@Override @Override
public void run() { public void run() {
logger.info("Resetting Geonetwork configuratiors cache..."); logger.info("Resetting Geonetwork configuratiors cache...");
resetCacheGeonetworkInstances(); purgeCacheGeonetworkInstances();
} }
}, CACHE_RESET_DELAY, CACHE_RESET_TIME); }, CACHE_RESET_DELAY, CACHE_RESET_TIME);
} }
@ -122,18 +122,24 @@ public class GeonetworkResolver extends HttpServlet{
} }
if(resetCache!=null && Boolean.parseBoolean(resetCache)){ if(resetCache!=null && Boolean.parseBoolean(resetCache)){
resetCacheGeonetworkInstances(); purgeCacheGeonetworkInstances();
} }
if(resetScope!=null && Boolean.parseBoolean(resetScope)){ if(resetScope!=null && Boolean.parseBoolean(resetScope)){
resetCacheServerParameterForScope(scopeValue); resetGeonetoworkInstanceCacheForScope(scopeValue);
} }
logger.info("SCOPE: " + scopeValue +", Query String: " + req.getQueryString()); logger.info("SCOPE: " + scopeValue +", Query String: " + req.getQueryString());
try { try {
// ServerParameters geonetworkParams = getGeonetworkCachedServerParameters(scopeValue);
GeonetworkInstance gnInstance = getGeonetworkInstanceForScope(scopeValue); GeonetworkInstance gnInstance = getGeonetworkInstanceForScope(scopeValue);
// if(gnInstance==null){
// logger.info("GeonetworkInstance not istanciable via geonetwork library.. using ");
// ServerParameters serverParams = getGeonetworkCachedServerParameters(scopeValue);
// gnInstance = gntwAccess.getGeonetworkInstance();
// }
// GeonetworkServiceInterface gntwAccess = new GeonetworkAccessParameter(scopeValue); // GeonetworkServiceInterface gntwAccess = new GeonetworkAccessParameter(scopeValue);
// GeonetworkInstance gnInstance = gntwAccess.getGeonetworkInstance(); // GeonetworkInstance gnInstance = gntwAccess.getGeonetworkInstance();
HTTPCallsUtils httpUtils = new HTTPCallsUtils(); HTTPCallsUtils httpUtils = new HTTPCallsUtils();
@ -406,7 +412,7 @@ public class GeonetworkResolver extends HttpServlet{
protected GeonetworkInstance getGeonetworkInstanceForScope(String scope) throws Exception{ protected GeonetworkInstance getGeonetworkInstanceForScope(String scope) throws Exception{
if(cacheGNInstances==null) if(cacheGNInstances==null)
resetCacheGeonetworkInstances(); purgeCacheGeonetworkInstances();
logger.info("Attempt to get geonetwork instance from GeonetworkInstance cache for scope: "+scope); logger.info("Attempt to get geonetwork instance from GeonetworkInstance cache for scope: "+scope);
GeonetworkInstance geoInstance = cacheGNInstances.get(scope); GeonetworkInstance geoInstance = cacheGNInstances.get(scope);
@ -441,12 +447,13 @@ public class GeonetworkResolver extends HttpServlet{
} }
/** /**
* Reset cache server parameter for scope. * Reset geonetowork instance cache for scope.
* *
* @param scope the scope * @param scope the scope
*/ */
private void resetCacheServerParameterForScope(String scope){ private void resetGeonetoworkInstanceCacheForScope(String scope){
if(cacheGNInstances!=null && cacheGNInstances.get(scope)!=null){ if(cacheGNInstances!=null && cacheGNInstances.get(scope)!=null){
cacheGNInstances.remove(scope); cacheGNInstances.remove(scope);
logger.info("Reset of "+scope+" in Cache Geonetwork server params perfomed!"); logger.info("Reset of "+scope+" in Cache Geonetwork server params perfomed!");
@ -455,10 +462,11 @@ public class GeonetworkResolver extends HttpServlet{
} }
/** /**
* Reset cache geonetwork instances. * Purge cache geonetwork instances.
*/ */
private void resetCacheGeonetworkInstances(){ private void purgeCacheGeonetworkInstances(){
cacheGNInstances = new HashMap<String, GeonetworkInstance>(); cacheGNInstances = new HashMap<String, GeonetworkInstance>();
logger.info("Reset of GeonetworkInstance cache perfomed!"); logger.info("Reset of GeonetworkInstance cache perfomed!");
} }