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="/WEB-INF/classes" source-path="/src/main/java"/>
<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="java-output-path" value="/uri-resolver/target/classes"/>
</wb-module>

View File

@ -188,7 +188,7 @@ public class CatalogueResolver {
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("/"));
fullScope = fullScope.substring(1, fullScope.indexOf("/")); //skypping the first slash
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)
* Nov 8, 2018
*/
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Nov 8, 2018
* May 16, 2019
*/
public class GetAllInfrastructureScopesFromIS {
@ -53,49 +49,6 @@ public class GetAllInfrastructureScopesFromIS {
try {
// //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());
String rootScope = "/gcube";
//String rootScope = "/d4science.research-infrastructures.eu";
ScopeProvider.instance.set(rootScope);
@ -123,6 +76,50 @@ public class GetAllInfrastructureScopesFromIS {
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());
}catch (Exception e) {
e.printStackTrace();
}