@Test public void testFSTypeParameter() throws Exception { URL url = TestData.url(STATE_POP); Map<String, Serializable> params = new HashMap<>(); params.put(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)); }
@Override public boolean canProcess(Map<String, Serializable> 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 = URLs.urlToFile(url); if (dir != null && dir.isDirectory() && fileType == null) { String dirPath = dir.getPath(); String[] vpfTables = {"LAT", "LHT", "DHT", "lat", "lht", "dht"}; for (int itab = 0; itab < vpfTables.length; itab++) { String tabFilename = vpfTables[itab]; String pathTab = dirPath.concat(File.separator).concat(tabFilename); if (new File(pathTab).exists()) { return false; } } } return dir != null && dir.isDirectory() && (fileType == null || "shapefile".equals(fileType)); } } catch (IOException e) { return false; } }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { @Override public boolean canProcess(Map<String, Serializable> 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 = URLs.urlToFile(url); if (dir != null && dir.isDirectory() && fileType == null) { String dirPath = dir.getPath(); String[] vpfTables = {"LAT", "LHT", "DHT", "lat", "lht", "dht"}; for (int itab = 0; itab < vpfTables.length; itab++) { String tabFilename = vpfTables[itab]; String pathTab = dirPath.concat(File.separator).concat(tabFilename); if (new File(pathTab).exists()) { return false; } } } return dir != null && dir.isDirectory() && (fileType == null || "shapefile".equals(fileType)); } } catch (IOException e) { return false; } } }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { @Override public boolean canProcess(Map<String, Serializable> 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 = URLs.urlToFile(url); if (dir != null && dir.isDirectory() && fileType == null) { String dirPath = dir.getPath(); String[] vpfTables = {"LAT", "LHT", "DHT", "lat", "lht", "dht"}; for (int itab = 0; itab < vpfTables.length; itab++) { String tabFilename = vpfTables[itab]; String pathTab = dirPath.concat(File.separator).concat(tabFilename); if (new File(pathTab).exists()) { return false; } } } return dir != null && dir.isDirectory() && (fileType == null || "shapefile".equals(fileType)); } } catch (IOException e) { return false; } }  }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { @Override public boolean canProcess(Map<String, Serializable> 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 = URLs.urlToFile(url); if (dir != null && dir.isDirectory() && fileType == null) { String dirPath = dir.getPath(); String[] vpfTables = {"LAT", "LHT", "DHT", "lat", "lht", "dht"}; for (int itab = 0; itab < vpfTables.length; itab++) { String tabFilename = vpfTables[itab]; String pathTab = dirPath.concat(File.separator).concat(tabFilename); if (new File(pathTab).exists()) { return false; } } } return dir != null && 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<String, Serializable> params); boolean canProcess(URL f); @Override String[] getFileExtensions(); @Override FileDataStore createDataStore(URL url); @Override String getTypeName(URL url); }
ShapefileDataStoreFactory implements FileDataStoreFactorySpi { @Override public boolean canProcess(Map<String, Serializable> 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 = URLs.urlToFile(url); if (dir != null && dir.isDirectory() && fileType == null) { String dirPath = dir.getPath(); String[] vpfTables = {"LAT", "LHT", "DHT", "lat", "lht", "dht"}; for (int itab = 0; itab < vpfTables.length; itab++) { String tabFilename = vpfTables[itab]; String pathTab = dirPath.concat(File.separator).concat(tabFilename); if (new File(pathTab).exists()) { return false; } } } return dir != null && 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<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; }