Author: areshetnyak
Date: 2011-01-10 03:30:21 -0500 (Mon, 10 Jan 2011)
New Revision: 3783
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/RepositoryChainLogPathHelper.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRepositoryChainLogPathHelper.java
Log:
EXOJCR-1077 : The problem with portability repository backup created on OS Windows to OS
Linux was fixed.
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-01-10
07:39:07 UTC (rev 3782)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-01-10
08:30:21 UTC (rev 3783)
@@ -78,8 +78,6 @@
XMLStreamWriter writer;
- private RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
public LogWriter(File file) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
{
this.logFile = file;
@@ -151,7 +149,7 @@
for (String path : wsLogFilePathList)
{
writer.writeStartElement("url");
- writer.writeCharacters(helper.getRelativePath(path,
PrivilegedFileHelper.getCanonicalPath(config
+ writer.writeCharacters(RepositoryChainLogPathHelper.getRelativePath(path,
PrivilegedFileHelper.getCanonicalPath(config
.getBackupDir())));
writer.writeEndElement();
}
@@ -285,8 +283,6 @@
private XMLStreamReader reader;
- private RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
private String version;
public LogReader(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
@@ -426,7 +422,7 @@
if (version != null && version.equals(VERSION_LOG_1_1))
{
String path = readContent();
- wsBackupInfo.add(helper.getPath(path,
PrivilegedFileHelper.getCanonicalPath(config
+ wsBackupInfo.add(RepositoryChainLogPathHelper.getPath(path,
PrivilegedFileHelper.getCanonicalPath(config
.getBackupDir())));
}
else
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryChainLogPathHelper.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryChainLogPathHelper.java 2011-01-10
07:39:07 UTC (rev 3782)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryChainLogPathHelper.java 2011-01-10
08:30:21 UTC (rev 3783)
@@ -30,7 +30,7 @@
public class RepositoryChainLogPathHelper
{
- public RepositoryChainLogPathHelper()
+ private RepositoryChainLogPathHelper()
{
}
@@ -46,7 +46,7 @@
* @throws MalformedURLException
*
*/
- public String getRelativePath(String path, String backupDirCanonicalPath) throws
MalformedURLException
+ public static String getRelativePath(String path, String backupDirCanonicalPath)
throws MalformedURLException
{
URL urlPath = new URL(resolveFileURL("file:" + path));
URL urlBackupDir = new URL(resolveFileURL("file:" +
backupDirCanonicalPath));
@@ -65,7 +65,7 @@
* Will be returned absolute path.
* @throws MalformedURLException
*/
- public String getPath(String relativePath, String backupDirCanonicalPath) throws
MalformedURLException
+ public static String getPath(String relativePath, String backupDirCanonicalPath)
throws MalformedURLException
{
String path = "file:" + backupDirCanonicalPath + "/" +
relativePath;
@@ -74,7 +74,7 @@
return urlPath.getFile();
}
- private String resolveFileURL(String url)
+ private static String resolveFileURL(String url)
{
// we ensure that we don't have windows path separator in the url
url = url.replace('\\', '/');
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRepositoryChainLogPathHelper.java
===================================================================
---
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRepositoryChainLogPathHelper.java 2011-01-10
07:39:07 UTC (rev 3782)
+++
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestRepositoryChainLogPathHelper.java 2011-01-10
08:30:21 UTC (rev 3783)
@@ -32,48 +32,40 @@
public void testGetRelativePathOSLinux() throws Exception
{
- RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
String path =
"/path/to/repository-backup-dir/workspace-backup-dir/workspace-backup-log.xml";
String backupDirCanonicalPath = "/path/to/repository-backup-dir";
- String relativePath = helper.getRelativePath(path, backupDirCanonicalPath);
+ String relativePath = RepositoryChainLogPathHelper.getRelativePath(path,
backupDirCanonicalPath);
assertEquals("workspace-backup-dir/workspace-backup-log.xml",
relativePath);
}
public void testGetRelativePathOSWindows() throws Exception
{
- RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
String path =
"c:\\\\path\\to\\repository-backup-dir\\workspace-backup-dir\\workspace-backup-log.xml";
String backupDirCanonicalPath = "c:\\\\path\\to\\repository-backup-dir";
- String relativePath = helper.getRelativePath(path, backupDirCanonicalPath);
+ String relativePath = RepositoryChainLogPathHelper.getRelativePath(path,
backupDirCanonicalPath);
assertEquals("workspace-backup-dir/workspace-backup-log.xml",
relativePath);
}
public void testGetPathOSLinux() throws Exception
{
- RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
String relativePath = "workspace-backup-dir/workspace-backup-log.xml";
String backupDirCanonicalPath = "/path/to/repository-backup-dir";
- String path = helper.getPath(relativePath, backupDirCanonicalPath);
+ String path = RepositoryChainLogPathHelper.getPath(relativePath,
backupDirCanonicalPath);
assertEquals("/path/to/repository-backup-dir/workspace-backup-dir/workspace-backup-log.xml",
path);
}
public void testGetPathOSWindiws() throws Exception
{
- RepositoryChainLogPathHelper helper = new RepositoryChainLogPathHelper();
-
String relativePath = "workspace-backup-dir/workspace-backup-log.xml";
String backupDirCanonicalPath = "c:\\\\path\\to\\repository-backup-dir";
- String path = helper.getPath(relativePath, backupDirCanonicalPath);
+ String path = RepositoryChainLogPathHelper.getPath(relativePath,
backupDirCanonicalPath);
assertEquals("/c://path/to/repository-backup-dir/workspace-backup-dir/workspace-backup-log.xml",
path);
}
Show replies by date