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;
\r
19 import org.apache.logging.log4j.LogManager;
\r
20 import org.apache.logging.log4j.Logger;
\r
21 import org.mxchange.addressbook.application.Application;
\r
22 import org.mxchange.addressbook.client.Client;
\r
23 import org.mxchange.addressbook.manager.contact.ContactManager;
\r
24 import org.mxchange.addressbook.manager.contact.ManageableContact;
\r
29 * @author Roland Haeder
\r
31 public class BaseFrameworkSystem implements FrameworkInterface {
\r
35 private final Logger LOG;
\r
38 * Application instance
\r
40 private Application application;
\r
45 private Client client;
\r
48 * Contact manager instance
\r
50 private ManageableContact contactManager;
\r
53 * Name of used database table, handled over to backend
\r
55 private String tableName;
\r
61 LOG = LogManager.getLogger(this);
\r
65 * No instances can be created of this class
\r
67 protected BaseFrameworkSystem () {
\r
71 * Application instance
\r
73 * @return the application
\r
76 public Application getApplication () {
\r
77 return this.application;
\r
83 * @return the client
\r
86 public Client getClient () {
\r
91 * Contact manager instance
\r
92 * @return the contactManager
\r
95 public ManageableContact getContactManager () {
\r
96 return this.contactManager;
\r
100 * Contact manager instance
\r
101 * @param contactManager the contactManager to set
\r
103 protected void setContactManager (final ManageableContact contactManager) {
\r
104 this.contactManager = contactManager;
\r
109 * @param client the client to set
\r
111 protected void setClient (final Client client) {
\r
112 this.client = client;
\r
116 * Application instance
\r
118 * @param application the application to set
\r
120 protected void setApplication(final Application application) {
\r
121 this.application = application;
\r
125 * Getter for logger
\r
129 protected Logger getLogger () {
\r
134 * Name of used database table, handled over to backend
\r
136 * @return the tableName
\r
138 protected String getTableName () {
\r
139 return this.tableName;
\r
143 * Name of used database table, handled over to backend
\r
145 * @param tableName the tableName to set
\r
147 protected void setTableName (final String tableName) {
\r
148 this.tableName = tableName;
\r
152 * Initializes contact manager
\r
154 * @param client Client instance
\r
156 protected void initContactManager (final Client client) {
\r
158 this.getLogger().debug("Initializing contact manager ...");
\r
160 // Init contact manager with console client
\r
161 // @TODO Static initial amount of contacts
\r
162 ManageableContact manager = new ContactManager (100, client);
\r
165 this.setContactManager(manager);
\r
168 this.getLogger().debug("Contact manager has been initialized.");
\r