cli.getConsole().println("Import successful.");
} catch (GeoToolsOpException e) {
switch (e.statusCode) {
case TABLE_NOT_DEFINED:
throw new CommandFailedException(
"No tables specified for import. Specify --all or --table <table>.", e);
case ALL_AND_TABLE_DEFINED:
throw new CommandFailedException(
"Specify --all or --table <table>, both cannot be set.", e);
case NO_FEATURES_FOUND:
throw new CommandFailedException("No features were found in the database.", e);
case TABLE_NOT_FOUND:
throw new CommandFailedException("Could not find the specified table.", e);
case UNABLE_TO_GET_NAMES:
throw new CommandFailedException("Unable to get feature types from the database.",
e);
case UNABLE_TO_GET_FEATURES:
throw new CommandFailedException("Unable to get features from the database.", e);
case UNABLE_TO_INSERT:
throw new CommandFailedException(
"Unable to insert features into the working tree.", e);
case ALTER_AND_ALL_DEFINED:
throw new CommandFailedException(
"Alter cannot be used with --all option and more than one table.", e);
case INCOMPATIBLE_FEATURE_TYPE:
throw new CommandFailedException(
"The feature type of the data to import does not match the feature type of the destination tree and cannot be imported\n"
+ "USe the --force-featuretype switch to import using the original featuretype and crete a mixed type tree",
e);
default:
throw new CommandFailedException("Import failed with exception: "
+ e.statusCode.name(), e);
}
} finally {
dataStore.dispose();
cli.getConsole().flush();