* @return The object passed in.
*/
@SuppressWarnings("unchecked")
public static JSONObj layer(JSONObj obj, LayerInfo layer, HttpServletRequest req) {
String wsName = layer.getResource().getNamespace().getPrefix();
ResourceInfo r = layer.getResource();
Type type = IO.Type.of(r); //IO.type(r);
obj.put("name", layer.getName())
.put("workspace", wsName)
.put("title", title(layer))
.put("description", description(layer))
.put("type", type.toString());
StoreInfo store = r.getStore();
if( req != null ){
obj.putObject("resource")
.put("name",r.getName())
.put("store",store.getName())
.put("workspace",wsName)
.put("url",
url(req, "/stores/%s/%s/%s",wsName, store.getName(),r.getName())
);
}
JSONArr keywords = new JSONArr();
keywords.raw().addAll( r.keywordValues() );
obj.put("keywords", keywords);
proj(obj.putObject("proj"), r.getCRS(), r.getSRS());
bbox( obj.putObject("bbox"), r );
if (r instanceof FeatureTypeInfo) {
FeatureTypeInfo ft = (FeatureTypeInfo) r;
FeatureType schema;