@Override public void setCapabilities(WFSGetCapabilities capabilities) { net.opengis.wfs20.WFSCapabilitiesType caps = (WFSCapabilitiesType) capabilities.getParsedCapabilities(); this.capabilities = caps; typeInfos.clear(); FeatureTypeListType featureTypeList = this.capabilities.getFeatureTypeList(); @SuppressWarnings("unchecked") List<FeatureTypeType> featureTypes = featureTypeList.getFeatureType(); for (FeatureTypeType typeInfo : featureTypes) { QName name = typeInfo.getName(); typeInfos.put(name, typeInfo); } }
@Override public FilterCapabilities getFilterCapabilities() { return capabilities.getFilterCapabilities(); }
/** * @return the operation metadata advertised in the capabilities for the given operation * @see #getServerSupportedOutputFormats(WFSOperationType) */ protected OperationType getOperationMetadata(final WFSOperationType operation) { final OperationsMetadataType operationsMetadata = capabilities.getOperationsMetadata(); @SuppressWarnings("unchecked") final List<OperationType> operations = operationsMetadata.getOperation(); final String expectedOperationName = operation.getName(); for (OperationType operationType : operations) { String operationName = operationType.getName(); if (expectedOperationName.equalsIgnoreCase(operationName)) { return operationType; } } throw new NoSuchElementException( "Operation metadata not found for " + expectedOperationName + " in the capabilities document"); }
/** * Maps to the capabilities' service identification abstract * * @see ServiceInfo#getDescription() */ public String getDescription() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null) { return null; } // The Abstract is of Type LanguageStringType, not String. StringBuilder sb = new StringBuilder(); for (Object line : serviceIdentification.getAbstract()) { if (line instanceof LanguageStringType) { sb.append(((LanguageStringType) line).getValue()); } else { sb.append(line); } } // end of for return sb.toString(); }
/** @see WFSServiceInfo#getVersion() */ public String getVersion() { return capabilities.getVersion(); } }
/** @see ServiceInfo#getPublisher() */ public URI getPublisher() { ServiceProviderType serviceProvider = capabilities.getServiceProvider(); if (null == serviceProvider) { return null; } OnlineResourceType providerSite = serviceProvider.getProviderSite(); if (null == providerSite) { return null; } String href = providerSite.getHref(); try { return href == null ? null : new URI(href); } catch (URISyntaxException e) { return null; } }
/** @see ServiceInfo#getTitle() */ public String getTitle() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null || serviceIdentification.getTitle() == null || serviceIdentification.getTitle().isEmpty()) { return null; } return ((LanguageStringType) serviceIdentification.getTitle().get(0)).getValue(); }
/** @see WFSServiceInfo#getVersion() */ public String getVersion() { return capabilities.getVersion(); } }
/** @see ServiceInfo#getPublisher() */ public URI getPublisher() { ServiceProviderType serviceProvider = capabilities.getServiceProvider(); if (null == serviceProvider) { return null; } OnlineResourceType providerSite = serviceProvider.getProviderSite(); if (null == providerSite) { return null; } String href = providerSite.getHref(); try { return href == null ? null : new URI(href); } catch (URISyntaxException e) { return null; } }
/** * Maps to the capabilities' service identification keywords list * * @see ServiceInfo#getDescription() */ public Set<String> getKeywords() { Set<String> kws = new HashSet<String>(); ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification != null) { @SuppressWarnings("unchecked") List<KeywordsType> keywords = serviceIdentification.getKeywords(); if (keywords != null) { for (KeywordsType k : keywords) { for (LanguageStringType s : (List<LanguageStringType>) k.getKeyword()) { kws.add(s.getValue()); } } kws.remove(null); } } return kws; }
@Override protected String getOperationURI(WFSOperationType operation, HttpMethod method) { OperationsMetadataType omt = this.capabilities.getOperationsMetadata(); omt.getOperation(); List<OperationType> operations = capabilities.getOperationsMetadata().getOperation(); for (OperationType op : operations) { if (!operation.getName().equals(op.getName())) {
@Override public FilterCapabilities getFilterCapabilities() { return capabilities.getFilterCapabilities(); }
@Override public void setCapabilities(WFSGetCapabilities capabilities) { net.opengis.wfs20.WFSCapabilitiesType caps = (WFSCapabilitiesType) capabilities.getParsedCapabilities(); this.capabilities = caps; typeInfos.clear(); FeatureTypeListType featureTypeList = this.capabilities.getFeatureTypeList(); @SuppressWarnings("unchecked") List<FeatureTypeType> featureTypes = featureTypeList.getFeatureType(); for (FeatureTypeType typeInfo : featureTypes) { QName name = typeInfo.getName(); typeInfos.put(name, typeInfo); } }
/** * Maps to the capabilities' service identification abstract * * @see ServiceInfo#getDescription() */ public String getDescription() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null) { return null; } @SuppressWarnings("unchecked") List<String> abs = serviceIdentification.getAbstract(); return abs == null || abs.isEmpty() ? null : abs.get(0); }
/** * @return the operation metadata advertised in the capabilities for the given operation * @see #getServerSupportedOutputFormats(WFSOperationType) */ protected OperationType getOperationMetadata(final WFSOperationType operation) { final OperationsMetadataType operationsMetadata = capabilities.getOperationsMetadata(); @SuppressWarnings("unchecked") final List<OperationType> operations = operationsMetadata.getOperation(); final String expectedOperationName = operation.getName(); for (OperationType operationType : operations) { String operationName = operationType.getName(); if (expectedOperationName.equalsIgnoreCase(operationName)) { return operationType; } } throw new NoSuchElementException( "Operation metadata not found for " + expectedOperationName + " in the capabilities document"); }
/** @see ServiceInfo#getTitle() */ public String getTitle() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification == null || serviceIdentification.getTitle() == null || serviceIdentification.getTitle().isEmpty()) { return null; } return String.valueOf(serviceIdentification.getTitle().get(0)); }
@Override protected String getOperationURI(WFSOperationType operation, HttpMethod method) { OperationsMetadataType omt = this.capabilities.getOperationsMetadata(); omt.getOperation(); List<OperationType> operations = capabilities.getOperationsMetadata().getOperation(); for (OperationType op : operations) { if (!operation.getName().equals(op.getName())) {
/** * Maps to the capabilities' service identification keywords list * * @see ServiceInfo#getDescription() */ public Set<String> getKeywords() { Set<String> kws = new HashSet<String>(); ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); if (serviceIdentification != null) { @SuppressWarnings("unchecked") List<KeywordsType> keywords = serviceIdentification.getKeywords(); if (keywords != null) { for (KeywordsType k : keywords) { for (LanguageStringType s : (List<LanguageStringType>) k.getKeyword()) { kws.add(s.getValue()); } } kws.remove(null); } } return kws; }