fix #80: Considering several layers with the same name

This commit is contained in:
carlo cancellieri 2013-06-13 07:59:55 +02:00
parent 51fac5a674
commit 71132e3b9e

View File

@ -476,6 +476,8 @@ public class GeoServerRESTReader {
/**
* Get detailed info about a given Layer.
*
* @deprecated use {@link #getLayer(String, String)}
*
* @param name The name of the Layer
* @return Layer details as a {@link RESTLayer}
@ -488,6 +490,25 @@ public class GeoServerRESTReader {
return RESTLayer.build(load(url));
}
/**
* Get detailed info about a given Layer.
*
* @param workspace the workspace name
* @param name the layer name
* @return a RESTLayer with layer information or null
*/
public RESTLayer getLayer(String workspace, String name) {
if (workspace == null || workspace.isEmpty())
throw new IllegalArgumentException("Workspace may not be null");
if (name == null || name.isEmpty())
throw new IllegalArgumentException("Layername may not be null");
String url = HTTPUtils.append("/rest/layers/",workspace,":",name,".xml").toString();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("### Retrieving layer from " + url);
}
return RESTLayer.build(load(url));
}
//==========================================================================
//=== NAMESPACES
//==========================================================================