public Object getValue( Element element, ElementValue[] value, Attributes attrs, Map hints ) throws SAXException, OperationNotSupportedException { LayerDescription layerDesc = new LayerDescription(); String[] queries = new String[value.length]; for (int i = 0; i < value.length; i++) { queries[i] = (String) value[i].getValue(); } layerDesc.setQueries(queries); String name = attrs.getValue("name"); layerDesc.setName(name); String owsType = attrs.getValue("owsType"); layerDesc.setOwsType(owsType); try { URL wfs = new URL(attrs.getValue("wfs")); layerDesc.setWfs(wfs); } catch (MalformedURLException e) { } try { URL owsURL = new URL(attrs.getValue("owsURL")); layerDesc.setOwsURL(owsURL); } catch (MalformedURLException e) { } return layerDesc; }
final LayerDescription layerDesc = new LayerDescription(); layerDesc.setName(layer.getName()); layerDesc.setOwsType(owsType); layerDesc.setOwsURL(owsURL);
private void writeJSON(Writer outWriter, DescribeLayerModel description) throws IOException { try { JSONBuilder json = new JSONBuilder(outWriter); final List<LayerDescription> layers = description.getLayerDescriptions(); json.object(); json.key("version").value(description.getVersion()); json.key("layerDescriptions"); json.array(); for (LayerDescription layer : layers) { json.object(); json.key("layerName").value(layer.getName()); URL url = layer.getOwsURL(); json.key("owsURL").value(url != null ? url.toString() : ""); json.key("owsType").value(layer.getOwsType()); json.key("typeName").value(layer.getName()); json.endObject(); } json.endArray(); json.endObject(); } catch (JSONException jsonException) { ServiceException serviceException = new ServiceException("Error: " + jsonException.getMessage()); serviceException.initCause(jsonException); throw serviceException; } }
public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException { LayerDescription layerDesc = new LayerDescription(); String[] queries = new String[value.length]; for (int i = 0; i < value.length; i++) { queries[i] = (String) value[i].getValue(); } layerDesc.setQueries(queries); String name = attrs.getValue("name"); layerDesc.setName(name); String owsType = attrs.getValue("owsType"); layerDesc.setOwsType(owsType); try { URL wfs = new URL(attrs.getValue("wfs")); layerDesc.setWfs(wfs); } catch (MalformedURLException e) { } try { URL owsURL = new URL(attrs.getValue("owsURL")); layerDesc.setOwsURL(owsURL); } catch (MalformedURLException e) { } return layerDesc; }