private JSONObj storeDetails(JSONObj json, StoreInfo store, HttpServletRequest req) throws IOException { store(json, store); JSONObj connection = new JSONObj(); Map<String, Serializable> params = store.getConnectionParameters(); for (Entry<String, Serializable> param : params.entrySet()) { String key = param.getKey(); Object value = param.getValue(); String text = value == null ? null : value.toString(); connection.put(key, text); } if (store instanceof CoverageStoreInfo) { CoverageStoreInfo info = (CoverageStoreInfo) store; connection.put("raster", info.getURL()); } if (store instanceof WMSStoreInfo) { WMSStoreInfo info = (WMSStoreInfo) store; json.put("wms", info.getCapabilitiesURL()); } json.put("connection", connection); json.put("error", IO.error(new JSONObj(), store.getError())); if (store.isEnabled()) { resources(store, json.putArray("resources"), req); } json.put("layer-count", layerCount(store)); return json; }
private JSONObj store(JSONObj obj, StoreInfo store) { String name = store.getName(); obj.put("name", name) .put("workspace", store.getWorkspace().getName()) .put("enabled", store.isEnabled()) .put("description", store.getDescription()) .put("format", store.getType()); String source = source(store); obj.put("source", source) .put("type", IO.Kind.of(store).name()) .put("kind", IO.Type.of(store).name()); return IO.metadata(obj, store); }