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 javax.naming.Context;
20 import javax.naming.InitialContext;
21 import javax.naming.NamingException;
22 import org.mxchange.jcore.BaseFrameworkSystem;
23 import org.mxchange.jcoreeelogger.beans.local.logger.Log;
24 import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
27 * A general addressbook class
29 * @author Roland Haeder
31 public abstract class BaseAddressbookSystem extends BaseFrameworkSystem {
37 private LoggerBeanLocal logger;
40 * Protected constructor
42 protected BaseAddressbookSystem () {
44 // Get initial context
45 Context context = new InitialContext();
48 this.logger = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal");
49 } catch (final NamingException ex) {
51 throw new RuntimeException(ex);
56 * Getter for logger instance
58 * @return Logger instance
60 protected LoggerBeanLocal getLogger () {
65 * Logs given exception
67 * @param exception Throwable
69 protected void logException (final Throwable exception) {
70 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
74 * Log exception and abort program.
76 * @param throwable Throwable
78 protected void abortProgramWithException (final Throwable throwable) {
80 this.logException(throwable);