@Test public void testQueryCapabilities() throws Exception { URL url = TestData.url(STATE_POP); Map<String, Serializable> params = new HashMap<>(); params.put(URLP.key, url); DataStore dataStore = factory.createDataStore(params); Name typeName = dataStore.getNames().get(0); SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName); QueryCapabilities caps = featureSource.getQueryCapabilities(); SortBy[] sortBy = new SortBy[] { SortBy.NATURAL_ORDER, }; assertTrue("Natural", caps.supportsSorting(sortBy)); SimpleFeatureType schema = featureSource.getSchema(); String attr = schema.getDescriptor(1).getLocalName(); sortBy[0] = ff.sort(attr, SortOrder.ASCENDING); assertTrue("Sort " + attr, caps.supportsSorting(sortBy)); sortBy[0] = ff.sort("the_geom", SortOrder.ASCENDING); assertFalse("Cannot sort the_geom", caps.supportsSorting(sortBy)); }
public DataStore createDataStore(Map<String, Serializable> params) throws IOException { URL url = lookup(URLP, params, URL.class); Boolean isMemoryMapped = lookup(MEMORY_MAPPED, params, Boolean.class); Boolean cacheMemoryMaps = lookup(CACHE_MEMORY_MAPS, params, Boolean.class); URI namespace = lookup(NAMESPACEP, params, URI.class); Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class); TimeZone dbfTimeZone = lookup(DBFTIMEZONE, params, TimeZone.class); Boolean isCreateSpatialIndex = lookup(CREATE_SPATIAL_INDEX, params, Boolean.class); Boolean isEnableSpatialIndex = (Boolean) ENABLE_SPATIAL_INDEX.lookUp(params); if (isEnableSpatialIndex == null) { isEnableSpatialIndex = Boolean.TRUE; } File dir = URLs.urlToFile(url); if (dir != null && dir.isDirectory()) { return new DirectoryDataStore( URLs.urlToFile(url), new ShpFileStoreFactory(this, params)); } else { ShpFiles shpFiles = new ShpFiles(url); boolean isLocal = shpFiles.isLocal(); boolean useMemoryMappedBuffer = isLocal && isMemoryMapped.booleanValue(); boolean enableIndex = isEnableSpatialIndex.booleanValue() && isLocal; boolean createIndex = isCreateSpatialIndex.booleanValue() && enableIndex; ShapefileDataStore store = new ShapefileDataStore(url); if (namespace != null) { store.setNamespaceURI(namespace.toString()); } store.setMemoryMapped(useMemoryMappedBuffer); store.setBufferCachingEnabled(cacheMemoryMaps); store.setCharset(dbfCharset); store.setTimeZone(dbfTimeZone); store.setIndexed(enableIndex); store.setIndexCreationEnabled(createIndex); return store; } }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { URL url = lookup(URLP, params, URL.class); Boolean isMemoryMapped = lookup(MEMORY_MAPPED, params, Boolean.class); Boolean cacheMemoryMaps = lookup(CACHE_MEMORY_MAPS, params, Boolean.class); URI namespace = lookup(NAMESPACEP, params, URI.class); Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class); TimeZone dbfTimeZone = lookup(DBFTIMEZONE, params, TimeZone.class); Boolean isCreateSpatialIndex = lookup(CREATE_SPATIAL_INDEX, params, Boolean.class); Boolean isEnableSpatialIndex = (Boolean) ENABLE_SPATIAL_INDEX.lookUp(params); if (isEnableSpatialIndex == null) { isEnableSpatialIndex = Boolean.TRUE; } File dir = URLs.urlToFile(url); if (dir != null && dir.isDirectory()) { return new DirectoryDataStore( URLs.urlToFile(url), new ShpFileStoreFactory(this, params)); } else { ShpFiles shpFiles = new ShpFiles(url); boolean isLocal = shpFiles.isLocal(); boolean useMemoryMappedBuffer = isLocal && isMemoryMapped.booleanValue(); boolean enableIndex = isEnableSpatialIndex.booleanValue() && isLocal; boolean createIndex = isCreateSpatialIndex.booleanValue() && enableIndex; ShapefileDataStore store = new ShapefileDataStore(url); if (namespace != null) { store.setNamespaceURI(namespace.toString()); } store.setMemoryMapped(useMemoryMappedBuffer); store.setBufferCachingEnabled(cacheMemoryMaps); store.setCharset(dbfCharset); store.setTimeZone(dbfTimeZone); store.setIndexed(enableIndex); store.setIndexCreationEnabled(createIndex); return store; } } }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { URL url = lookup(URLP, params, URL.class); Boolean isMemoryMapped = lookup(MEMORY_MAPPED, params, Boolean.class); Boolean cacheMemoryMaps = lookup(CACHE_MEMORY_MAPS, params, Boolean.class); URI namespace = lookup(NAMESPACEP, params, URI.class); Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class); TimeZone dbfTimeZone = lookup(DBFTIMEZONE, params, TimeZone.class); Boolean isCreateSpatialIndex = lookup(CREATE_SPATIAL_INDEX, params, Boolean.class); Boolean isEnableSpatialIndex = (Boolean) ENABLE_SPATIAL_INDEX.lookUp(params); if (isEnableSpatialIndex == null) { isEnableSpatialIndex = Boolean.TRUE; } File dir = URLs.urlToFile(url); if (dir != null && dir.isDirectory()) { return new DirectoryDataStore( URLs.urlToFile(url), new ShpFileStoreFactory(this, params)); } else { ShpFiles shpFiles = new ShpFiles(url); boolean isLocal = shpFiles.isLocal(); boolean useMemoryMappedBuffer = isLocal && isMemoryMapped.booleanValue(); boolean enableIndex = isEnableSpatialIndex.booleanValue() && isLocal; boolean createIndex = isCreateSpatialIndex.booleanValue() && enableIndex; ShapefileDataStore store = new ShapefileDataStore(url); if (namespace != null) { store.setNamespaceURI(namespace.toString()); } store.setMemoryMapped(useMemoryMappedBuffer); store.setBufferCachingEnabled(cacheMemoryMaps); store.setCharset(dbfCharset); store.setTimeZone(dbfTimeZone); store.setIndexed(enableIndex); store.setIndexCreationEnabled(createIndex); return store; } }  }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { URL url = lookup(URLP, params, URL.class); Boolean isMemoryMapped = lookup(MEMORY_MAPPED, params, Boolean.class); Boolean cacheMemoryMaps = lookup(CACHE_MEMORY_MAPS, params, Boolean.class); URI namespace = lookup(NAMESPACEP, params, URI.class); Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class); TimeZone dbfTimeZone = lookup(DBFTIMEZONE, params, TimeZone.class); Boolean isCreateSpatialIndex = lookup(CREATE_SPATIAL_INDEX, params, Boolean.class); Boolean isEnableSpatialIndex = (Boolean) ENABLE_SPATIAL_INDEX.lookUp(params); if (isEnableSpatialIndex == null) { isEnableSpatialIndex = Boolean.TRUE; } File dir = URLs.urlToFile(url); if (dir != null && dir.isDirectory()) { return new DirectoryDataStore( URLs.urlToFile(url), new ShpFileStoreFactory(this, params)); } else { ShpFiles shpFiles = new ShpFiles(url); boolean isLocal = shpFiles.isLocal(); boolean useMemoryMappedBuffer = isLocal && isMemoryMapped.booleanValue(); boolean enableIndex = isEnableSpatialIndex.booleanValue() && isLocal; boolean createIndex = isCreateSpatialIndex.booleanValue() && enableIndex; ShapefileDataStore store = new ShapefileDataStore(url); if (namespace != null) { store.setNamespaceURI(namespace.toString()); } store.setMemoryMapped(useMemoryMappedBuffer); store.setBufferCachingEnabled(cacheMemoryMaps); store.setCharset(dbfCharset); store.setTimeZone(dbfTimeZone); store.setIndexed(enableIndex); store.setIndexCreationEnabled(createIndex); return store; } }  String getDisplayName(); String getDescription(); Param[] getParametersInfo(); boolean isAvailable(); Map<Key, ?> getImplementationHints(); DataStore createDataStore(Map<String, Serializable> params); DataStore createNewDataStore(Map<String, Serializable> params); @Override boolean canProcess(Map<String, Serializable> params); boolean canProcess(URL f); @Override String[] getFileExtensions(); @Override FileDataStore createDataStore(URL url); @Override String getTypeName(URL url); }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { public DataStore createDataStore(Map<String, Serializable> params) throws IOException { URL url = lookup(URLP, params, URL.class); Boolean isMemoryMapped = lookup(MEMORY_MAPPED, params, Boolean.class); Boolean cacheMemoryMaps = lookup(CACHE_MEMORY_MAPS, params, Boolean.class); URI namespace = lookup(NAMESPACEP, params, URI.class); Charset dbfCharset = lookup(DBFCHARSET, params, Charset.class); TimeZone dbfTimeZone = lookup(DBFTIMEZONE, params, TimeZone.class); Boolean isCreateSpatialIndex = lookup(CREATE_SPATIAL_INDEX, params, Boolean.class); Boolean isEnableSpatialIndex = (Boolean) ENABLE_SPATIAL_INDEX.lookUp(params); if (isEnableSpatialIndex == null) { isEnableSpatialIndex = Boolean.TRUE; } File dir = URLs.urlToFile(url); if (dir != null && dir.isDirectory()) { return new DirectoryDataStore( URLs.urlToFile(url), new ShpFileStoreFactory(this, params)); } else { ShpFiles shpFiles = new ShpFiles(url); boolean isLocal = shpFiles.isLocal(); boolean useMemoryMappedBuffer = isLocal && isMemoryMapped.booleanValue(); boolean enableIndex = isEnableSpatialIndex.booleanValue() && isLocal; boolean createIndex = isCreateSpatialIndex.booleanValue() && enableIndex; ShapefileDataStore store = new ShapefileDataStore(url); if (namespace != null) { store.setNamespaceURI(namespace.toString()); } store.setMemoryMapped(useMemoryMappedBuffer); store.setBufferCachingEnabled(cacheMemoryMaps); store.setCharset(dbfCharset); store.setTimeZone(dbfTimeZone); store.setIndexed(enableIndex); store.setIndexCreationEnabled(createIndex); return store; } }  String getDisplayName(); String getDescription(); Param[] getParametersInfo(); boolean isAvailable(); Map<Key, ?> getImplementationHints(); DataStore createDataStore(Map<String, Serializable> params); DataStore createNewDataStore(Map<String, Serializable> params); @Override boolean canProcess(Map<String, Serializable> params); boolean canProcess(URL f); @Override String[] getFileExtensions(); @Override FileDataStore createDataStore(URL url); @Override String getTypeName(URL url); static final Param URLP; static final Param NAMESPACEP; static final Param MEMORY_MAPPED; static final Param CACHE_MEMORY_MAPS; static final Param FILE_TYPE; static final Param CREATE_SPATIAL_INDEX; static final Param DBFCHARSET; static final Param FSTYPE; static final Param DBFTIMEZONE; static final Param ENABLE_SPATIAL_INDEX; }