]> git.mxchange.org Git - jcore-utils.git/blobdiff - src/org/mxchange/jcoreee/beans/BaseFrameworkBean.java
Added EJB logger
[jcore-utils.git] / src / org / mxchange / jcoreee / beans / BaseFrameworkBean.java
index 0aa48438e162e7b4266b2f86c038d79690bed019..73d8345a658c645377bb519f875e46710e87004e 100644 (file)
 package org.mxchange.jcoreee.beans;
 
 import java.io.Serializable;
-import org.mxchange.jcoree.BaseEeSystem;
+import java.util.ResourceBundle;
+import javax.ejb.EJB;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
 
 /**
  * A general bean class. Do not put things in here that are not serializable.
  * The logger is currently not serializable, so you will get error messages.
  *
- * @author Roland Haeder
+ * @author Roland Haeder<roland@mxchange.org>
  */
-public abstract class BaseFrameworkBean extends BaseEeSystem implements Serializable {
+public abstract class BaseFrameworkBean implements Serializable {
 
        /**
         * Serial number
         */
        private static final long serialVersionUID = 83_258_139_481_372_814L;
 
+       /**
+        * Resource bundle
+        */
+       private ResourceBundle bundle;
+
+       /**
+        * Logger instance
+        */
+       @EJB
+       @Log
+       private LoggerBeanLocal logger;
+
        /**
         * Protected constructor, please don't add init() call here.
         */
@@ -39,11 +54,32 @@ public abstract class BaseFrameworkBean extends BaseEeSystem implements Serializ
        }
 
        /**
-        * Super initialization method. If you overwrite this method, please call it before (!) your own initialization.
+        * Super initialization method. If you wrie your initialization method,
+        * please call this method before (!) your own initialization.
         *
         * @throws RuntimeException If something unexpected happens
         */
        protected void genericInit () throws RuntimeException {
-               // Empty for now
+               // Init resource bundle
+               this.bundle = ResourceBundle.getBundle("org/mxchange/localization/bundle");
+       }
+
+       /**
+        * Returns an EJB logger instance
+        *
+        * @return EBJ logger instance
+        */
+       protected LoggerBeanLocal getLogger () {
+               return this.logger;
+       }
+
+       /**
+        * Getter for localized message from key
+        *
+        * @param key Key for message
+        * @return Localized message
+        */
+       protected String getMessage (final String key) {
+               return this.bundle.getString(key);
        }
 }