> Giulio,
>
> I would be quite interested to see that. I'm currently
> running from a command line test app while developing my
> model classes, but I will be moving to a Struts framework shortly.
>
> I also have a question about logging but I will post that in
> its own thread.
> -
> Scott
This is my own version, if someone has improvements and/or suggestion,
they will be welcome!
Here it is :
public final class TorqueInitListener implements ServletContextListener
{
public void contextInitialized(ServletContextEvent sce) {
System.out.println("\n[Initializing Torque]");
String propFile =
sce.getServletContext().getRealPath("/WEB-INF/Torque.properties");
System.out.println("[Configuration file: " + propFile + "]");
try {
if (!Torque.isInit()) {
Torque.init(propFile);
}
}
catch (Exception e) {
System.out.println("[Exception during init - " + e.getMessage() +
"]");
}
System.out.println("[Initialization complete]\n");
}
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("\n[Shutting down Torque]");
try {
if (Torque.isInit()) {
Torque.shutdown();
System.gc();
}
}
catch (Exception e) {
System.out.println("[Exception during shutdown " + e.getMessage()
+ "]");
}
System.out.println("[Shutdown complete]\n");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
|