reverted merge with #18967

This commit is contained in:
Francesco Mangiacrapa 2020-06-15 17:46:56 +02:00
parent 4ee21d618c
commit 257682bed8
16 changed files with 42 additions and 408 deletions

View File

@ -4,9 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="detachedres-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/detachedres-library/detachedres-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="uri-resolver"/>
<property name="java-output-path" value="/uri-resolver/target/classes"/>
</wb-module>

View File

@ -4,13 +4,6 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2-4-0] [r4-24-0]- 2020-06-10
**New Features**
[#18967] Extend the URIResolver behaviour to deal with Catalogue items belonging to Dismissed VREs
## [v2-3-2] [r4-23-0]- 2020-05-18
[#19288] Release the URI-Resolver to integrate the patched Uri-Resolver-Manager

View File

@ -9,7 +9,7 @@
</parent>
<groupId>org.gcube.data.transfer</groupId>
<artifactId>uri-resolver</artifactId>
<version>2.4.0-SNAPSHOT</version>
<version>2.3.2</version>
<packaging>war</packaging>
<description>The URI Resolver is an HTTP URI resolver implemented as an REST service which gives access trough HTTP to different gcube Resolvers and gCube Applications.</description>
@ -85,12 +85,6 @@
<version>[0.0.1,1.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.infrastructure.detachedres</groupId>
<artifactId>detachedres-library</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- TODO REMOVE THIS IMPORT -->
<dependency>
<groupId>org.gcube.common</groupId>

View File

@ -53,7 +53,7 @@ public class LoadingGNPublicLayerIDsInstanceCache {
RemovalListener<String, List<String>> removalListener = new RemovalListener<String, List<String>>() {
public void onRemoval(RemovalNotification<String, List<String>> removal) {
logger.debug("cache expired");
logger.info("cache expired");
}
};

View File

@ -46,7 +46,7 @@ public class LoadingGeoExplorerApplicationURLCache {
RemovalListener<String, String> removalListener = new RemovalListener<String, String>() {
public void onRemoval(RemovalNotification<String, String> removal) {
logger.debug("cache expired");
logger.info("cache expired");
}
};

View File

@ -48,7 +48,7 @@ public class LoadingGeonetworkInstanceCache {
RemovalListener<String, GeonetworkInstance> removalListener = new RemovalListener<String, GeonetworkInstance>() {
public void onRemoval(RemovalNotification<String, GeonetworkInstance> removal) {
logger.debug("cache expired");
logger.info("cache expired");
}
};

View File

@ -46,7 +46,7 @@ public class LoadingGisViewerApplicationURLCache {
RemovalListener<String, String> removalListener = new RemovalListener<String, String>() {
public void onRemoval(RemovalNotification<String, String> removal) {
logger.debug("cache expired");
logger.info("cache expired");
}
};

View File

@ -1,208 +0,0 @@
/**
*
*/
package org.gcube.datatransfer.resolver.caches;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.init.UriResolverSmartGearManagerInit;
import org.gcube.infrastructure.detachedres.detachedreslibrary.server.DetachedREsClient;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.DetachedREs;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.Gateway;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VO;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.cache.RemovalListener;
import com.google.common.cache.RemovalNotification;
/**
* The Class LoadingMapOfDetachedVRE.
*
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
* Jun 10, 2020
*/
public class LoadingMapOfDetachedVRE {
private static Logger LOG = LoggerFactory.getLogger(LoadingMapOfDetachedVRE.class);
private static LoadingCache<String, VRE> vreNameToVRE;
static{
CacheLoader<String, VRE> loader = new CacheLoader<String, VRE>(){
@Override
public VRE load(String vreName)
throws Exception {
LOG.info("Loading the cache for VRE name: {}",vreName);
VRE theVRE = loadVREObjForVREName(vreName);
if(theVRE!=null)
LOG.info("Returning {} with scope {} for the VRE name: {}", VRE.class.getSimpleName(), theVRE.getScope(), vreName);
else {
LOG.info("No VRE obj for VRE name {}",vreName);
}
return theVRE;
}
};
RemovalListener<String, VRE> removalListener = new RemovalListener<String, VRE>() {
@Override
public void onRemoval(RemovalNotification<String, VRE> arg0) {
LOG.debug("cache expired");
}
};
vreNameToVRE = CacheBuilder.newBuilder().maximumSize(300).expireAfterWrite(
12, TimeUnit.HOURS).removalListener(removalListener).
build(loader);
//Populating the cache at init stage
populateTheCache();
LOG.info("Pre-Loaded detached VRE Name to VRE Obj cache with: "+vreNameToVRE.asMap().size()+" item/s");
}
/**
* Populate the cache.
*/
private static void populateTheCache(){
String authorizationToken = null;
try{
//Populating the cache by using the detachedres-library
LOG.info("Trying to pre-populate the detached VREs cache with mapping (VRE Name, VRE Obj)");
ScopeProvider.instance.set(UriResolverSmartGearManagerInit.getRootContextScope());
authorizationToken = SecurityTokenProvider.instance.get();
if(authorizationToken==null) {
LOG.info("No token found into {} to instance the {}, so reading it from SG configurations",
SecurityTokenProvider.class.getSimpleName(), DetachedREsClient.class.getSimpleName());
authorizationToken = UriResolverSmartGearManagerInit.getRootTokenFromSGConfiguration();
if(authorizationToken!=null)
SecurityTokenProvider.instance.set(authorizationToken);
}
DetachedREsClient detachedREsClient = new DetachedREsClient();
DetachedREs detachedREs = detachedREsClient.getDetachedREs();
int totalVREDimissed = 0;
for (Gateway gateway : detachedREs.getGateways().values()) {
LOG.trace("Gateway: " + gateway.getName());
int vreDismissedPerGatew = 0;
for (VO vo : gateway.getVos().values()) {
LOG.trace("VO: " + vo.getName());
for (VRE vre : vo.getVres().values()) {
if(LOG.isTraceEnabled()) {
LOG.trace("VRE name: " + vre.getName() +
" scope: "+vre.getScope() +
" VRE catalogue url: " + vre.getCatalogUrl() +
" VRE catalog Portlet URL: "+vre.getCatalogPortletURL());
}
try {
if(vre.getScope()!=null && !vre.getScope().isEmpty()) {
String vreName = vre.getScope().split("/")[3];
vreNameToVRE.asMap().put(vreName, vre);
vreDismissedPerGatew++;
}
}catch (Exception e) {
LOG.warn("Error on parsing the scope: "+vre.getScope()+ " skipping it");
}
}
}
LOG.debug("VREs dismissed loaded and cached per " + gateway.getName() + " are: "+vreDismissedPerGatew);
totalVREDimissed+=vreDismissedPerGatew;
}
LOG.debug("Total detached VREs are: "+totalVREDimissed);
LOG.info("Cache populated with: ");
Map<String, VRE> mapOfVreNames = vreNameToVRE.asMap();
for (String key : mapOfVreNames.keySet()) {
VRE theDetachedVRE = mapOfVreNames.get(key);
LOG.info("VRE name {}, VRE obj with scope {}, catalogueURL {}, cataloguePortletURL {}",
key,
theDetachedVRE.getScope(),
theDetachedVRE.getCatalogUrl(),
theDetachedVRE.getCatalogPortletURL());
}
}catch(Exception e){
//SILENT
}finally{
if(authorizationToken!=null) {
LOG.info("resetting security token provider");
SecurityTokenProvider.instance.reset();
}
}
}
/**
* Gets the VRE obj for input VRE name.
*
* @param vreName the vre name
* @return the vre
* @throws ExecutionException the execution exception
*/
public static VRE get(String vreName) throws ExecutionException{
try {
return vreNameToVRE.get(vreName);
}catch (Exception e) {
LOG.info("Error on getting VRE obj for vreName {}. Is the key {} not found in the cache?", vreName, vreName);
throw e;
}
}
/**
* Load VRE obj for VRE name.
*
* @param vreName the vre name
* @return the vre
*/
protected static VRE loadVREObjForVREName(String vreName){
VRE theVRE = vreNameToVRE.getIfPresent(vreName);
//THIS CHECK SHOULD NOT BE NEEDED
if(theVRE==null){
populateTheCache();
theVRE = vreNameToVRE.getIfPresent(vreName);
}
return theVRE;
}
/**
* Gets the cache.
*
* @return the cache
*/
public LoadingCache<String, VRE> getCache(){
return vreNameToVRE;
}
}

View File

@ -54,7 +54,7 @@ public class LoadingMapOfScopeCache {
@Override
public void onRemoval(RemovalNotification<String, ScopeBean> arg0) {
logger.debug("cache expired");
logger.info("cache expired");
//prePopulateCache();
}
@ -86,6 +86,13 @@ public class LoadingMapOfScopeCache {
}
logger.info("Cache populated with: "+scopeNamesToFullScopes.asMap().toString());
//logger.info("Pre-Loaded CatalogueApplicationProfiles cache is: "+catalogueApplicationProfiles.asMap().toString());
// if(UriResolverSmartGearManagerInit.getRootContextScope().compareTo("/gcube")==0){
// logger.warn("HARD-CABLING PARTHENOS_Registry scope to resolve PARTHENOS_REGISTRY Links in dev environment");
// scopeNamesToFullScopes.asMap().put("PARTHENOS_Registry", "/d4science.research-infrastructures.eu/ParthenosVO/PARTHENOS_Registry");
// }
}catch(Exception e){
//SILENT
@ -116,9 +123,9 @@ public class LoadingMapOfScopeCache {
*/
protected static ScopeBean loadFullScopeforScopeName(String scopeName){
//THIS CHECK SHOULD BE NOT NEEDED
ScopeBean fullScope = scopeNamesToFullScopes.getIfPresent(scopeName);
//THIS CHECK SHOULD NOT BE NEEDED
if(fullScope==null){
populateTheCache();
fullScope = scopeNamesToFullScopes.getIfPresent(scopeName);

View File

@ -8,7 +8,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@ -18,13 +17,10 @@ import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.datatransfer.resolver.caches.LoadingGeonetworkInstanceCache;
import org.gcube.datatransfer.resolver.caches.LoadingGisViewerApplicationURLCache;
import org.gcube.datatransfer.resolver.caches.LoadingMapOfDetachedVRE;
import org.gcube.datatransfer.resolver.caches.LoadingMapOfScopeCache;
import org.gcube.datatransfer.resolver.gis.property.ApplicationProfilePropertyReader;
import org.gcube.datatransfer.resolver.gis.property.PropertyFileNotFoundException;
import org.gcube.smartgears.ApplicationManager;
import org.gcube.smartgears.ContextProvider;
import org.gcube.smartgears.context.application.ApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -93,12 +89,11 @@ public class UriResolverSmartGearManagerInit implements ApplicationManager {
//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();
new LoadingGisViewerApplicationURLCache();
new LoadingMapOfScopeCache();
new LoadingMapOfDetachedVRE();
}
}
catch (Exception e) {
@ -234,30 +229,4 @@ public class UriResolverSmartGearManagerInit implements ApplicationManager {
public static void setRootContextScope(String rootContextScope) {
UriResolverSmartGearManagerInit.rootContextScope = rootContextScope;
}
/**
* Gets the root token from SG configurations.
*
* @return the root token from SG configurations
*/
public static String getRootTokenFromSGConfiguration() {
try {
ApplicationContext ctx = ContextProvider.get();
Set<String> tokens = ctx.configuration().startTokens();
for (String token : tokens) {
//I'm using the first token,
//it should be a token of root because of URI-Resolver works at root level
log.info("Token read from SG configuration is {}-MASKED-TOKEN",token.substring(0,10));
return token;
}
log.warn("Token not found by reading the SG configurations!!! Returning null");
return null;
} catch (Exception e) {
log.error("Error on reading the start tokens from SG configuration",e);
return null;
}
}
}

View File

@ -1,9 +1,6 @@
package org.gcube.datatransfer.resolver.services;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import javax.servlet.http.HttpServletRequest;
@ -23,18 +20,15 @@ import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.common.scope.impl.ScopeBean.Type;
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueRunningCluster.ACCESS_LEVEL_TO_CATALOGUE_PORTLET;
import org.gcube.datatransfer.resolver.ConstantsResolver;
import org.gcube.datatransfer.resolver.caches.LoadingMapOfDetachedVRE;
import org.gcube.datatransfer.resolver.caches.LoadingMapOfScopeCache;
import org.gcube.datatransfer.resolver.catalogue.CatalogueRequest;
import org.gcube.datatransfer.resolver.catalogue.ItemCatalogueURLs;
import org.gcube.datatransfer.resolver.catalogue.ResourceCatalogueCodes;
import org.gcube.datatransfer.resolver.catalogue.resource.CatalogueStaticConfigurations;
import org.gcube.datatransfer.resolver.catalogue.resource.CkanCatalogueConfigurationsReader;
import org.gcube.datatransfer.resolver.catalogue.resource.GatewayCKANCatalogueReference;
import org.gcube.datatransfer.resolver.catalogue.resource.GetAllInfrastructureScopes;
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
import org.gcube.datatransfer.resolver.util.Util;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
import org.gcube.smartgears.utils.InnerMethodName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -55,7 +49,6 @@ public class CatalogueResolver {
private static Logger logger = LoggerFactory.getLogger(CatalogueResolver.class);
private static String helpURI = "https://wiki.gcube-system.org/gcube/URI_Resolver#CATALOGUE_Resolver";
private static enum SCOPE_STATUS {ACTIVE, DETACHED}
/**
* Resolve catalogue.
@ -191,29 +184,11 @@ public class CatalogueResolver {
try {
String entityContextValue = ResourceCatalogueCodes.valueOfCodeId(entityContext).getValue();
ScopeBean scopeBean = null;
SCOPE_STATUS scopeStatus = SCOPE_STATUS.ACTIVE;
VRE vreDetached = null;
try{
scopeBean = LoadingMapOfScopeCache.get(scopeName);
}catch(ExecutionException | InvalidCacheLoadException e){
logger.error("Error on getting the fullscope from cache for scopeName {}. Tryng to load it from DetachedRE",scopeName);
boolean isScopeDetached = false;
try {
vreDetached = LoadingMapOfDetachedVRE.get(scopeName);
scopeBean = new ScopeBean(vreDetached.getScope());
scopeStatus = SCOPE_STATUS.DETACHED;
logger.info("I loaded a valid VRE obj for scope name {}", scopeName);
isScopeDetached = true;
}catch (Exception e1) {
logger.warn("I was not able to load a detached VRE for vreName {}. Going to error for wrong scope",scopeName);
}
//If is not a cas of scope detached, going to error for wrong scope
if(!isScopeDetached) {
logger.error("Error on getting the fullscope from cache for scopeName "+scopeName, e);
throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the scope name '"+scopeName+"'. Is it registered as a valid Scope in the D4Science Infrastructure System?", CatalogueResolver.class, helpURI);
}
logger.error("Error on getting the fullscope from cache for scopeName "+scopeName, e);
throw ExceptionManager.wrongParameterException(req, "Error on getting full scope for the scope name '"+scopeName+"'. Is it registered as a valid Scope in the D4Science Infrastructure System?", CatalogueResolver.class, helpURI);
}
String fullScope = scopeBean.toString();
@ -228,37 +203,8 @@ public class CatalogueResolver {
}
ScopeProvider.instance.set(fullScope);
GatewayCKANCatalogueReference ckanCatalogueReference = null;
logger.info("Managing scope status: {}",scopeStatus);
switch (scopeStatus) {
case DETACHED:
String privatePortletURL = vreDetached.getCatalogPortletURL();
//The private portlet URL
Map<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String> mapAccessURLToCatalogue = new HashMap<ACCESS_LEVEL_TO_CATALOGUE_PORTLET, String>(3);
mapAccessURLToCatalogue.put(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PRIVATE_VRE,privatePortletURL);
//Building the gateway catalogue public URL from private VRE Portlet URL
URI toURL = new URI(privatePortletURL);
String publicURL = privatePortletURL.startsWith("https://")?"https://"+toURL.getHost():"http://"+toURL.getHost();
//It returns the string "catalogue"
CatalogueStaticConfigurations staticConf = new CatalogueStaticConfigurations();
//Replacing for example "ckan-bb" with "[PREFIXES-TO-CATALOGUE-URL]-bb" (e.g catalogue-bb)
String relativeURLWithCatalogueName = staticConf.buildRelativeURLToPublicCatalogueGateway(vreDetached.getCatalogUrl());
String toGatewayPortletURL = String.format("%s/%s", publicURL, relativeURLWithCatalogueName);
mapAccessURLToCatalogue.put(ACCESS_LEVEL_TO_CATALOGUE_PORTLET.PUBLIC_GATEWAY,toGatewayPortletURL);
ckanCatalogueReference = new GatewayCKANCatalogueReference(fullScope, vreDetached.getCatalogUrl(), mapAccessURLToCatalogue);
break;
case ACTIVE:
default:
ckanCatalogueReference = CkanCatalogueConfigurationsReader.loadCatalogueEndPoints();
break;
}
GatewayCKANCatalogueReference ckanCatalogueReference = CkanCatalogueConfigurationsReader.loadCatalogueEndPoints();
logger.info("For scope "+fullScope+" loaded end points: "+ckanCatalogueReference);
//IS THE PRODUCT PLUBLIC OR PRIVATE?

View File

@ -1,4 +1,5 @@
import org.gcube.datatransfer.resolver.catalogue.resource.CatalogueStaticConfigurations;
import org.junit.Test;
public class CatalogueNameExtractor {

View File

@ -1,11 +1,6 @@
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.catalogue.resource.CkanCatalogueConfigurationsReader;
import org.gcube.datatransfer.resolver.catalogue.resource.GatewayCKANCatalogueReference;
import org.gcube.datatransfer.resolver.init.UriResolverSmartGearManagerInit;
import org.gcube.datatransfer.resolver.services.CatalogueResolver;
import org.junit.Before;
import org.junit.Test;
/**
@ -17,33 +12,18 @@ import org.junit.Test;
*/
public class CatalogueResolverTest {
private static String entityName = "using_e-infrastructures_for_biodiversity_conservation";
private static String entityContext = "ctlg";
private static String vreName = "BlueBridgeProject";
private String rootContextScope = "/gcube";
private String authorizationToken = "";
//@Before
public void init() {
UriResolverSmartGearManagerInit.setRootContextScope(rootContextScope);
}
//@Test
public void testCatalogueResolver() {
SecurityTokenProvider.instance.set(authorizationToken);
CatalogueResolver catalogRes = new CatalogueResolver();
catalogRes.resolveCatalogue(null, entityName, vreName, entityContext);
}
//@Test
public void testCatalogueLoadEndPoints() {
/**
* The main method.
*
* @param args
* the arguments
*/
public static void main(String[] args) {
try {
ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/BiodiversityLab");
//ScopeProvider.instance.set("/d4science.research-infrastructures.eu");
GatewayCKANCatalogueReference ckanCatalogueReference = CkanCatalogueConfigurationsReader.loadCatalogueEndPoints();
System.out.println(ckanCatalogueReference.toString());

View File

@ -1,46 +0,0 @@
import java.util.concurrent.ExecutionException;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.caches.LoadingMapOfDetachedVRE;
import org.gcube.infrastructure.detachedres.detachedreslibrary.shared.re.VRE;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DetachedVREsTest {
public static Logger LOG = LoggerFactory.getLogger(DetachedVREsTest.class);
public static String TOKEN = "";
public static String detachedVREName = "BlueBridgeProject";
public static String rootScope = "/gcube";
//@Before
public void initCache() {
}
/**
* Storage hub test.
*
* @throws Exception the exception
*/
//@Test
public void testCacheOfDetachedVREs() throws Exception{
try {
ScopeProvider.instance.set(rootScope);
SecurityTokenProvider.instance.set(TOKEN);
//LoadingMapOfDetachedVRE cache = new LoadingMapOfDetachedVRE();
VRE theDetachedVRE = LoadingMapOfDetachedVRE.get(detachedVREName);
LOG.info("Detached VRE found {}", theDetachedVRE);
}catch (ExecutionException e) {
LOG.info("The Detached VRE for name {} not found",detachedVREName);
}catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -3,6 +3,7 @@ import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -17,7 +18,6 @@ import org.gcube.datatransfer.resolver.init.UriResolverSmartGearManagerInit;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@ -38,12 +38,12 @@ public class GetAllInfrastructureScopesFromIS {
protected static final String RESOURCE_PROFILE_NAME_TEXT = "/Resource/Profile/Name/text()";
/**
* Test loading map of scope.
* The main method.
*
* @param args the arguments
*/
@Test
public void testLoadingMapOfScope() {
public static void main(String[] args) {
try {
@ -53,16 +53,16 @@ public class GetAllInfrastructureScopesFromIS {
UriResolverSmartGearManagerInit.setRootContextScope(rootScope);
LoadingMapOfScopeCache cache = new LoadingMapOfScopeCache();
// int i = 0;
// for (String string : cache.getCache().asMap().keySet()) {
// try {
// System.out.println(++i+") Scope Name: "+string + " to full scope: "+LoadingMapOfScopeCache.get(string));
// } catch (ExecutionException e) {
// e.printStackTrace();
// }
// }
int i = 0;
for (String string : cache.getCache().asMap().keySet()) {
try {
System.out.println(++i+") Scope Name: "+string + " to full scope: "+LoadingMapOfScopeCache.get(string));
} catch (ExecutionException e) {
e.printStackTrace();
}
}
String scopeName = "abc";
String scopeName = "devsec";
ScopeBean scopeBean = LoadingMapOfScopeCache.get(scopeName);
String fullScope = scopeBean.toString();
logger.info("Read fullScope: "+fullScope + " for SCOPE name: "+scopeName +" from cache created by: "+GetAllInfrastructureScopes.class.getSimpleName());

View File

@ -1,5 +1,6 @@
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.gis.entity.GisLayerItem;
import org.gcube.datatransfer.resolver.gis.entity.ServerParameters;
import org.gcube.datatransfer.resolver.services.GisResolver;
/**