From 8f39e6c8e605ac61f32e40e65418821bf2949e5a Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 30 Sep 2015 09:25:03 +0200 Subject: [PATCH] =?utf8?q?Continued:=20-=20fixed=20some=20errors=20(not=20?= =?utf8?q?all)=20-=20updated=20jars=20Signed-off-by:Roland=20H=C3=A4der=20?= =?utf8?q??= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/jcore-logger-lib.jar | Bin 2505 -> 2496 bytes lib/jcore-swing.jar | Bin 6780 -> 6826 bytes lib/jcore.jar | Bin 29583 -> 30691 bytes .../addressbook/BaseAddressbookSystem.java | 12 ++-- .../application/AddressbookApplication.java | 62 +++++++++++++++--- .../addressbook/client/AddressbookClient.java | 4 +- .../client/BaseAddressbookClient.java | 2 + .../client/console/ConsoleClient.java | 8 ++- .../addressbook/client/gui/SwingClient.java | 5 ++ .../contact/AddressbookContactManager.java | 10 ++- .../mxchange/addressbook/menu/BaseMenu.java | 3 +- src/org/mxchange/addressbook/menu/Menu.java | 3 +- .../mxchange/addressbook/menu/MenuTools.java | 9 ++- 13 files changed, 92 insertions(+), 26 deletions(-) diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar index e03e3ca7f07b8329c9394a969445845a637d6cb3..463d15b1a912757aca434cba7c2b1b3e7270e54b 100644 GIT binary patch delta 448 zcmX>pd_b5tz?+$ci-CcIfkE5bZX&OSpq96t`(csvx#7 z-fX~RzyxL_vjl?~lXtRN@S@l~`5&8UJy5MX&=GLJ0%r*@ymdSRj!u`R139Icd|BX1 N=5eaBEo1|E3INg8T3P@A delta 443 zcmX>gd{USYpR5_2XlS7!$4y(kZ+K5Kxe$#RTlU^<-9224+5bOO`2 z89hPtW_2b5CNLw4B^b<@yn)RE)$++-*-XKDblIiF&jOv3UzDyN;LXS+!VGuuKPc8G%8R2&*26(ld(tc{%4>(2s@*w31gYW TX*_uji_qj%oC0jC*g%p1nObL) diff --git a/lib/jc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ZJ8GCZLjI%E3aFi$@MIHn1IwF?Az!Z$#_D`x^eW$2uF1G$?9crd=zGPL z^Z9g{niwxo7sqC+gSAq * @author Roland Haeder */ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { @@ -32,6 +33,7 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { /** * Logger instance */ + @Log private LoggerBeanLocal logger; /** @@ -41,7 +43,7 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { try { // Get initial 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"); } catch (final NamingException ex) { @@ -52,7 +54,7 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { /** * Getter for logger instance - * + *

* @return Logger instance */ protected LoggerBeanLocal getLogger () { @@ -61,7 +63,7 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { /** * Logs given exception - * + *

* @param exception Throwable */ protected void logException (final Throwable exception) { @@ -70,7 +72,7 @@ public abstract class BaseAddressbookSystem extends BaseFrameworkSystem { /** * Log exception and abort program. - * + *

* @param throwable Throwable */ protected void abortProgramWithException (final Throwable throwable) { diff --git a/src/org/mxchange/addressbook/application/AddressbookApplication.java b/src/org/mxchange/addressbook/application/AddressbookApplication.java index 2859e5c..4f07e31 100644 --- a/src/org/mxchange/addressbook/application/AddressbookApplication.java +++ b/src/org/mxchange/addressbook/application/AddressbookApplication.java @@ -19,14 +19,19 @@ package org.mxchange.addressbook.application; import java.io.IOException; import java.sql.SQLException; import java.text.MessageFormat; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; import org.mxchange.addressbook.client.AddressbookClient; import org.mxchange.addressbook.client.console.ConsoleClient; import org.mxchange.addressbook.client.gui.SwingClient; import org.mxchange.jcore.application.Application; import org.mxchange.jcore.application.BaseApplication; import org.mxchange.jcore.client.Client; +import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; import org.mxchange.jcore.manager.application.ApplicationManager; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; /** @@ -60,21 +65,30 @@ public class AddressbookApplication extends BaseApplication implements Applicati /** * Logger instance */ + @Log private LoggerBeanLocal logger; /** * Protected constructor */ protected AddressbookApplication () { - // Init properties file - this.initProperties(); + // Try this + try { + // Get context + Context context = new InitialContext(); - // Is the bundle initialized? - if (!isBundledInitialized()) { - // Temporary initialize default bundle - // TODO The enum Gender uses this - this.initBundle(); + // Get logger + this.logger = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); + } catch (final NamingException ex) { + // Output it and exit + System.err.println(MessageFormat.format("Cannot initialize: {0}", ex)); + + // Abort here + System.exit(1); } + + // Call init method + this.init(); } /** @@ -132,7 +146,7 @@ public class AddressbookApplication extends BaseApplication implements Applicati * Main loop of the application */ @Override - public void doMainLoop () { + public void doMainLoop () throws MenuInitializationException { // Get client and cast it AddressbookClient client = (AddressbookClient) this.getClient(); @@ -155,6 +169,7 @@ public class AddressbookApplication extends BaseApplication implements Applicati // Ask for user input and run proper method client.doUserMenuChoice(); } catch (final UnhandledUserChoiceException ex) { + // Log exception this.getLogger().logException(ex); } @@ -182,10 +197,32 @@ public class AddressbookApplication extends BaseApplication implements Applicati // Shutdown client this.getClient().doShutdown(); + // Regular exit reached this.getLogger().logInfo("End of program (last line)"); //NOI18N System.exit(0); } + /** + * Initializes this application + */ + private void init () { + // Try this + try { + // Init properties file + this.initProperties(); + } catch (final IOException ex) { + // Abort here + this.abortProgramWithException(ex); + } + + // Is the bundle initialized? + if (!isBundledInitialized()) { + // Temporary initialize default bundle + // TODO The enum Gender uses this + this.initBundle(); + } + } + /** * Logs given exception * @@ -312,8 +349,13 @@ public class AddressbookApplication extends BaseApplication implements Applicati // Parse arguments this.parseArguments(args); - // Launch application - ApplicationManager.getSingeltonManager(this).start(); + try { + // Launch application + ApplicationManager.getSingeltonManager(this).start(); + } catch (final MenuInitializationException ex) { + // Something bad happened + this.abortProgramWithException(ex); + } // Good bye, but this should not be reached ... this.getLogger().logWarning("Unusual exit reached."); //NOI18N diff --git a/src/org/mxchange/addressbook/client/AddressbookClient.java b/src/org/mxchange/addressbook/client/AddressbookClient.java index e884edb..c53c27d 100644 --- a/src/org/mxchange/addressbook/client/AddressbookClient.java +++ b/src/org/mxchange/addressbook/client/AddressbookClient.java @@ -16,6 +16,7 @@ */ package org.mxchange.addressbook.client; +import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcore.client.Client; import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; @@ -78,8 +79,9 @@ public interface AddressbookClient extends Client { * Asks the user for a choice and proceeds accordingly *

* @throws UnhandledUserChoiceException If choice is not supported + * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu cannot be initialized */ - public void doUserMenuChoice () throws UnhandledUserChoiceException; + public void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException; /** * Asks the the user to enter a single character which must match validChars diff --git a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java index 094d0ec..00a55bd 100644 --- a/src/org/mxchange/addressbook/client/BaseAddressbookClient.java +++ b/src/org/mxchange/addressbook/client/BaseAddressbookClient.java @@ -28,6 +28,7 @@ import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook; 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; /** @@ -50,6 +51,7 @@ public abstract class BaseAddressbookClient extends BaseClient implements Addres /** * Logger instance */ + @Log private LoggerBeanLocal logger; /** diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index 5deface..b01739e 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -26,6 +26,7 @@ import org.mxchange.addressbook.application.AddressbookApplication; import org.mxchange.addressbook.client.AddressbookClient; import org.mxchange.addressbook.client.BaseAddressbookClient; import org.mxchange.addressbook.exceptions.ContactAlreadyAddedException; +import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.addressbook.manager.contact.ManageableContactAddressbook; import org.mxchange.addressbook.menu.Menu; import org.mxchange.addressbook.menu.MenuTools; @@ -311,7 +312,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC } @Override - public void doUserMenuChoice () throws UnhandledUserChoiceException { + public void doUserMenuChoice () throws UnhandledUserChoiceException, MenuInitializationException { // Trace message this.getLogger().logTrace("CALLED!"); //NOI18N @@ -530,6 +531,11 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC System.out.println(message); } + @Override + public void show (final Contact contact) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public void showCurrentMenu () { this.showMenu(this.getCurrentMenu()); diff --git a/src/org/mxchange/addressbook/client/gui/SwingClient.java b/src/org/mxchange/addressbook/client/gui/SwingClient.java index d2316ce..8d91d07 100644 --- a/src/org/mxchange/addressbook/client/gui/SwingClient.java +++ b/src/org/mxchange/addressbook/client/gui/SwingClient.java @@ -197,6 +197,11 @@ public class SwingClient extends BaseAddressbookClient implements AddressbookCli throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. //NOI18N } + @Override + public void show (final Contact contact) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + @Override public void showCurrentMenu () { // Debug message diff --git a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java index beafc29..d5833c4 100644 --- a/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java +++ b/src/org/mxchange/addressbook/manager/contact/AddressbookContactManager.java @@ -31,6 +31,7 @@ import org.mxchange.jcore.exceptions.UnhandledUserChoiceException; import org.mxchange.jcore.manager.BaseManager; import org.mxchange.jcore.model.contact.Contact; import org.mxchange.jcore.model.contact.gender.Gender; +import org.mxchange.jcoreeelogger.beans.local.logger.Log; import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal; /** @@ -54,6 +55,7 @@ public class AddressbookContactManager extends BaseManager implements Manageable /** * Logger instance */ + @Log private LoggerBeanLocal logger; /** @@ -647,8 +649,12 @@ public class AddressbookContactManager extends BaseManager implements Manageable return isAdded; } - @Override - public void logException (final Throwable exception) { + /** + * Logs given exception + *

+ * @param exception Throwable + */ + protected void logException (final Throwable exception) { this.getLogger().logException(exception); } diff --git a/src/org/mxchange/addressbook/menu/BaseMenu.java b/src/org/mxchange/addressbook/menu/BaseMenu.java index ad8c2e5..019c8e0 100644 --- a/src/org/mxchange/addressbook/menu/BaseMenu.java +++ b/src/org/mxchange/addressbook/menu/BaseMenu.java @@ -25,10 +25,11 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcore.client.Client; /** + * A general menu class * * @author Roland Haeder */ -public class BaseMenu extends BaseAddressbookSystem { +public abstract class BaseMenu extends BaseAddressbookSystem { /** * Menu list diff --git a/src/org/mxchange/addressbook/menu/Menu.java b/src/org/mxchange/addressbook/menu/Menu.java index e027a47..909d2ef 100644 --- a/src/org/mxchange/addressbook/menu/Menu.java +++ b/src/org/mxchange/addressbook/menu/Menu.java @@ -21,7 +21,8 @@ import org.mxchange.addressbook.menu.item.SelectableMenuItem; import org.mxchange.jcore.client.Client; /** - * + * An interface for menus + *

* @author Roland Haeder TODO find better name */ public interface Menu { diff --git a/src/org/mxchange/addressbook/menu/MenuTools.java b/src/org/mxchange/addressbook/menu/MenuTools.java index 54d7c96..9f42475 100644 --- a/src/org/mxchange/addressbook/menu/MenuTools.java +++ b/src/org/mxchange/addressbook/menu/MenuTools.java @@ -16,11 +16,11 @@ */ package org.mxchange.addressbook.menu; -import java.text.MessageFormat; import java.util.Iterator; import java.util.Map; import org.mxchange.addressbook.BaseAddressbookSystem; import org.mxchange.addressbook.menu.item.SelectableMenuItem; +import org.mxchange.jcore.exceptions.MenuInitializationException; /** * Menu utilities @@ -36,17 +36,16 @@ public class MenuTools extends BaseAddressbookSystem { * @param menus A Map with all menus and their entries * @param menuType Menu type * @return An array with available access chars + * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu cannot be initialized */ - public static char[] getAccessKeysFromMenuMap (final Map menus, final String menuType) { + public static char[] getAccessKeysFromMenuMap (final Map menus, final String menuType) throws MenuInitializationException { // First search for the proper menu class Menu menu = menus.get(menuType); // Is it there? if (!(menu instanceof Menu)) { // Not found - // TODO Rewrite to exception - System.err.println(MessageFormat.format("menu is not implementing Menu: {0}", menu)); //NOI18N - System.exit(1); + throw new MenuInitializationException(menu, menuType); } // Get iterator -- 2.39.5