Пример #1
0
  /** create a response object from the GMLFeatureCollections store into the submitted HashMap */
  protected OGCWebServiceResponse[] createResponse(HashMap map, String[] affectedFeatureTypes)
      throws Exception {
    Debug.debugMethodBegin(this, "createResponse");

    String outputFormat = ((WFSGetFeatureRequest) request).getOutputFormat();

    OGCWebServiceResponse[] responses = new OGCWebServiceResponse[affectedFeatureTypes.length];
    for (int i = 0; i < affectedFeatureTypes.length; i++) {
      FeatureType ft = config.getFeatureType(affectedFeatureTypes[i]);
      OutputFormat of = ft.getOutputFormat(outputFormat);
      if (of == null) {
        throw new Exception("Outputformat: " + outputFormat + " is not known!");
      }

      Class cl = Class.forName(of.getResponsibleClass());
      DataStoreOutputFormat dsof = (DataStoreOutputFormat) cl.newInstance();

      ParameterList pl = of.getParameter();
      pl.addParameter(affectedFeatureTypes[i], dsof);
      Object fc = dsof.format(map, pl);

      // create response object
      OGCWebServiceResponse response = null;
      try {
        String[] s = new String[] {affectedFeatureTypes[i]};
        responses[i] = WFSProtocolFactory.createWFSGetFeatureResponse(request, s, null, fc);
      } catch (Exception e) {
        Debug.debugException(e, " - ");
        OGCWebServiceException exce =
            new OGCWebServiceException_Impl(e.toString(), "DBDataStore createResponse idx1");
        response = WFSProtocolFactory.createWFSGetFeatureResponse(request, null, exce, null);
        Debug.debugMethodEnd();
      }
    }

    Debug.debugMethodEnd();

    return responses;
  }