@Override
protected void onValidate(IValidatable validatable) {
String directory = (String) validatable.getValue();
DataStore store = null;
Map<String, Serializable> params = new HashMap<String, Serializable>();
try {
// check the store can be built (we need to provide the namespace as well
params.put(DirectoryDataStoreFactory.URLP.key, new File(directory).toURI().toURL());
params.put(DirectoryDataStoreFactory.NAMESPACE.key, new URI("http://www.geoserver.org"));
store = DataStoreFinder.getDataStore(params);
if (store == null) {
error(validatable, "ImportPage.invalidPath");
} else if (store.getTypeNames().length == 0) {
error(validatable, "ImportPage.noData");
}
} catch(Exception e) {
error(validatable, "ImportPage.noData");
}