@Override public void setCapabilities(WFSGetCapabilities capabilities) { WFSCapabilitiesType caps = (WFSCapabilitiesType) capabilities.getParsedCapabilities(); this.capabilities = caps; String version = caps.getVersion(); try { this.serviceVersion = Versions.find(version); } catch (IllegalArgumentException e) { LOGGER.warning( "Capabilities document didn't advertise a supported version (" + version + "). Defaulting to " + this.serviceVersion); } typeInfos.clear(); FeatureTypeListType featureTypeList = this.capabilities.getFeatureTypeList(); if (featureTypeList == null || featureTypeList.getFeatureType().isEmpty()) { Loggers.MODULE.info( "WFS Server contains no FeatureTypes: " + getOperationURI(GET_CAPABILITIES, GET)); return; } @SuppressWarnings("unchecked") List<FeatureTypeType> featureTypes = featureTypeList.getFeatureType(); for (FeatureTypeType typeInfo : featureTypes) { FeatureTypeType transTypeInfo = translateTypeInfo(typeInfo); QName name = transTypeInfo.getName(); typeInfos.put(name, transTypeInfo); } }
/** @see WFSStrategy#getFilterCapabilities() */ @Override public FilterCapabilities getFilterCapabilities() { FilterCapabilities wfsFilterCapabilities; wfsFilterCapabilities = capabilities.getFilterCapabilities(); return wfsFilterCapabilities; }
/** * @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(); return serviceIdentification == null ? null : serviceIdentification.getAbstract(); }
private ServiceIdentificationType getServiceIdentification() { ServiceIdentificationType serviceId = capabilities.getServiceIdentification(); if (serviceId == null) { LOGGER.info("Capabilities did not provide a ServiceIdentification section"); serviceId = Ows10Factory.eINSTANCE.createServiceIdentificationType(); capabilities.setServiceIdentification(serviceId); } return serviceId; }
@Override public boolean supportsTransaction(QName typeName) { try { getFeatureTypeInfo(typeName); } catch (IllegalArgumentException e) { throw e; } if (!supportsOperation(TRANSACTION, POST)) { return false; } OperationsType operations = this.capabilities.getFeatureTypeList().getOperations(); if (operations == null) { return false; } @SuppressWarnings("unchecked") List<net.opengis.wfs.OperationType> operation = operations.getOperation(); for (net.opengis.wfs.OperationType required : Arrays.asList( net.opengis.wfs.OperationType.INSERT_LITERAL, net.opengis.wfs.OperationType.UPDATE_LITERAL, net.opengis.wfs.OperationType.DELETE_LITERAL)) { if (!operation.contains(required)) { info( "Transactions not supported since WFS didn't declare support for " + required.getName()); return false; } } return true; }
/** @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 WFSServiceInfo#getVersion() */ public String getVersion() { return capabilities.getVersion(); } }
/** * Sets the "WFS_Capabilities" element */ public void setWFSCapabilities(net.opengis.wfs.WFSCapabilitiesType wfsCapabilities) { synchronized (monitor()) { check_orphaned(); net.opengis.wfs.WFSCapabilitiesType target = null; target = (net.opengis.wfs.WFSCapabilitiesType)get_store().find_element_user(WFSCAPABILITIES$0, 0); if (target == null) { target = (net.opengis.wfs.WFSCapabilitiesType)get_store().add_element_user(WFSCAPABILITIES$0); } target.set(wfsCapabilities); } }
/** @see ServiceInfo#getTitle() */ public String getTitle() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); return serviceIdentification == null ? null : serviceIdentification.getTitle(); }
public WFS_1_1_0_Protocol(InputStream capabilitiesReader, HTTPProtocol http, Charset defaultEncoding) throws IOException { this.defaultEncoding = defaultEncoding; this.strategy = new DefaultWFSStrategy(); this.capabilities = parseCapabilities(capabilitiesReader); this.http = http; this.typeInfos = new HashMap<String, FeatureTypeType>(); final List<FeatureTypeType> ftypes = capabilities.getFeatureTypeList().getFeatureType(); QName typeName; for (FeatureTypeType ftype : ftypes) { typeName = ftype.getName(); assert !("".equals(typeName.getPrefix())); String prefixedTypeName = typeName.getPrefix() + ":" + typeName.getLocalPart(); typeInfos.put(prefixedTypeName, ftype); } }
/** @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 WFSServiceInfo#getVersion() */ public String getVersion() { return capabilities.getVersion(); } }
/** * 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) { kws.addAll(k.getKeyword()); } kws.remove(null); } } return kws; }
List<OperationType> operations = capabilities.getOperationsMetadata().getOperation(); for (OperationType op : operations) { if (!operation.getName().equals(op.getName())) {
@Override public void setCapabilities(WFSGetCapabilities capabilities) { WFSCapabilitiesType caps = (WFSCapabilitiesType) capabilities.getParsedCapabilities(); this.capabilities = caps; String version = caps.getVersion(); try { this.serviceVersion = Versions.find(version); } catch (IllegalArgumentException e) { LOGGER.warning( "Capabilities document didn't advertise a supported version (" + version + "). Defaulting to " + this.serviceVersion); } typeInfos.clear(); FeatureTypeListType featureTypeList = this.capabilities.getFeatureTypeList(); if (featureTypeList == null || featureTypeList.getFeatureType().isEmpty()) { Loggers.MODULE.info( "WFS Server contains no FeatureTypes: " + getOperationURI(GET_CAPABILITIES, GET)); return; } @SuppressWarnings("unchecked") List<FeatureTypeType> featureTypes = featureTypeList.getFeatureType(); for (FeatureTypeType typeInfo : featureTypes) { FeatureTypeType transTypeInfo = translateTypeInfo(typeInfo); QName name = transTypeInfo.getName(); typeInfos.put(name, transTypeInfo); } }
OperationType operationMetadata = getOperationMetadata(WFSOperationType.GET_FEATURE); List<DomainType> parameters = operationMetadata.getParameter(); List featuretypes = capabilities.getFeatureTypeList().getFeatureType();
/** * @see WFSProtocol#getFilterCapabilities() */ public FilterCapabilities getFilterCapabilities() { FilterCapabilities wfsFilterCapabilities; wfsFilterCapabilities = capabilities.getFilterCapabilities(); return wfsFilterCapabilities; }
/** * @see WFSProtocol#getServiceProviderUri() */ public URI getServiceProviderUri() { ServiceProviderType serviceProvider = capabilities.getServiceProvider(); if (serviceProvider == null) { return null; } OnlineResourceType providerSite = serviceProvider.getProviderSite(); if (providerSite == null) { return null; } String href = providerSite.getHref(); if (href == null) { return null; } try { return new URI(href); } catch (URISyntaxException e) { return null; } }
/** * Maps to the capabilities' service identification abstract * * @see ServiceInfo#getDescription() */ public String getDescription() { ServiceIdentificationType serviceIdentification = capabilities.getServiceIdentification(); return serviceIdentification == null ? null : serviceIdentification.getAbstract(); }