From: Roland Haeder Date: Tue, 8 Sep 2015 13:37:54 +0000 (+0200) Subject: Initial import X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e6c34c5ff11a5652516cf76a7535e4b4d196ea3e;p=jcore-logger-ejb.git Initial import Signed-off-by:Roland Häder --- e6c34c5ff11a5652516cf76a7535e4b4d196ea3e diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cd7a86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/nbproject/private/ +/manifest.mf +/build/ +/dist/ +/*.properties diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..8f572f5 --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project jcore-ee-logger. + + + diff --git a/dist.sh b/dist.sh new file mode 100644 index 0000000..cd5274f --- /dev/null +++ b/dist.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +NAME="jcore-ee-logger" +LIST=`find ../*/lib/${NAME}.jar` +LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`" + +for entry in ${LIST}; +do + cp -v dist/${NAME}.jar ${entry} +done diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 0000000..eaf6790 Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/cdi-api.jar b/lib/cdi-api.jar new file mode 100644 index 0000000..1fa239e Binary files /dev/null and b/lib/cdi-api.jar differ diff --git a/lib/javaee-api-7.0/javaee-api-7.0.jar b/lib/javaee-api-7.0/javaee-api-7.0.jar new file mode 100644 index 0000000..9e38d4c Binary files /dev/null and b/lib/javaee-api-7.0/javaee-api-7.0.jar differ diff --git a/lib/javaee-api-7.0/javaee-doc-api.jar b/lib/javaee-api-7.0/javaee-doc-api.jar new file mode 100644 index 0000000..2859e3d Binary files /dev/null and b/lib/javaee-api-7.0/javaee-doc-api.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar new file mode 100644 index 0000000..7318d47 Binary files /dev/null and b/lib/jcore.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar new file mode 100644 index 0000000..54ab89b Binary files /dev/null and b/lib/jshop-ee-lib.jar differ diff --git a/lib/log4j-api-2.3.jar b/lib/log4j-api-2.3.jar new file mode 100644 index 0000000..2a61bbe Binary files /dev/null and b/lib/log4j-api-2.3.jar differ diff --git a/lib/log4j-core-2.3.jar b/lib/log4j-core-2.3.jar new file mode 100644 index 0000000..5438b0b Binary files /dev/null and b/lib/log4j-core-2.3.jar differ diff --git a/lib/log4j-web-2.3.jar b/lib/log4j-web-2.3.jar new file mode 100644 index 0000000..e87ef9a Binary files /dev/null and b/lib/log4j-web-2.3.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 0000000..1f1df42 --- /dev/null +++ b/lib/nblibraries.properties @@ -0,0 +1,10 @@ +libs.CopyLibs.classpath=\ + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar +libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=2.0 +libs.javaee-api-7.0.classpath=\ + ${base}/javaee-api-7.0/javaee-api-7.0.jar +libs.javaee-api-7.0.displayName=Java EE 7 API Library +libs.javaee-api-7.0.javadoc=\ + ${base}/javaee-api-7.0/javaee-doc-api.jar +libs.javaee-api-7.0.prop-maven-dependencies=javax:javaee-api:7.0:jar diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..50db30a --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..3a96618 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=6405b2ee +build.xml.script.CRC32=b92565f5 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=6405b2ee +nbproject/build-impl.xml.script.CRC32=dae3119a +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..dd8aaf1 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,97 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=jcore-ee-logger +application.vendor=Roland Haeder +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/jcore-ee-logger.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +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 +file.reference.log4j-web-2.3.jar=lib\\log4j-web-2.3.jar +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=false +jar.index=${jnlp.enabled} +javac.classpath=\ + ${file.reference.log4j-api-2.3.jar}:\ + ${file.reference.log4j-core-2.3.jar}:\ + ${file.reference.log4j-web-2.3.jar}:\ + ${libs.javaee-api-7.0.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.deprecation=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=true +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=EE Logger Bean +jnlp.codebase.type=no.codebase +jnlp.descriptor=application +jnlp.enabled=false +jnlp.mixed.code=default +jnlp.offline-allowed=false +jnlp.signed=false +jnlp.signing= +jnlp.signing.alias= +jnlp.signing.keystore= +# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed +manifest.custom.codebase= +# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions) +manifest.custom.permissions= +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +project.license=gpl30 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..803d371 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.java.j2seproject + + + jcore-ee-logger + + + + + + + + + .\lib\nblibraries.properties + + + diff --git a/src/org/mxchange/jcoreeelogger/LoggerFactory.java b/src/org/mxchange/jcoreeelogger/LoggerFactory.java new file mode 100644 index 0000000..934de2a --- /dev/null +++ b/src/org/mxchange/jcoreeelogger/LoggerFactory.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 KLC + * + * 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.jcoreeelogger; + +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.spi.InjectionPoint; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LoggerFactory { + + /** + * Own logger + */ + private final Logger logger; + + /** + * Factory method + */ + public LoggerFactory () { + this.logger = LogManager.getLogger(this.getClass().getName()); + } + + @Produces + Logger getLogger (final InjectionPoint caller) { + return LogManager.getLogger(caller.getMember().getDeclaringClass().getName()); + } +} diff --git a/src/org/mxchange/jshopejb/beans/local/logger/LoggerBean.java b/src/org/mxchange/jshopejb/beans/local/logger/LoggerBean.java new file mode 100644 index 0000000..e4a0e8d --- /dev/null +++ b/src/org/mxchange/jshopejb/beans/local/logger/LoggerBean.java @@ -0,0 +1,112 @@ +/* + * 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.jshopejb.beans.local.logger; + +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.inject.Inject; +import org.apache.logging.log4j.Logger; + +/** + * A "centralized" logger bean + * + * @author Roland Haeder + */ +@Startup +@Singleton(name = "logger", mappedName = "logger") +public class LoggerBean implements LoggerBeanLocal { + + /** + * Logger instance + */ + @Inject + private Logger logger; + + @Override + public void logDebug (String message) { + // Deligate to logger + this.getLogger().debug(message); + } + + @Override + public void logDebug (String message, Throwable cause) { + // Deligate to logger + this.getLogger().debug(message, cause); + } + + @Override + public void logException (final Throwable throwable) { + // Deligate to logger + this.getLogger().catching(throwable); + } + + @Override + public void logFatal (final String message, final Throwable cause) { + // Deligate to logger + this.getLogger().fatal(message, cause); + } + + @Override + public void logInfo (final String message) { + // Deligate to logger + this.getLogger().info(message); + } + + @Override + public void logFatal (final String message) { + // Deligate to logger + this.getLogger().fatal(message); + } + + @Override + public void logInfo (final String message, final Throwable cause) { + // Deligate to logger + this.getLogger().info(message, cause); + } + + @Override + public void logTrace (final String message) { + // Deligate to logger + this.getLogger().trace(message); + } + + @Override + public void logTrace (final String message, final Throwable cause) { + // Deligate to logger + this.getLogger().trace(message, cause); + } + + @Override + public void logWarning (final String message) { + // Deligate to logger + this.getLogger().warn(message); + } + + @Override + public void logWarning (final String message, final Throwable cause) { + // Deligate to logger + this.getLogger().warn(message, cause); + } + + /** + * Getter for logger + * @return Logger + */ + private Logger getLogger () { + return this.logger; + } +} diff --git a/src/org/mxchange/jshopejb/beans/local/logger/LoggerBeanLocal.java b/src/org/mxchange/jshopejb/beans/local/logger/LoggerBeanLocal.java new file mode 100644 index 0000000..4eab423 --- /dev/null +++ b/src/org/mxchange/jshopejb/beans/local/logger/LoggerBeanLocal.java @@ -0,0 +1,109 @@ +/* + * 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.jshopejb.beans.local.logger; + +import javax.ejb.Local; + +/** + *An interface for "centralized" logger + * + * @author Roland Haeder + */ +@Local +public interface LoggerBeanLocal { + /** + * Log an exception + * + * @param throwable Thrown exception + */ + public void logException (final Throwable throwable); + + /** + * Log a debug message + * + * @param message Message to log + */ + public void logDebug (final String message); + + /** + * Log a trace message + * + * @param message Message to log + */ + public void logTrace (final String message); + + /** + * Log a info message + * + * @param message Message to log + */ + public void logInfo (final String message); + + /** + * Log a warning message + * + * @param message Message to log + */ + public void logWarning (final String message); + + /** + * Log a fatal message + * + * @param message Message to log + */ + public void logFatal (final String message); + + /** + * Log a trace message and cause + * + * @param message Message to log + * @param cause Causing exception + */ + public void logTrace (final String message, final Throwable cause); + + /** + * Log a info message and cause + * + * @param message Message to log + * @param cause Causing exception + */ + public void logInfo (final String message, final Throwable cause); + + /** + * Log a debug message and cause + * + * @param message Message to log + * @param cause Causing exception + */ + public void logDebug (final String message, final Throwable cause); + + /** + * Log a warning message and cause + * + * @param message Message to log + * @param cause Causing exception + */ + public void logWarning (final String message, final Throwable cause); + + /** + * Log a fatal message and cause + * + * @param message Message to log + * @param cause Causing exception + */ + public void logFatal (final String message, final Throwable cause); +}