Author: areshetnyak
Date: 2011-08-31 11:00:42 -0400 (Wed, 31 Aug 2011)
New Revision: 4820
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
Log:
EXOJCR-1485 : The feature for support relative path in backup chain log was added.
Modified:
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 2011-08-31
14:03:56 UTC (rev 4819)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-08-31
15:00:42 UTC (rev 4820)
@@ -160,7 +160,8 @@
writer.flush();
}
- public synchronized void write(RepositoryBackupConfig config, String
fullBackupType, String incrementalBackupType)
+ public synchronized void write(RepositoryBackupConfig config, String
fullBackupType,
+ String incrementalBackupType, File serviceBackupDir)
throws XMLStreamException, IOException
{
writer.writeStartElement("repository-backup-config");
@@ -179,8 +180,21 @@
if (config.getBackupDir() != null)
{
+ String backupDir =
PrivilegedFileHelper.getCanonicalPath(config.getBackupDir());
+ String serviceBackupDirPath =
PrivilegedFileHelper.getCanonicalPath(serviceBackupDir);
+ if (backupDir.startsWith(serviceBackupDirPath))
+ {
+
+ backupDir = "." + backupDir.replace(serviceBackupDirPath,
"");
+
+ if (File.separator.equals("\\"))
+ {
+ backupDir = backupDir.replaceAll("\\\\", "/");
+ }
+ }
+
writer.writeStartElement("backup-dir");
-
writer.writeCharacters(PrivilegedFileHelper.getCanonicalPath(config.getBackupDir()));
+ writer.writeCharacters(backupDir);
writer.writeEndElement();
}
@@ -502,6 +516,19 @@
conf.setBackupDir(new File(path));
}
+ else if (dir.startsWith("./"))
+ {
+ String path =
PrivilegedFileHelper.getCanonicalPath(logFile.getParentFile());
+
+ dir = dir.replace("./", "/");
+
+ if (File.separator.equals("\\"))
+ {
+ dir = dir.replaceAll("/", "\\\\");
+ }
+
+ conf.setBackupDir(new File(path + dir));
+ }
else
{
conf.setBackupDir(new
File(Deserializer.resolveVariables(dir)));
@@ -636,7 +663,7 @@
this.originalRepositoryEntry = rEntry;
logWriter = new LogWriter(log);
- logWriter.write(config, fullBackupType, incrementalBackupType);
+ logWriter.write(config, fullBackupType, incrementalBackupType, logDirectory);
logWriter.writeSystemWorkspaceName(systemWorkspace);
logWriter.writeBackupsPath(wsLogFilePathList, config);
logWriter.writeRepositoryEntry(rEntry, repositoryServiceConfiguration);
Show replies by date