mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AVM now configures itself via Spring. Also adjusted jndi-client and catalina-virtual
to be semi-not-broken. The current limitation is that you've got to start tomcat from $TOMCAT_HOME for things to work (fix soon). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3267 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,39 +21,51 @@ import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
|
||||
/**
|
||||
* Like 83.7 gazillion others, a HibernateHelper. This will go away.
|
||||
* @author britt
|
||||
*/
|
||||
public class HibernateHelper
|
||||
{
|
||||
private static Configuration fgCfg = null;
|
||||
private static SessionFactory fgFactory = null;
|
||||
/**
|
||||
* The single instance of this.
|
||||
*/
|
||||
private static HibernateHelper fgInstance = null;
|
||||
|
||||
static
|
||||
/**
|
||||
* The Hibernate Configuration object.
|
||||
*/
|
||||
private Configuration fCfg;
|
||||
|
||||
/**
|
||||
* The Hibernate SessionFactory;
|
||||
*/
|
||||
private SessionFactory fFactory;
|
||||
|
||||
public HibernateHelper()
|
||||
{
|
||||
Reset();
|
||||
fCfg = null;
|
||||
fFactory = null;
|
||||
setup();
|
||||
fgInstance = this;
|
||||
}
|
||||
|
||||
public static SessionFactory GetSessionFactory()
|
||||
public SessionFactory getSessionFactory()
|
||||
{
|
||||
return fgFactory;
|
||||
return fFactory;
|
||||
}
|
||||
|
||||
public static Configuration GetConfiguration()
|
||||
public Configuration getConfiguration()
|
||||
{
|
||||
return fgCfg;
|
||||
return fCfg;
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
public void setup()
|
||||
{
|
||||
if (fgFactory != null)
|
||||
{
|
||||
fgFactory.close();
|
||||
}
|
||||
try
|
||||
{
|
||||
fgCfg = new Configuration();
|
||||
fgCfg.configure();
|
||||
fgFactory = fgCfg.buildSessionFactory();
|
||||
fCfg = new Configuration();
|
||||
fCfg.configure();
|
||||
fFactory = fCfg.buildSessionFactory();
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
@@ -61,4 +73,14 @@ public class HibernateHelper
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
fFactory.close();
|
||||
}
|
||||
|
||||
public static HibernateHelper GetInstance()
|
||||
{
|
||||
return fgInstance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user