use of com.revolsys.record.io.format.esri.rest.map.FeatureLayer in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method initializeDo.
@Override
protected boolean initializeDo() {
FeatureLayer layerDescription = getLayerDescription();
if (layerDescription == null) {
final String url = getUrl();
final PathName layerPath = getLayerPath();
if (url == null) {
Logs.error(this, "An ArcGIS Rest server requires a url: " + getPath());
return false;
}
if (layerPath == null) {
Logs.error(this, "An ArcGIS Rest server requires a layerPath: " + getPath());
return false;
}
ArcGisRestCatalog server;
try {
server = ArcGisRestCatalog.newArcGisRestCatalog(url);
} catch (final Throwable e) {
Logs.error(this, "Unable to connect to server: " + url + " for " + getPath(), e);
return false;
}
try {
layerDescription = server.getWebServiceResource(layerPath, FeatureLayer.class);
} catch (final IllegalArgumentException e) {
Logs.error(this, "ArcGIS Rest service is not a layer " + getPath(), e);
return false;
}
if (layerDescription == null) {
Logs.error(this, "No ArcGIS Rest layer with name: " + layerPath + " for " + getPath());
return false;
} else {
setLayerDescription(layerDescription);
}
}
if (layerDescription != null) {
final RecordDefinition recordDefinition = layerDescription.getRecordDefinition();
if (recordDefinition != null) {
setRecordDefinition(recordDefinition);
setBoundingBox(layerDescription.getBoundingBox());
initRenderer();
return super.initializeDo();
}
}
return false;
}
Aggregations