@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); } }
@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; }
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); } }
OperationType operationMetadata = getOperationMetadata(WFSOperationType.GET_FEATURE); List<DomainType> parameters = operationMetadata.getParameter(); List featuretypes = capabilities.getFeatureTypeList().getFeatureType();
@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); } }
@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; }