Package org.geotools.ows

Examples of org.geotools.ows.ServiceException


   
            Object object;
            try {
                object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING);
            } catch (SAXException e) {
                throw (ServiceException) new ServiceException("Error while parsing XML.").initCause(e); //$NON-NLS-1$
            }
           
            if (object instanceof ServiceException) {
                throw (ServiceException) object;
            }
View Full Code Here


    /* (non-Javadoc)
     * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map)
     */
    public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException {
      return new ServiceException((String)value[value.length - 1].getValue(),null);
    }
View Full Code Here

       * ServiceExceptions with codes get bumped to the top of the list.
       */
      List codes = new ArrayList();
      List noCodes = new ArrayList();
      for (int i = 0; i < value.length; i++) {
        ServiceException exception = (ServiceException) value[i].getValue();
        if (exception.getCode() != null && exception.getCode().length() != 0 ) {
          codes.add(exception);
        } else {
          noCodes.add(exception);
        }
      }
     
      /*
       * Now chain them.
       */
      ServiceException firstException = null;
      ServiceException recentException = null;
      for (int i = 0; i < codes.size(); i++) {
        ServiceException exception = (ServiceException) codes.get(i);
        if (firstException == null) {
          firstException = exception;
          recentException = exception;
        } else {
          recentException.setNext(exception);
          recentException = exception;
        }
      }
      codes = null;
      for (int i = 0; i < noCodes.size(); i++) {
        ServiceException exception = (ServiceException) noCodes.get(i);
        if (firstException == null) {
          firstException = exception;
          recentException = exception;
        } else {
          recentException.setNext(exception);
View Full Code Here

     */
    public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException {
      String body = (String) value[value.length - 1].getValue();
      String code = attrs.getValue("code");
      String location = attrs.getValue("location");
      return new ServiceException(body, code, location);
    }
View Full Code Here

                // object = DocumentFactory.getInstance(inputStream, hints, Level.WARNING);
                object = parser.parse(inputStream);
            }
            catch (SAXException e)
            {
                throw (ServiceException) new ServiceException("Error while parsing XML.").initCause(e);
            }
            catch (ParserConfigurationException e)
            {
                throw (ServiceException) new ServiceException("Error while parsing XML.").initCause(e);
            }

            // if (object instanceof ServiceException) {
            // throw (ServiceException) object;
            // }
View Full Code Here

        this(serverURL, new SimpleHttpClient(), null);

        capabilities = negotiateVersion();
        if (capabilities == null)
        {
            throw new ServiceException("Unable to retrieve or parse Capabilities document.");
        }
        else if (capabilities != null)
        {
            setupSpecification(capabilities);
        }
View Full Code Here

        else
        {
            this.capabilities = negotiateVersion();
            if (this.capabilities == null)
            {
                throw new ServiceException("Unable to retrieve or parse Capabilities document.");
            }
            setupSpecification(this.capabilities);
        }

    }
View Full Code Here

        setupSpecifications();

        if (capabilities == null) {
            this.capabilities = negotiateVersion();
            if (this.capabilities == null) {
                throw new ServiceException("Unable to retrieve or parse Capabilities document.");
            }
        } else {
            this.capabilities = capabilities;
        }
View Full Code Here

     */
    List codes = new ArrayList();
    List noCodes = new ArrayList();
    for (int i = 0; i < serviceExceptions.size(); i++) {
      Element element = (Element) serviceExceptions.get(i);
      ServiceException exception = parseSE(element);
      if (exception.getCode() != null && exception.getCode().length() != 0 ) {
        codes.add(exception);
      } else {
        noCodes.add(exception);
      }
    }
   
    /*
     * Now chain them.
     */
    ServiceException firstException = null;
    ServiceException recentException = null;
    for (int i = 0; i < codes.size(); i++) {
      ServiceException exception = (ServiceException) codes.get(i);
      if (firstException == null) {
        firstException = exception;
        recentException = exception;
      } else {
        recentException.setNext(exception);
        recentException = exception;
      }
    }
    codes = null;
    for (int i = 0; i < noCodes.size(); i++) {
      ServiceException exception = (ServiceException) noCodes.get(i);
      if (firstException == null) {
        firstException = exception;
        recentException = exception;
      } else {
        recentException.setNext(exception);
View Full Code Here

  private static ServiceException parseSE(Element element) {
    String errorMessage = element.getText();
    String code = element.getAttributeValue("code");
   
    return new ServiceException(errorMessage, code);
  }
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.