diff --git a/distro/README b/distro/README index 40bf743..351154a 100644 --- a/distro/README +++ b/distro/README @@ -14,7 +14,7 @@ Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo". Version ------------------------ -v. 1.0.0 +v. 1.1.0 Description ----------- diff --git a/distro/changelog.xml b/distro/changelog.xml index e1d6e5a..53acb48 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,8 @@ + + [Feature #2191] Update NcWmsGetMetadata to retrieve z-axis property + [Feature #2054] First Release diff --git a/pom.xml b/pom.xml index ae8454d..d55da79 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.gcube.spatial.data geo-utility jar - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT A library with several utility classes to work with geo-spatial data: WmsUrlValidator, GeoGetStyles, etc.. diff --git a/src/main/java/org/gcube/spatial/data/geoutility/bean/NcWmsLayerMetadata.java b/src/main/java/org/gcube/spatial/data/geoutility/bean/NcWmsLayerMetadata.java index 2a454cc..07ede0d 100644 --- a/src/main/java/org/gcube/spatial/data/geoutility/bean/NcWmsLayerMetadata.java +++ b/src/main/java/org/gcube/spatial/data/geoutility/bean/NcWmsLayerMetadata.java @@ -6,6 +6,8 @@ package org.gcube.spatial.data.geoutility.bean; import java.io.Serializable; import java.util.List; +import org.gcube.spatial.data.geoutility.wms.ZAxis; + /** * The Class NcWmsLayerMetadata. @@ -24,18 +26,22 @@ public class NcWmsLayerMetadata implements Serializable { public static final String SUPPORTEDSTYLES = "supportedStyles"; public static final String PALETTES = "palettes"; public static final String DEFAULTPALETTE = "defaultPalette"; + public static final String Z_AXIS = "zaxis"; + private String defaultPalette; private List supportedStyles; private List palettes; private int responseCode; + private ZAxis zAxis; + private String rawJson; /** * Instantiates a new nc wms layer metadata. */ public NcWmsLayerMetadata() { - // TODO Auto-generated constructor stub } + /** * Instantiates a new nc wms layer metadata. * @@ -43,12 +49,34 @@ public class NcWmsLayerMetadata implements Serializable { * @param defaultPalette the default palette * @param supportedStyles the supported styles * @param palettes the palettes + * @param zAxis the z axis + * @param json the json */ - public NcWmsLayerMetadata(int responseCode, String defaultPalette, List supportedStyles, List palettes) { + public NcWmsLayerMetadata(int responseCode, String defaultPalette, List supportedStyles, List palettes, ZAxis zAxis, String json) { this.responseCode = responseCode; this.defaultPalette = defaultPalette; this.supportedStyles = supportedStyles; this.palettes = palettes; + this.zAxis = zAxis; + this.rawJson = json; + } + + /** + * Sets the raw json. + * + * @param jsonTxt the new raw json + */ + public void setRawJson(String jsonTxt) { + this.rawJson =jsonTxt; + } + + /** + * Gets the raw json. + * + * @return the rawJson + */ + public String getRawJson() { + return rawJson; } @@ -61,7 +89,6 @@ public class NcWmsLayerMetadata implements Serializable { return defaultPalette; } - /** * Gets the supported styles. * @@ -82,6 +109,27 @@ public class NcWmsLayerMetadata implements Serializable { } + /** + * Gets the z axis. + * + * @return the zAxis + */ + public ZAxis getZAxis() { + + return zAxis; + } + + /** + * Sets the z axis. + * + * @param zAxis the zAxis to set + */ + public void setZAxis(ZAxis zAxis) { + + this.zAxis = zAxis; + } + + /** * Sets the default palette. * @@ -102,6 +150,8 @@ public class NcWmsLayerMetadata implements Serializable { } /** + * Gets the response code. + * * @return the responseCode */ public int getResponseCode() { @@ -109,6 +159,8 @@ public class NcWmsLayerMetadata implements Serializable { } /** + * Sets the response code. + * * @param responseCode the responseCode to set */ public void setResponseCode(int responseCode) { @@ -116,7 +168,6 @@ public class NcWmsLayerMetadata implements Serializable { } - /** * Sets the palettes. * @@ -125,11 +176,14 @@ public class NcWmsLayerMetadata implements Serializable { public void setPalettes(List palettes) { this.palettes = palettes; } + + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { + StringBuilder builder = new StringBuilder(); builder.append("NcWmsLayerMetadata [defaultPalette="); builder.append(defaultPalette); @@ -137,6 +191,10 @@ public class NcWmsLayerMetadata implements Serializable { builder.append(supportedStyles); builder.append(", palettes="); builder.append(palettes); + builder.append(", responseCode="); + builder.append(responseCode); + builder.append(", zAxis="); + builder.append(zAxis); builder.append("]"); return builder.toString(); } diff --git a/src/main/java/org/gcube/spatial/data/geoutility/wms/NcWmsGetMetadata.java b/src/main/java/org/gcube/spatial/data/geoutility/wms/NcWmsGetMetadata.java index 49f107f..8072b81 100644 --- a/src/main/java/org/gcube/spatial/data/geoutility/wms/NcWmsGetMetadata.java +++ b/src/main/java/org/gcube/spatial/data/geoutility/wms/NcWmsGetMetadata.java @@ -158,10 +158,11 @@ public class NcWmsGetMetadata { try{ source = httpConnection.getInputStream(); String jsonTxt = IOUtils.toString(source); + metadata.setRawJson(jsonTxt); + JSONObject json = new JSONObject(jsonTxt); - JSONArray supportedStyles = json.getJSONArray("supportedStyles"); - + JSONArray supportedStyles = json.getJSONArray(NcWmsLayerMetadata.SUPPORTEDSTYLES); if(supportedStyles!=null){ List s = new ArrayList(supportedStyles.length()); for (int i=0; i s = new ArrayList(palettes.length()); for (int i=0; i s = new ArrayList(values.length()); + for (int i=0; i values; + + /** + * + */ + public ZAxis() { + } + + /** + * @param units + * @param positive + * @param values + */ + public ZAxis(String units, boolean positive, List values) { + this.units = units; + this.positive = positive; + this.values = values; + } + + + /** + * @return the units + */ + public String getUnits() { + + return units; + } + + + /** + * @return the positive + */ + public boolean isPositive() { + + return positive; + } + + + /** + * @return the values + */ + public List getValues() { + + return values; + } + + + /** + * @param units the units to set + */ + public void setUnits(String units) { + + this.units = units; + } + + + /** + * @param positive the positive to set + */ + public void setPositive(boolean positive) { + + this.positive = positive; + } + + + /** + * @param values the values to set + */ + public void setValues(List values) { + + this.values = values; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + + StringBuilder builder = new StringBuilder(); + builder.append("ZAxis [units="); + builder.append(units); + builder.append(", positive="); + builder.append(positive); + builder.append(", values="); + builder.append(values); + builder.append("]"); + return builder.toString(); + } +}