From: Roland Haeder Date: Mon, 5 Oct 2015 09:57:31 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=52cc7114d5a7cca7b501553378ea780a1941131a;p=pizzaservice-swing.git Continued: - 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 --- diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar new file mode 100644 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 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 index 5438b0b..0000000 Binary files a/lib/log4j-core-2.3.jar and /dev/null differ diff --git a/nbproject/project.properties b/nbproject/project.properties index 849d818..f4d11a4 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -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 index 0000000..834e398 --- /dev/null +++ b/src/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java @@ -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 . + */ +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 + *

+ * @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 + *

+ * @return Logger instance + */ + protected LoggerBeanLocal getLogger () { + return this.loggerBeanLocal; + } +} diff --git a/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java b/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index a34807e..3af5428 100644 --- a/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java +++ b/src/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -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 *

* @author Roland Haeder */ -public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication { +public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication { /** * Default constructor