mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AVMService.createSnapshot() returns a map of possibly snapshotted stores.
When one snapshots a store, other stores can be implicitly snapshotted. This change allows clients to exploit this information. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6078 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -159,7 +159,7 @@ public class AVMLockingAwareService implements AVMService, ApplicationContextAwa
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.service.cmr.avm.AVMService#createSnapshot(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public int createSnapshot(String store, String tag, String description)
|
||||
public Map<String, Integer> createSnapshot(String store, String tag, String description)
|
||||
{
|
||||
return fService.createSnapshot(store, tag, description);
|
||||
}
|
||||
|
@@ -99,7 +99,7 @@ public class AVMRemoteLocal implements AVMRemote
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.avm.AVMRemote#createSnapshot(java.lang.String)
|
||||
*/
|
||||
public int createSnapshot(String store, String label, String comment)
|
||||
public Map<String, Integer> createSnapshot(String store, String label, String comment)
|
||||
{
|
||||
return fService.createSnapshot(store, label, comment);
|
||||
}
|
||||
|
@@ -630,7 +630,7 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
* @return The version id of the new snapshot.
|
||||
*/
|
||||
public int createSnapshot(String ticket, String store, String label, String comment)
|
||||
public Map<String, Integer> createSnapshot(String ticket, String store, String label, String comment)
|
||||
{
|
||||
fAuthService.validate(ticket);
|
||||
return fAVMService.createSnapshot(store, label, comment);
|
||||
|
@@ -445,7 +445,8 @@ public class AVMRepository
|
||||
if (version < 0)
|
||||
{
|
||||
fLookupCache.onSnapshot(pathParts[0]);
|
||||
version = srcRepo.createSnapshot("Branch Snapshot", null, new HashMap<String, Integer>());
|
||||
version =
|
||||
srcRepo.createSnapshot("Branch Snapshot", null, new HashMap<String, Integer>()).get(pathParts[0]);
|
||||
}
|
||||
sPath = srcRepo.lookup(version, pathParts[1], false, false);
|
||||
if (sPath == null)
|
||||
@@ -798,7 +799,7 @@ public class AVMRepository
|
||||
* @param description The thick description.
|
||||
* @return The version id of the newly snapshotted repository.
|
||||
*/
|
||||
public int createSnapshot(String storeName, String tag, String description)
|
||||
public Map<String, Integer> createSnapshot(String storeName, String tag, String description)
|
||||
{
|
||||
AlfrescoTransactionSupport.bindListener(fCreateVersionTxnListener);
|
||||
AVMStore store = getAVMStoreByName(storeName);
|
||||
@@ -807,8 +808,11 @@ public class AVMRepository
|
||||
throw new AVMNotFoundException("Store not found.");
|
||||
}
|
||||
fLookupCache.onSnapshot(storeName);
|
||||
int result = store.createSnapshot(tag, description, new HashMap<String, Integer>());
|
||||
fCreateVersionTxnListener.versionCreated(storeName, result);
|
||||
Map<String, Integer> result = store.createSnapshot(tag, description, new HashMap<String, Integer>());
|
||||
for (Map.Entry<String, Integer> entry : result.entrySet())
|
||||
{
|
||||
fCreateVersionTxnListener.versionCreated(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -607,9 +607,9 @@ public class AVMServiceImpl implements AVMService
|
||||
* @param store The name of the AVMStore.
|
||||
* @param tag The short description.
|
||||
* @param description The thick description.
|
||||
* @return The id of the new version.
|
||||
* @return Map of implicitly and explicitly snapshotted stores.
|
||||
*/
|
||||
public int createSnapshot(String store, String tag, String description)
|
||||
public Map<String, Integer> createSnapshot(String store, String tag, String description)
|
||||
{
|
||||
if (store == null)
|
||||
{
|
||||
|
@@ -277,7 +277,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
{
|
||||
// Layers are not yet indexed
|
||||
setupBasicTree();
|
||||
assertEquals(1, fService.createSnapshot("main", null, null));
|
||||
assertEquals(1, fService.createSnapshot("main", null, null).get("main").intValue());
|
||||
runQueriesAgainstBasicTree("main");
|
||||
fService.createStore("layer");
|
||||
fService.createLayeredDirectory("main:/a", "layer:/", "a");
|
||||
@@ -2001,9 +2001,9 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
fService.createStore("source");
|
||||
fService.createStore("dest");
|
||||
loader.recursiveLoad("config/alfresco/bootstrap", "source:/");
|
||||
int version1 = fService.createSnapshot("source", null, null);
|
||||
int version1 = fService.createSnapshot("source", null, null).get("source");
|
||||
loader.recursiveLoad("config/alfresco/extension", "source:/");
|
||||
int version2 = fService.createSnapshot("source", null, null);
|
||||
int version2 = fService.createSnapshot("source", null, null).get("source");
|
||||
List<AVMDifference> diffs = fSyncService.compare(version1, "source:/", -1, "dest:/", null);
|
||||
fService.createSnapshot("dest", null, null);
|
||||
assertEquals(1, diffs.size());
|
||||
@@ -4905,7 +4905,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
loader.setAvmService(fService);
|
||||
loader.recursiveLoad("source/java/org/alfresco/repo/avm", "main:/");
|
||||
times.add(System.currentTimeMillis());
|
||||
assertEquals(1, fService.createSnapshot("main", null, null));
|
||||
assertEquals(1, fService.createSnapshot("main", null, null).get("main").intValue());
|
||||
loader.recursiveLoad("source/java/org/alfresco/repo/action", "main:/");
|
||||
times.add(System.currentTimeMillis());
|
||||
assertEquals(2, fService.createSnapshot("main", null, null));
|
||||
|
@@ -77,9 +77,9 @@ public interface AVMStore
|
||||
* @param description The long description.
|
||||
* @param snapShotMap Keeps track of snapshot ids for all stores that
|
||||
* end up snapshotted, possibly recursively.
|
||||
* @return The version id of the newly created snapshot.
|
||||
* @return The map of all implicitely and explicitely snapshotted stores.
|
||||
*/
|
||||
public int createSnapshot(String tag, String Description, Map<String, Integer> snapShotMap);
|
||||
public Map<String, Integer> createSnapshot(String tag, String Description, Map<String, Integer> snapShotMap);
|
||||
|
||||
/**
|
||||
* Create a new directory.
|
||||
|
@@ -177,7 +177,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
* @return The version id of the new snapshot.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public int createSnapshot(String tag, String description, Map<String, Integer> snapShotMap)
|
||||
public Map<String, Integer> createSnapshot(String tag, String description, Map<String, Integer> snapShotMap)
|
||||
{
|
||||
VersionRoot lastVersion = AVMDAOs.Instance().fVersionRootDAO.getMaxVersion(this);
|
||||
List<VersionLayeredNodeEntry> layeredEntries =
|
||||
@@ -192,7 +192,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
lastVersion.setDescription(description);
|
||||
}
|
||||
snapShotMap.put(fName, lastVersion.getVersionID());
|
||||
return lastVersion.getVersionID();
|
||||
return snapShotMap;
|
||||
}
|
||||
snapShotMap.put(fName, fNextVersionID);
|
||||
// Force copies on all the layered nodes from last snapshot.
|
||||
@@ -299,7 +299,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
}
|
||||
// Increment the version id.
|
||||
fNextVersionID++;
|
||||
return fNextVersionID - 1;
|
||||
return snapShotMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -381,7 +381,7 @@ public class AVMSyncServiceImpl implements AVMSyncService
|
||||
}
|
||||
else
|
||||
{
|
||||
version = fAVMService.createSnapshot(storeName, "Snapshotted for submit.", null);
|
||||
version = fAVMService.createSnapshot(storeName, "Snapshotted for submit.", null).get(storeName);
|
||||
}
|
||||
}
|
||||
AVMNodeDescriptor srcDesc = fAVMService.lookup(version,
|
||||
|
@@ -116,7 +116,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
if (version < 0)
|
||||
{
|
||||
String storeName = srcPath.substring(0, srcPath.indexOf(":"));
|
||||
version = fAVMService.createSnapshot(storeName, null, null);
|
||||
version = fAVMService.createSnapshot(storeName, null, null).get(storeName);
|
||||
}
|
||||
// Get the root of the deployment from this server.
|
||||
AVMNodeDescriptor srcRoot = fAVMService.lookup(version, srcPath);
|
||||
@@ -148,7 +148,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
throw new AVMNotFoundException("Node Not Found: " + parentBase[0]);
|
||||
}
|
||||
}
|
||||
snapshot = remote.createSnapshot(storePath[0], "PreDeploy", "Pre Deployment Snapshot");
|
||||
snapshot = remote.createSnapshot(storePath[0], "PreDeploy", "Pre Deployment Snapshot").get(storePath[0]);
|
||||
|
||||
}
|
||||
// Get the root of the deployment on the destination server.
|
||||
@@ -639,7 +639,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
System.out.println(storeName);
|
||||
if (version < 0)
|
||||
{
|
||||
version = fAVMService.createSnapshot(storeName, null, null);
|
||||
version = fAVMService.createSnapshot(storeName, null, null).get(storeName);
|
||||
}
|
||||
String ticket = service.begin(target, userName, password);
|
||||
deployDirectoryPush(service, ticket, report, callback, version, srcPath, "/");
|
||||
|
@@ -110,7 +110,7 @@ public class AVMRemoteImpl implements AVMRemote
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.avm.AVMRemote#createSnapshot(java.lang.String)
|
||||
*/
|
||||
public int createSnapshot(String store, String label, String comment)
|
||||
public Map<String, Integer> createSnapshot(String store, String label, String comment)
|
||||
{
|
||||
return fTransport.createSnapshot(fTicketHolder.getTicket(), store, label, comment);
|
||||
}
|
||||
|
@@ -613,9 +613,11 @@ public interface AVMService
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
* @param tag The short description.
|
||||
* @param description The thick description.
|
||||
* @return A Map of all implicitly or explicitly snapshotted stores to last
|
||||
* version id.
|
||||
* @throws AVMNotFoundException
|
||||
*/
|
||||
public int createSnapshot(String store, String tag, String description);
|
||||
public Map<String, Integer> createSnapshot(String store, String tag, String description);
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -196,9 +196,9 @@ public interface AVMRemote
|
||||
/**
|
||||
* Snapshot an AVMStore.
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
* @return The version id of the new snapshot.
|
||||
* @return The map of implicitely and explicitely snapshotted stores.
|
||||
*/
|
||||
public int createSnapshot(String store, String label, String comment);
|
||||
public Map<String, Integer> createSnapshot(String store, String label, String comment);
|
||||
|
||||
/**
|
||||
* Get a List of all versions in a given store.
|
||||
|
@@ -208,9 +208,9 @@ public interface AVMRemoteTransport
|
||||
/**
|
||||
* Snapshot an AVMStore.
|
||||
* @param store The name of the AVMStore to snapshot.
|
||||
* @return The version id of the new snapshot.
|
||||
* @return The map of explicitly and implicitly snapshotted stores.
|
||||
*/
|
||||
public int createSnapshot(String ticket, String store, String label, String comment);
|
||||
public Map<String, Integer> createSnapshot(String ticket, String store, String label, String comment);
|
||||
|
||||
/**
|
||||
* Get a List of all versions in a given store.
|
||||
|
Reference in New Issue
Block a user