Author: areshetnyak
Date: 2010-09-30 09:03:22 -0400 (Thu, 30 Sep 2010)
New Revision: 3223
Modified:
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 : Make backup restore easier documentation.
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-09-30
11:43:34 UTC (rev 3222)
+++
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2010-09-30
13:03:22 UTC (rev 3223)
@@ -474,4 +474,197 @@
operation cycle as the chainPeriod and incrementalPeriod will be applied
again. That behaviour may be changed in the future.</para>
</section>
+
+ <section>
+ <title>Restore existing workspace or repository</title>
+
+ <highlights>
+ <para>Restore of existed system workspace was not supported. When need
+ restore of system workspace, than we need restore all repository.</para>
+ </highlights>
+
+ <para>The resore of existed workspace or repositry is avaleble. </para>
+
+ <para>For restore will be used spacial methods:</para>
+
+ <programlisting> /**
+ * Restore existed workspace. Previous data will be deleted.
+ * For getting status of workspace restore use can use
+ * BackupManager.getLastRestore(String repositoryName, String workspaceName) method
+ *
+ * @param workspaceBackupIdentifier
+ * backup identifier
+ * @param workspaceEntry
+ * new workspace configuration
+ * @param asynchronous
+ * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
+ * @throws BackupOperationException
+ * if backup operation exception occurred
+ * @throws BackupConfigurationException
+ * if configuration exception occurred
+ */
+ void restoreExistedWorkspace(String workspaceBackupIdentifier, String repositoryName,
WorkspaceEntry workspaceEntry,
+ boolean asynchronous) throws BackupOperationException,
BackupConfigurationException;
+
+ /**
+ * Restore existed workspace. Previous data will be deleted.
+ * For getting status of workspace restore use can use
+ * BackupManager.getLastRestore(String repositoryName, String workspaceName) method
+ *
+ * @param log
+ * workspace backup log
+ * @param workspaceEntry
+ * new workspace configuration
+ * @param asynchronous
+ * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
+ * @throws BackupOperationException
+ * if backup operation exception occurred
+ * @throws BackupConfigurationException
+ * if configuration exception occurred
+ */
+ void restoreExistedWorkspace(BackupChainLog log, String repositoryName, WorkspaceEntry
workspaceEntry, boolean asynchronous) throws BackupOperationException,
BackupConfigurationException;
+
+ /**
+ * Restore existed repository. Previous data will be deleted.
+ * For getting status of repository restore use can use
+ * BackupManager.getLastRestore(String repositoryName) method
+ *
+ * @param repositoryBackupIdentifier
+ * backup identifier
+ * @param repositoryEntry
+ * new repository configuration
+ * @param asynchronous
+ * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
+ * @throws BackupOperationException
+ * if backup operation exception occurred
+ * @throws BackupConfigurationException
+ * if configuration exception occurred
+ */
+ void restoreExistedRepository(String repositoryBackupIdentifier, RepositoryEntry
repositoryEntry, boolean asynchronous) throws BackupOperationException,
BackupConfigurationException;
+
+ /**
+ * Restore existed repository. Previous data will be deleted.
+ * For getting status of repository restore use can use
+ * BackupManager.getLastRestore(String repositoryName) method
+ *
+ * @param log
+ * repository backup log
+ * @param repositoryEntry
+ * new repository configuration
+ * @param asynchronous
+ * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
+ * @throws BackupOperationException
+ * if backup operation exception occurred
+ * @throws BackupConfigurationException
+ * if configuration exception occurred
+ */
+ void restoreExistedRepository(RepositoryBackupChainLog log, RepositoryEntry
repositoryEntry, boolean asynchronous)
+ throws BackupOperationException,
BackupConfigurationException;</programlisting>
+
+ <para>These methods for restore will do:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>remove existed workspace or repository;</para>
+ </listitem>
+
+ <listitem>
+ <para>clean database;</para>
+ </listitem>
+
+ <listitem>
+ <para>clean index data;</para>
+ </listitem>
+
+ <listitem>
+ <para>clean value storage;</para>
+ </listitem>
+
+ <listitem>
+ <para>restore from backup.</para>
+ </listitem>
+ </itemizedlist>
+
+ <example>
+ <title>Make backup of workspace and restore it.</title>
+
+ <para><programlisting> // backup
+ File backDir = new File("target/backup/ws1");
+ backDir.mkdirs();
+
+ BackupConfig config = new BackupConfig();
+ config.setRepository(repository.getName());
+ config.setWorkspace("ws1");
+ config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
+ config.setBackupDir(backDir);
+
+ backup.startBackup(config);
+
+ BackupChain bch = backup.findBackup(repository.getName(), "ws1");
+
+ // wait till full backup will be stopped
+ while (bch.getFullBackupState() != BackupJob.FINISHED)
+ {
+ Thread.yield();
+ Thread.sleep(50);
+ }
+
+ // stop fullBackup
+ backup.stopBackup(bch);
+
+ // restore
+ RepositoryEntry re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+ WorkspaceEntry ws1 = null;
+ for (WorkspaceEntry we : re.getWorkspaceEntries())
+ {
+ if (ws1Session.getWorkspace().getName().equals(we.getName()))
+ {
+ ws1 = we;
+ break;
+ }
+ }
+
+ File backLog = new File(bch.getLogFilePath());
+ BackupChainLog bchLog = new BackupChainLog(backLog);
+
+ backup.restoreExistedWorkspace(bchLog, re.getName(), ws1,
false);</programlisting></para>
+ </example>
+
+ <example>
+ <title>Make backup of repository and restore it.</title>
+
+ <para><programlisting> // backup
+ File backDir = new File("target/backup");
+ backDir.mkdirs();
+
+ RepositoryBackupConfig config = new RepositoryBackupConfig();
+ config.setRepository(repository.getName());
+ config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
+ config.setBackupDir(backDir);
+
+ backup.startBackup(config);
+
+ RepositoryBackupChain bch = backup.findRepositoryBackup(repository.getName());
+
+ // wait till full backup will be stopped
+ while (bch.getState() != RepositoryBackupChain.FINISHED)
+ {
+ Thread.yield();
+ Thread.sleep(50);
+ }
+
+ // stop fullBackup
+ backup.stopBackup(bch);
+
+ // restore
+ RepositoryEntry baseRE =
+
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+ RepositoryEntry re = makeRepositoryEntry(baseRE.getName(), baseRE, null, null);
+
+ File backLog = new File(bch.getLogFilePath());
+ RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
+
+ backup.restoreExistedRepository(bchLog, re,
false);</programlisting></para>
+ </example>
+ </section>
</chapter>
Show replies by date