use of com.revolsys.record.io.format.mapguide.FeatureLayer in project com.revolsys.open by revolsys.
the class MapGuideWebServerRecordLayer method initializeDo.
@Override
protected boolean initializeDo() {
FeatureLayer webServiceLayer = getWebServiceLayer();
if (webServiceLayer == null) {
final String url = getUrl();
final PathName layerPath = getLayerPath();
if (url == null) {
Logs.error(this, Classes.className(this) + " requires a url: " + getPath());
return false;
}
if (layerPath == null) {
Logs.error(this, Classes.className(this) + " 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 {
webServiceLayer = server.getWebServiceResource(layerPath, FeatureLayer.class);
} catch (final IllegalArgumentException e) {
Logs.error(this, "Layer is not valid: " + getPath(), e);
return false;
}
if (webServiceLayer == null) {
Logs.error(this, "Layer does not exist: " + layerPath + " for " + getPath());
return false;
} else {
setWebServiceLayer(webServiceLayer);
}
}
if (webServiceLayer != null) {
final RecordDefinition recordDefinition = webServiceLayer.getRecordDefinition();
if (recordDefinition != null) {
setRecordDefinition(recordDefinition);
setBoundingBox(webServiceLayer.getBoundingBox());
// initRenderer();
return super.initializeDo();
}
}
return false;
}
Aggregations