use of com.revolsys.gis.wms.capabilities.WmsLayerDefinition in project com.revolsys.open by revolsys.
the class OgcWmsImageLayer method initializeDo.
@Override
protected boolean initializeDo() {
final boolean initialized = super.initializeDo();
if (initialized) {
try {
final WmsClient wmsClient;
if (Property.hasValue(this.connectionName)) {
final WebService<?> webService = WebServiceConnectionManager.getWebService(this.connectionName);
if (webService == null) {
Logs.error(this, getPath() + ": Web service " + this.connectionName + ": no connection configured");
return false;
} else if (webService instanceof WmsClient) {
wmsClient = (WmsClient) webService;
} else {
Logs.error(this, getPath() + ": Web service " + this.connectionName + ": is not a OGS WMS service");
return false;
}
} else if (Property.hasValue(this.serviceUrl)) {
wmsClient = new WmsClient(this.serviceUrl);
} else {
Logs.error(this, getPath() + ": A record store layer requires a connection entry with a name or url, username, and password ");
return false;
}
final WmsLayerDefinition wmsLayerDefinition = wmsClient.getLayer(this.layerName);
setWmsLayerDefinition(wmsLayerDefinition);
return wmsLayerDefinition != null;
} catch (final WrappedException e) {
final Throwable cause = Exceptions.unwrap(e);
if (cause instanceof UnknownHostException) {
return setNotExists("Unknown host: " + cause.getMessage());
} else {
throw e;
}
}
}
return initialized;
}
Aggregations