Package org.geoserver.platform

Examples of org.geoserver.platform.ServiceException


      long reqUS = -1;
        if (request.getUpdateSequence() != null) {
          try {
            reqUS = Long.parseLong(request.getUpdateSequence());
          } catch (NumberFormatException nfe) {
            throw new ServiceException("GeoServer only accepts numbers in the updateSequence parameter");
          }
        }
        long geoUS = wfs.getGeoServer().getGlobal().getUpdateSequence();
      if (reqUS > geoUS) {
        throw new ServiceException("Client supplied an updateSequence that is greater than the current sever updateSequence","InvalidUpdateSequence");
      }
      if (reqUS == geoUS) {
        throw new ServiceException("WFS capabilities document is current (updateSequence = " + geoUS + ")","CurrentUpdateSequence");
      }
    }
View Full Code Here


        double miny = bbox[1];
        double maxx = bbox[2];
        double maxy = bbox[3];
       
        if (minx > maxx) {
            throw new ServiceException("illegal bbox, minX: " + minx + " is "
                + "greater than maxX: " + maxx);
        }

        if (miny > maxy) {
            throw new ServiceException("illegal bbox, minY: " + miny + " is "
                + "greater than maxY: " + maxy);
        }

        //check for crs
        CoordinateReferenceSystem crs = null;
View Full Code Here

            adapter.setContentHandler(documentFilter);
            adapter.parse(requestSource);
            LOGGER.fine("just parsed: " + requestSource);
        } catch (SAXException e) {
            throw new ServiceException(e, "XML getFeature request SAX parsing error",
                XmlRequestReader.class.getName());
        } catch (IOException e) {
            throw new ServiceException(e, "XML get feature request input error",
                XmlRequestReader.class.getName());
        } catch (ParserConfigurationException e) {
            throw new ServiceException(e, "Some sort of issue creating parser",
                XmlRequestReader.class.getName());
        }

        LOGGER.fine("passing filter: " + contentHandler.getFilter());
View Full Code Here

            String strictParam = getValue("STRICT");
            strict = strictParam == null? true : Boolean.valueOf(strictParam).booleanValue();
        }
        request.setStrict(strict);
        if (strict && layer == null) {
            throw new ServiceException("LAYER parameter not present for GetLegendGraphic",
                    "LayerNotDefined");
        }
        if (strict && format == null) {
            throw new ServiceException("Missing FORMAT parameter for GetLegendGraphic",
                    "MissingFormat");
        }

        WMS wms = request.getWMS();
        MapLayerInfo mli = null;
View Full Code Here

   
    int height = request.getHeight();
    int width = request.getWidth();
   
    if ((height>512)||(width>512)){
      throw new ServiceException("Cannot get WMS bil" +
          " tiles bigger than 512x512, try WCS");
    }
   
    MapLayerInfo[] reqlayers = request.getLayers();
   
    //Can't fetch bil for more than 1 layer
    if (reqlayers.length > 1)
    {
      throw new ServiceException("Cannot combine layers into BIL output");
    }
    MapLayerInfo mapLayerInfo = reqlayers[0];
   
    /*
    final ParameterValueGroup writerParams = format.getWriteParameters();
        writerParams.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString())
                    .setValue(wp);
    */
    GridCoverageReader coverageReader = mapLayerInfo.getCoverageReader();
   
    /*
     * Try to use a gridcoverage style render
     */
    GridCoverage2D subCov = null;
    try {
      subCov = BilMapProducer.getFinalCoverage(request,
          mapLayerInfo, (AbstractGridCoverage2DReader)coverageReader);
    } catch (IndexOutOfBoundsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (FactoryException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (TransformException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if(subCov!=null)
    {
      /*
      BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
      writer.write(subCov.toString());
      writer.flush();
      writer.close();
      */
          RenderedImage image = subCov.getRenderedImage();
          if(image!=null)
          {
            int dtype = image.getData().getDataBuffer().getDataType();
            /* Throw exception if required to perform conversion */
            /*
            if((bilEncoding.equals("application/bil32"))&&(dtype!=DataBuffer.TYPE_FLOAT))            {
              throw new ServiceException("Cannot fetch BIL float data,"+
                  "Wrong underlying data type");
            }
            if((bilEncoding.equals("application/bil16"))&&(dtype!=DataBuffer.TYPE_SHORT))            {
              throw new ServiceException("Cannot fetch BIL int data,"+
                  "Wrong underlying data type");
            }
            if((bilEncoding.equals("application/bil8"))&&(dtype!=DataBuffer.TYPE_BYTE))            {
              throw new ServiceException("Cannot fetch BIL byte data,"+
                  "Wrong underlying data type");
            }
            */
           
            /*
             * Perform format conversion
             * Operator is not created if no conversion is necessary
             */
            RenderedOp formcov = null;
            if((bilEncoding.equals("application/bil32"))&&(dtype!=DataBuffer.TYPE_FLOAT))            {
              formcov = FormatDescriptor.create(image,DataBuffer.TYPE_FLOAT ,null);
            }
            if((bilEncoding.equals("application/bil16"))&&(dtype!=DataBuffer.TYPE_SHORT))            {
              formcov = FormatDescriptor.create(image,DataBuffer.TYPE_SHORT ,null);
            }
            if((bilEncoding.equals("application/bil8"))&&(dtype!=DataBuffer.TYPE_BYTE))            {
              formcov = FormatDescriptor.create(image,DataBuffer.TYPE_BYTE ,null);
            }
            TiledImage tiled = null;
            if (formcov!= null)
              tiled = new TiledImage(formcov,width,height);
            else
              tiled = new TiledImage(image,width,height);
            final ImageOutputStream imageOutStream = ImageIO.createImageOutputStream(out);
            final ImageWriter writer = writerSPI.createWriterInstance();
            writer.setOutput(imageOutStream);
            writer.write(tiled);
            imageOutStream.flush();
            imageOutStream.close();
          }
          else
          {
            throw new ServiceException("Cannot render to BIL");
          }
    }
    else
    {     
      throw new ServiceException("You requested a bil of size:"+
          height+"x"+width+",but you can't have it!!");

    }
  }
View Full Code Here

        // writing
        if (writer != null) {
            writer.write(sourceCoverage, null);
        } else {
            throw new ServiceException("Could not create a writer for the format Gtopo30!");
        }

        // freeing everything
        writer.dispose();
        this.sourceCoverage.dispose(false);
View Full Code Here

            if (crs != null) {
                final String srsName = "EPSG:" + crs;
                try {
                    qt.setSrsName(new URI(srsName));
                } catch (URISyntaxException e) {
                    throw new ServiceException("Unable to determite coordinate system for featureType " + fc.getSchema().getTypeName() + ".  Schema told us '" + srsName + "'", e);
                }
            }
            gfreq.getQuery().add(qt);
           
        }
View Full Code Here

        } catch (SAXException e) {
            //SAXException does not sets initCause(). Instead, it holds its own "exception" field.
            if(e.getException() != null && e.getCause() == null){
                e.initCause(e.getException());
            }
            throw new ServiceException(e, "XML request parsing error",
                DispatcherXmlReader.class.getName());
        } catch (IOException e) {
            throw new ServiceException(e, "XML request input error",
                DispatcherXmlReader.class.getName());
        }
    }
View Full Code Here

    protected Envelope parseBbox(String bboxParam) throws ServiceException {
        Envelope bbox = null;
        Object[] bboxValues = readFlat(bboxParam, INNER_DELIMETER).toArray();

        if (bboxValues.length != 4) {
            throw new ServiceException(bboxParam + " is not a valid pair of coordinates",
                getClass().getName());
        }

        try {
            double minx = Double.parseDouble(bboxValues[0].toString());
            double miny = Double.parseDouble(bboxValues[1].toString());
            double maxx = Double.parseDouble(bboxValues[2].toString());
            double maxy = Double.parseDouble(bboxValues[3].toString());
            bbox = new Envelope(minx, maxx, miny, maxy);

            if (minx > maxx) {
                throw new ServiceException("illegal bbox, minX: " + minx + " is "
                    + "greater than maxX: " + maxx);
            }

            if (miny > maxy) {
                throw new ServiceException("illegal bbox, minY: " + miny + " is "
                    + "greater than maxY: " + maxy);
            }
        } catch (NumberFormatException ex) {
            throw new ServiceException(ex, "Illegal value for BBOX parameter: " + bboxParam,
                getClass().getName() + "::parseBbox()");
        }

        return bbox;
    }
View Full Code Here

     */
    protected List readCQLFilter(String filter) throws ServiceException {
        try {
            return CQL.toFilterList(filter);
        } catch (CQLException pe) {
            throw new ServiceException("Could not parse CQL filter list." + pe.getMessage(), pe);
        }
    }
View Full Code Here

TOP

Related Classes of org.geoserver.platform.ServiceException

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.