bug fixing skypping the first slash

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@179451 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-05-16 12:44:02 +00:00
parent f266f6ea96
commit a878fede4e
3 changed files with 74 additions and 80 deletions

View File

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

View File

@ -188,7 +188,7 @@ public class CatalogueResolver {
if(scopeBean.is(Type.VO)) { if(scopeBean.is(Type.VO)) {
logger.info("It is a {} scope", Type.VO); logger.info("It is a {} scope", Type.VO);
logger.warn("The Catalogue can't work at {} level, I'm overriding the scope to {} level", Type.VO, Type.INFRASTRUCTURE); logger.warn("The Catalogue can't work at {} level, I'm overriding the scope to {} level", Type.VO, Type.INFRASTRUCTURE);
fullScope = fullScope.substring(0, fullScope.indexOf("/")); fullScope = fullScope.substring(1, fullScope.indexOf("/")); //skypping the first slash
logger.info("Overriden the input scope {} with {} type: {}", fullScope, Type.INFRASTRUCTURE, fullScope); logger.info("Overriden the input scope {} with {} type: {}", fullScope, Type.INFRASTRUCTURE, fullScope);
} }

View File

@ -28,15 +28,11 @@ import org.xml.sax.InputSource;
/** /**
* The Class GetAllInfrastructureVREs. * The Class GetAllInfrastructureScopesFromIS.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Nov 8, 2018
*/
/**
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * May 16, 2019
* Nov 8, 2018
*/ */
public class GetAllInfrastructureScopesFromIS { public class GetAllInfrastructureScopesFromIS {
@ -53,75 +49,76 @@ public class GetAllInfrastructureScopesFromIS {
try { try {
String rootScope = "/gcube";
//String rootScope = "/d4science.research-infrastructures.eu";
ScopeProvider.instance.set(rootScope);
UriResolverSmartGearManagerInit.setRootContextScope(rootScope);
LoadingMapOfScopeCache cache = new LoadingMapOfScopeCache();
// //TODO TOKEN TO ROOT SCOPE int i = 0;
// String rootScope = "/gcube"; for (String string : cache.getCache().asMap().keySet()) {
// //String rootScope = "/d4science.research-infrastructures.eu"; try {
// ScopeProvider.instance.set(rootScope); System.out.println(++i+") Scope Name: "+string + " to full scope: "+LoadingMapOfScopeCache.get(string));
// } catch (ExecutionException e) {
// String secondaryType = "INFRASTRUCTURE"; e.printStackTrace();
// List<String> listVOScopes = getListOfVOScopes("INFRASTRUCTURE"); }
//
// System.out.println("Searching for secondaryType="+secondaryType +" scope/s found is/are: " +listVOScopes);
//
// Map<String, String> vreNameFullScope = new HashMap<String,String>();
//
// secondaryType = "VRE";
// int noVOTypeCount = 0;
// for (String voScope : listVOScopes) {
// int count = voScope.length() - voScope.replace("/", "").length();
// //IS A VO
// if(count==2){
// logger.info(voScope +" is a VO...");
// ScopeProvider.instance.set(voScope);
// List<String> listVREs = getListOfResourcesForSecondaryType(secondaryType);
// System.out.println("VREs found for VO "+voScope+ " is/are "+listVREs.size()+ ": "+listVREs);
// for (String vreName : listVREs) {
// String vreScope = String.format("%s/%s", voScope,vreName);
// vreNameFullScope.put(vreName, vreScope);
// }
//
// }else{
// noVOTypeCount++;
// System.out.println(voScope +" is not a VO, skipping it");
// }
// }
//
//
// System.out.println("Total VO is: "+(listVOScopes.size()+noVOTypeCount));
// for (String vreName : vreNameFullScope.keySet()) {
// System.out.println("VRE Name: "+vreName + " has scope: "+vreNameFullScope.get(vreName));
// }
//
// System.out.println("Total VRE is: "+vreNameFullScope.size());
String rootScope = "/gcube";
//String rootScope = "/d4science.research-infrastructures.eu";
ScopeProvider.instance.set(rootScope);
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();
} }
}
String scopeName = "devsec"; String scopeName = "devsec";
ScopeBean scopeBean = LoadingMapOfScopeCache.get(scopeName); ScopeBean scopeBean = LoadingMapOfScopeCache.get(scopeName);
String fullScope = scopeBean.toString(); String fullScope = scopeBean.toString();
logger.info("Read fullScope: "+fullScope + " for SCOPE name: "+scopeName +" from cache created by: "+GetAllInfrastructureScopes.class.getSimpleName()); logger.info("Read fullScope: "+fullScope + " for SCOPE name: "+scopeName +" from cache created by: "+GetAllInfrastructureScopes.class.getSimpleName());
if(scopeBean.is(Type.VO)) {
logger.info("It is a {} scope", Type.VO);
logger.warn("The Catalogue can't work at {} level, I'm overriding the scope to {} level", Type.VO, Type.INFRASTRUCTURE);
fullScope = fullScope.substring(0, fullScope.indexOf("/"));
logger.info("Overriden the input scope {} with {} type: {}", fullScope, Type.INFRASTRUCTURE, fullScope);
}
// //TODO TOKEN TO ROOT SCOPE
// String rootScope = "/gcube";
// //String rootScope = "/d4science.research-infrastructures.eu";
// ScopeProvider.instance.set(rootScope);
//
// String secondaryType = "INFRASTRUCTURE";
// List<String> listVOScopes = getListOfVOScopes("INFRASTRUCTURE");
//
// System.out.println("Searching for secondaryType="+secondaryType +" scope/s found is/are: " +listVOScopes);
//
// Map<String, String> vreNameFullScope = new HashMap<String,String>();
//
// secondaryType = "VRE";
// int noVOTypeCount = 0;
// for (String voScope : listVOScopes) {
// int count = voScope.length() - voScope.replace("/", "").length();
// //IS A VO
// if(count==2){
// logger.info(voScope +" is a VO...");
// ScopeProvider.instance.set(voScope);
// List<String> listVREs = getListOfResourcesForSecondaryType(secondaryType);
// System.out.println("VREs found for VO "+voScope+ " is/are "+listVREs.size()+ ": "+listVREs);
// for (String vreName : listVREs) {
// String vreScope = String.format("%s/%s", voScope,vreName);
// vreNameFullScope.put(vreName, vreScope);
// }
//
// }else{
// noVOTypeCount++;
// System.out.println(voScope +" is not a VO, skipping it");
// }
// }
//
//
// System.out.println("Total VO is: "+(listVOScopes.size()+noVOTypeCount));
// for (String vreName : vreNameFullScope.keySet()) {
// System.out.println("VRE Name: "+vreName + " has scope: "+vreNameFullScope.get(vreName));
// }
//
// System.out.println("Total VRE is: "+vreNameFullScope.size());
if(scopeBean.is(Type.VO)) {
logger.info("It is a {} scope", Type.VO);
logger.warn("The Catalogue can't work at {} level, I'm overriding the scope to {} level", Type.VO, Type.INFRASTRUCTURE);
fullScope = fullScope.substring(0, fullScope.indexOf("/"));
logger.info("Overriden the input scope {} with {} type: {}", fullScope, Type.INFRASTRUCTURE, fullScope);
}
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();