diff --git a/src/main/java/org/gcube/dataanalysis/geo/meta/features/FeaturesManager.java b/src/main/java/org/gcube/dataanalysis/geo/meta/features/FeaturesManager.java index a963a5b..894636c 100644 --- a/src/main/java/org/gcube/dataanalysis/geo/meta/features/FeaturesManager.java +++ b/src/main/java/org/gcube/dataanalysis/geo/meta/features/FeaturesManager.java @@ -18,8 +18,8 @@ import org.opengis.metadata.distribution.DigitalTransferOptions; import org.opengis.metadata.identification.Identification; public class FeaturesManager { -// private String geonetworkUrl = "http://geoserver-dev2.d4science-ii.research-infrastructures.eu/geonetwork/"; - private String geonetworkUrl = "http://geoserver.d4science-ii.research-infrastructures.eu/geonetwork/"; + private String geonetworkUrl = "http://geoserver-dev2.d4science-ii.research-infrastructures.eu/geonetwork/"; +// private String geonetworkUrl = "http://geoserver.d4science-ii.research-infrastructures.eu/geonetwork/"; private String geonetworkUser = "admin"; private String geonetworkPwd = "admin"; private String scope = "/gcube/devsec"; @@ -32,6 +32,40 @@ public class FeaturesManager { this.scope = scope; } + public String getGeoserverLink(Metadata meta) { + String link = null; + String geoserverString = "/geoserver/"; + String wmslink = getWMSLink(meta); + if (wmslink!=null){ + int idx = wmslink.indexOf(geoserverString); + if (idx>0){ + link = wmslink.substring(0,idx+geoserverString.length()-1); + return link; + } + } + String wfslink = getWFSLink(meta); + if (wfslink!=null){ + int idx = wfslink.indexOf(geoserverString); + if (idx>0){ + link = wfslink.substring(0,idx+geoserverString.length()-1); + return link; + } + } + String wcslink = getWCSLink(meta); + if (wcslink!=null){ + int idx = wcslink.indexOf(geoserverString); + if (idx>0){ + link = wcslink.substring(0,idx+geoserverString.length()-1); + return link; + } + } + + if (link == null) + System.out.println("NO GEOSERVER LINK WAS FOUND ACCORDING TO THE CRITERION"); + + return link; + } + private String searchInUrl(Metadata meta, String criterion) { String link = null; for (DigitalTransferOptions option : meta.getDistributionInfo().getTransferOptions()) {