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:
@@ -30,7 +30,6 @@ import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
||||
import org.alfresco.repo.avm.hibernate.HibernateTxn;
|
||||
import org.alfresco.repo.avm.hibernate.HibernateTxnCallback;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
|
||||
/**
|
||||
@@ -39,11 +38,6 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
*/
|
||||
public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
/**
|
||||
* The Hibernate SessionFactory.
|
||||
*/
|
||||
private SessionFactory fSessionFactory;
|
||||
|
||||
/**
|
||||
* The HibernateTxn.
|
||||
*/
|
||||
@@ -74,26 +68,33 @@ public class AVMServiceImpl implements AVMService
|
||||
*/
|
||||
private Issuer fLayerIssuer;
|
||||
|
||||
/**
|
||||
* Whether the tables should be dropped and created.
|
||||
*/
|
||||
private boolean fCreateTables;
|
||||
|
||||
/**
|
||||
* The HibernateHelper.
|
||||
*/
|
||||
private HibernateHelper fHibernateHelper;
|
||||
|
||||
/**
|
||||
* Basic constructor for the service.
|
||||
*/
|
||||
public AVMServiceImpl()
|
||||
{
|
||||
fSessionFactory = HibernateHelper.GetSessionFactory();
|
||||
fTransaction = new HibernateTxn(fSessionFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Final initialization of the service. Must be called only on a
|
||||
* fully initialized instance.
|
||||
* @param createTables Whether we should create tables, and a default
|
||||
* repository.
|
||||
*/
|
||||
public void init(boolean createTables)
|
||||
public void init()
|
||||
{
|
||||
if (createTables)
|
||||
fTransaction = new HibernateTxn(fHibernateHelper.getSessionFactory());
|
||||
if (fCreateTables)
|
||||
{
|
||||
SchemaExport se = new SchemaExport(HibernateHelper.GetConfiguration());
|
||||
SchemaExport se = new SchemaExport(fHibernateHelper.getConfiguration());
|
||||
se.drop(false, true);
|
||||
se.create(false, true);
|
||||
File storage = new File(fStorage);
|
||||
@@ -135,8 +136,30 @@ public class AVMServiceImpl implements AVMService
|
||||
fStorage = storage;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.avm.AVMService#getFileInputStream(int, java.lang.String)
|
||||
/**
|
||||
* Set whether we should drop and create tables.
|
||||
* @param createTables
|
||||
*/
|
||||
public void setCreateTables(boolean createTables)
|
||||
{
|
||||
fCreateTables = createTables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the HibernateHelper.
|
||||
* @param helper
|
||||
*/
|
||||
public void setHibernateHelper(HibernateHelper helper)
|
||||
{
|
||||
fHibernateHelper = helper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an InputStream from a file.
|
||||
* @param version The version to look under.
|
||||
* @param path The absolute path.
|
||||
* @return An InputStream
|
||||
* @throws AVMNotFoundException When the path is invalid.
|
||||
*/
|
||||
public InputStream getFileInputStream(final int version, final String path)
|
||||
{
|
||||
|
Reference in New Issue
Block a user