package org.mxchange.jcoreee.beans;
import java.io.Serializable;
+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 implements Serializable {
*/
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.
*/
}
/**
- * 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);
}
}