2 * Copyright (C) 2015 Roland Haeder
\r
4 * This program is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
17 package org.mxchange.addressbook.application;
\r
19 import org.mxchange.addressbook.BaseFrameworkSystem;
\r
20 import org.mxchange.addressbook.UnhandledUserChoiceException;
\r
21 import org.mxchange.addressbook.client.Client;
\r
22 import org.mxchange.addressbook.client.console.ConsoleClient;
\r
23 import org.mxchange.addressbook.manager.application.ApplicationManager;
\r
26 * ============================================
\r
27 * AddressbookApplication management:
\r
28 * ============================================
\r
30 * Inernet("public" service) and Intranet
\r
33 * - Single-user local application
\r
44 * + Cell phone number
\r
52 * - Categorization of contacts
\r
55 * - Permanent storage in database
\r
58 * - Multi-user web application
\r
59 * - Local user registration / login / resend confirmation link / password
\r
61 * - User groups (aka. teams)
\r
62 * - Administration area (user role)
\r
63 * + Create/edit/delete groups
\r
64 * + Edit/delete/lock/unlock user
\r
65 * + Assign user roles/rights
\r
66 * - Allow other users / groups to view addressbook
\r
67 * + Full addressbook
\r
68 * + Only some categories
\r
70 * + Allow users/guests (not recommended)
\r
71 * - XML export of addressbook and compressable (ZIP)
\r
72 * - Form to contact other user/group without need of mail program
\r
73 * + User can disabled this
\r
74 * - Directory for ussers/groups (who allowed to be listed)
\r
75 * + Simple click to add user to own addressbook
\r
79 * - Multi-language support
\r
81 * Version 2.2+:("socialized")
\r
82 * - "Social login" (OpenID consumer)
\r
83 * + Connect user account to social account
\r
85 * - "Social profile"
\r
87 * + RSS/activity feed
\r
89 * ============================================
\r
91 * ============================================
\r
97 * + Initial tables: contacts, categories, contact_category
\r
101 * + Additional tables: admins (?), admin_rights, groups,
\r
102 * users, user_contacts, user_user_rights, user_category_rights,
\r
106 * + Additional tables: languages (disable, enable language "pack" ?)
\r
110 * + Additional tables: ???
\r
112 * @author Roland Haeder
\r
116 public class AddressbookApplication extends BaseFrameworkSystem implements Application {
\r
118 * Application title
\r
120 public static final String APP_TITLE = "Addressbuch";
\r
123 * Application version
\r
125 public static final String APP_VERSION = "0.0";
\r
128 * Main method (entry point)
\r
130 * @param args the command line arguments
\r
132 public static void main (String[] args) {
\r
133 // Start application
\r
134 new AddressbookApplication().start();
\r
138 * Bootstraps application
\r
141 public void doBootstrap () {
\r
142 this.getLogger().debug("Initializing application ...");
\r
144 // Init client instance
\r
145 Client client = new ConsoleClient(this);
\r
147 // Init client instance
\r
148 this.setClient(client);
\r
150 // The application is running at this point
\r
151 this.getClient().enableIsRunning();
\r
155 * Main loop of the application
\r
158 public void doMainLoop () {
\r
159 // @TODO The application should be running now
\r
161 // Output introduction
\r
164 // Set current menu to main
\r
165 this.getClient().setCurrentMenu("main");
\r
167 // --- Main loop starts here ---
\r
168 while (this.getClient().isRunning()) {
\r
169 // The application is still active, show menu selection
\r
170 this.getClient().showCurrentMenu();
\r
173 // Ask for user input and run proper method
\r
174 this.getClient().doUserMenuChoice();
\r
175 } catch (final UnhandledUserChoiceException ex) {
\r
176 this.getLogger().catching(ex);
\r
179 // --- Main loop ends here ---
\r
182 this.getLogger().debug("Main loop exit - shutting down ...");
\r
186 * Show introduction which depends on client
\r
188 private void showIntro () {
\r
189 // Let the client show it
\r
190 this.getClient().showWelcome();
\r
194 * Launches the application
\r
196 private void start () {
\r
197 this.getLogger().info("Program is started.");
\r
199 // Launch application
\r
200 ApplicationManager.getManager(this).start();
\r
202 this.getLogger().info("End of program (last line)");
\r