Package org.geoserver.platform

Examples of org.geoserver.platform.OWS20Exception


    private Object describeEOCoverageSet(DescribeEOCoverageSetType dcs) {
        checkService(dcs.getService());
        checkVersion(dcs.getVersion());

        if (dcs.getEoId() == null || dcs.getEoId().isEmpty()) {
            throw new OWS20Exception("Required parameter eoID missing", new OWSExceptionCode(
                    "emptyEoIdList", 404), "eoid");
        }

        // check coverages are legit
        List<String> badCoverageIds = new ArrayList<String>();
View Full Code Here


    public WCS20DescribeCoverageTransformer describeCoverage(DescribeCoverageType request) {
        checkService(request.getService());
        checkVersion(request.getVersion());
       
        if( request.getCoverageId() == null || request.getCoverageId().isEmpty() ) {
            throw new OWS20Exception("Required parameter coverageId missing", WCS20Exception.WCS20ExceptionCode.EmptyCoverageIdList, "coverageId");
        }
       
        // check coverages are legit
        List<String> badCoverageIds = new ArrayList<String>();
View Full Code Here

    public GridCoverage getCoverage(GetCoverageType request) {
        checkService(request.getService());
        checkVersion(request.getVersion());

        if( request.getCoverageId() == null || "".equals(request.getCoverageId()) ) {
            throw new OWS20Exception("Required parameter coverageId missing", WCS20Exception.WCS20ExceptionCode.EmptyCoverageIdList, "coverageId");
        }
       
        return new GetCoverage(getServiceInfo(), catalog,envelopeAxesMapper).run(request);
    }
View Full Code Here

        // first, locate the intervalOrPoint part
        int openIdx = value.indexOf("(");
        int closeIdx = value.indexOf(")");

        if (openIdx == -1 || closeIdx == -1 || closeIdx < value.length() - 1) {
            throw new OWS20Exception("Invalid syntax, dimension [ , crs ] ( intervalOrPoint ) is expected",
                    WCS20ExceptionCode.InvalidEncodingSyntax, "subset");
           
        }

        // parse the first part, dimension[,crs]
        String dimension = null;
        String crs = null;
        String dimensionCrs = value.substring(0, openIdx);
        String[] dcElements = dimensionCrs.split("\\s*,\\s*");
        if (dcElements.length == 1) {
            dimension = dcElements[0];
            crs = null;
        } else if (dcElements.length == 2) {
            dimension = dcElements[0];
            crs = dcElements[1];
        } else {
            throw new OWS20Exception("Invalid syntax, dimension [ , crs ] ( intervalOrPoint ) is expected",
                    WCS20ExceptionCode.InvalidEncodingSyntax, "subset");
        }

        // parse the second part, intervalOrPoint
        String valuePoint = value.substring(openIdx + 1, closeIdx);
        // split on all commas not contained in quotes
        String[] vpElements = valuePoint.split(",\\s*(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
        if (vpElements.length == 1) {
            // point
            String point = parsePoint(vpElements[0], false);
            DimensionSliceType slice = Wcs20Factory.eINSTANCE.createDimensionSliceType();
            slice.setDimension(dimension);
            slice.setCRS(crs);
            slice.setSlicePoint(point);
            return slice;
        } else if (vpElements.length == 2) {
            String low = parsePoint(vpElements[0], true);
            String high = parsePoint(vpElements[1], true);

            DimensionTrimType trim = Wcs20Factory.eINSTANCE.createDimensionTrimType();
            trim.setDimension(dimension);
            trim.setCRS(crs);
            trim.setTrimLow(low);
            trim.setTrimHigh(high);
            return trim;
        } else {
            throw new OWS20Exception("Invalid syntax, dimension [ , crs ] ( intervalOrPoint ) "
                    + "where interval or point has either 1 or two elements",
                    WCS20ExceptionCode.InvalidEncodingSyntax, "subset");
        }
    }
View Full Code Here

        if ("*".equals(point)) {
            if (allowStar) {
                // "no" limit
                return null;
            } else {
                throw new OWS20Exception(
                        "Invalid usage of *, it can be used only when specifying an interval",
                        WCS20ExceptionCode.InvalidEncodingSyntax, "subset");
            }
        } else if (point.startsWith("\"") && point.endsWith("\"")) {
            point = point.substring(1, point.length() - 1);
        } else {
            try {
                // check it is a number
                Double.parseDouble(point);
            } catch (NumberFormatException e) {
                throw new OWS20Exception("Invalid point value " + point
                        + ", it is not a number and it's not between double quotes",
                        WCS20ExceptionCode.InvalidEncodingSyntax, "subset");
            }
        }

View Full Code Here

            if(interleavingS.equals("pixel")){
                // ok we want pixel interleaving, TIFF ImageWriter always writes
                // with pixel interleaving hence, we are good!
            } else if(interleavingS.equals("band")){
                // TODO implement this in TIFF Writer, as it is not supported right now
                throw new OWS20Exception("Banded Interleaving not supported", ows20Code(WcsExceptionCode.InterleavingNotSupported), interleavingS);
            } else {
                throw new OWS20Exception("Invalid Interleaving type provided", ows20Code(WcsExceptionCode.InterleavingInvalid), interleavingS);
            }
        }
       
    }
View Full Code Here

                            final int tileW=Integer.valueOf(tileW_);
                            if(tileW>0&& (tileW%16==0)){
                                tileDimensions.width=tileW;
                            } else {
                                // tile width not supported
                                throw new OWS20Exception(
                                        "Provided tile width is invalid",
                                        ows20Code(WcsExceptionCode.TilingInvalid),
                                        Integer.toString(tileW));                           
                            }
                        }catch (Exception e) {
                            // tile width not supported
                            throw new OWS20Exception(
                                    "Provided tile width is invalid",
                                    ows20Code(WcsExceptionCode.TilingInvalid),
                                    tileW_);   
                        }

                    }
                   
                }
                // tileH   
                if(econdingParameters.containsKey("tileheight")){
                    final String tileH_= econdingParameters.get("tileheight");
                    if(tileH_!=null){ 
                        try{
                            final int tileH=Integer.valueOf(tileH_);
                            if(tileH>0&& (tileH%16==0)){
                                tileDimensions.height=tileH;
                            } else {
                                // tile height not supported
                                throw new OWS20Exception(
                                        "Provided tile height is invalid",
                                        ows20Code(WcsExceptionCode.TilingInvalid),
                                        Integer.toString(tileH));
                            }
                        }catch (Exception e) {
                            // tile height not supported
                            throw new OWS20Exception(
                                    "Provided tile height is invalid",
                                    ows20Code(WcsExceptionCode.TilingInvalid),
                                    tileH_);
                        }
                    }
View Full Code Here

                           
                        } else if(predictorS.equals("Horizontal")){
                            wp.setTIFFCompressor(new TIFFLZWCompressor(BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING));
                        } else if(predictorS.equals("Floatingpoint")){
                            // NOT SUPPORTED YET
                            throw new OWS20Exception(
                                    "Floating Point predictor is not supported",
                                    ows20Code(WcsExceptionCode.PredictorNotSupported),
                                    predictorS);
                        } else {
                            // invalid predictor
                            throw new OWS20Exception(
                                    "Invalid Predictor provided",
                                    ows20Code(WcsExceptionCode.PredictorInvalid),
                                    predictorS);
                        }
                    }
                } else if(compressionS.equals("JPEG")){
                    wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
                    wp.setCompressionType("JPEG");
                    // start with the default one, visually lossless
                    wp.setCompressionQuality(DEFAULT_JPEG_COMPRESSION_QUALITY);
                   
                    // check quality
                    if(econdingParameters.containsKey("jpeg_quality")){
                        final String quality_= econdingParameters.get("jpeg_quality");
                        if(quality_!=null){ 
                            try{
                                final int quality=Integer.valueOf(quality_);
                                if(quality>0&&quality<=100){
                                    wp.setCompressionQuality(quality/100.f);
                                } else {
                                    // invalid quality
                                    throw new OWS20Exception(
                                            "Provided quality value for the jpeg compression in invalid",
                                            ows20Code(WcsExceptionCode.JpegQualityInvalid),
                                            quality_);
                               
                            } catch (Exception e) {
                                // invalid quality
                                throw new OWS20Exception(
                                        "Provided quality value for the jpeg compression in invalid",
                                        ows20Code(WcsExceptionCode.JpegQualityInvalid),
                                        quality_);
                            }
                        } 
                    }
                } else if(compressionS.equals("PackBits")){
                    wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
                    wp.setCompressionType("PackBits");     
                } else if(compressionS.equals("DEFLATE")){
                    wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
                    wp.setCompressionType("Deflate");     
                } else if(compressionS.equals("Huffman")){
                    wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
                    wp.setCompressionType("CCITT RLE")
                } else {
                    // compression not supported
                    throw new OWS20Exception("Provided compression does not seem supported", ows20Code(WcsExceptionCode.CompressionInvalid), compressionS);
                }
            }
        }
    }
View Full Code Here

        // from the spec: "If the list does not contain any version numbers that the server
        // supports, the server shall return an Exception with
        // exceptionCode="VersionNegotiationFailed"
        if(negotiated == null)
            throw new OWS20Exception("Could not find any matching version", OWS20Exception.OWSExceptionCode.VersionNegotiationFailed);

        return negotiated.toString();
    }
View Full Code Here

     * @param the locator for the service exception (may be null)
     */
    public static void checkVersionNumber20(String v, String locator) throws ServiceException {
        if (!v.matches("[0-9]{1,2}\\.[0-9]{1,2}(\\.[0-9]{1,2})?")) {
            String msg = v + " is an invalid version number";
            throw new OWS20Exception("Could not find any matching version,"+msg, OWS20Exception.OWSExceptionCode.VersionNegotiationFailed, locator);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.platform.OWS20Exception

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.