if (!existing.contains(names[i])) {
target.createWorkspace(names[i]);
}
// Copy all the workspace content
PersistenceCopier copier = new PersistenceCopier(
source.getWorkspaceInfo(names[i]).getPersistenceManager(),
target.getWorkspaceInfo(names[i]).getPersistenceManager(),
target.getDataStore());
copier.excludeNode(RepositoryImpl.SYSTEM_ROOT_NODE_ID);
copier.copy(RepositoryImpl.ROOT_NODE_ID);
// Copy all the active open-scoped locks
LockManagerImpl sourceLockManager = source.getLockManager(names[i]);
LockManagerImpl targetLockManager = target.getLockManager(names[i]);
targetLockManager.copyOpenScopedLocksFrom(sourceLockManager);