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

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


   * Generates the response.
   * @param context the operation context
   * @throws Exception if a processing exception occurs
   */
  public void generateResponse(OperationContext context) throws Exception {
    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 {
View Full Code Here


   */
  public void execute(OperationContext context) throws Exception {
   
    // initialize
    LOGGER.finer("Executing csw:GetRecords request...");
    IProviderFactory factory = context.getProviderFactory();
   
    // 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 {
View Full Code Here

    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) {
          String msg = "IProviderFactory.makeSortByParser: instantiation failed.";
          throw new OwsException(OwsException.OWSCODE_NoApplicableCode,locator,msg);
        } else {
          parser.parseSortBy(context,ndSortBy,xpath);
View Full Code Here

    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) {
       
        // constraint version
        String constraintVersion = xpath.evaluate("@version",ndConstraint);
        qOptions.setQueryConstraintVersion(constraintVersion);
   
        // csw:CqlText
        locator = "csw:CqlText";
        Node ndCql = (Node)xpath.evaluate(locator,ndConstraint,XPathConstants.NODE);
        if (ndCql != null) {
          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

   * Generates the response.
   * @param context the operation context
   * @throws Exception if a processing exception occurs
   */
  public void generateResponse(OperationContext context) throws Exception {
    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 {
View Full Code Here

   * @return the request handler
   */
  protected RequestHandler makeRequestHandler(HttpServletRequest request,
                                              HttpServletResponse response,
                                              RequestContext context) {
    IProviderFactory factory = new ProviderFactory();
    RequestHandler handler = factory.makeRequestHandler(
        request,context,this.cswSubContextPath,this.resourceFilePrefix);
    if (handler != null) {
      handler.getOperationContext().getServiceProperties().setAllowTransactions(this.allowTransactions);
    }
    return handler;
View Full Code Here

                               RequestContext context,
                               String id)
    throws Exception {
    RequestHandler handler = this.makeRequestHandler(request,response,context);
    OperationContext opContext = handler.getOperationContext();
    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 {
View Full Code Here

   * Executes a parsed operation request.
   * @param context the operation context
   * @throws Exception if a processing exception occurs
   */
  public void execute(OperationContext context) throws Exception {
    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 {
View Full Code Here

   */
  public void execute(OperationContext context) throws Exception {  
   
    // initialize
    LOGGER.finer("Executing csw:GetRecordById request...");
    IProviderFactory factory = context.getProviderFactory();
    QueryOptions qOptions = context.getRequestOptions().getQueryOptions();
    String outputSchema = Val.chkStr(qOptions.getOutputSchema());
    if (outputSchema.equalsIgnoreCase("original")) {
     
      // respond with the original XML
      this.validateIfOriginalSchema(context,"csw:Id","@outputSchema");
     
      IOriginalXmlProvider oxp = factory.makeOriginalXmlProvider(context);
      if (oxp == null) {
        String msg = "IProviderFactory.makeOriginalXmlProvider: instantiation failed.";
        LOGGER.log(Level.SEVERE,msg);
        throw new OwsException(msg);        
      } else {
        String id = qOptions.getIDs().iterator().next();
        String xml = oxp.provideOriginalXml(context,id);
        context.getOperationResponse().setResponseXml(xml);
      }
     
    } else {
     
      // 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.evaluateIdQuery(context,qOptions.getIDs().toArray(new String[0]));
      }
           
      // 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 {
View Full Code Here

   * Executes a parsed operation request.
   * @param context the operation context
   * @throws Exception if a processing exception occurs
   */
  public void execute(OperationContext context) throws Exception {
    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 {
View Full Code Here

TOP

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

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.