Package org.geotools.ows

Examples of org.geotools.ows.ServiceException


                    if (code == null) {
                        code = attr.getValue(namespaceURI, "code");
                    }

                    exception = new ServiceException("", code, locator);
                }
            }
        }
View Full Code Here


        /**
         * @see org.geotools.xml.XSIElementHandler#characters(java.lang.String)
         */
        public void characters(String text){
            if (inside) {
                exception = new ServiceException(text, exception.getCode(),
                        exception.getLocator());
            }
        }
View Full Code Here

            InputStream inputStream = null;
            try {
                inputStream = response.getResponseStream();
                object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING);
            } catch (SAXException e) {
                throw (ServiceException) new ServiceException("Error while parsing XML.")
                        .initCause(e);
            } finally {
                IOUtils.closeQuietly(inputStream);
            }
View Full Code Here

        // local server
        String serviceProperty = fixture.getProperty("service");
        if (serviceProperty == null)
        {
            throw new ServiceException(
                "Service URL not provided by test fixture");
        }
        url = new URL(serviceProperty);
        processIden = fixture.getProperty("processId");
View Full Code Here

        // local server
        String serviceProperty = fixture.getProperty("service");
        if (serviceProperty == null)
        {
            throw new ServiceException(
                "Service URL not provided by test fixture");
        }
        url = new URL(serviceProperty);
        processIden = fixture.getProperty("processId");
View Full Code Here

            if (code == null) {
                code = attrs1.getValue(getNamespace().toString(), "code");
            }

            ServiceException se = new ServiceException((msg == null) ? "" : msg,
                    (code == null) ? "" : code, (locator == null) ? "" : locator);

            if (cache(element, hints)) {
                return se;
            }
View Full Code Here

    public Object decode(InputStream input) throws Exception {
        Parser p = new Parser(config);
        p.validate(input);
       
        if (!p.getValidationErrors().isEmpty()) {
            throw new ServiceException("Errors were encountered while parsing GeoPackage contents: " + p.getValidationErrors());       
        }
       
        input.reset();
        return p.parse(input);
    }
View Full Code Here

     * @throws ServiceException
     */
    public void verifyAccessLayer(String layerName, ReferencedEnvelope boundingBox) throws ServiceException {
        LayerInfo layerInfo =  getLayerInfoByName(layerName); //catalog.getLayerByName(layerName);
        if (layerInfo == null) {
            throw new ServiceException("Could not find layer " + layerName, "LayerNotDefined");
        }
        if (layerInfo instanceof SecuredLayerInfo && boundingBox != null) {
            //test layer bbox limits
            SecuredLayerInfo securedLayerInfo = (SecuredLayerInfo) layerInfo;
            WrapperPolicy policy = securedLayerInfo.getWrapperPolicy();
            AccessLimits limits = policy.getLimits();
                       
            if (limits instanceof DataAccessLimits) {
                //ensure we are all using the same CRS
                CoordinateReferenceSystem dataCrs = layerInfo.getResource().getCRS()
                if (boundingBox.getCoordinateReferenceSystem()!=null && !CRS.equalsIgnoreMetadata(dataCrs, boundingBox.getCoordinateReferenceSystem())) {
                    try {
                        boundingBox = boundingBox.transform(dataCrs,true);
                    } catch (Exception e) {
                        //bboxes not compatible? deny access for all certainty.
                        boundingBox = null;
                    }
                }
                Envelope limitBox = new ReferencedEnvelope(ReferencedEnvelope.EVERYTHING, dataCrs);
               
                Filter filter = ((DataAccessLimits) limits).getReadFilter();
                if (filter != null) {
                    //extract filter envelope from filter
                    Envelope box = (Envelope) filter.accept(ExtractBoundsFilterVisitor.BOUNDS_VISITOR, null);
                    if (box != null) {
                        limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs);                       
                    }
                }
                if (limits instanceof CoverageAccessLimits) {
                    if (((CoverageAccessLimits) limits).getRasterFilter() != null) {
                        Envelope box = ((CoverageAccessLimits) limits).getRasterFilter().getEnvelopeInternal();
                        if (box != null) {
                            limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs);                       
                        }
                    }
                }
                if (limits instanceof WMSAccessLimits) {
                    if (((WMSAccessLimits) limits).getRasterFilter() != null) {
                        Envelope box = ((WMSAccessLimits) limits).getRasterFilter().getEnvelopeInternal();
                        if (box != null) {
                            limitBox = new ReferencedEnvelope(limitBox.intersection(box), dataCrs);                       
                        }
                    }
                }               
               
                if (!limitBox.covers(ReferencedEnvelope.EVERYTHING) && (boundingBox==null || !limitBox.contains(boundingBox))) {
                    throw new ServiceException("Access denied to bounding box on layer " + layerName, "AccessDenied");
                }
            }
           
        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.ows.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.