@Override public URI getSchema() { String namespaceURI = eType.getName().getNamespaceURI(); try { return XMLConstants.NULL_NS_URI.equals(namespaceURI) ? null : new URI(namespaceURI); } catch (URISyntaxException e) { return null; } }
@Override public FeatureTypeType translateTypeInfo(FeatureTypeType typeInfo) { if ("wfs".equals(typeInfo.getName().getPrefix()) || "http://www.opengis.net/wfs".equals(typeInfo.getName().getNamespaceURI())) { QName newName = new QName( "http://mapserver.gis.umn.edu/mapserver", typeInfo.getName().getLocalPart(), "ms"); typeInfo.setName(newName); } return typeInfo; }
@Override public String getName() { return config.localTypeName(eType.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); } }
@Override public URI getSchema() { String namespaceURI = eType.getName().getNamespaceURI(); try { return XMLConstants.NULL_NS_URI.equals(namespaceURI) ? null : new URI(namespaceURI); } catch (URISyntaxException e) { return null; } }
/** * @see WFSProtocol#getFeatureTypeNames() */ public Set<QName> getFeatureTypeNames() { Set<QName> typeNames = new HashSet<QName>(); for (FeatureTypeType typeInfo : typeInfos.values()) { QName name = typeInfo.getName(); typeNames.add(name); } return typeNames; }
@Override public FeatureTypeType translateTypeInfo(FeatureTypeType typeInfo) { if ("wfs".equals(typeInfo.getName().getPrefix()) || "http://www.opengis.net/wfs".equals(typeInfo.getName().getNamespaceURI())) { QName newName = new QName( "http://mapserver.gis.umn.edu/mapserver", typeInfo.getName().getLocalPart(), "ms"); typeInfo.setName(newName); } return typeInfo; }
/** * @see WFSProtocol#getFeatureTypeName(String) */ public QName getFeatureTypeName(String typeName) { FeatureTypeType featureTypeInfo = getFeatureTypeInfo(typeName); QName name = featureTypeInfo.getName(); return name; }
@Override public String getName() { return config.localTypeName(eType.getName()); }
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); } }
private URL getDescribeFeatureTypeURLGet(String typeName, String outputFormat) { final FeatureTypeType typeInfo = getFeatureTypeInfo(typeName); final URL describeFeatureTypeUrl = getOperationURL(DESCRIBE_FEATURETYPE, false); Map<String, String> kvp = new HashMap<String, String>(); kvp.put("SERVICE", "WFS"); kvp.put("VERSION", getServiceVersion().toString()); kvp.put("REQUEST", "DescribeFeatureType"); kvp.put("TYPENAME", typeName); QName name = typeInfo.getName(); if (!XMLConstants.DEFAULT_NS_PREFIX.equals(name.getPrefix())) { String nsUri = name.getNamespaceURI(); kvp.put("NAMESPACE", "xmlns(" + name.getPrefix() + "=" + nsUri + ")"); } // ommit output format by now, server should just return xml shcema // kvp.put("OUTPUTFORMAT", outputFormat); URL url; try { url = http.createUrl(describeFeatureTypeUrl, kvp); } catch (MalformedURLException e) { throw new RuntimeException(e); } return url; }
@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); } }