]> git.mxchange.org Git - pizzaservice-swing.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Mon, 5 Oct 2015 09:57:31 +0000 (11:57 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 5 Oct 2015 09:57:31 +0000 (11:57 +0200)
- removed log4j
- added jcore logger (hope this works this way)
- introduced abstract BasePizzaServiceSystem class which currently holds the logger
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jcore-logger-lib.jar [new file with mode: 0644]
lib/log4j-api-2.3.jar [deleted file]
lib/log4j-core-2.3.jar [deleted file]
nbproject/project.properties
src/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java [new file with mode: 0644]
src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java

diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar
new file mode 100644 (file)
index 0000000..463d15b
Binary files /dev/null and b/lib/jcore-logger-lib.jar differ
diff --git a/lib/log4j-api-2.3.jar b/lib/log4j-api-2.3.jar
deleted file mode 100644 (file)
index 2a61bbe..0000000
Binary files a/lib/log4j-api-2.3.jar and /dev/null differ
diff --git a/lib/log4j-core-2.3.jar b/lib/log4j-core-2.3.jar
deleted file mode 100644 (file)
index 5438b0b..0000000
Binary files a/lib/log4j-core-2.3.jar and /dev/null differ
index 849d8189643e65ce9d923de789f79740a56eaec4..f4d11a4f72bbe09ecd904a3d9a6e81835a0505e4 100644 (file)
@@ -30,13 +30,12 @@ dist.jar=${dist.dir}/PizzaService-swing.jar
 dist.javadoc.dir=${dist.dir}/javadoc
 endorsed.classpath=
 excludes=
+file.reference.jcore-logger-lib.jar=lib\\jcore-logger-lib.jar
 file.reference.jcore-swing.jar=lib/jcore-swing.jar
 file.reference.jcore.jar=lib/jcore.jar
 file.reference.jcoreee.jar=lib/jcoreee.jar
 file.reference.jshop-core.jar=lib/jshop-core.jar
 file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar
-file.reference.log4j-api-2.3.jar=lib/log4j-api-2.3.jar
-file.reference.log4j-core-2.3.jar=lib/log4j-core-2.3.jar
 includes=**
 jar.archive.disabled=${jnlp.enabled}
 jar.compress=false
@@ -44,12 +43,11 @@ jar.index=${jnlp.enabled}
 javac.classpath=\
     ${file.reference.jcore.jar}:\
     ${file.reference.jcoreee.jar}:\
+    ${file.reference.jcore-logger-lib.jar}:\
     ${file.reference.jshop-core.jar}:\
     ${file.reference.jshop-ee-lib.jar}:\
     ${file.reference.jcore-swing.jar}:\
-    ${reference.PizzaService-lib.jar}:\
-    ${file.reference.log4j-api-2.3.jar}:\
-    ${file.reference.log4j-core-2.3.jar}
+    ${reference.PizzaService-lib.jar}
 # Space-separated list of extra javac options
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
 javac.deprecation=true
@@ -105,6 +103,7 @@ run.test.classpath=\
     ${javac.test.classpath}:\
     ${build.test.classes.dir}
 source.encoding=UTF-8
+source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/
 source.reference.jcore-swing.jar=../jcore-swing/src/
 source.reference.jcore.jar=../jcore/src/
 source.reference.jcoreee.jar=../jcoreee/src/
diff --git a/src/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java b/src/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java
new file mode 100644 (file)
index 0000000..834e398
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcore.BaseFrameworkSystem;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+
+/**
+ * A general Pizza-Service class
+ * <p>
+ * @author Roland Haeder
+ */
+public abstract class BasePizzaServiceSystem extends BaseFrameworkSystem {
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * Protected constructor
+        */
+       protected BasePizzaServiceSystem () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Throw again
+                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+               }
+       }
+
+       /**
+        * Getter for logger instance
+        * <p>
+        * @return Logger instance
+        */
+       protected LoggerBeanLocal getLogger () {
+               return this.loggerBeanLocal;
+       }
+}
index a34807e3cde1f8e3211231f5c849eaef9e78fcb8..3af5428e697dd5a214f646f98e88d4edea5cc766 100644 (file)
@@ -25,13 +25,14 @@ import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException;
 import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException;
 import org.mxchange.jshopcore.model.category.Category;
 import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
 
 /**
  * Main application class
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
-public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication {
+public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication {
 
        /**
         * Default constructor