]> git.mxchange.org Git - jfinancials-swing.git/blob - Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java
b104090c5ba9f218fe1c7bd0f44a98097777af44
[jfinancials-swing.git] / Addressbook / src / org / mxchange / addressbook / BaseFrameworkSystem.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.addressbook;
18
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;
25
26 /**
27  * General class
28  *
29  * @author Roland Haeder
30  */
31 public class BaseFrameworkSystem implements FrameworkInterface {
32
33         /**
34          * Class' logger
35          */
36         private final Logger LOG;
37
38         /**
39          * Application instance
40          */
41         private Application application;
42
43         /**
44          * Bundle instance
45          */
46         private final ResourceBundle bundle;
47
48         /**
49          * Client instance
50          */
51         private Client client;
52
53         /**
54          * Contact manager instance
55          */
56         private ManageableContact contactManager;
57
58         /**
59          * Name of used database table, handled over to backend
60          */
61         private String tableName;
62
63         /**
64          * Initialize object
65          */
66         {
67                 LOG = LogManager.getLogger(this);
68                 bundle = ResourceBundle.getBundle("org/mxchange/addressbook/localization/bundle"); // NOI18N
69         }
70
71         /**
72          * No instances can be created of this class
73          */
74         protected BaseFrameworkSystem () {
75         }
76
77         /**
78          * Application instance
79          *
80          * @return the application
81          */
82         @Override
83         public final Application getApplication () {
84                 return this.application;
85         }
86
87         /**
88          * Client instance
89          *
90          * @return the client
91          */
92         @Override
93         public final Client getClient () {
94                 return this.client;
95         }
96
97         /**
98          * Contact manager instance
99          *
100          * @return the contactManager
101          */
102         @Override
103         public final ManageableContact getContactManager () {
104                 return this.contactManager;
105         }
106
107         /**
108          * Contact manager instance
109          *
110          * @param contactManager the contactManager to set
111          */
112         protected final void setContactManager (final ManageableContact contactManager) {
113                 this.contactManager = contactManager;
114         }
115
116         /**
117          * Client instance
118          *
119          * @param client the client to set
120          */
121         protected final void setClient (final Client client) {
122                 this.client = client;
123         }
124
125         /**
126          * Application instance
127          *
128          * @param application the application to set
129          */
130         protected final void setApplication (final Application application) {
131                 this.application = application;
132         }
133
134         /**
135          * Getter for bundle instance
136          *
137          * @return Resource bundle
138          */
139         protected final ResourceBundle getBundle () {
140                 return this.bundle;
141         }
142
143         /**
144          * Getter for logger
145          *
146          * @return Logger
147          */
148         protected final Logger getLogger () {
149                 return this.LOG;
150         }
151
152         /**
153          * Name of used database table, handled over to backend
154          *
155          * @return the tableName
156          */
157         protected final String getTableName () {
158                 return this.tableName;
159         }
160
161         /**
162          * Name of used database table, handled over to backend
163          *
164          * @param tableName the tableName to set
165          */
166         protected final void setTableName (final String tableName) {
167                 this.tableName = tableName;
168         }
169
170         /**
171          * Getter for human-readable string from given key
172          * 
173          * @param key Key to return
174          * @return Human-readable message
175          */
176         public final String getMessageStringFromKey (final String key) {
177                 // Return message
178                 return this.getBundle().getString(key);
179         }
180 }