* @see org.apache.struts.action.PlugIn#init(org.apache.struts.action.ActionServlet,
* org.apache.struts.config.ModuleConfig)
*/
public void init(ActionServlet servlet, ModuleConfig moduleconfig)
throws ServletException {
Logger log = null;
try {
log = JGossipLog.getInstance().getAppLogger();
} catch (SystemException e) {
throw new ServletException(e);
}
if (log.isInfoEnabled()) {
log.info("init is started");
}
ServletContext app = servlet.getServletContext();
app.setAttribute(IConst.CONTEXT.LAST_UPDATE_DATE, new Date());
app.setAttribute(IConst.CONTEXT.MAIL_QUEUE, new MailQueue(
new MailProcessor()));
DataSource ds;
//Setting Up Datasource
try {
ds = setupDataSource();
ForumDAO dao = ForumDAO.getInstance();
dao.setDataSource(ds);
UserDAO udao = UserDAO.getInstance();
udao.setDataSource(ds);
} catch (IOException e) {
throw new ServletException(e);
} catch (Exception e) {
throw new ServletException(e);
}
//Setting up MessageProcessor
MessageProcessor.setEmoticonsMap(ResourceBundle
.getBundle("org/jresearch/gossip/resources/emoticon"));
//Load configuration parameters
Configurator conf = Configurator.getInstance();
conf.setDataSource(ds);
try {
conf.load(app);
} catch (SQLException e) {
if (log.isErrorEnabled()) {
log.error("jGossip Configurator is not loaded");
}
throw new ServletException(e);
} catch (IOException e) {
if (log.isErrorEnabled()) {
log.error("jGossip Configurator is not loaded");
}
throw new ServletException(e);
} catch (SystemException e) {
throw new ServletException(e);
}