Package org.vfny.geoserver.wms

Examples of org.vfny.geoserver.wms.WmsException


                return (RegionatingStrategy) c.newInstance( gs );
            }
           
            return (RegionatingStrategy)clazz.newInstance();
        } catch (Exception e){
            throw new WmsException(e);
        }
    }
View Full Code Here


        Map options = con.getRequest().getFormatOptions();
        attribute = (String) options.get("regionateAttr");
        if (attribute == null)
            attribute = checkAttribute(featureType);
        if (attribute == null)
            throw new WmsException(
                    "Regionating attribute has not been specified");

        // Make sure the attribute is actually there
        AttributeDescriptor ad = ft.getDescriptor(attribute);
        if (ad == null) {
            throw new WmsException("Could not find regionating attribute "
                    + attribute + " in layer " + featureType.getName());
        }

        // Make sure we know how to turn that attribute into a H2 type
        h2Type = getH2DataType(ad);
        if (h2Type == null)
            throw new WmsException("Attribute type " + ad.getType()
                    + " is not " + "supported for external sorting on "
                    + featureType.getName() + "#" + attribute);
    }
View Full Code Here

            }
           
            //check if a non ignorable error occurred
            if(nonIgnorableExceptionListener.exceptionOccurred()){
                Exception renderError = nonIgnorableExceptionListener.getException();
                throw new WmsException("Rendering process failed", "internalError", renderError);
            }

            // check if too many errors occurred
            if(errorChecker.exceedsMaxErrors()) {
                throw new WmsException("More than " + maxErrors + " rendering errors occurred, bailing out",
                        "internalError", errorChecker.getLastException());
            }
           
            // check we did not use too much memory
            if(memoryChecker.exceedsMaxSize()) {
                long kbMax = maxMemory / KB;
                throw new WmsException("Rendering request used more memory than the maximum allowed:"
                        + kbMax + "KB");
            }

            graphic.dispose();
            cb.addTemplate(tp, 0, 0);

            // step 5: we close the document
            document.close();
            writer.flush();
            writer.close();
        } catch (DocumentException t) {
            throw new WmsException("Error setting up the PDF", "internalError", t);
        }
  }
View Full Code Here

            && !CRS.equalsIgnoreMetadata(box.getCoordinateReferenceSystem(), DefaultGeographicCRS.WGS84);
            if (reprojectBBox) {
                try {
                    box = box.transform(DefaultGeographicCRS.WGS84, true);
                } catch(Exception e) {
                    throw new WmsException("Could not transform bbox to WGS84", "ReprojectionError", e);
                }
            }
            start("LatLonBox");
            element("north", Double.toString(box.getMaxY()));
            element("south", Double.toString(box.getMinY()));
View Full Code Here

            attribute = ft.getGeometryDescriptor().getLocalName();
        } else {
            // Make sure the attribute is actually there
            AttributeType attributeType = ft.getType(attribute);
            if (attributeType == null) {
                throw new WmsException("Could not find regionating attribute "
                        + attribute + " in layer " + featureType.getName());
            }
        }

        // geometry size is a double
View Full Code Here

        SimpleFeature sampleFeature;

        try {
            sampleFeature = SimpleFeatureBuilder.template(schema, null);
        } catch (IllegalAttributeException e) {
            throw new WmsException(e);
        }

        return sampleFeature;
    }
View Full Code Here

     *
     * @throws WmsException if an error occurs during rendering
     */
    public void produceMap() throws WmsException {
        if (mapContext == null) {
            throw new WmsException("The map context is not set");
        }

        this.htmlImageMapEncoder = new EncodeHTMLImageMap(mapContext);
    }
View Full Code Here

            MapDecoration d = new WatermarkDecoration();
            try {
                d.loadOptions(options);
            } catch (Exception e) {
                LOGGER.log(Level.SEVERE, "Couldn't construct watermark from configuration", e);
                throw new WmsException(e);
            }

            MapDecorationLayout.Block.Position p = null;

            switch (watermark.getPosition()) {
            case TOP_LEFT:
                p = MapDecorationLayout.Block.Position.UL;
                break;
            case TOP_CENTER:
                p = MapDecorationLayout.Block.Position.UC;
                break;
            case TOP_RIGHT:
                p = MapDecorationLayout.Block.Position.UR;
                break;
            case MID_LEFT:
                p = MapDecorationLayout.Block.Position.CL;
                break;
            case MID_CENTER:
                p = MapDecorationLayout.Block.Position.CC;
                break;
            case MID_RIGHT:
                p = MapDecorationLayout.Block.Position.CR;
                break;
            case BOT_LEFT:
                p = MapDecorationLayout.Block.Position.LL;
                break;
            case BOT_CENTER:
                p = MapDecorationLayout.Block.Position.LC;
                break;
            case BOT_RIGHT:
                p = MapDecorationLayout.Block.Position.LR;
                break;
            default:
                throw new WmsException(
                        "Unknown WatermarkInfo.Position value.  Something is seriously wrong."
                );
            }

            return new MapDecorationLayout.Block(d, p, null, new Point(0,0));
View Full Code Here

        SLDTransformer tx = new SLDTransformer();
        try {
            tx.setIndentation(4);
            tx.transform(sld, output);
        } catch (TransformerException e) {
            throw new WmsException(e);
        }
    }
View Full Code Here

        final String version = getValue("VERSION");
        if (null == version) {
            // spec allows to use custom exception codes, so we'll use
            // NoVersionInfo here. No need to define it as a DTD extension
            // though
            throw new WmsException("Version parameter not provided for DescribeLayer operation",
                    "NoVersionInfo", getClass().getSimpleName());
        }

        if (!wms.getVersion().equals(version)) {
            // spec allows to use custom exception codes, so we'll use
            // InvalidVersion here. No need to define it as a DTD extension
            // though
            throw new WmsException("Wrong value for version parameter: " + version
                    + ". This server accetps version " + getWMS().getVersion(), "InvalidVersion",
                    getClass().getSimpleName());
        }

        req.setVersion(version);

        String layersParam = getValue("LAYERS");

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine(layersParam);
        }

        List<String> layers = readFlat(layersParam, INNER_DELIMETER);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine(layers.toString());
        }

        int layerCount = layers.size();

        if (layerCount == 0) {
            throw new WmsException("No LAYERS has been requested", "NoLayerRequested", getClass()
                    .getName());
        }

        String layerName = null;
        MapLayerInfo layer = null;

        for (int i = 0; i < layerCount; i++) {
            layerName = (String) layers.get(i);

            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine(new StringBuffer("Looking for layer ").append(layerName).toString());
            }

            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.fine("looking featuretypeinfos");
            }

            LayerInfo layerInfo = wms.getLayerByName(layerName);
            if (layerInfo == null) {
                throw new WmsException(layerName + ": no such layer on this server",
                        "LayerNotDefined",  getClass().getSimpleName());
            }
            layer = new MapLayerInfo(layerInfo);
            req.addLayer(layer);
            if (LOGGER.isLoggable(Level.FINE)) {
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.wms.WmsException

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.