Merge V1.2.0 BRANCH to HEAD

svn merge -r 2519:2565 svn://www.alfresco.org/alfresco/BRANCHES/V1.2.0/root HEAD/root


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2566 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-03-22 12:23:43 +00:00
parent 9fe16d5ae3
commit 506e408ca7
29 changed files with 725 additions and 182 deletions

View File

@@ -72,6 +72,7 @@ public class ImporterBootstrap implements ApplicationListener
// Dependencies
private boolean allowWrite = true;
private boolean useExistingStore = false;
private TransactionService transactionService;
private NamespaceService namespaceService;
private NodeService nodeService;
@@ -94,6 +95,18 @@ public class ImporterBootstrap implements ApplicationListener
this.allowWrite = write;
}
/**
* Set whether the importer bootstrap should only perform an import if the store
* being referenced doesn't already exist.
*
* @param useExistingStore true to allow imports into an existing store,
* otherwise false (default) to only import if the store doesn't exist.
*/
public void setUseExistingStore(boolean useExistingStore)
{
this.useExistingStore = useExistingStore;
}
/**
* Sets the Transaction Service
*
@@ -305,11 +318,13 @@ public class ImporterBootstrap implements ApplicationListener
}
else
{
// create the store
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
if (logger.isDebugEnabled())
logger.debug("Created store: " + storeRef);
// create the store if necessary
if (!nodeService.exists(storeRef))
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
if (logger.isDebugEnabled())
logger.debug("Created store: " + storeRef);
}
// bootstrap the store contents
if (bootstrapViews != null)
@@ -538,12 +553,16 @@ public class ImporterBootstrap implements ApplicationListener
*/
private boolean performBootstrap()
{
if (nodeService.exists(storeRef))
if (useExistingStore)
{
// it doesn't matter if the store exists or not
return true;
}
else if (nodeService.exists(storeRef))
{
return false;
}
if (mustNotExistStoreUrls != null)
else if (mustNotExistStoreUrls != null)
{
for (String storeUrl : mustNotExistStoreUrls)
{