summaryrefslogtreecommitdiffstats
path: root/petascope/src/petascope/wcs/server/core
diff options
context:
space:
mode:
Diffstat (limited to 'petascope/src/petascope/wcs/server/core')
-rw-r--r--petascope/src/petascope/wcs/server/core/TimeString.java15
-rw-r--r--petascope/src/petascope/wcs/server/core/convertGetCoverage.java138
-rw-r--r--petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java32
-rw-r--r--petascope/src/petascope/wcs/server/core/executeGetCapabilities.java33
4 files changed, 96 insertions, 122 deletions
diff --git a/petascope/src/petascope/wcs/server/core/TimeString.java b/petascope/src/petascope/wcs/server/core/TimeString.java
index 6e5d04f..d93d98a 100644
--- a/petascope/src/petascope/wcs/server/core/TimeString.java
+++ b/petascope/src/petascope/wcs/server/core/TimeString.java
@@ -14,19 +14,16 @@
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
- rasdaman GmbH.
+ * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
-package petascope.wcs.server.core;
-
-//~--- non-JDK imports --------------------------------------------------------
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
+package petascope.wcs.server.core;
+
+import org.joda.time.DateTime;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
/**
diff --git a/petascope/src/petascope/wcs/server/core/convertGetCoverage.java b/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
index 92262e6..153728c 100644
--- a/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
+++ b/petascope/src/petascope/wcs/server/core/convertGetCoverage.java
@@ -14,16 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
- rasdaman GmbH.
+ * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
package petascope.wcs.server.core;
-//~--- non-JDK imports --------------------------------------------------------
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import net.opengis.gml.v_3_1_1.TimePositionType;
import net.opengis.ows.v_1_0_0.BoundingBoxType;
import net.opengis.wcs.v_1_1_0.DomainSubsetType;
@@ -31,27 +30,18 @@ import net.opengis.wcs.v_1_1_0.GetCoverage;
import net.opengis.wcs.v_1_1_0.GridCrsType;
import net.opengis.wcs.v_1_1_0.RangeSubsetType;
import net.opengis.wcs.v_1_1_0.TimePeriodType;
-
-import petascope.wcps.server.core.DbMetadataSource;
+import petascope.core.DbMetadataSource;
import petascope.wcps.server.core.ProcessCoveragesRequest;
-import petascope.wcps.server.exceptions.WCPSException;
+import petascope.exceptions.WCPSException;
import petascope.wcps.server.core.DomainElement;
-
import petascope.ConfigManager;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.antlr.runtime.RecognitionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.InvalidTemporalMetadataException;
-import petascope.wcs.server.exceptions.MissingParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
+import petascope.core.Metadata;
/**
* This class takes a WCS GetCoverage XML request and converts this request into
@@ -62,7 +52,7 @@ import petascope.wcs.server.exceptions.NoApplicableCodeException;
*/
public class convertGetCoverage {
- private static Logger LOG = LoggerFactory.getLogger(convertGetCoverage.class);
+ private static Logger log = LoggerFactory.getLogger(convertGetCoverage.class);
// Trimming
private boolean xAxisTrim = false;
private boolean yAxisTrim = false;
@@ -125,11 +115,11 @@ public class convertGetCoverage {
}
/* Convert the abstract syntax query to a ProcessCoveragesRequest */
- LOG.debug("Converting WCPS abstract query '{}' to xml", abstractRequest);
+ log.debug("Converting WCPS abstract query '{}' to xml", abstractRequest);
xmlRequest = ProcessCoveragesRequest.abstractQueryToXmlQuery(abstractRequest);
- LOG.debug("Resulting XML query is: \n{}", xmlRequest);
+ log.debug("Resulting XML query is: \n{}", xmlRequest);
} catch (RecognitionException re) {
- throw new NoApplicableCodeException("Internal error: Generated abstract syntax query was not valid.", re);
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Internal error: Generated abstract syntax query was not valid.", re);
}
return xmlRequest;
@@ -149,10 +139,10 @@ public class convertGetCoverage {
*/
private void readField2() throws WCSException {
if (!wcs.isSetDomainSubset()) {
- throw new MissingParameterValueException("DomainSubset");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "DomainSubset");
}
if (!wcs.getDomainSubset().isSetBoundingBox()) {
- throw new MissingParameterValueException("BoundingBox");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "BoundingBox");
}
DomainSubsetType domain = wcs.getDomainSubset();
@@ -166,27 +156,27 @@ public class convertGetCoverage {
crsName = bbox.getCrs();
if (crsName != null) {
if (crsName.equals(DomainElement.IMAGE_CRS)) {
- LOG.trace("CRS: NATIVE_IMAGE_CRS");
+ log.trace("CRS: NATIVE_IMAGE_CRS");
} else if (crsName.equals(DomainElement.WGS84_CRS)) {
- LOG.trace("CRS: WGS84");
+ log.trace("CRS: WGS84");
} else {
- throw new InvalidParameterValueException("BoundingBox.crs. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "BoundingBox.crs. Explanation: "
+ "CRS '" + crsName + "' not available on this server.");
}
} else {
- LOG.debug("CRS: None specified for bounding box");
- LOG.debug("CRS: Using default IMAGE_CRS");
+ log.debug("CRS: None specified for bounding box");
+ log.debug("CRS: Using default IMAGE_CRS");
crsName = DomainElement.IMAGE_CRS;
}
/* BBox declarations */
if (bbox.getLowerCorner().size() != 2) {
- throw new InvalidParameterValueException("LowerCorner. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "LowerCorner. Explanation: "
+ "BoundingBox -> LowerCorner should have exactly two "
+ "values, not " + bbox.getLowerCorner().size());
}
if (bbox.getUpperCorner().size() != 2) {
- throw new InvalidParameterValueException("UpperCorner. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "UpperCorner. Explanation: "
+ "BoundingBox -> UpperCorner should have exactly two "
+ "values, not " + bbox.getUpperCorner().size());
}
@@ -194,13 +184,13 @@ public class convertGetCoverage {
xAxisTrim = true;
int u2 = bbox.getLowerCorner().get(0).intValue();
int u3 = bbox.getUpperCorner().get(0).intValue();
- LOG.trace("Added X-axis trimming ! (DomainSubset->BoundingBox): " + u2 + " ... "
+ log.trace("Added X-axis trimming ! (DomainSubset->BoundingBox): " + u2 + " ... "
+ u3);
yAxisTrim = true;
int v2 = bbox.getLowerCorner().get(1).intValue();
int v3 = bbox.getUpperCorner().get(1).intValue();
- LOG.trace("Added Y-axis trimming ! (DomainSubset->BoundingBox): " + v2 + " ... "
+ log.trace("Added Y-axis trimming ! (DomainSubset->BoundingBox): " + v2 + " ... "
+ v3);
/* Use bounding-box values as they are given */
@@ -211,7 +201,7 @@ public class convertGetCoverage {
if (crsName.equals(DomainElement.IMAGE_CRS) == false
&& crsName.equals(DomainElement.WGS84_CRS) == false) {
- throw new NoApplicableCodeException("Unknown CRS: " + crsName);
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Unknown CRS: " + crsName);
}
}
@@ -220,7 +210,7 @@ public class convertGetCoverage {
// TemporalSubset is of type TimeSequenceType = choice(gml:TimePosition, wcs:TimePeriodType)
Object one = domain.getTemporalSubset().getTimePositionOrTimePeriod().get(0);
- LOG.trace("Inside TemporalSubset there is " + one.getClass());
+ log.trace("Inside TemporalSubset there is " + one.getClass());
if (one instanceof net.opengis.gml.v_3_1_1.TimePositionType) {
// TemporalSubset = gml:TimePosition
// use WCPS:slice
@@ -232,7 +222,7 @@ public class convertGetCoverage {
/* Default syntax is ISO 8601.
However, we also accept direct time-axis coordinates, as a fail-back solution. */
timePos = parseTimePosition(pos);
- LOG.trace("Added time-axis slicing ! ( DomainSubset->TemporalSubset->gml:TimePositionType): position "
+ log.trace("Added time-axis slicing ! ( DomainSubset->TemporalSubset->gml:TimePositionType): position "
+ timePos);
} else if (one instanceof net.opengis.wcs.v_1_1_0.TimePeriodType) {
// TemporalSubset = wcs:TimePeriodType
@@ -248,7 +238,7 @@ public class convertGetCoverage {
time1 = parseTimePosition(pos1);
time2 = parseTimePosition(pos2);
- LOG.trace("Added time-axis trimming ! ( DomainSubset->TemporalSubset->wcs:TimePeriodType): "
+ log.trace("Added time-axis trimming ! ( DomainSubset->TemporalSubset->wcs:TimePeriodType): "
+ time1 + " ... " + time2);
}
}
@@ -270,9 +260,9 @@ public class convertGetCoverage {
RangeSubsetType.FieldSubset field = it.next();
fields.add(field.getIdentifier().getValue());
- LOG.trace("RangeSubsetType->FieldSubset->Identifier is "
+ log.trace("RangeSubsetType->FieldSubset->Identifier is "
+ field.getIdentifier().getValue());
- LOG.trace("RangeSubsetType->FieldSubset->Interpolation is "
+ log.trace("RangeSubsetType->FieldSubset->Interpolation is "
+ field.getInterpolationType());
/* NOTE: We ignore interpolation instructions (optional) */
/* NOTE: We ignore axis subset lists (optional) */
@@ -287,26 +277,26 @@ public class convertGetCoverage {
*/
private void readField4() throws WCSException {
if (!wcs.isSetOutput()) {
- throw new MissingParameterValueException("Output");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "Output");
}
- LOG.trace("Format: " + wcs.getOutput().getFormat());
+ log.trace("Format: " + wcs.getOutput().getFormat());
if (wcs.getOutput().isSetGridCRS()) {
GridCrsType crs = wcs.getOutput().getGridCRS();
- throw new NoApplicableCodeException("Currently, the Output->GridCRS node is not supported !");
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Currently, the Output->GridCRS node is not supported !");
}
String wcsMimeFormat = wcs.getOutput().getFormat();
format = meta.mimetypeToFormat(wcsMimeFormat);
- LOG.trace("New format: " + format);
+ log.trace("New format: " + format);
if ((format == null) || format.equals("")) {
- throw new InvalidParameterValueException("Output format");
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Output format");
}
- LOG.trace("issetstore = " + wcs.getOutput().isSetStore());
- LOG.trace("isstore = " + wcs.getOutput().isStore());
+ log.trace("issetstore = " + wcs.getOutput().isSetStore());
+ log.trace("isstore = " + wcs.getOutput().isStore());
store = false;
if (wcs.getOutput().isSetStore() && wcs.getOutput().isStore()) {
store = true;
@@ -314,7 +304,7 @@ public class convertGetCoverage {
/* WCPS does not support "store=true" */
if (store) {
- throw new InvalidParameterValueException("Output Store. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Output Store. Explanation: "
+ "Cannot store result image on server.");
}
}
@@ -327,50 +317,50 @@ public class convertGetCoverage {
public void process() throws WCSException {
/** * Processing starts here ... with the nodes of the WCS * */
// Service Description
- LOG.debug("WCS service: \"" + wcs.SERVICE + "\"");
- LOG.debug("WCS version: \"" + wcs.VERSION + "\"");
+ log.debug("WCS service: \"" + wcs.SERVICE + "\"");
+ log.debug("WCS version: \"" + wcs.VERSION + "\"");
if (!wcs.SERVICE.equalsIgnoreCase("WCS")) {
- throw new InvalidParameterValueException("Service. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Service. Explanation: "
+ "Only the WCS service is supported.");
}
if (!wcs.VERSION.equals("1.1.0")) {
- throw new InvalidParameterValueException("Version. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Version. Explanation: "
+ "Only WCS Version 1.1.0 is currently supported.");
}
// First of all, error checking: is the coverage offered by the server?
if (!wcs.isSetIdentifier()) {
- throw new MissingParameterValueException("Identifier");
+ throw new WCSException(ExceptionCode.MissingParameterValue, "Identifier");
}
try {
if (!meta.existsCoverageName(wcs.getIdentifier().getValue())) {
- throw new InvalidParameterValueException("Identifier. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: "
+ "Coverage " + wcs.getIdentifier().getValue()
+ " is not served by this server.");
}
covMeta = meta.read(wcs.getIdentifier().getValue());
- } catch (WCPSException e) {
- throw new InvalidParameterValueException("Identifier. Explanation: "
+ } catch (Exception e) {
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: "
+ "Coverage " + wcs.getIdentifier().getValue()
+ " is not served by this server.");
}
// Convert all the child nodes of WCS GetCoverage XML node
- LOG.trace("*** Reading WCS node 1 ... ");
+ log.trace("*** Reading WCS node 1 ... ");
readField1();
- LOG.trace("*** Reading WCS node 2 ...");
+ log.trace("*** Reading WCS node 2 ...");
readField2();
- LOG.trace("*** Reading WCS node 3 ...");
+ log.trace("*** Reading WCS node 3 ...");
readField3();
- LOG.trace("*** Reading WCS node 4 ...");
+ log.trace("*** Reading WCS node 4 ...");
readField4();
- LOG.trace("*** Assembling WCPS abstract syntax query ...");
+ log.trace("*** Assembling WCPS abstract syntax query ...");
assembleFinalWcpsQuery();
/* Done building WCPS abstract query. */
finished = true;
- LOG.trace("Done Converting WCS GetCoverage into WCPS ProcessCoverage.");
+ log.trace("Done Converting WCS GetCoverage into WCPS ProcessCoverage.");
}
/**
@@ -442,55 +432,55 @@ public class convertGetCoverage {
private String parseTimePosition(TimePositionType pos) throws WCSException {
String result;
- LOG.trace("TimePosition has length " + pos.getValue().size());
+ log.trace("TimePosition has length " + pos.getValue().size());
if (pos.getValue().size() != 1) {
- throw new InvalidParameterValueException("TimePosition. Explanation: "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition. Explanation: "
+ "The TimePosition element should have exactly one item, and not "
+ pos.getValue().size());
}
String timeStr = pos.getValue().get(0);
- LOG.debug("Parsing time position: " + timeStr);
+ log.debug("Parsing time position: " + timeStr);
try {
// ISO 8601 parsing
TimeString ts = new TimeString(timeStr);
- LOG.debug("Found time position (ISO 8601): " + timeStr);
+ log.debug("Found time position (ISO 8601): " + timeStr);
if (ts.subtract(covMeta.getTimePeriodBeginning()) < 0
|| TimeString.difference(covMeta.getTimePeriodEnd(), timeStr) < 0) {
- throw new InvalidParameterValueException("TimePosition: value " + timeStr
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition: value " + timeStr
+ " is outside this coverage's time range.");
}
String begin = covMeta.getTimePeriodBeginning();
if (begin == null) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis beginning or end in table PS_Domain.");
}
long diff1 = ts.subtract(begin);
- LOG.trace("Selected time span (ISO 8601, in ms) : " + diff1);
+ log.trace("Selected time span (ISO 8601, in ms) : " + diff1);
long diff2 = covMeta.getTimeSpan();
if (diff2 == -1) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis beginning or end in table PS_Domain.");
}
- LOG.trace("Coverage " + covMeta.getCoverageName() + " has time span (ISO 8601, in ms) : " + diff2);
- LOG.trace("Coverage " + covMeta.getCoverageName() + " has time indexes span : " + covMeta.getTimeIndexesSpan());
+ log.trace("Coverage " + covMeta.getCoverageName() + " has time span (ISO 8601, in ms) : " + diff2);
+ log.trace("Coverage " + covMeta.getCoverageName() + " has time indexes span : " + covMeta.getTimeIndexesSpan());
Double dIndex = covMeta.getTimeIndexesSpan() * diff1 * new Double(1.0) / diff2;
if (dIndex == -1) {
- throw new InvalidTemporalMetadataException("Coverage '" + covMeta.getCoverageName()
+ throw new WCSException(ExceptionCode.InvalidTemporalMetadata, "Coverage '" + covMeta.getCoverageName()
+ "' has no time axis.");
}
- LOG.trace("Computed time axis index: " + dIndex);
+ log.trace("Computed time axis index: " + dIndex);
long timeIndex = dIndex.longValue();
result = String.valueOf(timeIndex);
} catch (IllegalArgumentException e) {
- LOG.warn("Time position '" + timeStr + "' was not in ISO 8601 format. Trying to parse integer...");
+ log.warn("Time position '" + timeStr + "' was not in ISO 8601 format. Trying to parse integer...");
try {
Integer tPos = Integer.parseInt(timeStr);
- LOG.debug("Found time position in integer coordinates: " + tPos);
+ log.debug("Found time position in integer coordinates: " + tPos);
result = tPos.toString();
} catch (NumberFormatException e2) {
- throw new InvalidParameterValueException("TimePosition: " + timeStr, e2);
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "TimePosition: " + timeStr, e2);
}
}
diff --git a/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java b/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
index 1a7f882..5847559 100644
--- a/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
+++ b/petascope/src/petascope/wcs/server/core/executeDescribeCoverage.java
@@ -14,16 +14,17 @@
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
- rasdaman GmbH.
+ * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
package petascope.wcs.server.core;
-//~--- non-JDK imports --------------------------------------------------------
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.core.Metadata;
+import petascope.core.DbMetadataSource;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import net.opengis.ows.v_1_0_0.BoundingBoxType;
import net.opengis.wcs.ows.v_1_1_0.DomainMetadataType;
import net.opengis.wcs.ows.v_1_1_0.InterpolationMethodType;
@@ -36,13 +37,8 @@ import net.opengis.wcs.v_1_1_0.DescribeCoverage;
import net.opengis.wcs.v_1_1_0.FieldType;
import net.opengis.wcs.v_1_1_0.RangeType;
import net.opengis.wcs.v_1_1_0.SpatialDomainType;
-
import petascope.wcps.server.core.*;
-
-//~--- JDK imports ------------------------------------------------------------
-
import java.util.Iterator;
-
import javax.xml.XMLConstants;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
@@ -51,8 +47,6 @@ import net.opengis.wcs.ows.v_1_1_0.AnyValue;
import net.opengis.wcs.v_1_1_0.TimeSequenceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
/**
* This class takes a WCS DescribeCoverage XML request and executes request,
@@ -62,7 +56,7 @@ import petascope.wcs.server.exceptions.NoApplicableCodeException;
*/
public class executeDescribeCoverage {
- private static Logger LOG = LoggerFactory.getLogger(executeDescribeCoverage.class);
+ private static Logger log = LoggerFactory.getLogger(executeDescribeCoverage.class);
private boolean finished;
private DescribeCoverage input;
private DbMetadataSource meta;
@@ -92,7 +86,7 @@ public class executeDescribeCoverage {
process();
}
if (finished == false) {
- throw new NoApplicableCodeException("Could not execute the GetCapabilities request! "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Could not execute the GetCapabilities request! "
+ "Please see the other errors...");
}
@@ -118,12 +112,12 @@ public class executeDescribeCoverage {
* @return CoverageDescriptionType object, that can just be plugged in the respose object
*/
private CoverageDescriptionType getCoverageDescription(String name) throws WCSException {
- LOG.trace("Building coverage description for coverage '" + name + "' ...");
+ log.trace("Building coverage description for coverage '" + name + "' ...");
CoverageDescriptionType desc = new CoverageDescriptionType();
// Error checking: is the coverage available?
if (meta.existsCoverageName(name) == false) {
- throw new InvalidParameterValueException("Identifier. Explanation: Coverage "
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Identifier. Explanation: Coverage "
+ name + " is not served by this server !");
}
@@ -133,7 +127,7 @@ public class executeDescribeCoverage {
try {
cov = meta.read(name);
} catch (Exception e) {
- throw new NoApplicableCodeException("Metadata for coverage " + name + " is not valid.");
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Metadata for coverage " + name + " is not valid.");
}
desc.setIdentifier(name);
@@ -169,7 +163,7 @@ public class executeDescribeCoverage {
bbox.getUpperCorner().add(hi1);
bbox.getUpperCorner().add(hi2);
} else {
- throw new NoApplicableCodeException("Internal error: Could "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Internal error: Could "
+ "not find X and Y cell domain extents.");
}
@@ -202,7 +196,7 @@ public class executeDescribeCoverage {
/* Find a time-axis if exists */
CellDomainElement T = cov.getTCellDomain();
if (T != null) {
- LOG.trace("Found time-axis for coverage: [" + T.getLo() + ", " + T.getHi() + "]");
+ log.trace("Found time-axis for coverage: [" + T.getLo() + ", " + T.getHi() + "]");
TimeSequenceType temporal = new TimeSequenceType();
temporal.getTimePositionOrTimePeriod().add(T.getLo().intValue());
temporal.getTimePositionOrTimePeriod().add(T.getHi().intValue());
@@ -269,7 +263,7 @@ public class executeDescribeCoverage {
desc.getSupportedCRS().add(DomainElement.WGS84_CRS);
}
- LOG.trace("Done building the Coverage Description for coverage '" + name + "'.");
+ log.trace("Done building the Coverage Description for coverage '" + name + "'.");
return desc;
}
diff --git a/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java b/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
index 846f2c8..e000f9e 100644
--- a/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
+++ b/petascope/src/petascope/wcs/server/core/executeGetCapabilities.java
@@ -14,15 +14,16 @@
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
*
- * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
- rasdaman GmbH.
+ * Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
package petascope.wcs.server.core;
-import petascope.wcs.server.exceptions.WCSException;
+import petascope.exceptions.PetascopeException;
+import petascope.exceptions.WCSException;
+import petascope.exceptions.ExceptionCode;
import java.sql.SQLException;
import java.util.Iterator;
import javax.xml.bind.JAXBElement;
@@ -44,17 +45,12 @@ import net.opengis.wcs.v_1_1_0.Capabilities;
import net.opengis.wcs.v_1_1_0.Contents;
import net.opengis.wcs.v_1_1_0.CoverageSummaryType;
import net.opengis.wcs.v_1_1_0.GetCapabilities;
-import petascope.wcps.server.core.DbMetadataSource;
-import petascope.wcps.server.core.Metadata;
-import petascope.wcps.server.exceptions.ResourceException;
-
+import petascope.core.DbMetadataSource;
+import petascope.core.Metadata;
import javax.xml.XMLConstants;
import net.opengis.ows.v_1_0_0.AddressType;
import net.opengis.wcs.ows.v_1_1_0.RequestMethodType;
import petascope.ConfigManager;
-import petascope.wcs.server.exceptions.InternalSqlException;
-import petascope.wcs.server.exceptions.InvalidParameterValueException;
-import petascope.wcs.server.exceptions.NoApplicableCodeException;
/**
* This class takes a WCS GetCapabilities XML request and executes request,
@@ -87,12 +83,12 @@ public class executeGetCapabilities {
* @return a Capabilities object.
* @throws wcs_web_service.WCSException
*/
- public Capabilities get() throws WCSException {
+ public Capabilities get() throws WCSException, PetascopeException {
if (finished == false) {
process();
}
if (finished == false) {
- throw new NoApplicableCodeException("Could not execute the GetCapabilities request! "
+ throw new WCSException(ExceptionCode.NoApplicableCode, "Could not execute the GetCapabilities request! "
+ "Please see the other errors...");
}
return output;
@@ -102,9 +98,9 @@ public class executeGetCapabilities {
* Computes the response to the GetCapabilities request given to the constructor.
* @throws wcs_web_service.WCSException
*/
- public void process() throws WCSException {
+ public void process() throws WCSException, PetascopeException {
if (!input.SERVICE.equalsIgnoreCase("WCS")) {
- throw new InvalidParameterValueException("Service");
+ throw new WCSException(ExceptionCode.InvalidParameterValue, "Service");
}
try {
@@ -117,7 +113,7 @@ public class executeGetCapabilities {
finished = true;
} catch (SQLException se) {
finished = false;
- throw new InternalSqlException(se.getMessage(), se);
+ throw new WCSException(ExceptionCode.InternalSqlError, se.getMessage(), se);
}
}
@@ -252,14 +248,11 @@ public class executeGetCapabilities {
* Builds the output node "Contents"
* @throws java.sql.SQLException
*/
- private void buildField4() {
+ private void buildField4() throws PetascopeException {
Contents cont = new Contents();
Iterator<String> coverages = null;
- try {
- coverages = meta.coverages().iterator();
- } catch (ResourceException e) {
- }
+ coverages = meta.coverages().iterator();
while (coverages.hasNext()) {
Metadata metadata = null;
try {