Package org.geoserver.platform

Examples of org.geoserver.platform.ServiceException


                // TODO: implement support for GSIP 31 (DataAccess API)
                throw new UnsupportedOperationException(
                        "Sample non-simple feature not yet supported.");
            }
        } catch (IllegalAttributeException e) {
            throw new ServiceException(e);
        }
        return sampleFeature;
    }
View Full Code Here


       
        try {
            adapter.write(results, out);
        }
        catch (Exception e) {
            throw new ServiceException(e);
        }
    }
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");
    }
   
    List<MapLayerInfo> reqlayers = request.getLayers();
   
    //Can't fetch bil for more than 1 layer
    if (reqlayers.size() > 1)
    {
      throw new ServiceException("Cannot combine layers into BIL output");
    }
    MapLayerInfo mapLayerInfo = reqlayers.get(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 = 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();
      */
          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(outStream);
            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

   
        try {
            adapter.write(featureCollection, output);
        }
        catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

    public void writeTo(OutputStream out) throws ServiceException, IOException {
        try {
            adapter.write(context, out);
        }
        catch (Exception e) {
            throw new ServiceException(e);
        }
    }
View Full Code Here

            else {
                throw new IllegalStateException();
            }
        }
        catch(Exception e) {
            throw new ServiceException(e);
        }
       
    }
View Full Code Here

                outWriter.write(")");
                outWriter.flush();
            }

        } catch (JSONException jsonException) {
            ServiceException serviceException = new ServiceException("Error: "
                    + jsonException.getMessage());
            serviceException.initCause(jsonException);
            throw serviceException;
        }

    }
View Full Code Here

                    }
                    viewParams = replacement;
                } else if(viewParams.size() != layerCount) {
                    String msg = layerCount + " feature types requested, but found " + viewParams.size()
                    + " view params specified. ";
                    throw new ServiceException(msg, getClass().getName());
                }
            }
           
            gft.getMetadata().put(GetFeature.SQL_VIEW_PARAMS, viewParams);
        }
View Full Code Here

            regionatingStrategy = findStrategyByName(stratname);
           
            // if a strategy was specified but we did not find it, let the user
            // know
            if (regionatingStrategy == null)
                throw new ServiceException("Unknown regionating strategy " + stratname);
        }

        // try to load less features by leveraging regionating strategy and the
        // SLD
        Filter regionatingFilter = Filter.INCLUDE;
View Full Code Here

          remappedSchema);
         
        } catch (FactoryException fe) {
          LOGGER.log(Level.WARNING,
              "Error while getting EPSG code from FeatureType", fe);
          throw new ServiceException(fe);
        } catch (IOException ioe) {
            LOGGER.log(Level.WARNING,
                "Error while writing featuretype '" + schema.getTypeName() + "' to shapefile.", ioe);
            throw new ServiceException(ioe);
        } finally {
            if(dstore != null) {
                dstore.dispose();
            }
        }
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.