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.client.Client;
\r
21 import org.mxchange.addressbook.client.console.ConsoleClient;
\r
22 import org.mxchange.addressbook.manager.application.ApplicationManager;
\r
25 * ============================================
\r
26 * AddressbookApplication management:
\r
27 * ============================================
\r
29 * Inernet("public" service) and Intranet
\r
32 * - Single-user local application
\r
43 * + Cell phone number
\r
51 * - Categorization of contacts
\r
54 * - Permanent storage in database
\r
57 * - Multi-user web application
\r
58 * - Local user registration / login / resend confirmation link / password
\r
60 * - User groups (aka. teams)
\r
61 * - Administration area (user role)
\r
62 * + Create/edit/delete groups
\r
63 * + Edit/delete/lock/unlock user
\r
64 * + Assign user roles/rights
\r
65 * - Allow other users / groups to view addressbook
\r
66 * + Full addressbook
\r
67 * + Only some categories
\r
69 * + Allow users/guests (not recommended)
\r
70 * - XML export of addressbook and compressable (ZIP)
\r
71 * - Form to contact other user/group without need of mail program
\r
72 * + User can disabled this
\r
73 * - Directory for ussers/groups (who allowed to be listed)
\r
74 * + Simple click to add user to own addressbook
\r
78 * - Multi-language support
\r
80 * Version 2.2+:("socialized")
\r
81 * - "Social login" (OpenID consumer)
\r
82 * + Connect user account to social account
\r
84 * - "Social profile"
\r
86 * + RSS/activity feed
\r
88 * ============================================
\r
90 * ============================================
\r
96 * + Initial tables: contacts, categories, contact_category
\r
100 * + Additional tables: admins (?), admin_rights, groups,
\r
101 * users, user_contacts, user_user_rights, user_category_rights,
\r
105 * + Additional tables: languages (disable, enable language "pack" ?)
\r
109 * + Additional tables: ???
\r
111 * @author Roland Haeder
\r
115 public class AddressbookApplication extends BaseFrameworkSystem implements Application {
\r
117 * Application title
\r
119 public static final String APP_TITLE = "Addressbuch";
\r
122 * Application version
\r
124 public static final String APP_VERSION = "0.0";
\r
127 * Main method (entry point)
\r
129 * @param args the command line arguments
\r
131 public static void main (String[] args) {
\r
132 // Start application
\r
133 new AddressbookApplication().start ();
\r
137 * Bootstraps application
\r
140 public void doBootstrap () {
\r
141 this.getLogger().debug("Initializing application ...");
\r
143 // Init client instance
\r
144 Client client = new ConsoleClient(this);
\r
146 // Init client instance
\r
147 this.setClient(client);
\r
149 // The application is running at this point
\r
150 this.getClient().enableIsRunning();
\r
154 * Main loop of the application
\r
157 public void doMainLoop () {
\r
158 // @TODO The application should be running now
\r
160 // Output introduction
\r
163 // Set current menu to main
\r
164 this.getClient().setCurrentMenu("main");
\r
166 // --- Main loop starts here ---
\r
167 while (this.getClient().isApplicationRunning()) {
\r
168 // The application is still active, show menu selection
\r
169 this.getClient().showCurrentMenu();
\r
172 // Ask for user input and run proper method
\r
173 this.getClient().doUserMenuChoice();
\r
174 } catch (final Exception ex) {
\r
175 this.getLogger().catching(ex);
\r
178 // --- Main loop ends here ---
\r
181 this.getLogger().debug("Main loop exit - shutting down ...");
\r
185 * Show introduction which depends on client
\r
187 private void showIntro () {
\r
188 // Let the client show it
\r
189 this.getClient().showWelcome();
\r
193 * Launches the application
\r
195 private void start () {
\r
196 this.getLogger().info("Program is started.");
\r
198 // Launch application
\r
199 ApplicationManager.getManager(this).start ();
\r
201 this.getLogger().info("End of program (last line)");
\r