git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineGeoSpatialExtension@75157 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f841a6d5f7
commit
76c51ec78a
|
@ -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";
|
||||
|
@ -83,6 +83,23 @@ public class FeaturesManager {
|
|||
return link;
|
||||
}
|
||||
|
||||
private String searchLayerNameInMeta(Metadata meta) {
|
||||
String innerlayername = null;
|
||||
for (DigitalTransferOptions option : meta.getDistributionInfo().getTransferOptions()) {
|
||||
for (OnlineResource resource : option.getOnLines()) {
|
||||
String layername = resource.getName();
|
||||
if (layername!=null) {
|
||||
innerlayername = layername;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (innerlayername == null)
|
||||
System.out.println("NO LAYER NAME WAS FOUND IN TRANSFER OPTIONS");
|
||||
return innerlayername;
|
||||
}
|
||||
|
||||
public String getWFSLink(Metadata meta) {
|
||||
return searchInUrl(meta, "service=wfs");
|
||||
}
|
||||
|
@ -105,12 +122,15 @@ public class FeaturesManager {
|
|||
}
|
||||
|
||||
public String getLayerName(Metadata meta) {
|
||||
AnalysisLogger.getLogger().debug("Retrieving Layer Name");
|
||||
String wmslink = getWMSLink(meta);
|
||||
String layer = null;
|
||||
String finder = "layers=";
|
||||
if (wmslink != null) {
|
||||
AnalysisLogger.getLogger().debug("WMS layer found!");
|
||||
int idxfinder = wmslink.indexOf(finder);
|
||||
if (idxfinder > 0) {
|
||||
AnalysisLogger.getLogger().debug("Searching for Layer Name inside the WMS Link");
|
||||
wmslink = wmslink.substring(idxfinder);
|
||||
int andIdx = wmslink.indexOf("&");
|
||||
if (andIdx < 0)
|
||||
|
@ -118,6 +138,11 @@ public class FeaturesManager {
|
|||
|
||||
layer = wmslink.substring(finder.length(), andIdx).trim();
|
||||
}
|
||||
//if the layer is not inside the wmslink
|
||||
else{
|
||||
AnalysisLogger.getLogger().debug("Searching for Layer Name inside the file");
|
||||
layer = searchLayerNameInMeta(meta);
|
||||
}
|
||||
}
|
||||
return layer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue