@Override protected void checkAttribute(WMSMapContext con, SimpleFeatureType ft) { // find out which attribute we're going to use Map options = con.getRequest().getFormatOptions(); attribute = (String) options.get("regionateAttr"); if (attribute == null) { attribute = typeInfo.getRegionateAttribute(); } if (attribute == null) { LOGGER.log(Level.INFO, "No attribute specified, falling " + "back on geometry attribute"); attribute = ft.getGeometryDescriptor().getLocalName(); } else { // Make sure the attribute is actually there AttributeType attributeType = ft.getType(attribute); if (attributeType == null) { throw new WmsException("Could not find regionating attribute " + attribute + " in layer " + typeInfo.getName()); } } // geometry size is a double h2Type = "DOUBLE"; }
protected void checkAttribute(WMSMapContext con, SimpleFeatureType ft) { // find out which attribute we're going to use Map options = con.getRequest().getFormatOptions(); attribute = (String) options.get("regionateAttr"); if (attribute == null) attribute = typeInfo.getRegionateAttribute(); if (attribute == null) throw new WmsException( "Regionating attribute has not been specified"); // Make sure the attribute is actually there AttributeDescriptor ad = ft.getDescriptor(attribute); if (ad == null) { throw new WmsException("Could not find regionating attribute " + attribute + " in layer " + typeInfo.getName()); } // Make sure we know how to turn that attribute into a H2 type h2Type = getH2DataType(ad); if (h2Type == null) throw new WmsException("Attribute type " + ad.getType() + " is not " + "supported for external sorting on " + typeInfo.getName() + "#" + attribute); }
@Override protected String getDatabaseName(WMSMapContext con, MapLayer layer) throws Exception { fs = layer.getFeatureSource(); SimpleFeatureType type = (SimpleFeatureType) fs.getSchema(); // find out which attribute we're going to use Map options = con.getRequest().getFormatOptions(); attribute = (String) options.get("regionateAttr"); if (attribute == null) attribute = typeInfo.getRegionateAttribute(); if (attribute == null) throw new WmsException("Regionating attribute has not been specified"); // Make sure the attribute is actually there AttributeType attributeType = type.getType(attribute); if (attributeType == null) { throw new WmsException("Could not find regionating attribute " + attribute + " in layer " + typeInfo.getName()); } // check we can actually sort on that attribute if(!fs.getQueryCapabilities().supportsSorting(new SortBy[] {ff.sort(attribute, SortOrder.DESCENDING)})) throw new WmsException("Native sorting on the " + attribute + " is not possible for layer " + typeInfo.getName()); // make sure a special db for this layer and attribute will be created return super.getDatabaseName(con, layer) + "_" + attribute; }