Author: tolusha
Date: 2010-12-22 06:56:25 -0500 (Wed, 22 Dec 2010)
New Revision: 3709
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistedWorkspaceRestore.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRDBMSBackupManager.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
Log:
EXOJCR-747: revert: restore single workspace into existed one in case of multi-db is not
supported
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-12-22
11:55:56 UTC (rev 3708)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-12-22
11:56:25 UTC (rev 3709)
@@ -64,7 +64,6 @@
import
org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
@@ -757,41 +756,6 @@
PrivilegedFileHelper.mkdirs(dir);
config.setBackupDir(dir);
- try
- {
- // check if it is RDBMS backup of single workspace in case of multi-db
configuration
- if ((Class.forName(fullBackupType)
-
.equals(org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob.class)))
- {
- WorkspaceEntry wEntry = null;
- for (WorkspaceEntry entry :
repoService.getRepository(config.getRepository()).getConfiguration()
- .getWorkspaceEntries())
- {
- if (entry.getName().equals(config.getWorkspace()))
- {
- wEntry = entry;
- break;
- }
- }
-
- if (wEntry == null)
- {
- throw new WorkspaceRestoreException("Workspace " +
config.getWorkspace()
- + " did not found in current repository " +
config.getRepository() + " configuration");
- }
-
- if
(Boolean.parseBoolean(wEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.MULTIDB)))
- {
- throw new BackupOperationException(
- "Backup of single workspace in case of multi-db configuration is
not supported");
- }
- }
- }
- catch (ClassNotFoundException e)
- {
- throw new BackupOperationException("Class " + fullBackupType + "
is not found.", e);
- }
-
BackupChain bchain =
new BackupChainImpl(config, logsDirectory, repoService,
fullBackupType, incrementalBackupType, IdGenerator.generate(),
logsDirectory, startTime);
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistedWorkspaceRestore.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistedWorkspaceRestore.java 2010-12-22
11:55:56 UTC (rev 3708)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistedWorkspaceRestore.java 2010-12-22
11:56:25 UTC (rev 3709)
@@ -25,7 +25,6 @@
import org.exoplatform.services.jcr.ext.backup.BackupManager;
import org.exoplatform.services.jcr.ext.backup.WorkspaceRestoreException;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.util.jdbc.cleaner.DBCleanerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -101,29 +100,6 @@
+ " did not found in current repository " + repositoryName +
" configuration");
}
- boolean isMultiDb;
- try
- {
- String multiDb =
wEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.MULTIDB);
- if (multiDb == null)
- {
- throw new RepositoryConfigurationException("Parameter " +
JDBCWorkspaceDataContainer.MULTIDB
- + " not found in workspace configuration " +
wEntry.getName());
- }
-
- isMultiDb = Boolean.parseBoolean(multiDb);
- }
- catch (RepositoryConfigurationException e)
- {
- throw new WorkspaceRestoreException("Can't define " +
JDBCWorkspaceDataContainer.MULTIDB + " parameter", e);
- }
-
- if (isMultiDb)
- {
- throw new WorkspaceRestoreException(
- "Restore of single workspace into existed one for multi-db is not
supported");
- }
-
boolean isSystem =
repositoryService.getRepository(repositoryName).getConfiguration().getSystemWorkspaceName()
.equals(wEntry.getName());
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2010-12-22
11:55:56 UTC (rev 3708)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2010-12-22
11:56:25 UTC (rev 3709)
@@ -1275,7 +1275,12 @@
public void testExistedWorkspaceRestoreMultiDB() throws Exception
{
String repositoryNameToBackup = "db8";
+ SessionImpl ws1Session =
+
(SessionImpl)repositoryService.getRepository(repositoryNameToBackup).login(credentials,
"ws1");
+ ws1Session.getRootNode().addNode("TESTNODE");
+ ws1Session.save();
+
// backup
File backDir = new File("target/backup/" + getUUIndex());
backDir.mkdirs();
@@ -1326,15 +1331,26 @@
assertNotNull(bchLog.getStartedTime());
assertNotNull(bchLog.getFinishedTime());
+ backup.restoreExistingWorkspace(bchLog, repositoryNameToBackup, ws1, false);
+
+ // check
+ SessionImpl back1 = null;
try
{
- backup.restoreExistingWorkspace(bchLog, repositoryNameToBackup, ws1, false);
- fail("Exception should be thrown");
+ back1 =
(SessionImpl)repositoryService.getRepository("db8").login(credentials,
"ws1");
+ Node ws1backTestRoot = back1.getRootNode().getNode("TESTNODE");
}
- catch (WorkspaceRestoreException e)
+ catch (Exception e)
{
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ finally
+ {
+ if (back1 != null)
+ back1.logout();
+ }
- }
}
else
fail("There are no backup files in " + backDir.getAbsolutePath());
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRDBMSBackupManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRDBMSBackupManager.java 2010-12-22
11:55:56 UTC (rev 3708)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRDBMSBackupManager.java 2010-12-22
11:56:25 UTC (rev 3709)
@@ -20,8 +20,6 @@
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl;
-import java.io.File;
-
/**
* Created by The eXo Platform SAS.
*
@@ -54,29 +52,4 @@
return backupManagerImpl;
}
- // @Override
- public void testExistedWorkspaceRestoreMultiDB() throws Exception
- {
- String repositoryNameToBackup = "db8";
-
- // backup
- File backDir = new File("target/backup/" + System.currentTimeMillis());
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repositoryNameToBackup);
- config.setWorkspace(workspaceNameToBackup);
- config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
-
- config.setBackupDir(backDir);
-
- try
- {
- backup.startBackup(config);
- fail("Exception should be thrown");
- }
- catch (BackupOperationException e)
- {
- }
- }
}
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
===================================================================
---
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2010-12-22
11:55:56 UTC (rev 3708)
+++
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2010-12-22
11:56:25 UTC (rev 3709)
@@ -483,11 +483,6 @@
<section>
<title>Restore existing workspace or repository</title>
- <note>
- <para>Restoring single workspace into existed one in case of multi-db is
- not supported.</para>
- </note>
-
<para>The resore of existing workspace or repositry is available.</para>
<para>For restore will be used spacial methods:</para>
Show replies by date