use of com.revolsys.record.io.format.esri.rest.map.TileInfo in project com.revolsys.open by revolsys.
the class ArcGisRestServerTileCacheLayer method initializeDo.
@Override
protected boolean initializeDo() {
synchronized (this.initSync) {
if (this.mapService == null) {
try {
if (Property.hasValue(this.connectionName)) {
final WebService<?> webService = WebServiceConnectionManager.getWebService(this.connectionName);
if (webService instanceof ArcGisRestCatalog) {
final ArcGisRestCatalog catalog = (ArcGisRestCatalog) webService;
final WebServiceResource service = catalog.getWebServiceResource(this.servicePath);
if (service instanceof MapService) {
this.mapService = (MapService) service;
} else {
Logs.error(this, getPath() + ": Web service " + this.connectionName + " is not a ArcGIS service");
return false;
}
} else {
Logs.error(this, getPath() + ": Web service " + this.connectionName + " " + this.servicePath + " is not a ArcGIS Map service");
return false;
}
} else {
// TODO username/password
this.mapService = MapService.getMapService(this.url);
}
if (this.mapService == null) {
Logs.error(this, "Unable to connect to ArcGIS rest server");
return false;
} else {
final TileInfo tileInfo = this.mapService.getTileInfo();
if (tileInfo == null) {
Logs.info(this, this.url + " does not contain a tileInfo definition.");
return false;
} else {
this.geometryFactory = tileInfo.getGeometryFactory();
final BoundingBox boundingBox = this.mapService.getFullExtent();
setBoundingBox(boundingBox);
return true;
}
}
} catch (final WrappedException e) {
final Throwable cause = Exceptions.unwrap(e);
if (cause instanceof UnknownHostException) {
// cause.getMessage());
return setNotExists("Unknown host: " + cause.getMessage());
} else {
throw e;
}
}
} else {
return true;
}
}
}
Aggregations