2 * Copyright (C) 2015 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.addressbook;
19 import java.util.ResourceBundle;
20 import org.apache.logging.log4j.LogManager;
21 import org.apache.logging.log4j.Logger;
22 import org.mxchange.addressbook.application.Application;
23 import org.mxchange.addressbook.client.Client;
24 import org.mxchange.addressbook.manager.contact.ManageableContact;
29 * @author Roland Haeder
31 public class BaseFrameworkSystem implements FrameworkInterface {
36 private final Logger LOG;
39 * Application instance
41 private Application application;
46 private final ResourceBundle bundle;
51 private Client client;
54 * Contact manager instance
56 private ManageableContact contactManager;
59 * Name of used database table, handled over to backend
61 private String tableName;
67 LOG = LogManager.getLogger(this);
68 bundle = ResourceBundle.getBundle("org/mxchange/addressbook/localization/bundle"); // NOI18N
72 * No instances can be created of this class
74 protected BaseFrameworkSystem () {
78 * Application instance
80 * @return the application
83 public final Application getApplication () {
84 return this.application;
93 public final Client getClient () {
98 * Contact manager instance
100 * @return the contactManager
103 public final ManageableContact getContactManager () {
104 return this.contactManager;
108 * Contact manager instance
110 * @param contactManager the contactManager to set
112 protected final void setContactManager (final ManageableContact contactManager) {
113 this.contactManager = contactManager;
119 * @param client the client to set
121 protected final void setClient (final Client client) {
122 this.client = client;
126 * Application instance
128 * @param application the application to set
130 protected final void setApplication (final Application application) {
131 this.application = application;
135 * Getter for bundle instance
137 * @return Resource bundle
139 protected final ResourceBundle getBundle () {
148 protected final Logger getLogger () {
153 * Name of used database table, handled over to backend
155 * @return the tableName
157 protected final String getTableName () {
158 return this.tableName;
162 * Name of used database table, handled over to backend
164 * @param tableName the tableName to set
166 protected final void setTableName (final String tableName) {
167 this.tableName = tableName;
171 * Getter for human-readable string from given key
173 * @param key Key to return
174 * @return Human-readable message
177 public final String getMessageStringFromKey (final String key) {
179 return this.getBundle().getString(key);
183 * Aborts program with given exception
185 * @param throwable Any type of Throwable
187 protected final void abortProgramWithException (final Throwable throwable) {
189 this.getLogger().catching(throwable);