@Override protected void wrapInternal(Map properties, SimpleHash model, WFSInfo wfsInfo) { WorkspaceInfo workspaceInfo = wfsInfo.getWorkspace(); properties.put("workspaceName", workspaceInfo != null ? workspaceInfo.getName() : "NO_WORKSPACE"); properties.put("enabled", wfsInfo.isEnabled() ? "true" : "false"); properties.put("name", wfsInfo.getName()); properties.put("title", wfsInfo.getTitle()); properties.put("maintainer", wfsInfo.getMaintainer()); properties.put("abstract", wfsInfo.getAbstract()); properties.put("accessConstraints", wfsInfo.getAccessConstraints()); properties.put("fees", wfsInfo.getFees()); properties.put("versions", wfsInfo.getVersions()); properties.put("keywords", wfsInfo.getKeywords()); properties.put("metadataLink", wfsInfo.getMetadataLink()); properties.put("citeCompliant", wfsInfo.isCiteCompliant() ? "true" : "false"); properties.put("onlineResource", wfsInfo.getOnlineResource()); properties.put("schemaBaseURL", wfsInfo.getSchemaBaseURL()); properties.put("verbose", wfsInfo.isVerbose() ? "true" : "false"); properties.put("maxFeatures", String.valueOf(wfsInfo.getMaxFeatures())); properties.put("isFeatureBounding", wfsInfo.isFeatureBounding() ? "true" : "false"); properties.put("serviceLevel", wfsInfo.getServiceLevel()); properties.put("isCanonicalSchemaLocation", wfsInfo.isCanonicalSchemaLocation() ? "true" : "false"); properties.put("encodeFeatureMember", wfsInfo.isEncodeFeatureMember() ? "true" : "false"); } });
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof WFSInfo)) return false; final WFSInfo other = (WFSInfo) obj; if (gml == null) { if (other.getGML() != null) return false; } else if (!gml.equals(other.getGML())) return false; if (maxFeatures != other.getMaxFeatures()) return false; if (featureBounding != other.isFeatureBounding()) return false; if (canonicalSchemaLocation != other.isCanonicalSchemaLocation()) return false; if (serviceLevel == null) { if (other.getServiceLevel() != null) return false; } else if (!serviceLevel.equals(other.getServiceLevel())) return false; if (encodeFeatureMember != other.isEncodeFeatureMember()) return false; if (hitsIgnoreMaxFeatures != other.isHitsIgnoreMaxFeatures()) return false; if (srs == null) { if (other.getSRS() != null) return false; } else if (!srs.equals(other.getSRS())) return false; return true; } }
private DomainType getTimeoutParameter(WFSInfo wfs) { Integer timeout = wfs.getMetadata().get(TimeoutCallback.TIMEOUT_CONFIG_KEY, Integer.class); if (timeout == null) { timeout = 300; } DomainType result = new DomainType("Timeout", String.valueOf(timeout)); return result; }
@Override protected WFSInfo initialize(WFSInfo service) { super.initialize(service); if (service.getVersions().isEmpty()) { service.getVersions().add(WFSInfo.Version.V_10.getVersion()); service.getVersions().add(WFSInfo.Version.V_11.getVersion()); if (!service.getVersions().contains(WFSInfo.Version.V_20.getVersion())) { service.getVersions().add(WFSInfo.Version.V_20.getVersion()); if (service.getGML() == null) { ((WFSInfoImpl) service).setGML(new HashMap<WFSInfo.Version, GMLInfo>()); GMLInfo gml = service.getGML().get(WFSInfo.Version.V_10); if (gml == null) { addGml(service, WFSInfo.Version.V_10, SrsNameStyle.URL, false); gml.setOverrideGMLAttributes(true); gml = service.getGML().get(WFSInfo.Version.V_11); if (gml == null) { addGml(service, WFSInfo.Version.V_11, SrsNameStyle.URN, false); gml = service.getGML().get(WFSInfo.Version.V_20); if (gml == null) { addGml(service, WFSInfo.Version.V_20, SrsNameStyle.URN2, false); if (service.getSRS() == null) { ((WFSInfoImpl) service).setSRS(new ArrayList<String>());
element("Name", wfs.getName()); element("Title", wfs.getTitle()); element("Abstract", wfs.getAbstract()); handleKeywords(wfs.getKeywords()); element("Fees", wfs.getFees()); element("AccessConstraints", wfs.getAccessConstraints()); end("Service");
@Override protected GMLInfo getGMLConfig(WFSInfo wfs) { return wfs.getGML().get(WFSInfo.Version.V_10); } }
ContactInfo contactInfo = wfs.getGeoServer().getGlobal().getSettings().getContact(); Contact contact = new Contact() .collect(Collectors.joining(" - "))) .url(contactInfo.getOnlineResource()); String title = wfs.getTitle() == null ? "WFS 3.0 server" : wfs.getTitle(); String version = getGeoServerVersion(); Info info = .contact(contact) .title(title) .description(wfs.getAbstract()) .version(version); api.info(info); Catalog catalog = wfs.getGeoServer().getCatalog(); List<String> validCollectionIds = catalog.getFeatureTypes() if (wfs.getMaxFeatures() > 0) { limitMax = BigDecimal.valueOf(wfs.getMaxFeatures()); } else { limitMax = BigDecimal.valueOf(Integer.MAX_VALUE);
if (wfs.isFeatureBounding()) { configuration.getProperties().remove(GMLConfiguration.NO_FEATURE_BOUNDS); } else { if (wfs.isCiteCompliant()) { wfs.getGML().get(WFSInfo.Version.V_11).getSrsNameStyle().toSrsSyntax()); if (wfs.isEncodeFeatureMember()) { configuration.getProperties().add(GMLConfiguration.ENCODE_FEATURE_MEMBER); } else { if (wfs.isCanonicalSchemaLocation()) { encoder.setSchemaLocation(getWfsNamespace(), getCanonicalWfsSchemaLocation()); } else {
transformer.setIndentation(wfs.isVerbose() ? INDENT_SIZE : (NO_FORMATTING)); transformer.setNumDecimals(numDecimals); transformer.setPadWithZeros(padWithZeros); transformer.setForceDecimalEncoding(forcedDecimal); transformer.setFeatureBounding(wfs.isFeatureBounding()); transformer.setCollectionBounding(wfs.isFeatureBounding()); transformer.setEncoding(Charset.forName(settings.getCharset())); if (wfs.isCanonicalSchemaLocation()) { transformer.addSchemaLocation(WFS.NAMESPACE, wfsCanonicalSchemaLocation()); } else { GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_10); transformer.setGmlPrefixing(wfs.isCiteCompliant() || !gml.getOverrideGMLAttributes());
int maxFeatures = Math.min(request.getMaxFeatures().intValue(), wfs.getMaxFeatures()); if (wfs.isHitsIgnoreMaxFeatures() && request.isResultTypeHits()) { maxFeatures = org.geotools.data.Query.DEFAULT_MAX; if (totalOffset == -1 && request.getVersion().startsWith("2") && (wfs.isCiteCompliant() || (request.getMaxFeatures() != null && request.getMaxFeatures().longValue() > 0 if (wfs.isFeatureBounding()) { metaAllPropNames = addGeometryProperties(meta, metaPropNames); } else {
@Test public void testNumReturnedMatchedWithMaxFeatures() throws Exception { WFSInfo wfs = getWFS(); int oldMaxFeatures = wfs.getMaxFeatures(); boolean oldHitsIgnoreMaxFeatures = wfs.isHitsIgnoreMaxFeatures(); try { wfs.setMaxFeatures(1); wfs.setHitsIgnoreMaxFeatures(true); getGeoServer().save(wfs); Document doc = getAsDOM( "wfs?request=GetFeature&typename=cdf:Seven&version=2.0.0&resultType=results&service=wfs"); assertGML32(doc); assertEquals("7", doc.getDocumentElement().getAttribute("numberMatched")); assertEquals("1", doc.getDocumentElement().getAttribute("numberReturned")); } finally { wfs.setMaxFeatures(oldMaxFeatures); wfs.setHitsIgnoreMaxFeatures(oldHitsIgnoreMaxFeatures); getGeoServer().save(wfs); } }
@Test public void testValues() throws Exception { WFSInfo wfs = getGeoServerApplication().getGeoServer().getService(WFSInfo.class); login(); tester.startPage(WFSAdminPage.class); tester.assertModelValue("form:maxFeatures", wfs.getMaxFeatures()); tester.assertModelValue( "form:maxNumberOfFeaturesForPreview", wfs.getMaxNumberOfFeaturesForPreview()); tester.assertModelValue("form:keywords", wfs.getKeywords()); }
public GML2(FeatureTypeInfo featureType, WFSInfo wfs, Catalog catalog) { super(featureType, wfs, catalog); builder = new FeatureTypeSchemaBuilder.GML2(wfs.getGeoServer()); } }
public void testValues() throws Exception { WFSInfo wfs = getGeoServerApplication().getGeoServer().getService(WFSInfo.class); login(); tester.startPage(WFSAdminPage.class); tester.assertModelValue("form:maxFeatures", wfs.getMaxFeatures()); tester.assertModelValue("form:keywords", wfs.getKeywords()); } }
public DomainType getSrsParameter(WFSInfo wfs) { List<String> extraSRS = wfs.getSRS(); Set<String> srsParameterValues; GMLInfo gml = wfs.getGML().get(WFSInfo.Version.V_20); String prefix = gml.getSrsNameStyle().getPrefix(); Function<String, String> epsgMapper = srs -> qualifySRS(prefix, srs); if (extraSRS != null && !extraSRS.isEmpty()) { srsParameterValues = extraSRS.stream() .map(epsgMapper) .collect(Collectors.toCollection(LinkedHashSet::new)); } else { srsParameterValues = new LinkedHashSet<>(); } // add values from feature types gs.getCatalog() .getFeatureTypes() .forEach( ft -> { String srs = epsgMapper.apply(ft.getSRS()); srsParameterValues.add(srs); }); // build the parameter DomainType srsParameter = new DomainType("srsName", new ArrayList<>(srsParameterValues)); return srsParameter; }
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd")); encoder.encode( hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output); } }
/** Encodes the GetFeature ows:Operation element. */ protected OperationMetadata getFeature() { String[] formats = getAvailableOutputFormatNames(GML32_FORMAT); OperationMetadata operation = new OperationMetadata("GetFeature", true, true); operation .getParameters() .add(new DomainType("resultType", new String[] {"results", "hits"})); operation.getParameters().add(new DomainType("outputFormat", formats)); operation.getConstraints().add(new DomainType("PagingIsTransactionSafe", FALSE)); operation .getConstraints() .add(new DomainType("CountDefault", String.valueOf(wfs.getMaxFeatures()))); operation .getParameters() .add(new DomainType("resolve", new String[] {"none", "local"})); return operation; }
protected List<String> getOtherSRS(FeatureTypeInfo featureType) { List<String> extraSRS; if (featureType.isOverridingServiceSRS()) { extraSRS = featureType.getResponseSRS(); } else { extraSRS = wfs.getSRS(); } return extraSRS; }
public FeatureTypeInfo[] run(DescribeFeatureTypeRequest request) throws WFSException { List<QName> names = new ArrayList<QName>(request.getTypeNames()); final boolean citeConformance = getWFS().isCiteCompliant(); if (!citeConformance) { getWFS().getGeoServer().getGlobal().getResourceErrorHandling());
schemaLocation.append(WFS20_URI); schemaLocation.append(" "); if (wfs.isCanonicalSchemaLocation()) { schemaLocation.append(org.geotools.wfs.v2_0.WFS.CANONICAL_SCHEMA_LOCATION); } else { delegate.serviceProvider(wfs.getGeoServer());