Author: nzamosenchuk
Date: 2011-10-04 02:51:40 -0400 (Tue, 04 Oct 2011)
New Revision: 5013
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
Log:
EXOJCR-1563 : reverting prev.changes.
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-10-04
06:15:55 UTC (rev 5012)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-10-04
06:51:40 UTC (rev 5013)
@@ -116,20 +116,20 @@
File fullBackupDir =
JCRRestore.getFullBackupFile(workspacesMapping.get(wEntry.getName()).getBackupConfig().getBackupDir());
-
+
DataRestoreContext context;
if (jdbcConn != null)
{
- context =
- new DataRestoreContext(
- new String[]{DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION}, new Object[]{
- fullBackupDir, jdbcConn});
+ context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR,
DataRestoreContext.DB_CONNECTION},
+ new Object[] {fullBackupDir, jdbcConn});
}
else
{
- context =
- new DataRestoreContext(new String[]{DataRestoreContext.STORAGE_DIR},
new Object[]{fullBackupDir});
+ context = new DataRestoreContext(
+ new String[] {DataRestoreContext.STORAGE_DIR},
+ new Object[] {fullBackupDir});
}
for (Backupable component : backupable)
@@ -226,13 +226,4 @@
}
}
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isSameConfiguration()
- {
- return true;
- }
}
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2011-10-04
06:15:55 UTC (rev 5012)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2011-10-04
06:51:40 UTC (rev 5013)
@@ -16,6 +16,8 @@
*/
package org.exoplatform.services.jcr.ext.backup.impl;
+
+
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -160,7 +162,7 @@
* will be generated the Throwable
*/
protected void restoreRepository() throws RepositoryRestoreExeption,
BackupOperationException,
- ClassNotFoundException
+ ClassNotFoundException
{
List<WorkspaceEntry> originalWorkspaceEntrys =
repositoryEntry.getWorkspaceEntries();
@@ -180,7 +182,7 @@
//getting backup chail log to system workspace.
BackupChainLog systemBackupChainLog =
workspacesMapping.get(systemWorkspaceEntry.getName());
-
+
WorkspaceInitializerEntry wiEntry =
getWorkspaceInitializerEntry(systemBackupChainLog);
// set initializer
@@ -204,15 +206,8 @@
WorkspaceEntry createdWorkspaceEntry =
(WorkspaceEntry)wcf.getComponent(WorkspaceEntry.class);
createdWorkspaceEntry.setInitializer(wieOriginal);
- // if same configuration is used, then no need to retain configuration. There
is
- // a common usecase, when no configuration persister is used, so configuration
can't
- // be rewritten, but backup-restore cycles are always performed. This usecase is
- // correct if same configuration used. Otherwise exception will be thrown on
retain.
- if (!isSameConfiguration())
- {
- // save configuration to persistence (file or persister)
- repositoryService.getConfig().retain();
- }
+ // save configuration to persistence (file or persister)
+ repositoryService.getConfig().retain();
for (WorkspaceEntry wsEntry : originalWorkspaceEntrys)
{
@@ -275,7 +270,8 @@
* @throws RepositoryConfigurationException
*/
protected void removeRepository(RepositoryService repositoryService, String
repositoryName)
- throws RepositoryException, RepositoryConfigurationException
+ throws RepositoryException,
+ RepositoryConfigurationException
{
ManageableRepository mr = null;
@@ -297,7 +293,7 @@
}
private WorkspaceInitializerEntry getWorkspaceInitializerEntry(BackupChainLog
systemBackupChainLog)
- throws BackupOperationException, ClassNotFoundException
+ throws BackupOperationException, ClassNotFoundException
{
String fullBackupPath =
systemBackupChainLog.getJobEntryInfos().get(0).getURL().getPath();
@@ -309,20 +305,20 @@
fullbackupType = systemBackupChainLog.getFullBackupType();
}
else if ((Class.forName(systemBackupChainLog.getFullBackupType())
-
.equals(org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob.class)))
+
.equals(org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob.class)))
{
fullbackupType = systemBackupChainLog.getFullBackupType();
}
else
{
throw new BackupOperationException("Class \"" +
systemBackupChainLog.getFullBackupType()
- + "\" is not support as full backup.");
+ + "\" is not support as full backup.");
}
}
catch (ClassNotFoundException e)
{
throw new BackupOperationException("Class \"" +
systemBackupChainLog.getFullBackupType() + "\" is not found.",
- e);
+ e);
}
WorkspaceInitializerEntry wiEntry = new WorkspaceInitializerEntry();
@@ -333,19 +329,19 @@
List<SimpleParameterEntry> wieParams = new
ArrayList<SimpleParameterEntry>();
wieParams.add(new
SimpleParameterEntry(BackupWorkspaceInitializer.RESTORE_PATH_PARAMETER, (new File(
- fullBackupPath).getParent())));
+ fullBackupPath).getParent())));
wiEntry.setParameters(wieParams);
}
else if ((Class.forName(fullbackupType)
-
.equals(org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob.class)))
+
.equals(org.exoplatform.services.jcr.ext.backup.impl.rdbms.FullBackupJob.class)))
{
// set the initializer RdbmsBackupWorkspaceInitializer
wiEntry.setType(RdbmsBackupWorkspaceInitializer.class.getCanonicalName());
List<SimpleParameterEntry> wieParams = new
ArrayList<SimpleParameterEntry>();
wieParams.add(new
SimpleParameterEntry(RdbmsBackupWorkspaceInitializer.RESTORE_PATH_PARAMETER, (new File(
- fullBackupPath).getParent())));
+ fullBackupPath).getParent())));
wiEntry.setParameters(wieParams);
}
@@ -399,14 +395,6 @@
}
/**
- * @return true, if configuration the same
- */
- public boolean isSameConfiguration()
- {
- return false;
- }
-
- /**
* getRestoreException.
*
* @return Throwable return the exception of repository restore.