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

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


   
    // initialize
    LOGGER.finer("Handling csw:GetRecords request URL...");
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
    IProviderFactory factory = context.getProviderFactory();
   
    CswNamespaces ns = new CswNamespaces();
    XPath xpath = XPathFactory.newInstance().newXPath();
    xpath.setNamespaceContext(ns.makeNamespaceContext());
   
    // service and version are parsed by the parent RequestHandler
   
    // TODO typeNames requestId distributedSearch hopCount responseHandler
    // TODO resultype validate is not applicable for a GET request?
   
    // output format
    locator = "outputFormat";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
       
    // output schema
    locator = "outputSchema";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputSchema);
    qOptions.setOutputSchema(vHelper.validateValue(supported,locator,parsed,false));
   
    // start and max records
    parsed = pHelper.getParameterValues(request,"startPosition");
    if ((parsed != null) && (parsed.length) > 0) {
      qOptions.setStartRecord(Math.max(Val.chkInt(parsed[0],1),1));
    }
    parsed = pHelper.getParameterValues(request,"maxRecords");
    if ((parsed != null) && (parsed.length) > 0) {
      qOptions.setMaxRecords(Val.chkInt(parsed[0],10));
    }
   
    // result type
    locator = "resultType";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_ResultType);
    qOptions.setResultType(vHelper.validateValue(supported,locator,parsed,false));
    if (qOptions.getResultType() == null) {
      qOptions.setResultType(CswConstants.ResultType_Hits);
    }
   
    // query type names
    locator = "typeNames";
    parsed = pHelper.getParameterValues(request,locator);
    qOptions.setQueryTypeNames(vHelper.validateValues(locator,parsed,false));
   
    // response element set type
    locator = "ElementSetName";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementSetType);
    qOptions.setElementSetType(vHelper.validateValue(supported,locator,parsed,false));
   
    // response element names
    if (qOptions.getElementSetType() == null) {
      // TODO supported ElementNames this for GetRecordById as well?
      locator = "ElementName";
      parsed = pHelper.getParameterValues(request,locator,",");
      supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementName);
      qOptions.setElementNames(vHelper.validateValues(supported,locator,parsed,false));
    }
   
    // constraint language
    locator = "constraintLanguage";
    parsed = pHelper.getParameterValues(request,locator);
    supported = new SupportedValues("CQL_TEXT,FILTER",",");
    String constraintLanguage = vHelper.validateValue(supported,locator,parsed,false);
   
    // constraint version
    locator = "constraint_language_version";
    parsed = pHelper.getParameterValues(request,locator);
    String constraintVersion = vHelper.validateValue(locator,parsed,false);
    qOptions.setQueryConstraintVersion(constraintVersion);
   
    // constraint text
    locator = "constraint";
    parsed = pHelper.getParameterValues(request,locator);
    String constraint = vHelper.validateValue(locator,parsed,false);
   
    // csw:CqlText
    if ((constraintLanguage != null) && constraintLanguage.equalsIgnoreCase("CQL_TEXT")) {
      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) {
View Full Code Here


   
    // initialize
    LOGGER.finer("Handling csw:GetRecords request XML...");
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
    IProviderFactory factory = context.getProviderFactory();
   
    // service and version are parsed by the parent RequestHandler
   
    // TODO requestId
       
    // output format
    locator = "@outputFormat";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
   
    // output schema
    locator = "@outputSchema";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputSchema);
    qOptions.setOutputSchema(vHelper.validateValue(supported,locator,parsed,false));
   
    // start and max records
    qOptions.setStartRecord(Math.max(Val.chkInt(xpath.evaluate("@startPosition",root),1),1));
    qOptions.setMaxRecords(Val.chkInt(xpath.evaluate("@maxRecords",root),10))
   
    // result type
    locator = "@resultType";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_ResultType);
    qOptions.setResultType(vHelper.validateValue(supported,locator,parsed,false));
    if (qOptions.getResultType() == null) {
      qOptions.setResultType(CswConstants.ResultType_Hits);
    }
   
    // find the query node
    locator = "csw:Query";
    Node ndQuery = (Node)xpath.evaluate(locator,root,XPathConstants.NODE);
    if (ndQuery != null) {
   
      // query type names
      locator = "csw:Query/@typeNames";
      parsed = pHelper.getParameterValues(root,xpath,"@typeNames");
      qOptions.setQueryTypeNames(vHelper.validateValues(locator,parsed,false));
             
      // response element set type
      locator = "csw:ElementSetName";
      parsed = pHelper.getParameterValues(ndQuery,xpath,locator);
      supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementSetType);
      qOptions.setElementSetType(vHelper.validateValue(supported,locator,parsed,false));
     
      // response element set type names
      String elementSetType = qOptions.getElementSetType();
      if (elementSetType != null) {
        locator = "csw:ElementSetName/@typeNames";
        parsed = pHelper.getParameterValues(ndQuery,xpath,locator);
        qOptions.setElementSetTypeNames(vHelper.validateValues(locator,parsed,false));
      }
     
      // response element names
      if (elementSetType == null) {
        // TODO supported ElementNames
        locator = "csw:ElementName";
        parsed = pHelper.getParameterValues(ndQuery,xpath,locator);
        supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementName);
        qOptions.setElementNames(vHelper.validateValues(supported,locator,parsed,false));
      }
     
      // find the constraint node
View Full Code Here

    // initialize
    AsnContext context = this.getAssertionContext();
    AsnFactory factory = context.getAssertionFactory();
    AsnRequestOptions rOptions = context.getRequestOptions();
    AsnResponse opResponse = context.getOperationResponse();
    ParseHelper pHelper = new ParseHelper();
    String[] parsed;
   
    // parse the HTTP request
    if (request != null) {
   
      // set the IP address
      rOptions.setIPAddress(request.getRemoteAddr());
     
      // parse an operations request
      boolean isOperationsRequest = false;
      if (request.getRequestURI() != null) {
        isOperationsRequest = request.getRequestURI().toLowerCase().endsWith("/operations");
      }
      if (isOperationsRequest) {
        rOptions.setSubject(AsnConstants.APP_URN_PREFIX);
        rOptions.setPredicate(AsnConstants.APP_URN_PREFIX+":assertion:operations");
       
      // parse a non-operations request
      } else {
 
        // subject
        parsed = pHelper.getParameterValues(request,"s");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"subject");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setSubject(parsed[0]);
        }
       
        // predicate
        parsed = pHelper.getParameterValues(request,"p");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"predicate");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setPredicate(parsed[0]);
        }
       
        // value
        parsed = pHelper.getParameterValues(request,"v");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"value");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setValue(parsed[0]);
        }
       
        // output format
        parsed = pHelper.getParameterValues(request,"f");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"format");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          opResponse.setOutputFormat(parsed[0]);
        }
       
        // start and max records start=&max=
        parsed = pHelper.getParameterValues(request,"start");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"startRecord");
          if ((parsed == null) || (parsed.length) == 0) {
            parsed = pHelper.getParameterValues(request,"startPosition");
          }
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setStartRecord(Math.max(Val.chkInt(parsed[0],1),1));
        }
        parsed = pHelper.getParameterValues(request,"max");
        if ((parsed == null) || (parsed.length) == 0) {
          parsed = pHelper.getParameterValues(request,"maxRecords");
        }
        if ((parsed != null) && (parsed.length) > 0) {
          rOptions.setMaxRecords(Val.chkInt(parsed[0],10));
        }
      }
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:GetCapabilities request URL...");
    CapabilityOptions cOptions = context.getRequestOptions().getCapabilityOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
   
    // service and version and language code are parsed by the parent RequestHandler,
    // the language code is initialized within the associated IProviderFactory
               
    // output format
    locator = "acceptFormats";
    parsed = pHelper.getParameterValues(request,locator,",");
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    String outputFormat = Val.chkStr(vHelper.negotiateValue(supported,locator,parsed,false));
    if (outputFormat.length() > 0) {
      context.getOperationResponse().setOutputFormat(outputFormat);
    } else {
      locator = "outputFormat";
      parsed = pHelper.getParameterValues(request,locator);
      supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
      outputFormat = vHelper.validateValue(supported,locator,parsed,false);
      context.getOperationResponse().setOutputFormat(outputFormat);
    }
   
    // sections (an empty sections parameter should return all non-optional sections)
    locator = "sections";
    parsed = pHelper.getParameterValues(request,locator,",");
    if ((parsed != null) && (parsed.length == 0)) {
      cOptions.setSections(new StringSet());
      cOptions.getSections().add("Filter_Capabilities");
    } else {
      supported = new SupportedValues(
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:GetCapabilities request XML...");
    CapabilityOptions cOptions = context.getRequestOptions().getCapabilityOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;

    // service and version are parsed by the parent RequestHandler
       
    // output format
    locator = "ows:AcceptFormats/ows:OutputFormat";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    String outputFormat = Val.chkStr(vHelper.negotiateValue(supported,locator,parsed,false));
    if (outputFormat.length() > 0) {
      context.getOperationResponse().setOutputFormat(outputFormat);
    } else {
      locator = "@outputFormat";
      parsed = pHelper.getParameterValues(root,xpath,locator);
      supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
      outputFormat = vHelper.validateValue(supported,locator,parsed,false);
      context.getOperationResponse().setOutputFormat(outputFormat);
    }
   
    // sections (an empty sections parameter should return all non-optional sections)
    locator = "ows:Sections/ows:Section";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = new SupportedValues(
        "ServiceIdentification,ServiceProvider,OperationsMetadata,Filter_Capabilities",",");
    if (parsed == null) {
      parsed = pHelper.getParameterValues(root,xpath,"ows:Sections");
      if (parsed != null) {
        cOptions.setSections(new StringSet());
        cOptions.getSections().add("Filter_Capabilities");
      } else {
        cOptions.setSections(vHelper.validateValues(supported,locator,parsed,false));
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:GetRecordById request URL...");
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
   
    // service and version are parsed by the parent RequestHandler
   
    // output format
    locator = "outputFormat";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
       
    // output schema
    locator = "outputSchema";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputSchema);
    qOptions.setOutputSchema(vHelper.validateValue(supported,locator,parsed,false));
   
    // IDs
    locator = "Id";
    parsed = pHelper.getParameterValues(request,locator,",");
    qOptions.setIDs(vHelper.validateValues(locator,parsed,true));
   
    // validate the ID count if an original output schema was requested
    this.validateIfOriginalSchema(context,"Id","outputSchema");
   
    // result type
    qOptions.setResultType(CswConstants.ResultType_Results);
   
    // response element set type
    locator = "ElementSetName";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementSetType);
    qOptions.setElementSetType(vHelper.validateValue(supported,locator,parsed,false));
   
    // default element set type for GetRecordById is summary
    if (Val.chkStr(qOptions.getElementSetType()).length() == 0) {
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:GetRecordById request XML...");
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;

    // service and version are parsed by the parent RequestHandler
       
    // output format
    locator = "@outputFormat";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
   
    // output schema
    locator = "@outputSchema";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputSchema);
    qOptions.setOutputSchema(vHelper.validateValue(supported,locator,parsed,false));
   
    // IDs
    locator = "csw:Id";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    qOptions.setIDs(vHelper.validateValues(locator,parsed,true));
   
    // validate the ID count if an original output schema was requested
    this.validateIfOriginalSchema(context,"csw:Id","@outputSchema");
   
    // result type
    qOptions.setResultType(CswConstants.ResultType_Results);
   
    // response element set type
    locator = "csw:ElementSetName";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_ElementSetType);
    qOptions.setElementSetType(vHelper.validateValue(supported,locator,parsed,false));
   
    // response element set type names
    String elementSetType = qOptions.getElementSetType();
    if (elementSetType != null) {
      locator = "csw:ElementSetName/@typeNames";
      parsed = pHelper.getParameterValues(root,xpath,locator);
      qOptions.setElementSetTypeNames(vHelper.validateValues(locator,parsed,false));
    }
   
    // default element set type for GetRecordById is summary
    if (Val.chkStr(qOptions.getElementSetType()).length() == 0) {
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:DescribeRecord request URL...");
    DescribeRecordOptions drOptions = context.getRequestOptions().getDescribeRecordOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
   
    // service and version are parsed by the parent RequestHandler
   
    // output format
    locator = "outputFormat";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
   
    // schema language
    locator = "schemaLanguage";
    parsed = pHelper.getParameterValues(request,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_SchemaLanguage);
    drOptions.setSchemaLanguage(vHelper.validateValue(supported,locator,parsed,false));
   
    // type names
    locator = "TypeName";
    parsed = pHelper.getParameterValues(request,locator,",");
    drOptions.setTypeNames(vHelper.validateValues(locator,parsed,false));
   
    // execute
    this.execute(context);
  }
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:DescribeRecord request XML...");
    DescribeRecordOptions drOptions = context.getRequestOptions().getDescribeRecordOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
   
    // service and version are parsed by the parent RequestHandler
   
    // output format
    locator = "@outputFormat";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
   
    // schema language
    locator = "@schemaLanguage"
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_SchemaLanguage);
    drOptions.setSchemaLanguage(vHelper.validateValue(supported,locator,parsed,false));
   
    // type names
    locator = "csw:TypeName";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    drOptions.setTypeNames(vHelper.validateValues(locator,parsed,false));
   
    // execute
    this.execute(context);
  }
View Full Code Here

   
    // initialize
    LOGGER.finer("Handling csw:Transaction request XML...");
    TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
    ServiceProperties svcProps = context.getServiceProperties();
    ParseHelper pHelper = new ParseHelper();
    ValidationHelper vHelper = new ValidationHelper();
    String locator;
    String[] parsed;
    ISupportedValues supported;
    NodeList nlActions;
    IOperationProvider opProvider = null;
   
    // service and version are parsed by the parent RequestHandler
   
    // output format
    locator = "@outputFormat";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = svcProps.getSupportedValues(CswConstants.Parameter_OutputFormat);
    context.getOperationResponse().setOutputFormat(
        vHelper.validateValue(supported,locator,parsed,false));
   
   
    // verbose response
    locator = "@verboseResponse";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    supported = new SupportedValues("true,false",",");
    String verbose = Val.chkStr(vHelper.validateValue(supported,locator,parsed,false));
    tOptions.setVerboseResponse(verbose.equalsIgnoreCase("true"));
       
    // request ID
    locator = "@requestId";
    parsed = pHelper.getParameterValues(root,xpath,locator);
    tOptions.setRequestId(vHelper.validateValue(locator,parsed,false));
   
    // determine the sub-operation

    // Insert
View Full Code Here

TOP

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

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.