import java.util.Iterator;
import java.util.List;
import org.mxchange.addressbook.contact.Contact;
-import org.mxchange.addressbook.database.backend.csv.CsvBackend;
import org.mxchange.addressbook.database.frontend.BaseDatabaseFrontend;
import org.mxchange.addressbook.database.storage.Storeable;
import org.mxchange.addressbook.exceptions.BadTokenException;
+import org.mxchange.addressbook.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.addressbook.manager.contact.ContactManager;
/**
// Set "table" name
this.setTableName("contacts"); //NOI18N
- // Initalize backend
- this.initBackend();
+ try {
+ // Initalize backend
+ this.initBackend();
+ } catch (final UnsupportedDatabaseBackendException ex) {
+ // Abort program
+ this.abortProgramWithException(ex);
+ }
}
/**
this.getBackend().store((Storeable) contact);
} catch (final IOException ex) {
// Should not happen?
- this.getLogger().catching(ex);
- System.exit(1);
+ this.abortProgramWithException(ex);
}
}
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
- // Get iterator and case it
- CsvBackend backend = (CsvBackend) this.getBackend();
-
// First rewind to beginning
this.getBackend().rewind();
// Get backend iterator
Iterator<Contact> iterator = null;
try {
- iterator = backend.contactIterator();
+ iterator = this.getBackend().contactIterator();
} catch (final BadTokenException ex) {
- this.getLogger().catching(ex);
- System.exit(1);
+ // Abort program
+ this.abortProgramWithException(ex);
}
// Read all entries