X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Faddressbook%2Fapplication%2FAddressbookApplication.java;h=dca6fe202e2dc7e9892f2a158a474f8ef4e5e7e5;hb=6728dbd7598e463076ac0c433ee43022b19c32f1;hp=4be3359bdbe5fb7c6a7cbb6d3d62d55fdaed979b;hpb=f2010ed4e24bb3e08ee7884184ee23f35193200d;p=addressbook-lib.git diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index 4be3359..dca6fe2 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -19,107 +19,23 @@ package org.mxchange.addressbook.application; import java.io.IOException; import java.sql.SQLException; 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.application.BaseApplication; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; import org.mxchange.jcore.manager.application.ApplicationManager; /** - * ============================================ - * AddressbookApplication management: - * ============================================ - * - * Inernet("public" service) and Intranet - * - * Version 1.0+: - * - Single-user local application - * - Fields: - * + Gender - * + Surname - * + Family name - * + Company name - * + Street + number - * + ZIP code - * + City - * + Landline number - * + Fax number - * + Cell phone number - * + Email address - * + Birth day - * + Comment (?) - * - Edit own data - * - Add new contact - * - Edit contacts - * - Delete contacts - * - Categorization of contacts - * - * Version 1.1+: - * - Permanent storage in database - * - * Version 2.0+: - * - Multi-user web application - * - Local user registration / login / resend confirmation link / password - * recovery - * - User groups (aka. teams) - * - Administration area (user role) - * + Create/edit/delete groups - * + Edit/delete/lock/unlock user - * + Assign user roles/rights - * - Allow other users / groups to view addressbook - * + Full addressbook - * + Only some categories - * - VCard export - * + Allow users/guests (not recommended) - * - XML export of addressbook and compressable (ZIP) - * - Form to contact other user/group without need of mail program - * + User can disabled this - * - Directory for ussers/groups (who allowed to be listed) - * + Simple click to add user to own addressbook - * + Search form? - * - * Version 2.1+: - * - Multi-language support - * - * Version 2.2+:("socialized") - * - "Social login" (OpenID consumer) - * + Connect user account to social account - * + Sync own data? - * - "Social profile" - * + OpenID provider - * + RSS/activity feed - * - * ============================================ - * Time esitmation: - * ============================================ - * 1.0 (console): - * + 2 days - * - * 1.1 (database): - * + 2 day - * + Initial tables: contacts, categories, contact_category - * - * 2.0 (web): - * + 3 days - * + Additional tables: admins (?), admin_rights, groups, - * users, user_contacts, user_user_rights, user_category_rights, - * - * 2.1 (language) - * + 1 day - * + Additional tables: languages (disable, enable language "pack" ?) - * - * 2.2 (social): - * + 3 days - * + Additional tables: ??? -* + * Address book application class. Please see ROADMAP.txt for details. + *

* @author Roland Haeder * @version 0.0 */ -public class AddressbookApplication extends BaseAddressbookSystem implements Application { +public class AddressbookApplication extends BaseApplication implements Application { /** * Application title @@ -143,14 +59,19 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Protected constructor + *

* @throws java.io.IOException If any IO error occurs */ protected AddressbookApplication () throws IOException { // Init properties file this.initProperties(); - // Init bundle - this.initBundle(); + // Is the bundle initialized? + if (!isBundledInitialized()) { + // Temporary initialize default bundle + // TODO The enum Gender uses this + this.initBundle(); + } } /** @@ -179,6 +100,15 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App } else { // Not client choosen this.getLogger().error("No client choosen. Cannot launch."); //NOI18N + + try { + this.doShutdown(); + } catch (final SQLException | IOException ex) { + // Abort here + this.abortProgramWithException(ex); + } + + // Bye ... System.exit(1); } @@ -206,7 +136,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App // Debug message this.getLogger().trace("CALLED!"); //NOI18N - // @TODO The application should be running now + // TODO The application should be running now // Output introduction this.showIntro(); @@ -245,10 +175,10 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App public void doShutdown () throws SQLException, IOException { // Trace message this.getLogger().trace("CALLED!"); //NOI18N - + // Shutdown client this.getClient().doShutdown(); - + this.getLogger().info("End of program (last line)"); //NOI18N System.exit(0); } @@ -274,7 +204,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Checks whether the client shoule be console client should be launched by * checking if -console is set. - * + *

* @return Whether console client should be taken */ private boolean isConsole () { @@ -284,7 +214,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Checks whether the client shoule be GUI client should be launched by * checking if -gui is set. - * + *

* @return Whether GUI client should be taken */ private boolean isGui () { @@ -293,7 +223,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Parses all given arguments - * + *

* @param args Arguments from program launch */ private void parseArguments (final String[] args) { @@ -333,7 +263,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Launches the application - * + *

* @param args Arguments handled to program */ private void start (final String args[]) { @@ -350,7 +280,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App this.parseArguments(args); // Launch application - ApplicationManager.getManager(this).start(); + ApplicationManager.getSingeltonManager(this).start(); // Good bye, but this should not be reached ... this.getLogger().warn("Unusual exit reached."); //NOI18N @@ -363,7 +293,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Main method (entry point) - * + *

* @param args the command line arguments */ public static void main (String[] args) { @@ -379,7 +309,7 @@ public class AddressbookApplication extends BaseAddressbookSystem implements App /** * Getter for printable application name - * + *

* @return A printable name */ public static String printableTitle () {