Package org.vfny.geoserver.wms

Examples of org.vfny.geoserver.wms.WmsException


            if (numLayers != styleNames.size()) {
                String msg = numLayers + " layers requested, but found "
                    + styleNames.size() + " styles specified. "
                    + "Since SLD parameter is not yet implemented, the STYLES parameter "
                    + "is mandatory and MUST have exactly one value per requested layer";
                throw new WmsException(msg, getClass().getName());
            }

            String currStyleName;
            Style currStyle;
            FeatureTypeInfo currLayer;

            for (int i = 0; i < numLayers; i++) {
                currStyleName = (String) styleNames.get(i);
                currLayer = layers[i];

                if ((null == currStyleName) || "".equals(currStyleName)) {
                    currStyle = currLayer.getDefaultStyle();
                } else {
                    currStyle = findStyle(request, currStyleName);

                    if (currStyle == null) {
                        String msg = "No default style has been defined for "
                            + currLayer.getName();
                        throw new WmsException(msg,
                            "StyleNotDefined");
                    }
                }

                try {
                    checkStyle(currStyle, layers[i].getFeatureType());
                } catch (IOException e) {
                    throw new WmsException(
                        "Error obtaining FeatureType for layer "
                        + layers[i].getName());
                }

                LOGGER.fine("establishing " + currStyleName + " style for "
View Full Code Here


        for (int i = 0; i < styleAttributes.length; i++) {
            String attName = styleAttributes[i];

            if (fType.getAttributeType(attName) == null) {
                throw new WmsException(
                    "The requested Style can not be used with "
                    + "this featureType.  The style specifies an attribute of "
                    + attName + " and the featureType definition is: " + fType);
            }
        }
View Full Code Here

           //Create a sax input source from the reader
            InputSource in = new InputSource(reader);
            errors = validator.validateSLD(in, request.getHttpServletRequest().getSession().getServletContext());
            if (errors.size() != 0) {
              reader = getReaderFromString(sldBody);
              throw new WmsException(SLDValidator.getErrorMessage(reader, errors));
            }
//-        errors = validator.validateSLD(in, request.getHttpServletRequest().getSession().getServletContext());
//-        try{
//-          in.close();
//-        }
View Full Code Here

        try {
            sldUrl = new URL(urlValue);
        } catch (MalformedURLException e) {
            String msg = "Creating remote SLD url: " + e.getMessage();
            LOGGER.log(Level.WARNING, msg, e);
            throw new WmsException(e, msg, "parseSldParam");
        }

       
        if (getValue("VALIDATESCHEMA") != null)
        {
          // user requested to validate the schema.
          SLDValidator validator = new SLDValidator();
          List errors =null;
          try {
            //JD: GEOS-420, Wrap the sldUrl in getINputStream method in order
            // to do compression
            InputStream in = getInputStream(sldUrl);
            errors = validator.validateSLD(in, request.getHttpServletRequest().getSession().getServletContext());
            in.close();
            if (errors.size() != 0)
              throw new WmsException(SLDValidator.getErrorMessage(sldUrl.openStream(),errors));
          }
          catch (IOException e)
      {
            String msg = "Creating remote SLD url: " + e.getMessage();
                LOGGER.log(Level.WARNING, msg, e);
                throw new WmsException(e, msg, "parseSldParam");
      }
        }
        SLDParser parser;

        try {
          //JD: GEOS-420, Wrap the sldUrl in getINputStream method in order
        // to do compression
            parser = new SLDParser(styleFactory, getInputStream( sldUrl));
        } catch (IOException e) {
            String msg = "Creating remote SLD url: " + e.getMessage();
            LOGGER.log(Level.WARNING, msg, e);
            throw new WmsException(e, msg, "parseSldParam");
        }

        StyledLayerDescriptor sld = parser.parseSLD();
        parseStyledLayerDescriptor(request, sld);
    }
View Full Code Here

        final StyledLayer[] styledLayers = sld.getStyledLayers();
        final int slCount = styledLayers.length;

        if (slCount == 0) {
            throw new WmsException("SLD document contains no layers");
        }

        final List layers = new ArrayList();
        final List styles = new ArrayList();

        FeatureTypeInfo currLayer;
        Style currStyle;

        if (null != libraryModeLayers) {
            int lCount = libraryModeLayers.length;

            for (int i = 0; i < lCount; i++) {
                currLayer = libraryModeLayers[i];
                currStyle = findStyleOf(request, currLayer, styledLayers); // DJB: this might not be 100% correct, but its close enough until someone complains
                layers.add(currLayer);
                styles.add(currStyle);
            }
        } else {
            StyledLayer sl = null;
            for (int i = 0; i < slCount; i++) {
                sl = styledLayers[i];
                String layerName = sl.getName();
                if(null == layerName)
                  throw new WmsException("A UserLayer without layer name was passed");


                  // handle the InLineFeature stuff
                    // TODO: add support for remote WFS here
                if ((sl instanceof UserLayer) && (((UserLayer)sl)).getInlineFeatureDatastore()!=null )
View Full Code Here

        if (layerStyles[t] instanceof NamedStyle)
        {
          layers.add(currLayer);
          Style s = findStyle( request, ((NamedStyle) layerStyles[t]).getName() );
          if (s == null)
            throw new WmsException("couldnt find style named '"+((NamedStyle) layerStyles[t]).getName()+"'");
          styles.add(s);
        }
        else
        {
          layers.add(currLayer);
View Full Code Here

        String layersParam = getValue("LAYERS");
        List layerNames = layerNames = readFlat(layersParam, INNER_DELIMETER);
        int layerCount = layerNames.size();

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

        featureTypes = new FeatureTypeInfo[layerCount];
View Full Code Here

        FeatureTypeInfo ftype = null;

        try {
            ftype = catalog.getFeatureTypeInfo(layerName);
        } catch (NoSuchElementException ex) {
          WmsException e = new WmsException(ex,
                layerName + ": no such layer on this server", "LayerNotDefined");
          e.setCode("LayerNotDefined"); //DJB: added this for cite tests
          throw e;
        }

        return ftype;
    }
View Full Code Here

            int x = Integer.parseInt(getValue("X"));
            int y = Integer.parseInt(getValue("Y"));
            request.setXPixel(x);
            request.setYPixel(y);
        } catch (NumberFormatException ex) {
            throw new WmsException("X and Y incorrectly specified");
        }

        String exceptionsFormat = getValue("EXCEPTIONS");
        request.setExeptionFormat(exceptionsFormat);
       
View Full Code Here

    private FeatureTypeInfo[] parseLayers() throws WmsException {
        List layers = layers = readFlat(getValue("QUERY_LAYERS"), INNER_DELIMETER);
        int layerCount = layers.size();

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

        FeatureTypeInfo[] featureTypes = new FeatureTypeInfo[layerCount];
        Data catalog = null;
        catalog = request.getWMS().getData();

        String layerName = null;
        FeatureTypeInfo ftype = null;

        try {
            for (int i = 0; i < layerCount; i++) {
                layerName = (String) layers.get(i);
                ftype = catalog.getFeatureTypeInfo(layerName);
                featureTypes[i] = ftype;
            }
        } catch (NoSuchElementException ex) {
            throw new WmsException(ex,
                layerName + ": no such layer on this server",
                getClass().getName());
        }

        return featureTypes;
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.