Ejemplo n.º 1
0
 protected static void setup(Locale locale, WikiUser user) throws Exception {
   Connection conn = null;
   try {
     try {
       conn = WikiDatabase.getConnection();
       // set up tables
       WikiDatabase.queryHandler().createTables(conn);
     } catch (Exception e) {
       logger.severe("Unable to set up database tables", e);
       // clean up anything that might have been created
       WikiDatabase.queryHandler().dropTables(conn);
       throw e;
     }
     try {
       WikiDatabase.setupDefaultVirtualWiki(conn);
       WikiDatabase.setupAdminUser(user, conn);
       WikiDatabase.setupSpecialPages(locale, user, conn);
     } catch (Exception e) {
       DatabaseConnection.handleErrors(conn);
       throw e;
     }
   } finally {
     WikiDatabase.releaseConnection(conn);
   }
 }
Ejemplo n.º 2
0
 protected static Connection getConnection(Object transactionObject) throws Exception {
   if (transactionObject instanceof Connection) {
     return (Connection) transactionObject;
   }
   return WikiDatabase.getConnection();
 }