Search in sources :

Example 1 with Madvoc

use of jodd.madvoc.Madvoc in project jodd by oblac.

the class WebRunner method runWebApp.

/**
	 * Starts the app web application and {@link #run() runs} user code.
	 */
public void runWebApp(Class<? extends WebApplication> webAppClass) {
    madvoc = new Madvoc();
    madvoc.setWebAppClass(webAppClass);
    madvoc.startNewWebApplication(null);
    app = madvoc.getWebApplication();
    appCore = BeanUtil.declared.getProperty(app, "appCore");
    setJtxManager(appCore.getJtxManager());
    appDao = appCore.getPetite().getBean(AppDao.class);
    petite = appCore.getPetite();
    JtxTransaction tx = startRwTx();
    try {
        System.out.println(StringUtil.repeat('-', 55) + " start");
        System.out.println("\n\n");
        run();
        System.out.println("\n\n");
        System.out.println(StringUtil.repeat('-', 55) + " end");
        tx.commit();
    } catch (Throwable throwable) {
        throwable.printStackTrace();
        tx.rollback();
    }
    try {
        ReflectUtil.invokeDeclared(app, "destroy", new Class[] { MadvocConfig.class }, new Object[] { null });
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : Madvoc(jodd.madvoc.Madvoc) AppDao(jodd.joy.db.AppDao) JtxTransaction(jodd.jtx.JtxTransaction)

Aggregations

AppDao (jodd.joy.db.AppDao)1 JtxTransaction (jodd.jtx.JtxTransaction)1 Madvoc (jodd.madvoc.Madvoc)1