* No instances can be created of this class
*/
protected BaseAddressbookSystem () {
- // Init properties file
- this.initProperties();
}
}
*/
package org.mxchange.addressbook.application;
+import java.io.IOException;
import java.text.MessageFormat;
import org.mxchange.addressbook.BaseAddressbookSystem;
import org.mxchange.addressbook.client.AddressbookClient;
import org.mxchange.addressbook.client.console.ConsoleClient;
import org.mxchange.addressbook.client.gui.SwingClient;
+import org.mxchange.jcore.BaseFrameworkSystem;
import org.mxchange.jcore.application.Application;
import org.mxchange.jcore.client.Client;
import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
/**
* Protected constructor
+ * @throws java.io.IOException If any IO error occurs
*/
- protected AddressbookApplication () {
- // Always init i18n bundle in this application
+ protected AddressbookApplication () throws IOException {
+ // Init properties file
+ this.initProperties();
+
+ // Init bundle
this.initBundle();
}
* @param args the command line arguments
*/
public static void main (String[] args) {
- // Start application
- new AddressbookApplication().start(args);
+ try {
+ // Start application
+ new AddressbookApplication().start(args);
+ } catch (final IOException ex) {
+ // Get instance
+ BaseFrameworkSystem.getInstance().getLogger().catching(ex);
+ System.exit(1);
+ }
}
/**
*/
package org.mxchange.addressbook.client;
+import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import org.mxchange.addressbook.menu.Menu;
import org.mxchange.jcore.client.BaseClient;
import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.jcore.manager.database.ManageableDatabase;
/**
/**
* Initializes contact manager
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+ * @throws java.sql.SQLException If any SQL error occurs
*/
- protected void initContactManager () {
+ protected void initContactManager () throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
*/
package org.mxchange.addressbook.client.console;
+import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Scanner;
import org.mxchange.addressbook.application.AddressbookApplication;
import org.mxchange.addressbook.client.AddressbookClient;
import org.mxchange.addressbook.client.BaseAddressbookClient;
-import org.mxchange.jcore.contact.Contact;
-import org.mxchange.jcore.contact.Gender;
import org.mxchange.addressbook.contact.user.UserContact;
import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
import org.mxchange.addressbook.manager.contact.ManageableAddressbookContact;
import org.mxchange.addressbook.menu.item.SelectableMenuItem;
import org.mxchange.addressbook.menu.item.console.ConsoleMenuItem;
import org.mxchange.jcore.application.Application;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
/**
* A client for the console
}
/**
- * Inizializes this client
+ * Initializes this client
*/
@Override
public void init () {
this.getLogger().trace("CALLED!"); //NOI18N
// Init contact manager here
- this.initContactManager();
+ try {
+ this.initContactManager();
+ } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
+ // End here
+ this.abortProgramWithException(ex);
+ }
// Fill menu map
this.fillMenuMap();
*/
package org.mxchange.addressbook.client.gui;
-import org.mxchange.jcore.client.gui.ClientFrame;
+import java.sql.SQLException;
import org.mxchange.addressbook.client.AddressbookClient;
import org.mxchange.addressbook.client.BaseAddressbookClient;
import org.mxchange.addressbook.menu.Menu;
import org.mxchange.addressbook.menu.item.SelectableMenuItem;
import org.mxchange.jcore.application.Application;
+import org.mxchange.jcore.client.gui.ClientFrame;
import org.mxchange.jcore.contact.Contact;
import org.mxchange.jcore.contact.Gender;
import org.mxchange.jcore.exceptions.FrameAlreadyInitializedException;
import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
/**
*
// Debug message
this.getLogger().trace("CALLED!"); //NOI18N
- // Init contact manager here
- this.initContactManager();
-
try {
+ // Init contact manager here
+ this.initContactManager();
+
// Init frame
this.frame.init();
- } catch (final FrameAlreadyInitializedException ex) {
+ } catch (final FrameAlreadyInitializedException | UnsupportedDatabaseBackendException | SQLException ex) {
// Abort program
this.abortProgramWithException(ex);
}
* Constructor which accepts a contact manager
*
* @param manager Manager instance
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+ * @throws java.sql.SQLException If any SQL error occurs
*/
- public AddressbookContactDatabaseFrontend (final AddressbookContactManager manager) {
+ public AddressbookContactDatabaseFrontend (final AddressbookContactManager manager) throws UnsupportedDatabaseBackendException, SQLException {
// Call own constructor
this();
}
/**
- * Basic constrcutor
+ * Default but protected constructor
* @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
* @throws java.sql.SQLException Any SQL exception from e.g. MySQL connector
*/
* Checks whether own contact is found in database
*
* @return Whether own contact is found
+ * @throws java.io.IOException If any IO error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
*/
@Override
- public boolean isOwnContactFound () throws SQLException {
+ public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException {
// Get search criteria instance
SearchableCritera critera = new SearchCriteria();
*/
package org.mxchange.addressbook.database.frontend.contact;
+import java.io.IOException;
import java.sql.SQLException;
import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException;
import org.mxchange.jcore.contact.Contact;
*
* @return Whether own contact is found
* @throws java.sql.SQLException If any SQL error occurs
+ * @throws java.io.IOException If an IO error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
*/
- public boolean isOwnContactFound () throws SQLException;
+ public boolean isOwnContactFound () throws SQLException, IOException, BadTokenException;
/**
* Reads a single row and parses it to a contact instance
*/
package org.mxchange.addressbook.manager.contact;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.ArrayList;
import org.mxchange.jcore.contact.Gender;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.UnhandledUserChoiceException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.jcore.manager.BaseManager;
/**
* a client instance.
*
* @param client Client instance to use
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the database backend is not supported
+ * @throws java.sql.SQLException If an SQL error occurs
*/
- public AddressbookContactManager (final Client client) {
+ public AddressbookContactManager (final Client client) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
this.getLogger().trace(MessageFormat.format("client={1} - CALLED!", client)); //NOI18N
/**
* Shuts down this contact manager
+ *
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws java.io.IOException If an IO error occurs
*/
@Override
- public void doShutdown () {
+ public void doShutdown () throws SQLException, IOException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
this.getLogger().debug(MessageFormat.format("columnName={0}", columnName));
// Now get that column
- Object value = contact.getValueFromColumn(columnName);
+ Object value = null;
+ try {
+ value = contact.getValueFromColumn(columnName);
+ } catch (final IllegalArgumentException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ this.abortProgramWithException(ex);
+ }
// Trace message
this.getLogger().trace(MessageFormat.format("value={0} - EXIT!", value));
try {
// Deligate this call to frontend
isAdded = this.getContactDatabase().isOwnContactFound();
- } catch (final SQLException ex) {
+ } catch (final SQLException | IOException | BadTokenException ex) {
// Something bad happened
this.abortProgramWithException(ex);
}