mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Made AVMRepository Springable. Modularized Spring configuration a bit.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3380 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -56,21 +56,6 @@ public class AVMServiceImpl implements AVMService
|
||||
*/
|
||||
private String fStorage;
|
||||
|
||||
/**
|
||||
* The node id issuer.
|
||||
*/
|
||||
private Issuer fNodeIssuer;
|
||||
|
||||
/**
|
||||
* The content id issuer.
|
||||
*/
|
||||
private Issuer fContentIssuer;
|
||||
|
||||
/**
|
||||
* The layer id issuer.
|
||||
*/
|
||||
private Issuer fLayerIssuer;
|
||||
|
||||
/**
|
||||
* Whether the tables should be dropped and created.
|
||||
*/
|
||||
@@ -83,43 +68,23 @@ public class AVMServiceImpl implements AVMService
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage directory.
|
||||
* @param storage The full path to the storage directory.
|
||||
*/
|
||||
public void setStorage(String storage)
|
||||
{
|
||||
fStorage = storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Final initialization of the service. Must be called only on a
|
||||
* fully initialized instance.
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
try
|
||||
{
|
||||
fTransaction.perform(
|
||||
new RetryingTransactionCallback()
|
||||
{
|
||||
public void perform()
|
||||
{
|
||||
IssuerDAO dao = AVMContext.fgInstance.fIssuerDAO;
|
||||
Long val = dao.getNodeIssuerValue();
|
||||
fNodeIssuer = new Issuer(val == null ? 0L : val + 1L);
|
||||
val = dao.getContentIssuerValue();
|
||||
fContentIssuer = new Issuer(val == null ? 0L : val + 1L);
|
||||
val = dao.getLayerIssuerValue();
|
||||
fLayerIssuer = new Issuer(val == null ? 0L : val + 1L);
|
||||
}
|
||||
}, false);
|
||||
fAVMRepository = new AVMRepository(fNodeIssuer,
|
||||
fContentIssuer,
|
||||
fLayerIssuer,
|
||||
fStorage);
|
||||
fgLogger.info("Initialized AVMService and AVMRepository");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
fgLogger.fatal("Failed to initialize AVMService", e);
|
||||
// TODO Abort in some useful way.
|
||||
}
|
||||
if (fInitialize)
|
||||
{
|
||||
File storageDir = new File(fStorage);
|
||||
storageDir.mkdirs();
|
||||
createAVMStore("main");
|
||||
fgLogger.info("Created new main AVMStore");
|
||||
}
|
||||
@@ -134,15 +99,6 @@ public class AVMServiceImpl implements AVMService
|
||||
fTransaction = txn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the location of file storage.
|
||||
* @param storage
|
||||
*/
|
||||
public void setStorage(String storage)
|
||||
{
|
||||
fStorage = storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether we should create an initial AVMStore.
|
||||
* @param initialize
|
||||
@@ -152,6 +108,15 @@ public class AVMServiceImpl implements AVMService
|
||||
fInitialize = initialize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repository reference. For Spring.
|
||||
* @param avmRepository The repository reference.
|
||||
*/
|
||||
public void setAvmRepository(AVMRepository avmRepository)
|
||||
{
|
||||
fAVMRepository = avmRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an InputStream from a file.
|
||||
* @param version The version to look under.
|
||||
|
Reference in New Issue
Block a user