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

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


    // 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) {
      qOptions.setElementSetType(CswConstants.ElementSetType_Summary);
    }
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) {
      qOptions.setElementSetType(CswConstants.ElementSetType_Summary);
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(
          "ServiceIdentification,ServiceProvider,OperationsMetadata,Filter_Capabilities",",");
      cOptions.setSections(vHelper.validateValues(supported,locator,parsed,false));
    }
   
    // execute
    this.execute(context);
  }
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));
      }
    } else {
      cOptions.setSections(vHelper.validateValues(supported,locator,parsed,false));
    }
   
    // execute
    this.execute(context);
  }
View Full Code Here

    // 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);
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
      Node ndConstraint = (Node)xpath.evaluate("csw:Constraint",ndQuery,XPathConstants.NODE);
      if (ndConstraint != null) {
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
    if (opProvider == null) {
View Full Code Here

TOP

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

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.