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:Delete request URL...");
    throw new OwsException("HTTP Get is not supported for this operation.");
  }
View Full Code Here

        // find the constraint node
        locator = "csw:Constraint";
        Node ndConstraint = (Node)xpath.evaluate(locator,ndAction,XPathConstants.NODE);
        if (ndConstraint == null) {
          String msg = "The parameter was missing - "+locator;
          throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
        }
       
        // constraint version
        //String cVersion = xpath.evaluate("@version",ndConstraint);
       
        // csw:CqlText
        locator = "csw:CqlText";
        Node ndCql = (Node)xpath.evaluate(locator,ndConstraint,XPathConstants.NODE);
        if (ndCql != null) {
          //String cql = Val.chkStr(ndCql.getTextContent());     
          String msg = "Delete transactions based upon "+locator+" are not supported.";
          throw new OwsException(OwsException.OWSCODE_OperationNotSupported,locator,msg);
        } else {
       
          // ogc:Filter
          locator = "ogc:Filter";
          Node ndFilter = (Node)xpath.evaluate(locator,ndConstraint,XPathConstants.NODE);
          if (ndFilter == null) {
            String msg = "The parameter was missing - "+locator;
            throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
          } else {
            this.parseDeletionIds(ndFilter,xpath,ids);
          }
        }
         
        // execute the delete
        if (ids.size() > 0) {
          this.executeDelete(context,publisher,typeName,handle,ids.toArray(new String[0]));
        } else {
          String msg = "No Ids were specified for deletion.";
          throw new OwsException(msg);
        }
      }
    }
   
    // generate the response
View Full Code Here

            // check the property name
            String locator = "ogc:PropertyIsEqualTo/ogc:PropertyName";
            Node ndPropName = (Node)xpath.evaluate("ogc:PropertyName",subNode,XPathConstants.NODE);
            if (ndPropName == null) {
              String msg = "The parameter was not found.";
              throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
            }
            String sPropName = Val.chkStr(ndPropName.getTextContent());
            if (sPropName.length() == 0) {
              String msg = "The parameter value was empty.";
              throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
            }
           
            // ensure an ID property
            boolean isIdProperty = idAliases.containsKey(sPropName.toLowerCase());
            if (!isIdProperty) {
              String msg = "\""+sPropName+"\" is not a supported queryable";
              msg += ", only \"Id\" is supported for this operation.";
              throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
            }
           
            // check the literal
            locator = "ogc:PropertyIsEqualTo/ogc:Literal";
            Node ndLiteral = (Node)xpath.evaluate("ogc:Literal",subNode,XPathConstants.NODE);
            if (ndLiteral == null) {
              String msg = "The parameter was not found.";
              throw new OwsException(OwsException.OWSCODE_MissingParameterValue,locator,msg);
            }
            String sLiteral = Val.chkStr(ndLiteral.getTextContent());
            if (sLiteral.length() == 0) {
              String msg = "The parameter value was empty.";
              throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
            }
           
            // add the ID
            ids.add(sLiteral);
           
          } else {

            String locator = Val.chkStr(subNode.getNodeName());
            throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,err);
          }
        }
      }
    }
  }
View Full Code Here

   */
  protected String handleException(OperationContext context, Exception e) throws Exception {
    if (e instanceof NotAuthorizedException) {
      throw e;
    } else if (e instanceof OwsException) {
      OwsException ows = (OwsException)e;
      LOGGER.finer("Invalid CSW request: "+e.getMessage());
      return ows.getReport(context);
    } else {
      OwsException ows = new OwsException(e);
      LOGGER.log(Level.WARNING,e.toString(),e);
      return ows.getReport(context);
    }
  }
View Full Code Here

    IProviderFactory factory = opContext.getProviderFactory();
    IOriginalXmlProvider oxp = factory.makeOriginalXmlProvider(opContext);
    if (oxp == null) {
      String msg = "The getxml parameter is not supported.";
      String locator = "getxml";
      throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
    } else {
      String xml = oxp.provideOriginalXml(opContext,id);
      return xml;
    }
  }
View Full Code Here

          } else if (localName.equals("Beyond"|| localName.equals("Crosses") ||
                     localName.equals("DWithin") || localName.equals("Touches")) {
            String locator = subNode.getLocalName();
            String msg = "Spatial operator "+subNode.getNodeName()+" is not supported.";
            throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
           
          } else {
           
            String locator = subNode.getLocalName();
            String msg = "Operator "+subNode.getNodeName()+" is not supported.";
            throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,locator,msg);
          }
        }
      }
    }
  }
View Full Code Here

        Node ndPropName = (Node)xpath.evaluate("ogc:PropertyName",parent,XPathConstants.NODE);
        if (ndPropName != null) {
          sPropName = Val.chkStr(ndPropName.getTextContent());
        }
        String msg = sErr+" - PropertyIsLike is the only supported operand for PropertyName: "+sPropName;
        throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"PropertyName",msg);
      }
    }

    // between comparison - set lower and upper boundaries
    if (propertyClause instanceof PropertyClause.PropertyIsBetween) {
      PropertyClause.PropertyIsBetween between;
      between = (PropertyClause.PropertyIsBetween)propertyClause;
      Node ndLower = (Node)xpath.evaluate("ogc:LowerBoundary",parent,XPathConstants.NODE);
      Node ndUpper = (Node)xpath.evaluate("ogc:UpperBoundary",parent,XPathConstants.NODE);
      String sLower = "";
      String sUpper = "";
      if ((ndLower == null) && (ndUpper == null)) {
        String msg = sErr+" - a LowerBoundary or UpperBoundary was not found.";
        throw new OwsException(OwsException.OWSCODE_MissingParameterValue,"PropertyIsBetween",msg);
      }
      if (ndLower != null) {
        sLower = ndLower.getTextContent();
        between.setLowerBoundary(sLower);
        // TODO validate content
      }
      if (ndUpper != null) {
        sUpper = ndUpper.getTextContent();
        between.setUpperBoundary(sUpper);
        // TODO validate content
      }
      if ((sLower == null) || (sLower.length() == 0)) {
        if ((sUpper == null) || (sUpper.length() == 0)) {
          String msg = sErr+" - the LowerBoundary and UpperBoundary are empty.";
          throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"PropertyIsBetween",msg);
        }
      }

      // null check - no literal required
    } else if (propertyClause instanceof PropertyClause.PropertyIsNull) {

      // non-range clauses
    } else {
      Node ndLiteral = (Node)xpath.evaluate("ogc:Literal", parent,XPathConstants.NODE);
      if (ndLiteral == null) {
        String msg = sErr+" - an ogc:Literal was not found.";
        throw new OwsException(OwsException.OWSCODE_MissingParameterValue,"Literal",msg);
      }
      String sLiteral = ndLiteral.getTextContent();
      propertyClause.setLiteral(sLiteral);
      // TODO validate content
      if ((sLiteral == null) || (sLiteral.length() == 0)) {
        String msg = sErr+".ogc:Literal - the supplied literal was empty.";
        throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,"Literal",msg);
      }

      // set like comparison attributes
      if (propertyClause instanceof PropertyClause.PropertyIsLike) {
        PropertyClause.PropertyIsLike like;
View Full Code Here

    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

    // add the clause if the envelope is not empty
    if (!envelope.isEmpty()) {
      logicalClause.getClauses().add(spatialClause);
    } else {
      String msg = sErr+" - the geometry of the spatial operand was not valid.";
      throw new OwsException(OwsException.OWSCODE_InvalidParameterValue,parent.getLocalName(),msg);
    }
  }
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.