X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2Forg%2Fmxchange%2Faddressbook%2Fclient%2FBaseAddressbookClient.java;h=b566d764854f8681ddbc63338de9c20c27b812e8;hb=528eeece943480f5a89d0067cfb6e4cb86f528b5;hp=3dced1bd5ea2743726bf00b1f00a25e193f3c89e;hpb=4e789b77f2a6fcdd6cb4e7b3acd9ce00a388a111;p=addressbook-swing.git
diff --git a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java
index 3dced1b..b566d76 100644
--- a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java
+++ b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Roland Haeder
+ * Copyright (C) 2016 - 2020 Free Software Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@ package org.mxchange.addressbook.client;
import java.sql.SQLException;
import java.text.MessageFormat;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.naming.Context;
@@ -27,14 +28,13 @@ import org.mxchange.addressbook.facade.contact.AddressbookContactFacade;
import org.mxchange.addressbook.facade.contact.ContactFacade;
import org.mxchange.addressbook.menu.Menu;
import org.mxchange.jcore.client.BaseClient;
-import org.mxchange.jcore.client.Client;
import org.mxchange.jcoreeelogger.beans.local.logger.Log;
import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
/**
* A general addressbook client
*
- * @author Roland Haeder TODO: Find better name
+ * @author Roland Häder TODO: Find better name
*/
public abstract class BaseAddressbookClient extends BaseClient implements AddressbookClient {
@@ -47,7 +47,7 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
* Logger instance
*/
@Log
- private LoggerBeanLocal logger;
+ private LoggerBeanLocal loggerBeanLocal;
/**
* Menu system
@@ -66,8 +66,8 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
// Get context
Context context = new InitialContext();
- // Lookup logger
- this.logger = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+ // Lookup loggerBeanLocal
+ this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
} catch (final NamingException ex) {
// Continue to throw
throw new RuntimeException(ex);
@@ -79,12 +79,12 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
*
* @return the currentMenu
*/
- public final String getCurrentMenu () {
+ public String getCurrentMenu () {
return this.currentMenu;
}
@Override
- public final void setCurrentMenu (final String currentMenu) {
+ public void setCurrentMenu (final String currentMenu) {
this.currentMenu = currentMenu;
}
@@ -128,12 +128,12 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
protected abstract void fillMenuMap ();
/**
- * Getter for logger instance
+ * Getter for loggerBeanLocal instance
*
* @return Logger instance
*/
- protected LoggerBeanLocal getLogger () {
- return this.logger;
+ protected LoggerBeanLocal getLoggerBeanLocal () {
+ return this.loggerBeanLocal;
}
/**
@@ -141,8 +141,8 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
*
* @return Map of all menus
*/
- protected final Map getMenus () {
- return this.menus;
+ protected Map getMenus () {
+ return Collections.unmodifiableMap(this.menus);
}
/**
@@ -152,23 +152,23 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
*/
protected void initContactManager () throws SQLException {
// Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace("CALLED!"); //NOI18N
// Debug message
- this.getLogger().logDebug("Initializing contact manager ..."); //NOI18N
+ this.getLoggerBeanLocal().logDebug("Initializing contact manager ..."); //NOI18N
// Init contact facade with console client
// TODO Static initial amount of contacts
- ContactFacade facade = new AddressbookContactFacade((Client) this);
+ ContactFacade facade = new AddressbookContactFacade(this);
// Set it here
this.setFacade(facade);
// Debug message
- this.getLogger().logDebug("Contact manager has been initialized."); //NOI18N
+ this.getLoggerBeanLocal().logDebug("Contact manager has been initialized."); //NOI18N
// Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N
}
/**
@@ -177,8 +177,8 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
* @param throwable Throwable
*/
protected void logException (final Throwable throwable) {
- // Deligate to logger
- this.getLogger().logException(throwable);
+ // Deligate to loggerBeanLocal
+ this.getLoggerBeanLocal().logException(throwable);
}
/**
@@ -188,7 +188,7 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
*/
protected void showMenu (final String menuType) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("menuType={0} - CALLED!", menuType)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("menuType={0} - CALLED!", menuType)); //NOI18N
// Get menu from type
Menu menu = this.getMenu(menuType);
@@ -204,6 +204,6 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres
menu.show(this);
// Trace message
- this.getLogger().logTrace("EXIT!"); //NOI18N
+ this.getLoggerBeanLocal().logTrace("EXIT!"); //NOI18N
}
}