diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/ConstantsResolver.java b/src/main/java/org/gcube/datatransfer/resolver/ConstantsResolver.java similarity index 86% rename from src/main/java/org/gcube/datatransfer/resolver/services/ConstantsResolver.java rename to src/main/java/org/gcube/datatransfer/resolver/ConstantsResolver.java index c5c582f..b3bb892 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/ConstantsResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/ConstantsResolver.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.datatransfer.resolver.services; +package org.gcube.datatransfer.resolver; /** @@ -18,7 +18,7 @@ public class ConstantsResolver { public static final String CONTENT_LENGTH = "Content-Length"; public static final String CONTENT_TYPE= "Content-Type"; - protected static final String HPC = "hproxycheck"; //for hproxycheck + public static final String HPC = "hproxycheck"; //for hproxycheck public static final String QUERY_PARAM_VALIDATION = "validation"; public static final String QUERY_PARAM_CONTENT_TYPE = "contentType"; diff --git a/src/main/java/org/gcube/datatransfer/resolver/init/UriResolverSmartGearManagerInit.java b/src/main/java/org/gcube/datatransfer/resolver/init/UriResolverSmartGearManagerInit.java index 73d9663..ed501b1 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/init/UriResolverSmartGearManagerInit.java +++ b/src/main/java/org/gcube/datatransfer/resolver/init/UriResolverSmartGearManagerInit.java @@ -54,34 +54,37 @@ public class UriResolverSmartGearManagerInit implements ApplicationManager { */ @Override public void onInit() { - log.debug("init called"); + log.info("init called with scope: "+ScopeProvider.instance.get()); try { - boolean initContextPerformed = false; + boolean initRootContextPerformed = false; if(rootContextScope==null){ - log.info("The RootContextScope is null, getting it from ScopeProvider"); + log.debug("The rootContextScope is null, getting it from ScopeProvider"); String scope = ScopeProvider.instance.get(); ScopeBean theScopeBean = new ScopeBean(scope); - log.info("The ScopeBean is: "+theScopeBean.toString()); + log.debug("The ScopeBean is: "+theScopeBean.toString()); if(theScopeBean.is(Type.INFRASTRUCTURE)){ rootContextScope = theScopeBean.name(); rootContextScope = rootContextScope.startsWith("/")?rootContextScope:"/"+rootContextScope; - log.info("The RootContextScope has value: "+rootContextScope); + log.info("The rootContextScope has value: "+rootContextScope); //THE ROOT SCOPE has been initialized - initContextPerformed = true; + initRootContextPerformed = true; } } - if(gisViewerProfile==null || geoExplorerProfile==null){ + //JUST ONCE AND TO BE SURE WITH THE ROOT SCOPE INITIALIZED + if(initRootContextPerformed && (gisViewerProfile==null || geoExplorerProfile==null)){ + log.info("init Profiles..."); gisViewerProfile = loadApplicationProfile(UriResolverServletContextListener.getServletContext(), GIS_VIEWER_GENERIC_RESOURCE_GCUBE_APPS_PROPERTIES); geoExplorerProfile = loadApplicationProfile(UriResolverServletContextListener.getServletContext(), GEO_EXPLORER_GENERIC_RESOURCE_GCUBE_APPS_PROPERTIES); log.info("GisViewerProfile [ID: "+gisViewerProfile.getAppId() + ", Generic Resource Type: "+gisViewerProfile.getGenericResource()+"]"); log.info("GeoExplorerProfile [ID: "+geoExplorerProfile. getAppId() + ", Generic Resource Type: "+geoExplorerProfile.getGenericResource()+"]"); } - if(gisViewerProfile!=null && geoExplorerProfile!=null & initContextPerformed){ - log.info("Pre-Loading caches... using RootContextScope: "+rootContextScope); + //JUST ONCE AND TO BE SURE WITH THE ROOT SCOPE INITIALIZED + if(initRootContextPerformed && gisViewerProfile!=null && geoExplorerProfile!=null){ + log.info("Pre-Loading caches... using rootContextScope: "+rootContextScope); //init the caches new LoadingGeonetworkInstanceCache(); diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/GeonetworkResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/GeonetworkResolver.java index dba1be7..0c8a086 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/GeonetworkResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/GeonetworkResolver.java @@ -26,6 +26,7 @@ import javax.ws.rs.core.StreamingOutput; import org.apache.commons.io.IOUtils; import org.gcube.common.scope.api.ScopeProvider; +import org.gcube.datatransfer.resolver.ConstantsResolver; import org.gcube.datatransfer.resolver.gis.GeonetworkAccessParameter; import org.gcube.datatransfer.resolver.gis.GeonetworkInstance; import org.gcube.datatransfer.resolver.gis.GeonetworkServiceInterface; diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/SMPIDResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/SMPIDResolver.java index 9b4e51e..561c7da 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/SMPIDResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/SMPIDResolver.java @@ -11,6 +11,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; +import org.gcube.datatransfer.resolver.ConstantsResolver; import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/SMPResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/SMPResolver.java index 786be71..c7d2f5e 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/SMPResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/SMPResolver.java @@ -11,6 +11,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; +import org.gcube.datatransfer.resolver.ConstantsResolver; import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java index e091dfc..c8d8357 100644 --- a/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java +++ b/src/main/java/org/gcube/datatransfer/resolver/services/StorageIDResolver.java @@ -22,6 +22,7 @@ import org.gcube.contentmanagement.blobstorage.service.IClient; import org.gcube.contentmanager.storageclient.wrapper.AccessType; import org.gcube.contentmanager.storageclient.wrapper.MemoryType; import org.gcube.contentmanager.storageclient.wrapper.StorageClient; +import org.gcube.datatransfer.resolver.ConstantsResolver; import org.gcube.datatransfer.resolver.services.error.ExceptionManager; import org.gcube.datatransfer.resolver.util.SingleFileStreamingOutput; import org.slf4j.Logger;