Author: skabashnyuk
Date: 2010-07-01 06:08:10 -0400 (Thu, 01 Jul 2010)
New Revision: 2736
Modified:
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
Log:
EXOJCR-756 test fix
Modified:
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
---
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-07-01
08:16:32 UTC (rev 2735)
+++
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-07-01
10:08:10 UTC (rev 2736)
@@ -162,7 +162,7 @@
private final WorkspaceBackupAutoStopper workspaceBackupStopper;
private final RepositoryBackupAutoStopper repositoryBackupStopper;
-
+
/**
* Temporary directory;
*/
@@ -284,6 +284,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
while (true)
@@ -331,6 +332,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
while (true)
@@ -1364,16 +1366,16 @@
BackupConfigurationException, RepositoryException,
RepositoryConfigurationException
{
// Checking repository exists.
- try
+ try
{
repoService.getRepository(repositoryEntry.getName());
throw new BackupConfigurationException("Repository \"" +
repositoryEntry.getName() + "\" is already exists.");
- }
- catch (RepositoryException e)
+ }
+ catch (RepositoryException e)
{
//OK. Repository with "repositoryEntry.getName" is not exists.
- }
-
+ }
+
Map<String, BackupChainLog> workspacesMapping = new HashedMap();
Map<String, BackupChainLog> backups = new HashedMap();
@@ -1469,9 +1471,9 @@
JobRepositoryRestore jobRepositoryRestore =
new JobRepositoryRestore(repoService, this, repositoryEntry, workspacesMapping,
rblog);
+ restoreRepositoryJobs.add(jobRepositoryRestore);
if (asynchronous)
{
- restoreRepositoryJobs.add(jobRepositoryRestore);
jobRepositoryRestore.start();
}
else
Modified:
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
===================================================================
---
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2010-07-01
08:16:32 UTC (rev 2735)
+++
jcr/branches/1.12-SEC/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2010-07-01
10:08:10 UTC (rev 2736)
@@ -127,6 +127,41 @@
*/
protected void restore() throws RepositoryRestoreExeption
{
+ try
+ {
+ stateRestore = REPOSITORY_RESTORE_STARTED;
+ startTime = Calendar.getInstance();
+
+ restoreRepository();
+
+ stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
+ endTime = Calendar.getInstance();
+ }
+ catch (Throwable t)
+ {
+ stateRestore = REPOSITORY_RESTORE_FAIL;
+ restoreException = t;
+
+ if (t instanceof RepositoryRestoreExeption)
+ {
+ throw (RepositoryRestoreExeption)t;
+ }
+ else
+ {
+ throw new RuntimeException(t);
+ }
+ }
+ }
+
+ /**
+ * Will be restored the workspace.
+ * @throws RepositoryRestoreExeption
+ *
+ * @throws Throwable
+ * will be generated the Throwable
+ */
+ protected void restoreRepository() throws RepositoryRestoreExeption
+ {
List<WorkspaceEntry> originalWorkspaceEntrys =
repositoryEntry.getWorkspaceEntries();
//Getting system workspace entry
@@ -187,28 +222,31 @@
{
currennWorkspaceName = wsEntry.getName();
backupManager.restore(workspacesMapping.get(wsEntry.getName()),
repositoryEntry.getName(), wsEntry,
- false);
+ false);
}
}
}
catch (InvalidItemStateException e)
{
restored = false;
-
- log.error("Can not restore workspace \"" + currennWorkspaceName
+ " in repository \"" + repositoryEntry.getName() + "\".",
e);
-
- throw new RepositoryRestoreExeption("Can not restore workspace
\"" + currennWorkspaceName + " in repository \"" +
repositoryEntry.getName() + "\"."
- + " There was database error.", e);
+ log.error("Can not restore workspace \"" + currennWorkspaceName +
" in repository \""
+ + repositoryEntry.getName() + "\".", e);
+
+ throw new RepositoryRestoreExeption("Can not restore workspace
\"" + currennWorkspaceName
+ + " in repository \"" + repositoryEntry.getName() +
"\"." + " There was database error.", e);
+
}
catch (Throwable t)
{
restored = false;
-
- log.error("Can not restore workspace \"" + currennWorkspaceName
+ " in repository \"" + repositoryEntry.getName() + "\".",
t);
-
- throw new RepositoryRestoreExeption("Can not restore workspace
\"" + currennWorkspaceName + " in repository \"" +
repositoryEntry.getName() + "\".", t);
+ log.error("Can not restore workspace \"" + currennWorkspaceName +
" in repository \""
+ + repositoryEntry.getName() + "\".", t);
+
+ throw new RepositoryRestoreExeption("Can not restore workspace
\"" + currennWorkspaceName
+ + " in repository \"" + repositoryEntry.getName() +
"\".", t);
+
}
finally
{
@@ -236,7 +274,8 @@
}
catch (Throwable thr)
{
- log.error("The partly restored repository \"" +
repositoryEntry.getName() + "\" can not be removed.", thr);
+ log.error("The partly restored repository \"" +
repositoryEntry.getName() + "\" can not be removed.",
+ thr);
}
}
}
@@ -265,15 +304,15 @@
/**
* {@inheritDoc}
*/
+ @Override
public void run()
{
-
try
{
stateRestore = REPOSITORY_RESTORE_STARTED;
startTime = Calendar.getInstance();
- restore();
+ restoreRepository();
stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
endTime = Calendar.getInstance();
Show replies by date