Package com.esri.gpt.server.csw.provider.components

Examples of com.esri.gpt.server.csw.provider.components.OwsException


    IProviderFactory factory = context.getProviderFactory();
    IResponseGenerator generator = factory.makeResponseGenerator(context);
    if (generator == null) {
      String msg = "IProviderFactory.makeResponseGenerator: instantiation failed.";
      LOGGER.log(Level.SEVERE,msg);
      throw new OwsException(msg);
    } else {
      generator.generateResponse(context);
    }
  }
View Full Code Here


  public void handleGet(OperationContext context, HttpServletRequest request)
    throws Exception {
   
    // initialize
    LOGGER.finer("Handling csw:Transaction/csw:Insert request URL...");
    throw new OwsException("HTTP Get is not supported for this operation.");
   
    /*
    // initialize
    LOGGER.finer("Handling ccsw:Transaction/csw:Insert request URL...");
    Publisher publisher = new Publisher(context.getRequestContext());
View Full Code Here

      String locator = "csw:Insert/*";
      if (this instanceof UpdateProvider) {
        locator = "csw:Update/*";
      }
      String msg = "No child documents were included for publication.";
      throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
    }
  }
View Full Code Here

      }
      for (String msg : messages) {
        sb.append("\r\n").append(msg);
      }
      sb.append("\r\n]]>");
      throw new OwsException(sb.toString());   
     
    } catch (UnrecognizedSchemaException e) {
     
      StringBuilder sb = new StringBuilder();
      sb.append("<![CDATA[");
      sb.append("\r\n").append(e.getMessage());
      if (handle.length() > 0) {
        sb.append("\r\nhandle=").append(handle);
      }
      sb.append("\r\n]]>");
      throw new OwsException(sb.toString())
    }
   
  }
View Full Code Here

  public void handleGet(OperationContext context, HttpServletRequest request)
    throws Exception {
   
    // initialize
    LOGGER.finer("Handling csw:Transaction/csw:Update request URL...");
    throw new OwsException("HTTP Get is not supported for this operation.");
  }
View Full Code Here

        // updates based upon constraints and record properties are not supported
        locator = "csw:Constraint";
        Node nd = (Node)xpath.evaluate(locator,ndAction,XPathConstants.NODE);
        if (nd != null) {
          String msg = "Update transactions based upon "+locator+" are not supported.";
          throw new OwsException(OwsException.OWSCODE_OperationNotSupported,locator,msg);
        }
        locator = "csw:RecordProperty";
        nd = (Node)xpath.evaluate("csw:RecordProperty",ndAction,XPathConstants.NODE);
        if (nd != null) {
          String msg = "Update transactions based upon "+locator+" are not supported.";
          throw new OwsException(OwsException.OWSCODE_OperationNotSupported,locator,msg);
        }
       
        // publish all XML documents contained
        NodeList nlXmls = ndAction.getChildNodes();
        this.processDocumentNodes(context,publisher,typeName,handle,nlXmls);
View Full Code Here

          }
        }
        if ((nsUri == null) || (nsUri.length() == 0)) {
          String msg = "The namespace must follow the following pattern:";
          msg += " xmlns(pfx1=uri1),xmlns(pfx2=uri2),...";
          throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"namespace",msg);
        } else {
          if (nsUri.equals("http://www.opengis.net/cat/csw/")) {
            hasCswUri = true;
            if ((nsPfx != null) && (nsPfx.length() > 0)) {
              hasCswPfx = true;
              cswPfx = nsPfx;
            }
          }
          nsUri = Val.escapeXml(nsUri);
          if ((nsPfx == null) || (nsPfx.length() == 0)) {
            nsBuffer.append(" xmlns=\"").append(nsUri).append("\"");
          } else {
            nsBuffer.append(" xmlns:").append(nsPfx).append("=\"").append(nsUri).append("\"");
          }
        }
      }
    }  
   
    // use ogc as the default namespace if no namespace parameter was supplied
    if (nsBuffer.length() == 0) {
      nsBuffer.append(" xmlns=\"http://www.opengis.net/ogc\"");
    }
   
    // build the constraint XML
    StringBuilder sbXml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    if (hasCswUri && hasCswPfx) {
      cswPfx = cswPfx+":";
    } else if (hasCswUri) {
      cswPfx = "";
    } else {
      cswPfx = "csw:";
      nsBuffer.append(" xmlns:csw=\"http://www.opengis.net/cat/csw/2.0.2\"");
    }
    sbXml.append("\r\n<").append(cswPfx).append("Constraint");
    if (nsBuffer.length() > 0) {
      sbXml.append(" ").append(nsBuffer);
    }
    sbXml.append(">");
    sbXml.append("\r\n").append(constraintFilter);
    sbXml.append("\r\n</").append(cswPfx).append("Constraint>");
   
    // make the dom, find the ogc:Filter node
    try {
      Document dom = DomUtil.makeDomFromString(sbXml.toString(),true);
      CswNamespaces ns = new CswNamespaces();
      XPath xpath = XPathFactory.newInstance().newXPath();
      xpath.setNamespaceContext(ns.makeNamespaceContext());
     
      Node ndFilter = null;
      Node ndConstraint = (Node)xpath.evaluate("csw:Constraint",dom,XPathConstants.NODE);
      if (ndConstraint != null) {
        ndFilter = (Node)xpath.evaluate("ogc:Filter",ndConstraint,XPathConstants.NODE);;
      }
      if (ndFilter == null) {
        String msg = "The supplied constraint was not a valid ogc:Filter.";
        throw new OwsException(OwsException.OWSCODE_NoApplicableCode,"constraint",msg);
      } else {
        return ndFilter;
      }
     
    } catch (SAXException e) {
      String msg = "The supplied namespace/constraint pairs were not well-formed xml: ";
      msg += " "+e.toString();
      throw new OwsException(OwsException.OWSCODE_NoApplicableCode,"constraint",msg);
    }
   
  }
View Full Code Here

    // evaluate the query
    IQueryEvaluator evaluator = factory.makeQueryEvaluator(context);
    if (evaluator == null) {
      String msg = "IProviderFactory.makeQueryEvaluator: instantiation failed.";
      LOGGER.log(Level.SEVERE,msg);
      throw new OwsException(msg);
    } else {
      evaluator.evaluateQuery(context);
    }
   
    // generate the response
    IResponseGenerator generator = factory.makeResponseGenerator(context);
    if (generator == null) {
      String msg = "IProviderFactory.makeResponseGenerator: instantiation failed.";
      LOGGER.log(Level.SEVERE,msg);
      throw new OwsException(msg);
    } else {
      generator.generateResponse(context);
    }
     
  }
View Full Code Here

      String cql = Val.chkStr(constraint);
      qOptions.setQueryConstraintCql(cql);
      ICqlParser parser = factory.makeCqlParser(context,constraintVersion);
      if (parser == null) {
        String msg = "IProviderFactory.makeCqlParser: instantiation failed.";
        throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
      } else {
        parser.parseCql(context,cql);
      }
    }
   
    // ogc:Filter
    if ((constraintLanguage == null) || constraintLanguage.equalsIgnoreCase("FILTER")) {
      Node ndFilter = null;
      IFilterParser parser = factory.makeFilterParser(context,constraintVersion);
      if (parser == null) {
        String msg = "IProviderFactory.makeFilterParser: instantiation failed.";
        throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
      }
      String constraintFilter = Val.chkStr(constraint);
      if (constraintFilter.length() > 0) {
        String[] namespace = pHelper.getParameterValues(request,"namespace",",");
        ndFilter = this.buildFilterNode(namespace,constraintFilter);
        parser.parseFilter(context,ndFilter,xpath);
      }
    }
   
    // ogc:SortBy
    locator = "sortBy";
    String[] sortBy = pHelper.getParameterValues(request,"sortBy",",");
    if (sortBy != null) {
      Node ndSortBy = this.buildSortByNode(sortBy);
      if (ndSortBy != null) {
        ISortByParser parser = factory.makeSortByParser(context);
        if (parser == null) {
          String msg = "IProviderFactory.makeSortByParser: instantiation failed.";
          throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
        } else {
          parser.parseSortBy(context,ndSortBy,xpath);
        }
      }
    }
View Full Code Here

          String cql = Val.chkStr(ndCql.getTextContent());
          qOptions.setQueryConstraintCql(cql);
          ICqlParser parser = factory.makeCqlParser(context,constraintVersion);
          if (parser == null) {
            String msg = "IProviderFactory.makeCqlParser: instantiation failed.";
            throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
          } else {
            parser.parseCql(context,cql);
          }
        } else {
       
          // ogc:Filter
          locator = "ogc:Filter";
          Node ndFilter = (Node)xpath.evaluate(locator,ndConstraint,XPathConstants.NODE);
          if (ndFilter != null) {
            IFilterParser parser = factory.makeFilterParser(context,constraintVersion);
            if (parser == null) {
              String msg = "IProviderFactory.makeFilterParser: instantiation failed.";
              throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
            } else {
              parser.parseFilter(context,ndFilter,xpath);
            }
          } else {
            String msg = "An OGC filter for the CSW constraint is required.";
            throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
          }
        }
      }
     
      // ogc:SortBy
      locator = "ogc:SortBy";
      Node ndSortBy = (Node)xpath.evaluate(locator,ndQuery,XPathConstants.NODE);
      if (ndSortBy != null) {
        ISortByParser parser = factory.makeSortByParser(context);
        if (parser == null) {
          String msg = "IProviderFactory.makeSortByParser: instantiation failed.";
          throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
        } else {
          parser.parseSortBy(context,ndSortBy,xpath);
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.esri.gpt.server.csw.provider.components.OwsException

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.