Author: areshetnyak
Date: 2010-03-24 10:18:24 -0400 (Wed, 24 Mar 2010)
New Revision: 2108
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChain.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupConfig.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryRestoreExeption.java
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/RepositoryBackupChainImpl.java
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChain.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupConfig.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
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/server/HTTPBackupAgent.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/test/ReplicationTestService.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-549 : The implementation backup/restore whole repository.
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChain.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChain.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChain.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -26,7 +26,7 @@
* Author : Alex Reshetnyak alex.reshetnyak(a)exoplatform.com.ua
* 09.01.2008
*/
-public interface BackupChain
+public interface BackupChain extends RepositoryBackupChain
{
/**
* The full backup state.
@@ -39,16 +39,6 @@
public static final int INCREMENTAL_WORKING = 2;
/**
- * State of backup FINISHED.
- */
- public static final int FINISHED = 4;
-
- /**
- * Sate of backup INITIALIZED.
- */
- public static final int INITIALIZED = 0;
-
- /**
* The timeout.
*/
public long TIMEOUT = 10000;
@@ -62,18 +52,6 @@
List<BackupJob> getBackupJobs();
/**
- * Call start backup.
- *
- */
- void startBackup();
-
- /**
- * Call stop backup.
- *
- */
- void stopBackup();
-
- /**
* Getting backup config.
*
* @return BackupConfig
@@ -88,32 +66,16 @@
* return state of full backup
*/
int getFullBackupState();
-
+
/**
- * Getting state of backup.
+ * Getting the state of incremental backup.
*
* @return int
- * return state of backup
+ * return state of full backup
*/
- int getState();
+ int getIncrementalBackupState();
/**
- * isFinished.
- *
- * @return boolean
- * return 'true' if backup was finished.
- */
- boolean isFinished();
-
- /**
- * Getting path to backup log.
- *
- * @return String
- * return path to backup log
- */
- String getLogFilePath();
-
- /**
* Add listener to all existing and will be created in future jobs.
*
* @param listener
@@ -128,21 +90,4 @@
* BackupJobListener, the backup job listener
*/
void removeListener(BackupJobListener listener);
-
- /**
- * Getting identifier of backup.
- *
- * @return String
- * return identifier of backup
- */
- String getBackupId();
-
- /**
- * Getting started time of backup.
- *
- * @return Calendar
- * return started time of backup
- */
- Calendar getStartedTime();
-
}
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -309,7 +309,7 @@
return finishedTime;
}
- class LogReader
+ private class LogReader
{
protected Log logger = ExoLogger.getLogger("ext.LogWriter");
@@ -533,7 +533,7 @@
}
}
- class LogWriter
+ private class LogWriter
{
protected Log logger = ExoLogger.getLogger("ext.LogWriter");
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupConfig.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupConfig.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupConfig.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -27,107 +27,14 @@
* @version $Id: $
*/
-public class BackupConfig
+public class BackupConfig extends RepositoryBackupConfig
{
-
/**
- * The backup type.
- */
- private int backupType;
-
- /**
- * The repository name.
- */
- private String repository;
-
- /**
* The workspace name.
*/
private String workspace;
/**
- * The incremental job period.
- */
- private long incrementalJobPeriod;
-
- /**
- * The incremental job number (the repetition numper).
- */
- private int incrementalJobNumber;
-
- /**
- * The backup directory.
- */
- private File backupDir;
-
- /**
- * Getting incremental job period.
- *
- * @return long
- * return incremental job period.
- */
- public long getIncrementalJobPeriod()
- {
- return incrementalJobPeriod;
- }
-
- /**
- * Setting incremental job period.
- *
- * @param incrementalJobPeriod
- * long, the incremental job period
- */
- public void setIncrementalJobPeriod(long incrementalJobPeriod)
- {
- this.incrementalJobPeriod = incrementalJobPeriod;
- }
-
- /**
- * Getting incremental job period (the repetition period).
- *
- * @return int
- * return incremental job period
- */
- public int getIncrementalJobNumber()
- {
- return incrementalJobNumber;
- }
-
- /**
- * Setting incremental job number (the repetition period).
- *
- * @param incrementalJobNumber
- * int, the incremental job number
- *
- */
- public void setIncrementalJobNumber(int incrementalJobNumber)
- {
- this.incrementalJobNumber = incrementalJobNumber;
- }
-
- /**
- * Getting the repository name.
- *
- * @return String
- * return the repository name
- */
- public String getRepository()
- {
- return repository;
- }
-
- /**
- * Setting the repository name.
- *
- * @param repository
- * String, the repository name
- */
- public void setRepository(String repository)
- {
- this.repository = repository;
- }
-
- /**
* Getting the workspace name.
*
* @return String
@@ -148,48 +55,4 @@
{
this.workspace = workspace;
}
-
- /**
- * Getting backup directory.
- *
- * @return File
- * return c
- */
- public File getBackupDir()
- {
- return backupDir;
- }
-
- /**
- * Setting the backup directory.
- *
- * @param backupDir
- * File, the backup directory
- */
- public void setBackupDir(File backupDir)
- {
- this.backupDir = backupDir;
- }
-
- /**
- * Getting the backup type.
- *
- * @return int
- * return the backup type
- */
- public int getBackupType()
- {
- return backupType;
- }
-
- /**
- * Setting the backup type.
- *
- * @param backupType
- * int, the backup type
- */
- public void setBackupType(int backupType)
- {
- this.backupType = backupType;
- }
}
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -19,13 +19,16 @@
package org.exoplatform.services.jcr.ext.backup;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.ext.backup.impl.BackupMessage;
import org.exoplatform.services.jcr.ext.backup.impl.BackupScheduler;
+import org.exoplatform.services.jcr.ext.backup.impl.JobRepositoryRestore;
import org.exoplatform.services.jcr.ext.backup.impl.JobWorkspaceRestore;
import java.io.File;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.jcr.RepositoryException;
@@ -57,6 +60,14 @@
* return the set of current backups
*/
Set<BackupChain> getCurrentBackups();
+
+ /**
+ * Getting current repository backups.
+ *
+ * @return Set
+ * return the set of current backups
+ */
+ Set<RepositoryBackupChain> getCurrentRepositoryBackups();
/**
* Getting list of restores.
@@ -67,7 +78,7 @@
List<JobWorkspaceRestore> getRestores();
/**
- * Getting last restore by repository nam workspace.
+ * Getting last restore by repository and workspace name.
*
* @param repositoryName
* String, the repository name
@@ -77,8 +88,26 @@
* return the job to restore
*/
JobWorkspaceRestore getLastRestore(String repositoryName, String workspaceName);
+
+ /**
+ * Getting list of repository restores.
+ *
+ * @return List
+ * return the list of backups
+ */
+ List<JobRepositoryRestore> getRepositoryRestores();
/**
+ * Getting last repository restore by repository name.
+ *
+ * @param repositoryName
+ * String, the repository name
+ * @return JobWorkspaceRestore
+ * return the job to restore
+ */
+ JobRepositoryRestore getLastRepositoryRestore(String repositoryName);
+
+ /**
* Getting all backup logs .
*
* @return BackupChainLog[]
@@ -229,4 +258,88 @@
* return the default incremental job period
*/
long getDefaultIncrementalJobPeriod();
+
+ /**
+ * Starting repository backup.
+ *
+ * @param config
+ * RepositoryBackupConfig, the backup configuration to repository
+ * @return RepositoryBackupChain
+ * return the repository backup chain
+ * @throws BackupOperationException BackupOperationException
+ * will be generate the exception BackupOperationException
+ * @throws BackupConfigurationException
+ * will be generate the exception BackupConfigurationException
+ * @throws RepositoryException
+ * will be generate the exception RepositoryException
+ * @throws RepositoryConfigurationException
+ * will be generate the exception RepositoryConfigurationException
+ */
+ RepositoryBackupChain startBackup(RepositoryBackupConfig config) throws
BackupOperationException, BackupConfigurationException,
+ RepositoryException, RepositoryConfigurationException;
+
+ /**
+ * Stop backup.
+ *
+ * @param backup
+ * RepositoryBackupChain, the repositroy backup chain
+ */
+ void stopBackup(RepositoryBackupChain backup);
+
+ /**
+ * Repository restore from backup.
+ *
+ * @param log
+ * RepositoryBackupChainLog, the repository backup log
+ * @param repositoryEntry
+ * RepositoryEntry, the repository entry
+ * @param workspaceNamesCorrespondMap
+ * Map<String, String>, the map with correspondence workspace name in
RepositoryEntry and RepositoryBackupChainLog.
+ * @param asynchronous
+ * boolean, in 'true' then asynchronous restore.
+ * @throws BackupOperationException
+ * will be generate the exception BackupOperationException
+ * @throws BackupConfigurationException
+ * will be generate the exception BackupConfigurationException
+ * @throws RepositoryException
+ * will be generate the exception RepositoryException
+ * @throws RepositoryConfigurationException
+ * will be generate the exception RepositoryConfigurationException
+ */
+ void restore(RepositoryBackupChainLog log, RepositoryEntry repositoryEntry,
Map<String, String> workspaceNamesCorrespondMap, boolean asynchronous)
+ throws BackupOperationException, BackupConfigurationException,
RepositoryException,
+ RepositoryConfigurationException;
+
+ /**
+ * Repository restore from backup.
+ *
+ * @param log
+ * RepositoryBackupChainLog, the repository backup log
+ * @param repositoryEntry
+ * RepositoryEntry, the repository entry
+ * @param asynchronous
+ * boolean, in 'true' then asynchronous restore.
+ * @throws BackupOperationException
+ * will be generate the exception BackupOperationException
+ * @throws BackupConfigurationException
+ * will be generate the exception BackupConfigurationException
+ * @throws RepositoryException
+ * will be generate the exception RepositoryException
+ * @throws RepositoryConfigurationException
+ * will be generate the exception RepositoryConfigurationException
+ */
+ void restore(RepositoryBackupChainLog log, RepositoryEntry repositoryEntry, boolean
asynchronous)
+ throws BackupOperationException, BackupConfigurationException,
RepositoryException,
+ RepositoryConfigurationException;
+
+ /**
+ * Finding current backup by repository.
+ *
+ * @param reposytore
+ * String, the repository name
+ * @return RepositoryBackupChain
+ * return the current backup to repository
+ */
+ RepositoryBackupChain findRepositoryBackup(String repository);
+
}
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChain.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChain.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChain.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup;
+
+import java.util.Calendar;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public interface RepositoryBackupChain
+{
+
+ /**
+ * State of backup : full backup was finished and incremental backup is working.
+ */
+ public static final int FULL_BACKUP_FINISHED_INCREMENTAL_BACKUP_WORKING = 16;
+
+ /**
+ * State of backup WORKING.
+ */
+ public static final int WORKING = 8;
+
+ /**
+ * State of backup FINISHED.
+ */
+ public static final int FINISHED = 4;
+
+ /**
+ * Sate of backup INITIALIZED.
+ */
+ public static final int INITIALIZED = 0;
+
+ /**
+ * Call start backup.
+ *
+ */
+ void startBackup();
+
+ /**
+ * Call stop backup.
+ *
+ */
+ void stopBackup();
+
+ /**
+ * Getting state of backup.
+ *
+ * @return int
+ * return state of backup
+ */
+ int getState();
+
+ /**
+ * isFinished.
+ *
+ * @return boolean
+ * return 'true' if backup was finished.
+ */
+ boolean isFinished();
+
+ /**
+ * Getting path to backup log.
+ *
+ * @return String
+ * return path to backup log
+ */
+ String getLogFilePath();
+
+ /**
+ * Getting identifier of backup.
+ *
+ * @return String
+ * return identifier of backup
+ */
+ String getBackupId();
+
+ /**
+ * Getting started time of backup.
+ *
+ * @return Calendar
+ * return started time of backup
+ */
+ Calendar getStartedTime();
+
+ /**
+ * Getting repository backup config.
+ *
+ * @return RepositoryBackupConfig
+ * return the repository backup config
+ */
+ RepositoryBackupConfig getBackupConfig();
+
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChain.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,409 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.jcr.ValueFormatException;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.events.StartElement;
+
+import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public class RepositoryBackupChainLog
+{
+ private class LogWriter
+ {
+
+ protected Log logger = ExoLogger.getLogger("ext.LogWriter");
+
+ private File logFile;
+
+ XMLStreamWriter writer;
+
+ public LogWriter(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
+ {
+ this.logFile = logFile;
+
+ writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(this.logFile));
+
+ writer.writeStartDocument();
+ writer.writeStartElement("repository-backup-cain-log");
+ writer.flush();
+
+ writer.writeStartElement("start-time");
+ writer.writeCharacters(JCRDateFormat.format(startedTime));
+ writer.writeEndElement();
+ }
+
+ public void writeSystemWorkspaceName(String wsName) throws XMLStreamException
+ {
+ writer.writeStartElement("system-workspace");
+ writer.writeCharacters(wsName);
+ writer.writeEndElement();
+ writer.flush();
+ }
+
+ public void writeBackupsPath(List<String> wsLogFilePathList) throws
XMLStreamException
+ {
+ writer.writeStartElement("workspaces-backup-info");
+
+ for (String path : wsLogFilePathList)
+ {
+ writer.writeStartElement("url");
+ writer.writeCharacters(path);
+ writer.writeEndElement();
+ }
+
+ writer.writeEndElement();
+
+ writer.flush();
+ }
+
+ public synchronized void writeEndLog()
+ {
+ try
+ {
+ writer.writeStartElement("finish-time");
+ writer.writeCharacters(JCRDateFormat.format(finishedTime));
+ writer.writeEndElement();
+
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ writer.flush();
+ }
+ catch (Exception e)
+ {
+ logger.error("Can't write end log", e);
+ }
+ }
+ }
+
+ private class LogReader
+ {
+ protected Log logger = ExoLogger.getLogger("ext.LogWriter");
+
+ private File logFile;
+
+ private XMLStreamReader reader;
+
+ public LogReader(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
+ {
+ this.logFile = logFile;
+ reader = XMLInputFactory.newInstance().createXMLStreamReader(new
FileInputStream(logFile));
+ }
+
+ public void readLogFile() throws XMLStreamException, MalformedURLException,
ValueFormatException
+ {
+ boolean endDocument = false;
+
+ while (!endDocument)
+ {
+ int eventCode = reader.next();
+ switch (eventCode)
+ {
+
+ case StartElement.START_ELEMENT :
+ String name = reader.getLocalName();
+
+ if (name.equals("system-workspace"))
+ workspaceSystem = readContent();
+
+ if (name.equals("workspaces-backup-info"))
+ workspaceBackupsInfo = readWorkspaceBackupInfo();
+
+ if (name.equals("start-time"))
+ startedTime = JCRDateFormat.parse(readContent());
+
+ if (name.equals("finish-time"))
+ finishedTime = JCRDateFormat.parse(readContent());
+
+ break;
+
+ case StartElement.END_DOCUMENT :
+ endDocument = true;
+ break;
+ }
+ }
+ }
+
+ private List<String> readWorkspaceBackupInfo() throws XMLStreamException
+ {
+ List<String> wsBackupInfo = new ArrayList<String>();
+
+ boolean endWorkspaceBackupInfo = false;
+
+ while (!endWorkspaceBackupInfo)
+ {
+ int eventCode = reader.next();
+ switch (eventCode)
+ {
+
+ case StartElement.START_ELEMENT :
+ String name = reader.getLocalName();
+
+ if (name.equals("url"))
+ wsBackupInfo.add(readContent());
+
+ break;
+
+ case StartElement.END_ELEMENT :
+ String tagName = reader.getLocalName();
+
+ if (tagName.equals("workspaces-backup-info"))
+ endWorkspaceBackupInfo = true;
+ break;
+ }
+ }
+
+ return wsBackupInfo;
+ }
+
+ private String readContent() throws XMLStreamException
+ {
+ String content = null;
+
+ int eventCode = reader.next();
+
+ if (eventCode == StartElement.CHARACTERS)
+ content = reader.getText();
+
+ return content;
+ }
+ }
+
+ protected static Log logger = ExoLogger.getLogger("ext.BackupChainLog");
+
+ private static final String PREFIX = "repository-backup-";
+
+ private static final String SUFFIX = ".xml";
+
+ private File log;
+
+ private LogWriter logWriter;
+
+ private LogReader logReader;
+
+ private RepositoryBackupConfig config;
+
+ private String backupId;
+
+ private Calendar startedTime;
+
+ private Calendar finishedTime;
+
+ private boolean finalized;
+
+ private List<String> workspaceBackupsInfo;
+
+ private String workspaceSystem;
+
+ /**
+ * @param logDirectory
+ * @param config
+ * @param systemWorkspace
+ * @param wsLogFilePathList
+ * @param backupId
+ * @param startTime
+ * @throws BackupOperationException
+ */
+ public RepositoryBackupChainLog(File logDirectory, RepositoryBackupConfig config,
String systemWorkspace, List<String> wsLogFilePathList,
+ String backupId, Calendar startTime) throws BackupOperationException
+ {
+ try
+ {
+ this.finalized = false;
+ this.log = new File(logDirectory.getCanonicalPath() + File.separator + (PREFIX +
backupId + SUFFIX));
+ this.log.createNewFile();
+ this.backupId = backupId;
+ this.config = config;
+ this.startedTime = Calendar.getInstance();
+
+ logWriter = new LogWriter(log);
+ logWriter.writeSystemWorkspaceName(systemWorkspace);
+ logWriter.writeBackupsPath(wsLogFilePathList);
+
+ this.workspaceBackupsInfo = wsLogFilePathList;
+ this.workspaceSystem = systemWorkspace;
+ }
+ catch (IOException e)
+ {
+ throw new BackupOperationException("Can not create backup log ...",
e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BackupOperationException("Can not create backup log ...",
e);
+ }
+ catch (FactoryConfigurationError e)
+ {
+ throw new BackupOperationException("Can not create backup log ...",
e);
+ }
+ }
+
+ /**
+ * @param log
+ * @throws BackupOperationException
+ */
+ public RepositoryBackupChainLog(File log) throws BackupOperationException
+ {
+ this.log = log;
+ this.backupId = log.getName().replaceAll(PREFIX, "").replaceAll(SUFFIX,
"");
+
+ try
+ {
+ logReader = new LogReader(log);
+ logReader.readLogFile();
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new BackupOperationException("Can not read RepositoryBackupChainLog
from file ...", e);
+ }
+ catch (XMLStreamException e)
+ {
+ throw new BackupOperationException("Can not read RepositoryBackupChainLog
from file ...", e);
+ }
+ catch (FactoryConfigurationError e)
+ {
+ throw new BackupOperationException("Can not read RepositoryBackupChainLog
from file ...", e);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new BackupOperationException("Can not read RepositoryBackupChainLog
from file ...", e);
+ }
+ catch (ValueFormatException e)
+ {
+ throw new BackupOperationException("Can not read RepositoryBackupChainLog
from file ...", e);
+ }
+ }
+
+ /**
+ * Getting log file path.
+ *
+ * @return String
+ * return the path to backup log
+ */
+ public String getLogFilePath()
+ {
+ return log.getAbsolutePath();
+ }
+
+ /**
+ * Getting repository backup configuration.
+ *
+ * @return ReposiotoryBackupConfig
+ * return the repository backup configuration
+ */
+ public RepositoryBackupConfig getBackupConfig()
+ {
+ return config;
+ }
+
+ /**
+ * Getting the started time.
+ *
+ * @return Calendar
+ * return the started time
+ */
+ public Calendar getStartedTime()
+ {
+ return startedTime;
+ }
+
+ /**
+ * Getting the finished time.
+ *
+ * @return Calendar
+ * return the finished time
+ */
+ public Calendar getFinishedTime()
+ {
+ return finishedTime;
+ }
+
+ public boolean isFinilized()
+ {
+ return finalized;
+ }
+
+ /**
+ * Finalize log.
+ *
+ */
+ public void endLog()
+ {
+ finishedTime = Calendar.getInstance();
+ finalized = true;
+ logWriter.writeEndLog();
+ }
+
+ /**
+ * Getting the system workspace name.
+ *
+ * @return String
+ * return the system workspace name.
+ */
+ public String getSystemWorkspace()
+ {
+ return workspaceSystem;
+ }
+
+ /**
+ * Getting the workspace backups info.
+ *
+ * @return Collection
+ * return the list with path to backups.
+ */
+ public List<String> getWorkspaceBackupsInfo()
+ {
+ return workspaceBackupsInfo;
+ }
+
+ /**
+ * Getting the backup id.
+ *
+ * @return int
+ * return the backup id
+ */
+ public String getBackupId()
+ {
+ return backupId;
+ }
+
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupConfig.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupConfig.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupConfig.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup;
+
+import java.io.File;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public class RepositoryBackupConfig
+{
+ /**
+ * The backup type.
+ */
+ private int backupType;
+
+ /**
+ * The repository name.
+ */
+ private String repository;
+
+ /**
+ * The incremental job period.
+ */
+ private long incrementalJobPeriod;
+
+ /**
+ * The incremental job number (the repetition numper).
+ */
+ private int incrementalJobNumber;
+
+ /**
+ * The backup directory.
+ */
+ private File backupDir;
+
+ /**
+ * Getting incremental job period.
+ *
+ * @return long
+ * return incremental job period.
+ */
+ public long getIncrementalJobPeriod()
+ {
+ return incrementalJobPeriod;
+ }
+
+ /**
+ * Setting incremental job period.
+ *
+ * @param incrementalJobPeriod
+ * long, the incremental job period
+ */
+ public void setIncrementalJobPeriod(long incrementalJobPeriod)
+ {
+ this.incrementalJobPeriod = incrementalJobPeriod;
+ }
+
+ /**
+ * Getting incremental job period (the repetition period).
+ *
+ * @return int
+ * return incremental job period
+ */
+ public int getIncrementalJobNumber()
+ {
+ return incrementalJobNumber;
+ }
+
+ /**
+ * Setting incremental job number (the repetition period).
+ *
+ * @param incrementalJobNumber
+ * int, the incremental job number
+ *
+ */
+ public void setIncrementalJobNumber(int incrementalJobNumber)
+ {
+ this.incrementalJobNumber = incrementalJobNumber;
+ }
+
+ /**
+ * Getting the repository name.
+ *
+ * @return String
+ * return the repository name
+ */
+ public String getRepository()
+ {
+ return repository;
+ }
+
+ /**
+ * Setting the repository name.
+ *
+ * @param repository
+ * String, the repository name
+ */
+ public void setRepository(String repository)
+ {
+ this.repository = repository;
+ }
+
+ /**
+ * Getting backup directory.
+ *
+ * @return File
+ * return c
+ */
+ public File getBackupDir()
+ {
+ return backupDir;
+ }
+
+ /**
+ * Setting the backup directory.
+ *
+ * @param backupDir
+ * File, the backup directory
+ */
+ public void setBackupDir(File backupDir)
+ {
+ this.backupDir = backupDir;
+ }
+
+ /**
+ * Getting the backup type.
+ *
+ * @return int
+ * return the backup type
+ */
+ public int getBackupType()
+ {
+ return backupType;
+ }
+
+ /**
+ * Setting the backup type.
+ *
+ * @param backupType
+ * int, the backup type
+ */
+ public void setBackupType(int backupType)
+ {
+ this.backupType = backupType;
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupConfig.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryRestoreExeption.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryRestoreExeption.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryRestoreExeption.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup;
+
+import javax.jcr.InvalidItemStateException;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public class RepositoryRestoreExeption
+ extends BackupConfigurationException
+{
+
+ /**
+ * RepositoryRestoreExeption constructor.
+ *
+ * @param message
+ * String, the exception message
+ * @param e
+ * Throwable, the cause exception
+ */
+ public RepositoryRestoreExeption(String message, Throwable e)
+ {
+ super(message, e);
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryRestoreExeption.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -247,6 +247,14 @@
{
return fullBackup.getState();
}
+
+ public int getIncrementalBackupState()
+ {
+ if (incrementalBackup == null)
+ throw new RuntimeException("The incremental bacup was not configured. Only
full backup.");
+
+ return incrementalBackup.getState();
+ }
public String getLogFilePath()
{
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-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -18,13 +18,17 @@
*/
package org.exoplatform.services.jcr.ext.backup.impl;
+import org.apache.commons.collections.map.HashedMap;
+import org.bouncycastle.jce.interfaces.BCKeyStore;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.config.WorkspaceInitializerEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
@@ -40,6 +44,9 @@
import org.exoplatform.services.jcr.ext.backup.BackupManager;
import org.exoplatform.services.jcr.ext.backup.BackupOperationException;
import org.exoplatform.services.jcr.ext.backup.JobEntryInfo;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChain;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChainLog;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupConfig;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
import org.exoplatform.services.jcr.ext.registry.RegistryEntry;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
@@ -75,6 +82,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.jcr.PathNotFoundException;
@@ -122,11 +130,18 @@
private String incrementalBackupType;
private final Set<BackupChain> currentBackups;
+
+ private final Set<RepositoryBackupChain> currentRepositoryBackups;
/**
- * The list of restore job.
+ * The list of workspace restore job.
*/
private List<JobWorkspaceRestore> restoreJobs;
+
+ /**
+ * The list of repository restore job.
+ */
+ private List<JobRepositoryRestore> restoreRepositoryJobs;
private InitParams initParams;
@@ -329,6 +344,8 @@
this.initParams = initParams;
currentBackups = Collections.synchronizedSet(new HashSet<BackupChain>());
+
+ currentRepositoryBackups = Collections.synchronizedSet(new
HashSet<RepositoryBackupChain>());
fileCleaner = new FileCleaner(10000);
@@ -337,6 +354,7 @@
scheduler = new BackupScheduler(this, messages);
this.restoreJobs = new ArrayList<JobWorkspaceRestore>();
+ this.restoreRepositoryJobs = new ArrayList<JobRepositoryRestore>();
this.stopper = new AutoStopper();
this.stopper.start();
}
@@ -411,10 +429,10 @@
BackupConfig config = log.getBackupConfig();
String reposytoryName = (repositoryName == null ? config.getRepository() :
repositoryName);
- String workspaseName = workspaceEntry.getName();
+ String workspaceName = workspaceEntry.getName();
// ws should be registered not created
- if (!workspaceAlreadyExist(reposytoryName, workspaseName))
+ if (!workspaceAlreadyExist(reposytoryName, workspaceName))
{
for (int i = 0; i < list.size(); i++)
@@ -423,7 +441,7 @@
{
try
{
- fullRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaseName, workspaceEntry);
+ fullRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaceName, workspaceEntry);
}
catch (FileNotFoundException e)
{
@@ -440,7 +458,7 @@
// events which are logged in chan log one after another
try
{
- incrementalRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaseName);
+ incrementalRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaceName);
}
catch (FileNotFoundException e)
{
@@ -458,7 +476,7 @@
}
}
else
- throw new BackupConfigurationException("Workspace should exists " +
workspaseName);
+ throw new BackupConfigurationException("Workspace should exists " +
workspaceName);
}
protected void restoreOverInitializer(BackupChainLog log, String repositoryName,
WorkspaceEntry workspaceEntry)
@@ -470,10 +488,10 @@
BackupConfig config = log.getBackupConfig();
String reposytoryName = (repositoryName == null ? config.getRepository() :
repositoryName);
- String workspaseName = workspaceEntry.getName();
+ String workspaceName = workspaceEntry.getName();
// ws should be registered not created
- if (!workspaceAlreadyExist(reposytoryName, workspaseName))
+ if (!workspaceAlreadyExist(reposytoryName, workspaceName))
{
for (int i = 0; i < list.size(); i++)
@@ -501,7 +519,7 @@
// events which are logged in chan log one after another
try
{
- incrementalRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaseName);
+ incrementalRestore(list.get(i).getURL().getPath(), reposytoryName,
workspaceName);
}
catch (FileNotFoundException e)
{
@@ -519,7 +537,7 @@
}
}
else
- throw new BackupConfigurationException("Workspace should exists " +
workspaseName);
+ throw new BackupConfigurationException("Workspace should exists " +
workspaceName);
}
private boolean workspaceAlreadyExist(String repository, String workspace) throws
RepositoryException,
@@ -557,20 +575,12 @@
BackupChain startBackup(BackupConfig config, BackupJobListener jobListener) throws
BackupOperationException,
BackupConfigurationException, RepositoryException,
RepositoryConfigurationException
{
+ validateBackupConfig(config);
- if (config.getIncrementalJobPeriod() < 0)
- throw new BackupConfigurationException("The parameter 'incremental job
period' can not be negative.");
-
- if (config.getIncrementalJobNumber() < 0)
- throw new BackupConfigurationException("The parameter 'incremental job
number' can not be negative.");
-
- if (config.getIncrementalJobPeriod() == 0 && config.getBackupType() ==
BackupManager.FULL_AND_INCREMENTAL)
- config.setIncrementalJobPeriod(defaultIncrementalJobPeriod);
-
BackupChain bchain =
- new BackupChainImpl(config, logsDirectory,
repoService.getRepository(config.getRepository()),
- fullBackupType, incrementalBackupType, IdGenerator.generate());
-
+ new BackupChainImpl(config, logsDirectory,
repoService.getRepository(config.getRepository()),
+ fullBackupType, incrementalBackupType, IdGenerator.generate());
+
bchain.addListener(messagesListener);
bchain.addListener(jobListener);
@@ -579,7 +589,29 @@
return bchain;
}
+
+ /**
+ * Initialize backup chain to workspace backup.
+ *
+ * @param config
+ * @return
+ * @throws BackupOperationException
+ * @throws BackupConfigurationException
+ * @throws RepositoryException
+ * @throws RepositoryConfigurationException
+ */
+ private void validateBackupConfig(RepositoryBackupConfig config) throws
BackupConfigurationException
+ {
+ if (config.getIncrementalJobPeriod() < 0)
+ throw new BackupConfigurationException("The parameter 'incremental job
period' can not be negative.");
+ if (config.getIncrementalJobNumber() < 0)
+ throw new BackupConfigurationException("The parameter 'incremental job
number' can not be negative.");
+
+ if (config.getIncrementalJobPeriod() == 0 && config.getBackupType() ==
BackupManager.FULL_AND_INCREMENTAL)
+ config.setIncrementalJobPeriod(defaultIncrementalJobPeriod);
+ }
+
/**
* {@inheritDoc}
*/
@@ -1160,7 +1192,32 @@
return null;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public JobRepositoryRestore getLastRepositoryRestore(String repositoryName)
+ {
+
+ for (int i = restoreRepositoryJobs.size() - 1; i >= 0; i--)
+ {
+ JobRepositoryRestore job = restoreRepositoryJobs.get(i);
+ if (repositoryName.equals(job.getRepositoryName()))
+ {
+ return job;
+
+ }
+ }
+
+ return null;
+ }
+
+ public List<JobRepositoryRestore> getRepositoryRestores()
+ {
+ return restoreRepositoryJobs;
+ }
+
/**
* {@inheritDoc}
*/
@@ -1180,4 +1237,154 @@
this.restoreOverInitializer(log, repositoryName, workspaceEntry);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void restore(RepositoryBackupChainLog log, RepositoryEntry repositoryEntry,
boolean asynchronous)
+ throws BackupOperationException, BackupConfigurationException,
RepositoryException,
+ RepositoryConfigurationException
+ {
+ this.restore(log, repositoryEntry, null, asynchronous);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void restore(RepositoryBackupChainLog rblog, RepositoryEntry repositoryEntry,
+ Map<String, String> workspaceNamesCorrespondMap, boolean asynchronous)
throws BackupOperationException,
+ BackupConfigurationException, RepositoryException,
RepositoryConfigurationException
+ {
+ Map<String, BackupChainLog> workspacesMapping = new HashedMap();
+
+ Map<String, BackupChainLog> backups = new HashedMap();
+
+ for (String path : rblog.getWorkspaceBackupsInfo())
+ {
+ BackupChainLog bLog = new BackupChainLog(new File(path));
+ backups.put(bLog.getBackupConfig().getWorkspace(), bLog);
+ }
+
+ if (workspaceNamesCorrespondMap == null)
+ {
+ if
(!rblog.getSystemWorkspace().equals(repositoryEntry.getSystemWorkspaceName()))
+ {
+ throw new BackupConfigurationException("The backup to system workspace
is not system workspace in repository entry: " + rblog.getSystemWorkspace() + "
is not equal " + repositoryEntry.getSystemWorkspaceName());
+ }
+
+ if (backups.size() != repositoryEntry.getWorkspaceEntries().size())
+ {
+ throw new BackupConfigurationException("The repository entry is contains
more or less workspace entry than backups of workspace in " +
rblog.getLogFilePath());
+ }
+
+ for (WorkspaceEntry wsEntry : repositoryEntry.getWorkspaceEntries())
+ {
+ if (!backups.containsKey(wsEntry.getName()))
+ {
+ throw new BackupConfigurationException("The workspace '" +
wsEntry.getName() + "' is not found in backup " + rblog.getLogFilePath());
+ }
+ else
+ {
+ workspacesMapping.put(wsEntry.getName(), backups.get(wsEntry.getName()));
+ }
+ }
+ }
+ else
+ {
+ if
(!repositoryEntry.getSystemWorkspaceName().equals(workspaceNamesCorrespondMap.get(rblog.getSystemWorkspace())))
+ {
+ throw new BackupConfigurationException("The backup to system workspace
is not system workspace in repository entry: " +
repositoryEntry.getSystemWorkspaceName() + " is not equal " +
workspaceNamesCorrespondMap.get(rblog.getSystemWorkspace()));
+ }
+
+ if (workspaceNamesCorrespondMap.size() !=
repositoryEntry.getWorkspaceEntries().size())
+ {
+ throw new BackupConfigurationException("The repository entry is contains
more or less workspace entry than backups of workspace in " +
rblog.getLogFilePath());
+ }
+
+ for (WorkspaceEntry wsEntry : repositoryEntry.getWorkspaceEntries())
+ {
+ if (!workspaceNamesCorrespondMap.containsKey(wsEntry.getName()))
+ {
+ throw new BackupConfigurationException("The workspace '" +
wsEntry.getName() + "' is not found workspaceNamesCorrespondMap : " +
workspaceNamesCorrespondMap.keySet());
+ }
+ else if (!backups.containsKey(wsEntry.getName()))
+ {
+ throw new BackupConfigurationException("The workspace '" +
wsEntry.getName() + "' is not found in backup " + rblog.getLogFilePath());
+ }
+ else
+ {
+ workspacesMapping.put(wsEntry.getName(), backups.get(wsEntry.getName()));
+ }
+ }
+ }
+
+ JobRepositoryRestore jobRepositoryRestore =
+ new JobRepositoryRestore(repoService, this, repositoryEntry,
workspacesMapping);
+
+ if (asynchronous)
+ {
+ restoreRepositoryJobs.add(jobRepositoryRestore);
+ jobRepositoryRestore.start();
+ }
+ else
+ {
+ jobRepositoryRestore.restore();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RepositoryBackupChain startBackup(RepositoryBackupConfig config) throws
BackupOperationException,
+ BackupConfigurationException, RepositoryException,
RepositoryConfigurationException
+ {
+ validateBackupConfig(config);
+
+ ManageableRepository repository =
repoService.getRepository(config.getRepository());
+
+ File dir =
+ new File(config.getBackupDir() + File.separator + "repository_"
+ config.getRepository() + "_backup_"
+ + System.currentTimeMillis());
+ dir.mkdir();
+ config.setBackupDir(dir);
+
+ RepositoryBackupChain repositoryBackupChain =
+ new RepositoryBackupChainImpl(config, logsDirectory, repository,
fullBackupType, incrementalBackupType,
+ IdGenerator.generate());
+
+ repositoryBackupChain.startBackup();
+
+ currentRepositoryBackups.add(repositoryBackupChain);
+
+ return repositoryBackupChain;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stopBackup(RepositoryBackupChain backup)
+ {
+ backup.stopBackup();
+ currentRepositoryBackups.remove(backup);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RepositoryBackupChain findRepositoryBackup(String repository)
+ {
+ Iterator<RepositoryBackupChain> it = currentRepositoryBackups.iterator();
+ while (it.hasNext())
+ {
+ RepositoryBackupChain chain = it.next();
+ if (repository.equals(chain.getBackupConfig().getRepository()))
+ return chain;
+ }
+ return null;
+ }
+
+ public Set<RepositoryBackupChain> getCurrentRepositoryBackups()
+ {
+ return currentRepositoryBackups;
+ }
}
Added:
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
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,320 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.RepositoryException;
+
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.config.WorkspaceInitializerEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
+import org.exoplatform.services.jcr.ext.backup.BackupChainLog;
+import org.exoplatform.services.jcr.ext.backup.RepositoryRestoreExeption;
+import org.exoplatform.services.jcr.ext.backup.server.WorkspaceRestoreExeption;
+import org.exoplatform.services.jcr.impl.core.BackupWorkspaceInitializer;
+import org.exoplatform.services.jcr.impl.core.SessionRegistry;
+import org.exoplatform.services.jcr.impl.core.SysViewWorkspaceInitializer;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public class JobRepositoryRestore extends Thread
+{
+ /**
+ * The apache logger.
+ */
+ private static Log log = ExoLogger.getLogger("ext.JobRepositoryRestore");
+
+ /**
+ * REPOSITORY_RESTORE_STARTED. The state of start restore.
+ */
+ public static final int REPOSITORY_RESTORE_STARTED = 1;
+
+ /**
+ * REPOSITORY_RESTORE_SUCCESSFUL. The state of restore successful.
+ */
+ public static final int REPOSITORY_RESTORE_SUCCESSFUL = 2;
+
+ /**
+ * REPOSITORY_RESTORE_FAIL. The state of restore fail.
+ */
+ public static final int REPOSITORY_RESTORE_FAIL = 3;
+
+ /**
+ * REPOSITORY_RESTORE_STARTED. The state of initialized restore.
+ */
+ public static final int REPOSITORY_RESTORE_INITIALIZED = 4;
+
+ /**
+ * The state of restore.
+ */
+ private int stateRestore;
+
+ /**
+ * The start time of restore.
+ */
+ private Calendar startTime;
+
+ /**
+ * The end time of restore.
+ */
+ private Calendar endTime;
+
+ /**
+ * The exception on restore.
+ */
+ private Throwable restoreException = null;
+
+ private RepositoryService repositoryService;
+
+ private BackupManagerImpl backupManager;
+
+ private RepositoryEntry repositoryEntry;
+
+ private Map<String, BackupChainLog> workspacesMapping;
+
+ public JobRepositoryRestore(RepositoryService repoService, BackupManagerImpl
backupManagerImpl,
+ RepositoryEntry repositoryEntry, Map<String, BackupChainLog>
workspacesMapping)
+ {
+ this.repositoryService = repoService;
+ this.backupManager = backupManagerImpl;
+ this.repositoryEntry = repositoryEntry;
+ this.workspacesMapping = workspacesMapping;
+ }
+
+ /**
+ * Will be restored the workspace.
+ * @throws RepositoryRestoreExeption
+ *
+ * @throws Throwable
+ * will be generated the Throwable
+ */
+ protected void restore() throws RepositoryRestoreExeption
+ {
+ List<WorkspaceEntry> originalWorkspaceEntrys =
repositoryEntry.getWorkspaceEntries();
+
+ //Getting system workspace entry
+ WorkspaceEntry systemWorkspaceEntry = null;
+
+ for (WorkspaceEntry wsEntry : originalWorkspaceEntrys)
+ {
+ if (wsEntry.getName().equals(repositoryEntry.getSystemWorkspaceName()))
+ {
+ systemWorkspaceEntry = wsEntry;
+ break;
+ }
+ }
+
+ //getting backup cahil log to system workspace.
+ BackupChainLog systemBackupChainLog =
workspacesMapping.get(systemWorkspaceEntry.getName());
+ File fullBackupFile = new
File(systemBackupChainLog.getJobEntryInfos().get(0).getURL().getPath());
+
+ // set the initializer SysViewWorkspaceInitializer
+ WorkspaceInitializerEntry wiEntry = new WorkspaceInitializerEntry();
+ wiEntry.setType(BackupWorkspaceInitializer.class.getCanonicalName());
+
+ List<SimpleParameterEntry> wieParams = new
ArrayList<SimpleParameterEntry>();
+ wieParams.add(new
SimpleParameterEntry(BackupWorkspaceInitializer.RESTORE_PATH_PARAMETER,
fullBackupFile.getParent()));
+
+ wiEntry.setParameters(wieParams);
+
+ // set initializer
+ systemWorkspaceEntry.setInitializer(wiEntry);
+
+ ArrayList<WorkspaceEntry> newEntries = new
ArrayList<WorkspaceEntry>();
+ newEntries.add(systemWorkspaceEntry);
+
+ repositoryEntry.setWorkspaceEntries(newEntries);
+
+ String currennWorkspaceName = repositoryEntry.getSystemWorkspaceName();
+
+ boolean restored = true;
+ try
+ {
+ repositoryService.createRepository(repositoryEntry);
+ repositoryService.getConfig().retain(); // save configuration to persistence
(file or persister)
+
+ for (WorkspaceEntry wsEntry : originalWorkspaceEntrys)
+ {
+ if (!(wsEntry.getName().equals(repositoryEntry.getSystemWorkspaceName())))
+ {
+ currennWorkspaceName = wsEntry.getName();
+ backupManager.restore(workspacesMapping.get(wsEntry.getName()),
repositoryEntry.getName(), wsEntry, false);
+ }
+ }
+ }
+ catch (InvalidItemStateException e)
+ {
+ restored = false;
+ throw new RepositoryRestoreExeption("Workspace '" + "/"
+ repositoryEntry.getName() + "/" + currennWorkspaceName
+ + "' can not be restored! There was database error!", e);
+
+ }
+ catch (Throwable t)
+ {
+ restored = false;
+ throw new RepositoryRestoreExeption("Workspace '" + "/"
+ repositoryEntry.getName() + "/" + currennWorkspaceName
+ + "' can not be restored!", t);
+
+ }
+ finally
+ {
+ if (!restored)
+ {
+ try
+ {
+ ManageableRepository mr = null;
+
+ try
+ {
+ mr = repositoryService.getRepository(repositoryEntry.getName());
+ }
+ catch (RepositoryException e)
+ {
+ // The repository not exist.
+ }
+
+ if (mr != null)
+ {
+ closeAllSession(mr);
+ repositoryService.removeRepository(repositoryEntry.getName());
+ repositoryService.getConfig().retain(); // save configuration to
persistence (file or persister)
+ }
+ }
+ catch (Throwable thr)
+ {
+ throw new RepositoryRestoreExeption("Reprository '" +
"/" + repositoryEntry.getName() +
+ "' can not be restored!", thr);
+ }
+ }
+ }
+ }
+
+ /**
+ * Close all open session in repository
+ *
+ * @param mr
+ *
+ * @throws NoSuchWorkspaceException
+ */
+ private void closeAllSession(ManageableRepository mr) throws NoSuchWorkspaceException
+ {
+ for (String wsName : mr.getWorkspaceNames())
+ {
+ if (!mr.canRemoveWorkspace(wsName))
+ {
+ WorkspaceContainerFacade wc = mr.getWorkspaceContainer(wsName);
+ SessionRegistry sessionRegistry = (SessionRegistry)
wc.getComponent(SessionRegistry.class);
+ sessionRegistry.closeSessions(wsName);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void run()
+ {
+
+ try
+ {
+ stateRestore = REPOSITORY_RESTORE_STARTED;
+ startTime = Calendar.getInstance();
+
+ restore();
+
+ stateRestore = REPOSITORY_RESTORE_SUCCESSFUL;
+ endTime = Calendar.getInstance();
+ }
+ catch (Throwable t)
+ {
+ stateRestore = REPOSITORY_RESTORE_FAIL;
+ restoreException = t;
+
+ log.error("The restore was fail", t);
+ }
+ }
+
+ /**
+ * getRestoreException.
+ *
+ * @return Throwable return the exception of repository restore.
+ */
+ public Throwable getRestoreException()
+ {
+ return restoreException;
+ }
+
+ /**
+ * getStateRestore.
+ *
+ * @return int return state of restore.
+ */
+ public int getStateRestore()
+ {
+ return stateRestore;
+ }
+
+ /**
+ * getBeginTime.
+ *
+ * @return Calendar return the start time of restore
+ */
+ public Calendar getStartTime()
+ {
+ return startTime;
+ }
+
+ /**
+ * getEndTime.
+ *
+ * @return Calendar return the end time of restore
+ */
+ public Calendar getEndTime()
+ {
+ return endTime;
+ }
+
+ /**
+ * getRepositoryName.
+ *
+ * @return String
+ * the name of destination repository
+ */
+ public String getRepositoryName()
+ {
+ return repositoryEntry.getName();
+ }
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobRepositoryRestore.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.backup.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.ext.backup.BackupChain;
+import org.exoplatform.services.jcr.ext.backup.BackupConfig;
+import org.exoplatform.services.jcr.ext.backup.BackupConfigurationException;
+import org.exoplatform.services.jcr.ext.backup.BackupJob;
+import org.exoplatform.services.jcr.ext.backup.BackupManager;
+import org.exoplatform.services.jcr.ext.backup.BackupOperationException;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChain;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChainLog;
+import org.exoplatform.services.jcr.ext.backup.RepositoryBackupConfig;
+import org.exoplatform.services.jcr.util.IdGenerator;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id$
+ */
+public class RepositoryBackupChainImpl
+ implements RepositoryBackupChain
+{
+
+ private final RepositoryBackupConfig config;
+
+ private final Set<BackupChain> workspaceBackups;
+
+ private final RepositoryBackupChainLog repositoryChainLog;
+
+ private final String repositoryBackupId;
+
+ private final Calendar startTime;
+
+ private int state;
+
+ public RepositoryBackupChainImpl(RepositoryBackupConfig config, File logDirectory,
ManageableRepository repository,
+ String fullBackupType, String incrementalBackupType, String
repositoryBackupId) throws BackupOperationException,
+ BackupConfigurationException
+ {
+ this.config = config;
+ this.workspaceBackups = Collections.synchronizedSet(new
HashSet<BackupChain>());
+ this.startTime = Calendar.getInstance();
+ this.repositoryBackupId = repositoryBackupId;
+
+ List<String> wsLogFilePathList = new ArrayList<String>();
+
+ for (WorkspaceEntry workspaceEntry :
repository.getConfiguration().getWorkspaceEntries())
+ {
+ BackupConfig wsBackupConfig = new BackupConfig();
+ wsBackupConfig.setRepository(config.getRepository());
+ wsBackupConfig.setWorkspace(workspaceEntry.getName());
+ wsBackupConfig.setBackupDir(config.getBackupDir());
+ wsBackupConfig.setBackupType(config.getBackupType());
+ wsBackupConfig.setIncrementalJobNumber(config.getIncrementalJobNumber());
+ wsBackupConfig.setIncrementalJobPeriod(config.getIncrementalJobPeriod());
+
+ BackupChain bchain =
+ new BackupChainImpl(wsBackupConfig, config.getBackupDir(), repository,
+ fullBackupType, incrementalBackupType, IdGenerator.generate());
+
+ wsLogFilePathList.add(bchain.getLogFilePath());
+ workspaceBackups.add(bchain);
+ }
+
+ this.repositoryChainLog = new RepositoryBackupChainLog(logDirectory, this.config,
repository.getConfiguration().getSystemWorkspaceName(), wsLogFilePathList,
this.repositoryBackupId, startTime);
+
+ state = INITIALIZED;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getLogFilePath()
+ {
+ return repositoryChainLog.getLogFilePath();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getState()
+ {
+ if (state != FINISHED)
+ {
+ int fullBackupsState =-1;
+ int incrementalBackupsState = -1;
+
+ for (BackupChain bc : workspaceBackups)
+ {
+ fullBackupsState = bc.getFullBackupState();
+
+ if (bc.getBackupConfig().getBackupType() ==
BackupManager.FULL_AND_INCREMENTAL)
+ {
+ incrementalBackupsState = bc.getIncrementalBackupState();
+ }
+ }
+
+ if (config.getBackupType() == BackupManager.FULL_BACKUP_ONLY)
+ {
+ if (fullBackupsState == BackupJob.FINISHED)
+ {
+ state = FINISHED;
+ }
+ else
+ {
+ state = WORKING;
+ }
+ }
+ else
+ {
+ if (fullBackupsState == BackupJob.FINISHED && incrementalBackupsState
== BackupJob.FINISHED)
+ {
+ state = FINISHED;
+ }
+ else if (fullBackupsState == BackupJob.FINISHED &&
incrementalBackupsState != BackupJob.WORKING)
+ {
+ state = FULL_BACKUP_FINISHED_INCREMENTAL_BACKUP_WORKING;
+ }
+
+ else
+ {
+ state = WORKING;
+ }
+ }
+ }
+
+ return state;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isFinished()
+ {
+ return this.getState() == FINISHED;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void startBackup()
+ {
+ for (BackupChain wsChain : workspaceBackups)
+ {
+ wsChain.startBackup();
+ }
+
+ state = WORKING;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stopBackup()
+ {
+ if (state != INITIALIZED || this.getState() != FINISHED)
+ {
+ for (BackupChain wsChain : workspaceBackups)
+ {
+ wsChain.stopBackup();
+ }
+
+ repositoryChainLog.endLog();
+ }
+
+ state = this.getState();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBackupId()
+ {
+ return repositoryBackupId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Calendar getStartedTime()
+ {
+ return startTime;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RepositoryBackupConfig getBackupConfig()
+ {
+ return config;
+ }
+
+}
Property changes on:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -762,7 +762,7 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/info/backup/{repo}/{ws}")
- public Response infoBackupByWorkspase(@PathParam("repo") String repository,
@PathParam("ws") String workspace)
+ public Response infoBackupByWorkspace(@PathParam("repo") String repository,
@PathParam("ws") String workspace)
{
try
{
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/test/ReplicationTestService.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/test/ReplicationTestService.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/replication/test/ReplicationTestService.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -131,7 +131,7 @@
/**
* The move node by workspace.
*/
- public static final String WORKSPASE_MOVE = "workspaceMove";
+ public static final String WORKSPACE_MOVE = "workspaceMove";
/**
* The move node by session.
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -18,33 +18,33 @@
*/
package org.exoplatform.services.jcr.ext.backup;
-import org.exoplatform.services.jcr.config.ContainerEntry;
-import org.exoplatform.services.jcr.config.QueryHandlerEntry;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
-import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
-import org.exoplatform.services.jcr.impl.core.SessionImpl;
-
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
+import java.util.Map;
import javax.jcr.ItemExistsException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
-import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.ValueFormatException;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.version.VersionException;
+import org.exoplatform.services.jcr.config.ContainerEntry;
+import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+
/**
* Created by The eXo Platform SAS Author : Peter Nedonosko
peter.nedonosko(a)exoplatform.com.ua
* 04.02.2008
@@ -85,13 +85,26 @@
throw new Exception("There are no BackupManagerImpl in
configuration");
// ws1
- SessionImpl ws1 = (SessionImpl)repository.login(credentials, "ws1");
- ws1TestRoot = ws1.getRootNode().addNode("backupTest");
- ws1.save();
- ws1Session = ws1;
+
+ for (String wsName : repository.getWorkspaceNames())
+ {
+ if ("ws1".equals(wsName))
+ {
+ ws1Session = (SessionImpl) repository.login(credentials, "ws1");
+ ws1TestRoot = ws1Session.getRootNode().addNode("backupTest");
+ ws1Session.save();
+ addContent(ws1TestRoot, 1, 10, 1);
+
+ }
+ else
+ {
+ SessionImpl ws = (SessionImpl) repository.login(credentials, wsName);
+ Node wsTestRoot = ws.getRootNode().addNode("backupTest");
+ ws.save();
+ addContent(wsTestRoot, 1, 10, 1);
+ }
+ }
- addContent(ws1TestRoot, 1, 10, 1);
-
// ws2
ws2Session = (SessionImpl)repository.login(credentials, "ws2");
}
@@ -100,8 +113,21 @@
protected void tearDown() throws Exception
{
- ws1Session.getRootNode().getNode("backupTest").remove();
- ws1Session.save();
+ for (String wsName : repository.getWorkspaceNames())
+ {
+ if ("ws1".equals(wsName))
+ {
+ ws1Session = (SessionImpl) repository.login(credentials, "ws1");
+ ws1Session.getRootNode().getNode("backupTest").remove();
+ ws1Session.save();
+ }
+ else
+ {
+ SessionImpl ws = (SessionImpl)repository.login(credentials, wsName);
+ ws.getRootNode().getNode("backupTest").remove();
+ ws.save();
+ }
+ }
super.tearDown();
}
@@ -116,11 +142,7 @@
// container.getComponentInstanceOfType(RepositoryContainer.class);
ws1back.setUniqueName(((RepositoryImpl)ws1Session.getRepository()).getName() +
"_" + ws1back.getName()); // EXOMAN
- Repository repository1;
-
ws1back.setAccessManager(ws1e.getAccessManager());
- ws1back.setAutoInitializedRootNt(ws1e.getAutoInitializedRootNt());
- ws1back.setAutoInitPermissions(ws1e.getAutoInitPermissions());
ws1back.setCache(ws1e.getCache());
ws1back.setContainer(ws1e.getContainer());
ws1back.setLockManager(ws1e.getLockManager());
@@ -129,7 +151,7 @@
ArrayList qParams = new ArrayList();
// qParams.add(new SimpleParameterEntry("indexDir", "target" +
File.separator+ "temp" +
// File.separator +"index" + name));
- qParams.add(new SimpleParameterEntry("indexDir", "target" +
File.separator + name));
+ qParams.add(new SimpleParameterEntry("indexDir", "target" +
File.separator + name + System.currentTimeMillis()));
QueryHandlerEntry qEntry =
new
QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex",
qParams);
@@ -144,7 +166,7 @@
if (newp.getName().equals("source-name"))
newp.setValue(sourceName);
else if (newp.getName().equals("swap-directory"))
- newp.setValue("target/temp/swap/" + name);
+ newp.setValue("target/temp/swap/" + name +
System.currentTimeMillis());
params.add(newp);
}
@@ -155,7 +177,81 @@
return ws1back;
}
+
+ protected RepositoryEntry makeRepositoryEntry(String repoName, RepositoryEntry
baseRepoEntry, String sourceName, Map<String, String> workspaceMapping)
+ {
+ ArrayList<WorkspaceEntry> wsEntries = new ArrayList<WorkspaceEntry>();
+
+ for (WorkspaceEntry wsEntry : baseRepoEntry.getWorkspaceEntries())
+ {
+ String newWorkspaceName = wsEntry.getName();
+ if (workspaceMapping != null)
+ {
+ newWorkspaceName = workspaceMapping.get(wsEntry.getName());
+ }
+
+ WorkspaceEntry newWSEntry = makeWorkspaceEntry(wsEntry, newWorkspaceName,
repoName, sourceName);
+
+ wsEntries.add(newWSEntry);
+ }
+
+ RepositoryEntry newRepositoryEntry = new RepositoryEntry();
+
+ newRepositoryEntry.setSystemWorkspaceName(workspaceMapping == null ?
baseRepoEntry.getSystemWorkspaceName() :
workspaceMapping.get(baseRepoEntry.getSystemWorkspaceName()));
+ newRepositoryEntry.setAccessControl(baseRepoEntry.getAccessControl());
+
newRepositoryEntry.setAuthenticationPolicy(baseRepoEntry.getAuthenticationPolicy());
+ newRepositoryEntry.setDefaultWorkspaceName(workspaceMapping == null ?
baseRepoEntry.getDefaultWorkspaceName() :
workspaceMapping.get(baseRepoEntry.getDefaultWorkspaceName()));
+ newRepositoryEntry.setName(repoName);
+ newRepositoryEntry.setSecurityDomain(baseRepoEntry.getSecurityDomain());
+ newRepositoryEntry.setSessionTimeOut(baseRepoEntry.getSessionTimeOut());
+
+ newRepositoryEntry.setWorkspaceEntries(wsEntries);
+
+ return newRepositoryEntry;
+ }
+
+ protected WorkspaceEntry makeWorkspaceEntry(WorkspaceEntry baseWorkspaceEntry, String
wsName, String repoName, String sourceName)
+ {
+ WorkspaceEntry ws1back = new WorkspaceEntry();
+ ws1back.setName(wsName);
+ ws1back.setUniqueName(repoName + "_" + ws1back.getName());
+ ws1back.setAccessManager(baseWorkspaceEntry.getAccessManager());
+ ws1back.setCache(baseWorkspaceEntry.getCache());
+ ws1back.setContainer(baseWorkspaceEntry.getContainer());
+ ws1back.setLockManager(baseWorkspaceEntry.getLockManager());
+
+ // Indexer
+ ArrayList qParams = new ArrayList();
+ qParams.add(new SimpleParameterEntry("indexDir", "target" +
File.separator + repoName + "_" + wsName));
+ QueryHandlerEntry qEntry =
+ new
QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex",
qParams);
+
+ ws1back.setQueryHandler(qEntry);
+
+ ArrayList params = new ArrayList();
+ for (Iterator i = ws1back.getContainer().getParameters().iterator(); i.hasNext();)
+ {
+ SimpleParameterEntry p = (SimpleParameterEntry)i.next();
+ SimpleParameterEntry newp = new SimpleParameterEntry(p.getName(),
p.getValue());
+
+ if (newp.getName().equals("source-name"))
+ newp.setValue(sourceName);
+ else if (newp.getName().equals("swap-directory"))
+ newp.setValue("target/temp/swap/" + repoName + "_" +
wsName);
+ else if (newp.getName().equals("multi-db"))
+ newp.setValue("false");
+
+ params.add(newp);
+ }
+
+ ContainerEntry ce =
+ new
ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
params);
+ ws1back.setContainer(ce);
+
+ return ws1back;
+ }
+
protected void restoreAndCheck(String workspaceName, String datasourceName, String
backupLogFilePath, File backDir,
int startIndex, int stopIndex) throws RepositoryConfigurationException,
RepositoryException,
BackupOperationException, BackupConfigurationException
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -18,15 +18,20 @@
*/
package org.exoplatform.services.jcr.ext.backup;
+import org.apache.commons.collections.map.HashedMap;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.ext.backup.impl.JobRepositoryRestore;
import org.exoplatform.services.jcr.ext.backup.impl.JobWorkspaceRestore;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.Map;
import javax.jcr.Node;
import javax.jcr.lock.Lock;
@@ -498,7 +503,7 @@
SessionImpl sessionWS1 = (SessionImpl)repository.login(credentials,
"ws3");
sessionWS1.getRootNode().addNode("asdasdasda",
"nt:unstructured")
- .setProperty("data", "data_1"/*new
FileInputStream(createBLOBTempFile(1024))*/);
+ .setProperty("data", /*"data_1"*/new
FileInputStream(createBLOBTempFile(1024)));
sessionWS1.save();
// 1-st backup
@@ -536,7 +541,7 @@
// add date to restored workspace
back1.getRootNode().addNode("gdfgrghfhf",
"nt:unstructured")
- .setProperty("data", "data_2"/*new
FileInputStream(createBLOBTempFile(1024))*/);
+ .setProperty("data", /*"data_2"*/new
FileInputStream(createBLOBTempFile(1024)));
back1.save();
}
else
@@ -734,5 +739,285 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
+
+
+ public void testRepositoryFullBackupRestore() throws Exception
+ {
+ // 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 re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+
+ String newRepositoryName = "repo_restored_1";
+ RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re,
"jdbcjcr_to_repository_restore_1", null);
+
+ File backLog = new File(bch.getLogFilePath());
+ if (backLog.exists())
+ {
+ RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
+
+ assertNotNull(bchLog.getStartedTime());
+ assertNotNull(bchLog.getFinishedTime());
+
+ backup.restore(bchLog, newRepositoryEntry, false);
+
+ // check
+ ManageableRepository restoredRepository =
repositoryService.getRepository(newRepositoryName);
+
+ for (String wsName : restoredRepository.getWorkspaceNames())
+ {
+ SessionImpl back1 = null;
+ try
+ {
+ back1 = (SessionImpl)repository.login(credentials, wsName);
+ Node ws1backTestRoot =
back1.getRootNode().getNode("backupTest");
+ assertEquals("Restored content should be same",
"property-5", ws1backTestRoot.getNode("node_5")
+ .getProperty("exo:data").getString());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ finally
+ {
+ if (back1 != null)
+ back1.logout();
+ }
+ }
+ }
+ else
+ fail("There are no backup files in " + backDir.getAbsolutePath());
+ }
+
+ public void testRepositoryFullBackupAsynchronusRestore() throws Exception
+ {
+ // 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 re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+
+ String newRepositoryName = "repo_restored_2";
+ RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re,
"jdbcjcr_to_repository_restore_1", null);
+
+ File backLog = new File(bch.getLogFilePath());
+ if (backLog.exists())
+ {
+ RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
+
+ assertNotNull(bchLog.getStartedTime());
+ assertNotNull(bchLog.getFinishedTime());
+
+ backup.restore(bchLog, newRepositoryEntry, true);
+
+ JobRepositoryRestore job = backup.getLastRepositoryRestore(newRepositoryName);
+
+ while (job.getStateRestore() !=
JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL
+ || job.getStateRestore() ==
JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
+ {
+ Thread.yield();
+ Thread.sleep(50);
+ }
+
+ // check
+ ManageableRepository restoredRepository =
repositoryService.getRepository(newRepositoryName);
+
+ for (String wsName : restoredRepository.getWorkspaceNames())
+ {
+ SessionImpl back1 = null;
+ try
+ {
+ back1 = (SessionImpl)repository.login(credentials, wsName);
+ Node ws1backTestRoot =
back1.getRootNode().getNode("backupTest");
+ assertEquals("Restored content should be same",
"property-5", ws1backTestRoot.getNode("node_5")
+ .getProperty("exo:data").getString());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ finally
+ {
+ if (back1 != null)
+ back1.logout();
+ }
+ }
+ }
+ else
+ fail("There are no backup files in " + backDir.getAbsolutePath());
+ }
+
+ public void testRepositoryFullBackupAsynchronusRestoreWorkspaceMapping() throws
Exception
+ {
+ // 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 re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+
+ String newRepositoryName = "repo_restored_3";
+ RepositoryEntry newRepositoryEntry = makeRepositoryEntry(newRepositoryName, re,
"jdbcjcr_to_repository_restore_1", null);
+
+ // create workspace mappingS
+ Map<String, String> workspaceMapping = new HashedMap();
+ for (WorkspaceEntry we : newRepositoryEntry.getWorkspaceEntries())
+ {
+ workspaceMapping.put(we.getName(), we.getName() + "_mapped");
+ }
+
+ // Change workspaeNames
+ for (WorkspaceEntry we : newRepositoryEntry.getWorkspaceEntries())
+ {
+ if (newRepositoryEntry.getSystemWorkspaceName().equals(we.getName()))
+ {
+
newRepositoryEntry.setSystemWorkspaceName(workspaceMapping.get(we.getName()));
+
newRepositoryEntry.setDefaultWorkspaceName(workspaceMapping.get(we.getName()));
+ }
+
+ we.setName(workspaceMapping.get(we.getName()));
+ we.setUniqueName(we.getUniqueName() + workspaceMapping.get(we.getName()));
+ }
+
+ File backLog = new File(bch.getLogFilePath());
+ if (backLog.exists())
+ {
+ RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
+
+ assertNotNull(bchLog.getStartedTime());
+ assertNotNull(bchLog.getFinishedTime());
+
+ backup.restore(bchLog, newRepositoryEntry, workspaceMapping,true);
+
+ JobRepositoryRestore job = backup.getLastRepositoryRestore(newRepositoryName);
+
+ while (job.getStateRestore() !=
JobRepositoryRestore.REPOSITORY_RESTORE_SUCCESSFUL
+ || job.getStateRestore() ==
JobRepositoryRestore.REPOSITORY_RESTORE_FAIL)
+ {
+ Thread.yield();
+ Thread.sleep(50);
+ }
+
+ // check
+ ManageableRepository restoredRepository =
repositoryService.getRepository(newRepositoryName);
+
+ for (String wsName : restoredRepository.getWorkspaceNames())
+ {
+ SessionImpl back1 = null;
+ try
+ {
+ back1 = (SessionImpl)repository.login(credentials,
workspaceMapping.get(wsName));
+ Node ws1backTestRoot =
back1.getRootNode().getNode("backupTest");
+ assertEquals("Restored content should be same",
"property-5", ws1backTestRoot.getNode("node_5")
+ .getProperty("exo:data").getString());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ finally
+ {
+ if (back1 != null)
+ back1.logout();
+ }
+ }
+ }
+ else
+ fail("There are no backup files in " + backDir.getAbsolutePath());
+ }
+
+ /*public void testAutoStopRepositoryBackupIncrRepetion() throws Exception
+ {
+ // backup
+ File backDir = new File("target/backup/" + repository.getName() +
"123");
+ backDir.mkdirs();
+
+ RepositoryBackupConfig config = new RepositoryBackupConfig();
+ config.setRepository(repository.getName());
+ config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
+ config.setBackupDir(backDir);
+ config.setIncrementalJobPeriod(4);
+ config.setIncrementalJobNumber(2);
+
+ final RepositoryBackupChain bch = backup.startBackup(config);
+
+ Thread.sleep(20000);
+
+ assertTrue(bch.isFinished());
+
+ for (RepositoryBackupChain chain : backup.getCurrentRepositoryBackups())
+ if (bch.getBackupId().equals(chain.getBackupId()))
+ fail("The backup with id '" + chain.getBackupId() + "'
should not be active");
+ }*/
}
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2010-03-24
14:18:24 UTC (rev 2108)
@@ -205,6 +205,8 @@
new ContainerRequestUserRole("POST", new
URI(REST_REPOSITORY_SERVICE_PATH
+
RestRepositoryService.Constants.OperationType.CREATE_REPOSITORY), new URI(""),
new
ByteArrayInputStream(json.toString().getBytes("UTF-8")), new
InputHeadersMap(headers));
+
+ System.out.print("testCreateRepository : " +json.toString());
ByteArrayContainerResponseWriter responseWriter = new
ByteArrayContainerResponseWriter();
ContainerResponse cres = new ContainerResponse(responseWriter);
@@ -239,6 +241,8 @@
+ RestRepositoryService.Constants.OperationType.CREATE_WORKSPACE
+ "/"
+ rName), new URI(""),
new
ByteArrayInputStream(json.toString().getBytes("UTF-8")), new
InputHeadersMap(headers));
+
+ System.out.print("testCreateWorkspace : " +json.toString());
ByteArrayContainerResponseWriter responseWriter = new
ByteArrayContainerResponseWriter();
ContainerResponse cres = new ContainerResponse(responseWriter);
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2010-03-24
13:11:41 UTC (rev 2107)
+++
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2010-03-24
14:18:24 UTC (rev 2108)
@@ -1885,6 +1885,33 @@
</properties-param>
</init-params>
</component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr_to_repository_restore_1</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName"
value="org.hsqldb.jdbcDriver" />
+ <property name="url"
value="jdbc:hsqldb:file:target/temp/data/jdbcjcr_to_repository_restore_1" />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
</external-component-plugins>
</configuration>