]> git.mxchange.org Git - jbonuscard-lib.git/commitdiff
Added a lot stuff:
authorRoland Haeder <roland@mxchange.org>
Tue, 21 Jul 2015 13:10:28 +0000 (15:10 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 21 Jul 2015 13:10:28 +0000 (15:10 +0200)
- Introduced doShutdown()
- Added status bar to Swing frame
- Added "Exit program" menu item
Signed-off-by:Roland Häder <roland@mxchange.org>

15 files changed:
Addressbook/src/org/mxchange/addressbook/application/AddressbookApplication.java
Addressbook/src/org/mxchange/addressbook/application/Application.java
Addressbook/src/org/mxchange/addressbook/client/BaseClient.java
Addressbook/src/org/mxchange/addressbook/client/Client.java
Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.form
Addressbook/src/org/mxchange/addressbook/client/gui/AddressbookFrame.java
Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties [new file with mode: 0644]
Addressbook/src/org/mxchange/addressbook/client/gui/SwingClient.java
Addressbook/src/org/mxchange/addressbook/database/backend/DatabaseBackend.java
Addressbook/src/org/mxchange/addressbook/database/backend/csv/CsvDatabaseBackend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactDatabaseFrontend.java
Addressbook/src/org/mxchange/addressbook/database/frontend/contact/ContactWrapper.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java

index 0b6e918d4f14b2ff39e18c3c94b055c2def6f14e..788c940ed3c41eb082ab699fcda3f03383381a24 100644 (file)
@@ -136,6 +136,15 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
      */\r
     private boolean guiClient = false;\r
 \r
+    /**\r
+     * Getter for printable application name\r
+     * \r
+     * @return A printable name\r
+     */\r
+    public static String printableTitle () {\r
+       return MessageFormat.format("{0} v{1}", APP_TITLE, APP_VERSION);\r
+    }\r
+\r
     /**\r
      * Bootstraps application\r
      */\r
@@ -289,7 +298,9 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
        // Launch application\r
        ApplicationManager.getManager(this).start();\r
 \r
-       this.getLogger().info("End of program (last line)");\r
+       // Good bye, but this should not be reached ...\r
+       this.getLogger().warn("Unusual exit reached.");\r
+       this.doShutdown();\r
     }\r
 \r
     /**\r
@@ -301,4 +312,16 @@ public class AddressbookApplication extends BaseFrameworkSystem implements Appli
        // Start application\r
        new AddressbookApplication().start(args);\r
     }\r
+\r
+    /**\r
+     * Shuts down the application.\r
+     */\r
+    @Override\r
+    public void doShutdown () {\r
+       // Shutdown client\r
+       this.getClient().doShutdown();\r
+\r
+       this.getLogger().info("End of program (last line)");\r
+       System.exit(0);\r
+    }\r
 }\r
index 503cfe5258a52bf1b4b16be42eddb68ef37ce51b..aa773e53709be30b91e8c508cbb883a62b9a2e4f 100644 (file)
@@ -32,4 +32,9 @@ public interface Application extends FrameworkInterface {
      * Run the main loop\r
      */\r
     public void doMainLoop();\r
+\r
+    /**\r
+     * Shutdown the application\r
+     */\r
+    public void doShutdown ();\r
 }\r
index 04b1ad5ce34a484a1b7538aaf413f798e7ce098e..0282c91f6f65760462868118d1f7fbdf0813b638 100644 (file)
@@ -56,10 +56,14 @@ public abstract class BaseClient extends BaseFrameworkSystem {
     }\r
 \r
     /**\r
-     * Disables running state, so the main loop can abort.\r
+     * Shutdown method for all clients\r
      */\r
-    public void disableIsRunning () {\r
-       this.isRunning = false;\r
+    public void doShutdown () {\r
+       // Disable client\r
+       this.disableIsRunning();\r
+\r
+       // Shuts down contact manager\r
+       this.getContactManager().doShutdown();\r
     }\r
 \r
     /**\r
@@ -117,6 +121,13 @@ public abstract class BaseClient extends BaseFrameworkSystem {
        return this.isRunning;\r
     }\r
 \r
+    /**\r
+     * Disables running state, so the main loop can abort.\r
+     */\r
+    protected void disableIsRunning () {\r
+       this.isRunning = false;\r
+    }\r
+\r
     /**\r
      * Fills menu map with swing menus\r
      */\r
@@ -130,6 +141,24 @@ public abstract class BaseClient extends BaseFrameworkSystem {
        return this.menus;\r
     }\r
 \r
+    /**\r
+     * Initializes contact manager\r
+     */\r
+    protected void initContactManager () {\r
+       // Debug message\r
+       this.getLogger().debug("Initializing contact manager ...");\r
+       \r
+       // Init contact manager with console client\r
+       // @TODO Static initial amount of contacts\r
+       ManageableContact manager = new ContactManager (100, (Client) this);\r
+       \r
+       // Set it here\r
+       this.setContactManager(manager);\r
+       \r
+       // Debug message\r
+       this.getLogger().debug("Contact manager has been initialized.");\r
+    }\r
+\r
     /**\r
      * Shows given menu\r
      *\r
@@ -148,22 +177,4 @@ public abstract class BaseClient extends BaseFrameworkSystem {
        // Show menu\r
        menu.show((Client) this);\r
     }\r
-\r
-    /**\r
-     * Initializes contact manager\r
-     */\r
-    protected void initContactManager () {\r
-       // Debug message\r
-       this.getLogger().debug("Initializing contact manager ...");\r
-       \r
-       // Init contact manager with console client\r
-       // @TODO Static initial amount of contacts\r
-       ManageableContact manager = new ContactManager (100, (Client) this);\r
-       \r
-       // Set it here\r
-       this.setContactManager(manager);\r
-       \r
-       // Debug message\r
-       this.getLogger().debug("Contact manager has been initialized.");\r
-    }\r
 }\r
index a776c88f97d8b66dc514fadc612ad90f95aa074b..0d5e154d0da157444773c1532a7784c26aac4983 100644 (file)
@@ -35,6 +35,11 @@ public interface Client extends FrameworkInterface {
      */\r
     public void displayAddressBox (final Contact contact);\r
 \r
+    /**\r
+     * Shuts down the client and therefore whole application\r
+     */\r
+    public void doShutdown ();\r
+\r
     /**\r
      * Displays a message to the user\r
      *\r
index 82d80d824e86ceebc5353cf7cda31952d2467662..4803fee54a1594f19e6483198a3f897b08a2741a 100644 (file)
@@ -101,7 +101,18 @@ public class ConsoleClient extends BaseClient implements Client {
     @Override\r
     public void displayOtherDataBox (final Contact contact) {\r
        // Cellphone and such ...\r
-       this.outputMessage("Telefonnumer: " + contact.getPhoneNumber() + "\nFaxnummer: " + contact.getFaxNumber() + "\nHandy: " + contact.getCellphoneNumber() + "\nKommentar:\n" + contact.getComment());\r
+       this.outputMessage(MessageFormat.format("Telefonnumer: {0}\nFaxnummer: {1}\nHandy: {2}\nKommentar:\n{3}", contact.getPhoneNumber(), contact.getFaxNumber(), contact.getCellphoneNumber(), contact.getComment()));\r
+    }\r
+\r
+    /**\r
+     * Shutdown this client\r
+     */\r
+    @Override\r
+    public void doShutdown () {\r
+       // Parent call\r
+       super.doShutdown();\r
+\r
+       // @TODO Add other shutdown stuff\r
     }\r
 \r
     @Override\r
@@ -143,12 +154,12 @@ public class ConsoleClient extends BaseClient implements Client {
                break;\r
 \r
            case '0': // Program exit\r
-               this.disableIsRunning();\r
+               this.getApplication().doShutdown();\r
                break;\r
        \r
            default:\r
                // @TODO throw own exception\r
-               throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");\r
+               throw new UnhandledUserChoiceException(MessageFormat.format("Choice '{0}' not handled yet.", choice));\r
        }\r
     }\r
 \r
@@ -296,7 +307,7 @@ public class ConsoleClient extends BaseClient implements Client {
      */\r
     @Override\r
     public void showWelcome () {\r
-       this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);\r
+       this.outputMessage("Welcome to " + AddressbookApplication.printableTitle());\r
        this.outputMessage("");\r
        this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");\r
        \r
index 112b81ffab730543b6182eab1e3ff15b9d54c7b1..7c1b68888e90a3c00634425d4521ec3b8bc5d7d0 100644 (file)
@@ -1,10 +1,58 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+  <NonVisualComponents>
+    <Menu class="javax.swing.JMenuBar" name="mainMenu">
+      <SubComponents>
+        <Menu class="javax.swing.JMenu" name="jMenu1">
+          <Properties>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+            </Property>
+            <Property name="focusable" type="boolean" value="false"/>
+            <Property name="name" type="java.lang.String" value="" noResource="true"/>
+          </Properties>
+          <SubComponents>
+            <MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
+              <Properties>
+                <Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
+                  <KeyStroke key="Alt+X"/>
+                </Property>
+                <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+                  <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.jMenuItem1.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+                </Property>
+                <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+                  <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.jMenuItem1.toolTipText" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+                </Property>
+              </Properties>
+              <Events>
+                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem1ActionPerformed"/>
+              </Events>
+            </MenuItem>
+          </SubComponents>
+        </Menu>
+        <Menu class="javax.swing.JMenu" name="jMenu2">
+          <Properties>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.jMenu2.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+        </Menu>
+      </SubComponents>
+    </Menu>
+  </NonVisualComponents>
   <Properties>
     <Property name="defaultCloseOperation" type="int" value="3"/>
+    <Property name="title" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+      <Connection code="AddressbookApplication.printableTitle()" type="code"/>
+    </Property>
+    <Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
+      <Color id="Standardcursor"/>
+    </Property>
+    <Property name="name" type="java.lang.String" value="main" noResource="true"/>
   </Properties>
   <SyntheticProperties>
+    <SyntheticProperty name="menuBar" type="java.lang.String" value="mainMenu"/>
     <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
     <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
   </SyntheticProperties>
   <Layout>
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
-          <EmptySpace min="0" pref="400" max="32767" attributes="0"/>
+          <Component id="statusPane" alignment="0" pref="400" max="32767" attributes="0"/>
       </Group>
     </DimensionLayout>
     <DimensionLayout dim="1">
       <Group type="103" groupAlignment="0" attributes="0">
-          <EmptySpace min="0" pref="300" max="32767" attributes="0"/>
+          <Group type="102" alignment="1" attributes="0">
+              <EmptySpace min="0" pref="257" max="32767" attributes="0"/>
+              <Component id="statusPane" min="-2" max="-2" attributes="0"/>
+          </Group>
       </Group>
     </DimensionLayout>
   </Layout>
+  <SubComponents>
+    <Container class="javax.swing.JScrollPane" name="statusPane">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextPane" name="statusText">
+          <Properties>
+            <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+              <Color blue="f0" green="f0" red="f0" type="rgb"/>
+            </Property>
+            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.status.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+            </Property>
+            <Property name="name" type="java.lang.String" value="status" noResource="true"/>
+          </Properties>
+          <AccessibilityProperties>
+            <Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString bundle="org/mxchange/addressbook/client/gui/Bundle.properties" key="AddressbookFrame.status.AccessibleContext.accessibleName" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+            </Property>
+          </AccessibilityProperties>
+        </Component>
+      </SubComponents>
+    </Container>
+  </SubComponents>
 </Form>
index 1a629c03fffe1ab7d50bf5594f61a5de0f19f4be..6b0e8354d574271f71e98e946a468b07cffd2928 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.addressbook.client.gui;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import org.mxchange.addressbook.application.AddressbookApplication;
 import org.mxchange.addressbook.application.Application;
 import org.mxchange.addressbook.client.Client;
 import org.mxchange.addressbook.manager.contact.ManageableContact;
@@ -83,22 +84,67 @@ public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
     private void initComponents() {
 
+        statusPane = new javax.swing.JScrollPane();
+        statusText = new javax.swing.JTextPane();
+        mainMenu = new javax.swing.JMenuBar();
+        jMenu1 = new javax.swing.JMenu();
+        jMenuItem1 = new javax.swing.JMenuItem();
+        jMenu2 = new javax.swing.JMenu();
+
         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+        setTitle(AddressbookApplication.printableTitle());
+        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
+        setName("main"); // NOI18N
+
+        statusText.setBackground(new java.awt.Color(240, 240, 240));
+        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/mxchange/addressbook/client/gui/Bundle"); // NOI18N
+        statusText.setText(bundle.getString("AddressbookFrame.status.text")); // NOI18N
+        statusText.setName("status"); // NOI18N
+        statusPane.setViewportView(statusText);
+        statusText.getAccessibleContext().setAccessibleName(bundle.getString("AddressbookFrame.status.AccessibleContext.accessibleName")); // NOI18N
+
+        jMenu1.setText(bundle.getString("AddressbookFrame.text")); // NOI18N
+        jMenu1.setFocusable(false);
+        jMenu1.setName(""); // NOI18N
+
+        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
+        jMenuItem1.setText(bundle.getString("AddressbookFrame.jMenuItem1.text")); // NOI18N
+        jMenuItem1.setToolTipText(bundle.getString("AddressbookFrame.jMenuItem1.toolTipText")); // NOI18N
+        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                jMenuItem1ActionPerformed(evt);
+            }
+        });
+        jMenu1.add(jMenuItem1);
+
+        mainMenu.add(jMenu1);
+
+        jMenu2.setText(bundle.getString("AddressbookFrame.jMenu2.text")); // NOI18N
+        mainMenu.add(jMenu2);
+
+        setJMenuBar(mainMenu);
 
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
         getContentPane().setLayout(layout);
         layout.setHorizontalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGap(0, 400, Short.MAX_VALUE)
+            .addComponent(statusPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
         );
         layout.setVerticalGroup(
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGap(0, 300, Short.MAX_VALUE)
+            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                .addGap(0, 257, Short.MAX_VALUE)
+                .addComponent(statusPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
         );
 
         pack();
     }// </editor-fold>//GEN-END:initComponents
 
+    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
+        // Close application instance
+       this.getClient().getApplication().doShutdown();
+    }//GEN-LAST:event_jMenuItem1ActionPerformed
+
     /**
      * Initializes the frame
      */
@@ -155,5 +201,11 @@ public class AddressbookFrame extends javax.swing.JFrame implements ClientFrame
     }
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JMenu jMenu1;
+    private javax.swing.JMenu jMenu2;
+    private javax.swing.JMenuItem jMenuItem1;
+    private javax.swing.JMenuBar mainMenu;
+    private javax.swing.JScrollPane statusPane;
+    private javax.swing.JTextPane statusText;
     // End of variables declaration//GEN-END:variables
 }
diff --git a/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties b/Addressbook/src/org/mxchange/addressbook/client/gui/Bundle.properties
new file mode 100644 (file)
index 0000000..f499144
--- /dev/null
@@ -0,0 +1,6 @@
+AddressbookFrame.jMenu2.text=Edit
+AddressbookFrame.text=File
+AddressbookFrame.jMenuItem1.text=Exit program
+AddressbookFrame.jMenuItem1.toolTipText=Exits the program cleanly.
+AddressbookFrame.status.AccessibleContext.accessibleName=
+AddressbookFrame.status.text=Welcome ...
index 88dfb96b58fef366eceaa729e52064b8e69ca5be..3aec6e512709d1af27cbf16f244081cb3ac1c8a8 100644 (file)
@@ -63,9 +63,17 @@ public class SwingClient extends BaseClient implements Client {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
     }\r
 \r
+    @Override\r
+    public void doShutdown () {\r
+       // Parent call\r
+       super.doShutdown();\r
+\r
+       // @TODO Add other shutdown stuff\r
+    }\r
+\r
     @Override\r
     public void doUserMenuChoice () throws UnhandledUserChoiceException {\r
-       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+       // Not implemented here\r
     }\r
 \r
     @Override\r
@@ -121,7 +129,7 @@ public class SwingClient extends BaseClient implements Client {
 \r
     @Override\r
     public void showCurrentMenu () {\r
-       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+       // Not implemented here\r
     }\r
 \r
     @Override\r
@@ -131,7 +139,7 @@ public class SwingClient extends BaseClient implements Client {
 \r
     @Override\r
     public void showWelcome () {\r
-       throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.\r
+       // Not implemented here\r
     }\r
 \r
     @Override\r
index fad842ecbad4cc50f53690088226b1769c0ff237..5b2d42d1844baf395fb320591e9c8f06e16c470f 100644 (file)
@@ -27,6 +27,11 @@ import org.mxchange.addressbook.database.storage.Storeable;
  */\r
 public interface DatabaseBackend extends FrameworkInterface {\r
 \r
+    /**\r
+     * Shuts down this backend\r
+     */\r
+    public void doShutdown ();\r
+\r
     /**\r
      * Rewinds backend\r
      */\r
index 750d60ec2a5ed511f5260a4bd649ea34de9537c7..0bc97f3a78b9d12436195296e223d2ce7c44639e 100644 (file)
@@ -93,6 +93,20 @@ public class CsvDatabaseBackend extends BaseDatabaseBackend implements CsvBacken
        return list.iterator();\r
     }\r
 \r
+    /**\r
+     * Shuts down this backend\r
+     */\r
+    @Override\r
+    public void doShutdown () {\r
+       try {\r
+           // Close file\r
+           this.storageFile.close();\r
+       } catch (final IOException ex) {\r
+           this.getLogger().catching(ex);\r
+           System.exit(1);\r
+       }\r
+    }\r
+\r
     /**\r
      * Get length of underlaying file\r
      *\r
index 87126f0b9111b107900446b9ff8328055b3ccf9d..4065c25521af951080337fef39cdd6ddcc52a764 100644 (file)
@@ -45,6 +45,15 @@ public class ContactDatabaseFrontend extends BaseDatabaseFrontend implements Con
        this.initBackend();\r
     }\r
 \r
+    /**\r
+     * Shuts down the database layer\r
+     */\r
+    @Override\r
+    public void doShutdown () {\r
+       // Shutdown backend\r
+       this.getBackend().doShutdown();\r
+    }\r
+\r
     /**\r
      * Flushes all contact entries to database\r
      * @param contactManager An instance of a MangeableContact class\r
index ce574ab30cb3d01a020a89dfb32202c547615ade..e9f710ad05d0588d12cbc20c139ed67486f680a1 100644 (file)
@@ -25,6 +25,11 @@ import org.mxchange.addressbook.manager.contact.ManageableContact;
  */\r
 public interface ContactWrapper extends DatabaseWrapper {\r
 \r
+    /**\r
+     * Shuts down the database layer\r
+     */\r
+    public void doShutdown ();\r
+\r
     /**\r
      * Flushes all contact entries to database\r
      * \r
index 049901197963149f28112ebcb53c9e920a1ff983..1b269ec3e2a0632fb4d178f4316c26ccf16fc72c 100644 (file)
@@ -279,6 +279,15 @@ public class ContactManager extends BaseManager implements ManageableContact {
        this.registerContact(contact);\r
     }\r
 \r
+    /**\r
+     * Shuts down this contact manager\r
+     */\r
+    @Override\r
+    public void doShutdown () {\r
+       // Shut down the database layer\r
+       this.contactDatabase.doShutdown();\r
+    }\r
+\r
     /**\r
      * Getter for whole contact list\r
      * \r
index a9285059beef55085f8c59ef18f2500515252d07..520f4abaaa8bca000cf5e8700a3631dda17db4fd 100644 (file)
@@ -27,6 +27,11 @@ import org.mxchange.addressbook.manager.Manageable;
  */\r
 public interface ManageableContact extends Manageable {\r
 \r
+    /**\r
+     * Shuts down this contact manager\r
+     */\r
+    public void doShutdown ();\r
+\r
     /**\r
      * List all contacts\r
      */\r