git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-transfer/data-transfer-model/1.2@160521 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b6e233b644
commit
693c246600
|
@ -28,5 +28,14 @@ public class ThreddsCatalog{
|
|||
private DataSetRoot declaredDataSetRoot;
|
||||
private HashSet<DataSetScan> declaredDataSetScan;
|
||||
private CatalogCollection subCatalogs;
|
||||
|
||||
|
||||
public String getPathFromLocation(String location) {
|
||||
if(declaredDataSetRoot!=null&&declaredDataSetRoot.getLocation()!=null&&
|
||||
ThreddsInfo.matchesPath(declaredDataSetRoot.getLocation(),location)) return declaredDataSetRoot.getPath();
|
||||
for(DataSetScan scan : declaredDataSetScan)
|
||||
if(scan!=null&&scan.getLocation()!=null&&ThreddsInfo.matchesPath(scan.getLocation(), location))
|
||||
return scan.getPath();
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -40,11 +40,15 @@ public class ThreddsInfo {
|
|||
}
|
||||
|
||||
|
||||
public ThreddsCatalog getByFittingLocation(String toMatchLocation) {
|
||||
public ThreddsCatalog getCatalogByFittingLocation(String toMatchLocation) {
|
||||
return getByFittingLocation(catalog, toMatchLocation);
|
||||
}
|
||||
|
||||
private static ThreddsCatalog findById(ThreddsCatalog catalog,String id) {
|
||||
public String getPathFromLocation(String location) {
|
||||
return getCatalogByFittingLocation(location).getPathFromLocation(location);
|
||||
}
|
||||
|
||||
public static ThreddsCatalog findById(ThreddsCatalog catalog,String id) {
|
||||
if(catalog!=null) {
|
||||
if(catalog.getID()!=null&&catalog.getID().equals(id)) return catalog;
|
||||
if(catalog.getSubCatalogs()!=null&&catalog.getSubCatalogs().getLinkedCatalogs()!=null)
|
||||
|
@ -54,7 +58,7 @@ public class ThreddsInfo {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static ThreddsCatalog getByFittingLocation(ThreddsCatalog catalog,String toMatchPath) {
|
||||
public static ThreddsCatalog getByFittingLocation(ThreddsCatalog catalog,String toMatchPath) {
|
||||
if(catalog!=null) {
|
||||
if(catalog.getDeclaredDataSetRoot()!=null&&catalog.getDeclaredDataSetRoot().getLocation()!=null&&
|
||||
matchesPath(catalog.getDeclaredDataSetRoot().getLocation(),toMatchPath)) return catalog;
|
||||
|
@ -68,7 +72,7 @@ public class ThreddsInfo {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static boolean matchesPath(String catalogPath,String toMatchPath) {
|
||||
public static boolean matchesPath(String catalogPath,String toMatchPath) {
|
||||
return toMatchPath.startsWith(catalogPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,8 +291,8 @@ public class MarshallUnmarshalTest {
|
|||
|
||||
info.setCatalog(mainCatalog);
|
||||
info.getById(subCatalog.getID());
|
||||
System.out.println(info.getByFittingLocation("/tmp/public/genericScanned"));
|
||||
System.out.println(info.getByFittingLocation("/tmp/more_tuna/anotherfolder/inside/this/one/"));
|
||||
System.out.println(info.getCatalogByFittingLocation("/tmp/public/genericScanned"));
|
||||
System.out.println(info.getCatalogByFittingLocation("/tmp/more_tuna/anotherfolder/inside/this/one/"));
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue