Search in sources :

Example 1 with FeatureLayer

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;
}
Also used : FeatureLayer(com.revolsys.record.io.format.mapguide.FeatureLayer) ArcGisRestCatalog(com.revolsys.record.io.format.esri.rest.ArcGisRestCatalog) PathName(com.revolsys.io.PathName) RecordDefinition(com.revolsys.record.schema.RecordDefinition)

Aggregations

PathName (com.revolsys.io.PathName)1 ArcGisRestCatalog (com.revolsys.record.io.format.esri.rest.ArcGisRestCatalog)1 FeatureLayer (com.revolsys.record.io.format.mapguide.FeatureLayer)1 RecordDefinition (com.revolsys.record.schema.RecordDefinition)1