コード例 #1
0
ファイル: XMLFactory.java プロジェクト: camptocamp/secureOWS
  /**
   * Exports a <code>WFSCapabilities</code> instance to a <code>WFSCapabilitiesDocument</code>.
   *
   * @param capabilities
   * @return DOM representation of the <code>WFSCapabilities</code>
   * @throws IOException if XML template could not be loaded
   */
  public static WFSCapabilitiesDocument export(WFSCapabilities capabilities) throws IOException {
    LOG.entering();
    WFSCapabilitiesDocument capabilitiesDocument = new WFSCapabilitiesDocument();

    try {
      capabilitiesDocument.createEmptyDocument();
      Element root = capabilitiesDocument.getRootElement();

      ServiceIdentification serviceIdentification = capabilities.getServiceIdentification();
      if (serviceIdentification != null) {
        appendServiceIdentification(root, serviceIdentification);
      }

      ServiceProvider serviceProvider = capabilities.getServiceProvider();
      if (serviceProvider != null) {
        appendServiceProvider(root, capabilities.getServiceProvider());
      }

      OperationsMetadata operationsMetadata = capabilities.getOperationsMetadata();
      if (operationsMetadata != null) {
        appendOperationsMetadata(root, operationsMetadata);
      }
      FeatureTypeList featureTypeList = capabilities.getFeatureTypeList();
      if (featureTypeList != null) {
        appendFeatureTypeList(root, featureTypeList);
      }
      GMLObject[] servesGMLObjectTypes = capabilities.getServesGMLObjectTypeList();
      if (servesGMLObjectTypes != null) {
        appendGMLObjectTypeList(root, WFS, "wfs:ServesGMLObjectTypeList", servesGMLObjectTypes);
      }
      GMLObject[] supportsGMLObjectTypes = capabilities.getSupportsGMLObjectTypeList();
      if (supportsGMLObjectTypes != null) {
        appendGMLObjectTypeList(root, WFS, "wfs:SupportsGMLObjectTypeList", supportsGMLObjectTypes);
      }
      Contents contents = capabilities.getContents();
      if (contents != null) {
        // appendContents(root, contents);
      }

      FilterCapabilities filterCapabilities = capabilities.getFilterCapabilities();
      if (filterCapabilities != null) {
        org.deegree.model.filterencoding.XMLFactory.appendFilterCapabilities110(
            root, filterCapabilities);
      }
    } catch (SAXException e) {
      LOG.logError(e.getMessage(), e);
    }
    LOG.exiting();
    return capabilitiesDocument;
  }
コード例 #2
0
 /**
  * Creates a new instance of <code>GetFeatureHandler</code>. Only called by the <code>WFService
  * </code>.
  *
  * @param service associated WFService
  */
 GetFeatureHandler(WFService service) {
   this.service = service;
   WFSCapabilities capa = service.getCapabilities();
   WFSOperationsMetadata md = (WFSOperationsMetadata) capa.getOperationsMetadata();
   OWSDomainType[] dt = md.getConstraints();
   for (int i = 0; i < dt.length; i++) {
     if (dt[i].getName().equals("DefaultMaxFeatures")) {
       try {
         String tmp = dt[i].getValues()[0];
         maxFeatures = Integer.parseInt(tmp);
       } catch (Exception e) {
         // e.printStackTrace();
       }
       break;
     }
   }
   LOG.logDebug("default maxFeatures " + maxFeatures);
 }