ShapefileDataStoreFactory implements FileDataStoreFactorySpi { @Override public boolean canProcess(Map params) { if (!DataUtilities.canProcess(params, getParametersInfo())) { return false; } try { URL url = (URL) URLP.lookUp(params); if (canProcess(url)) { return true; } else { Object fileType = FILE_TYPE.lookUp(params); File dir = DataUtilities.urlToFile(url); return dir.isDirectory() && (fileType == null || "shapefile".equals(fileType)); } } catch (IOException e) { return false; } }  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 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; }
@Test public void testFSTypeParameter() throws Exception { URL url = TestData.url(STATE_POP); KVP params = new KVP( URLP.key,url ); assertTrue( "Sorting is optional", factory.canProcess(params) ); params.put( FSTYPE.key, "shape-ng" ); assertTrue( "Shape NG supported", factory.canProcess(params) ); params.put(FSTYPE.key, "shape" ); assertTrue( "Plain shape supported", factory.canProcess(params) ); params.put(FSTYPE.key, "index" ); assertTrue( "Plain index supported", factory.canProcess(params) ); params.put( FSTYPE.key, "smurf" ); assertFalse( "Feeling blue; don't try a smruf", factory.canProcess(params) ); }