Author: areshetnyak
Date: 2010-12-01 10:42:53 -0500 (Wed, 01 Dec 2010)
New Revision: 3586
Removed:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/ExtendedBackupManager.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/WorkspaceRestoreException.java
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
Log:
JCR-1502 : The changes for this issue in JCR 1.12.x was rollback. Will be committed in JCR
1.12.7-GA
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupChainLog.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -18,14 +18,15 @@
*/
package org.exoplatform.services.jcr.ext.backup;
-import java.io.ByteArrayInputStream;
+import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -43,20 +44,6 @@
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.events.StartElement;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.ws.frameworks.json.JsonHandler;
-import org.exoplatform.ws.frameworks.json.JsonParser;
-import org.exoplatform.ws.frameworks.json.impl.BeanBuilder;
-import org.exoplatform.ws.frameworks.json.impl.JsonDefaultHandler;
-import org.exoplatform.ws.frameworks.json.impl.JsonException;
-import org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl;
-import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
-import org.exoplatform.ws.frameworks.json.value.JsonValue;
-
/**
* Created by The eXo Platform SARL .<br/>
*
@@ -66,11 +53,6 @@
public class BackupChainLog
{
- /**
- * Start for 1.1 version log will be stored relative paths.
- */
- protected static String VERSION_LOG_1_1 = "1.1";
-
protected static Log logger =
ExoLogger.getLogger("exo.jcr.component.ext.BackupChainLog");
public static final String PREFIX = "backup-";
@@ -97,12 +79,6 @@
private boolean finalized;
- private WorkspaceEntry originalWorkspaceEntry;
-
- private final String versionLog;
-
- private File rootDir;
-
/**
* BackupChainLog constructor.
*
@@ -116,30 +92,24 @@
* Sting, FQN for incremental backup
* @param backupId
* String, the identifier of backup
- * @param wEntry
- * original workspace config
* @throws BackupOperationException
* will be generate the exception BackupOperationException
*/
public BackupChainLog(File logDir, BackupConfig config, String fullBackupType, String
incrementalBackupType,
- String backupId, WorkspaceEntry wEntry, File rootDir) throws
BackupOperationException
+ String backupId) throws BackupOperationException
{
try
{
this.finalized = false;
- this.versionLog = VERSION_LOG_1_1;
this.log = new File(logDir.getCanonicalPath() + File.separator + (PREFIX +
backupId + SUFFIX));
- this.rootDir = rootDir;
this.log.createNewFile();
this.backupId = backupId;
this.config = config;
this.jobEntries = new ArrayList<JobEntryInfo>();
- this.originalWorkspaceEntry = wEntry;
// write config info here
logWriter = new LogWriter(log);
logWriter.write(config, fullBackupType, incrementalBackupType);
- logWriter.writeWorkspaceEntry(originalWorkspaceEntry);
}
catch (IOException e)
{
@@ -153,10 +123,6 @@
{
throw new BackupOperationException(e);
}
- catch (JsonException e)
- {
- throw new BackupOperationException(e);
- }
}
/**
@@ -178,12 +144,10 @@
logReader.readLogFile();
logReader.jobEntrysNormalize();
- this.versionLog = logReader.getVersionLog();
this.config = logReader.getBackupConfig();
this.startedTime = logReader.getBeginTime();
this.finishedTime = logReader.getEndTime();
this.jobEntries = logReader.getJobEntryInfoNormalizeList();
- this.originalWorkspaceEntry = logReader.getOriginalWorkspaceEntry();
for (JobEntryInfo info : jobEntries)
{
@@ -214,10 +178,6 @@
{
throw new BackupOperationException(e);
}
- catch (Exception e)
- {
- throw new BackupOperationException(e);
- }
}
/**
@@ -237,7 +197,7 @@
info.setState(job.getState());
info.setURL(job.getStorageURL());
- logWriter.write(info, config);
+ logWriter.write(info);
}
catch (Exception e)
{
@@ -286,33 +246,6 @@
{
finalized = true;
logWriter.writeEndLog();
-
- //copy backup chain log file in into Backupset files itself for portability (e.g.
on another server)
- try
- {
- InputStream in = new FileInputStream(log);
-
- File dest = new File(config.getBackupDir() + File.separator + log.getName());
- if (!dest.exists())
- {
- OutputStream out = new FileOutputStream(dest);
-
- byte[] buf = new byte[(int) (log.length())];
- in.read(buf);
-
- String sConfig = new String(buf, Constants.DEFAULT_ENCODING);
- sConfig =
sConfig.replaceAll("<backup-dir>.+</backup-dir>",
"<backup-dir>.</backup-dir>");
-
- out.write(sConfig.getBytes(Constants.DEFAULT_ENCODING));
- in.close();
- out.close();
- }
- }
- catch (Exception e)
- {
- logger.error("Can't write log", e);
- }
-
}
/**
@@ -376,17 +309,6 @@
return finishedTime;
}
- /**
- * Getting original workspace configuration
- *
- * @return WorkspaceEntry
- * return the original workspace configuration
- */
- public WorkspaceEntry getOriginalWorkspaceEntry()
- {
- return originalWorkspaceEntry;
- }
-
private class LogReader
{
protected Log logger =
ExoLogger.getLogger("exo.jcr.component.ext.LogReader");
@@ -400,31 +322,15 @@
private List<JobEntryInfo> jobEntries;
private List<JobEntryInfo> jobEntriesNormalize;
-
- private WorkspaceEntry originalWorkspaceEntry;
-
- private String version;
public LogReader(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
{
this.logFile = logFile;
jobEntries = new ArrayList<JobEntryInfo>();
- reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new
FileInputStream(this.logFile),
- Constants.DEFAULT_ENCODING);
+ reader = XMLInputFactory.newInstance().createXMLStreamReader(new
FileInputStream(this.logFile));
}
- public String getVersionLog()
- {
- return version;
- }
-
- public WorkspaceEntry getOriginalWorkspaceEntry()
- {
- return originalWorkspaceEntry;
- }
-
public BackupConfig getBackupConfig()
{
return config;
@@ -450,7 +356,7 @@
return jobEntries.get(jobEntries.size() - 1).getDate();
}
- public void readLogFile() throws Exception
+ public void readLogFile() throws XMLStreamException, MalformedURLException,
ValueFormatException
{
boolean endDocument = false;
@@ -469,14 +375,6 @@
if (name.equals("job-entry-info"))
jobEntries.add(readJobEntryInfo());
- if (name.equals("original-workspace-config"))
- this.originalWorkspaceEntry = readWorkspaceEntry();
-
- if (name.equals("version-log"))
- {
- this.version = readContent();
- }
-
break;
case StartElement.END_DOCUMENT :
@@ -486,38 +384,8 @@
}
}
- private WorkspaceEntry readWorkspaceEntry() throws Exception
+ private JobEntryInfo readJobEntryInfo() throws XMLStreamException,
MalformedURLException, ValueFormatException
{
- String jsonRepositoryEntry = reader.getElementText();
-
- return (WorkspaceEntry) (getObject(WorkspaceEntry.class, jsonRepositoryEntry
- .getBytes(Constants.DEFAULT_ENCODING)));
- }
-
- /**
- * Will be created the Object from JSON binary data.
- *
- * @param cl
- * Class
- * @param data
- * binary data (JSON)
- * @return Object
- * @throws Exception
- * will be generated Exception
- */
- private Object getObject(Class cl, byte[] data) throws Exception
- {
- JsonHandler jsonHandler = new JsonDefaultHandler();
- JsonParser jsonParser = new JsonParserImpl();
- InputStream inputStream = new ByteArrayInputStream(data);
- jsonParser.parse(inputStream, jsonHandler);
- JsonValue jsonValue = jsonHandler.getJsonObject();
-
- return new BeanBuilder().createObject(cl, jsonValue);
- }
-
- private JobEntryInfo readJobEntryInfo() throws XMLStreamException,
ValueFormatException, IOException
- {
JobEntryInfo info = new JobEntryInfo();
boolean endJobEntryInfo = false;
@@ -538,22 +406,8 @@
info.setState(getState(readContent()));
if (name.equals("url"))
- {
- if (version != null && version.equals(VERSION_LOG_1_1))
- {
- String path =
- readContent().replace("file:",
- "file:" +
config.getBackupDir().getCanonicalPath()
- + File.separator);
+ info.setURL(new URL(readContent()));
- info.setURL(new URL(path));
- }
- else
- {
- info.setURL(new URL(readContent()));
- }
- }
-
if (name.equals("date"))
info.setDate(JCRDateFormat.parse(readContent()));
@@ -603,7 +457,7 @@
return type;
}
- private BackupConfig readBackupConfig() throws XMLStreamException, IOException
+ private BackupConfig readBackupConfig() throws XMLStreamException
{
BackupConfig conf = new BackupConfig();
@@ -619,27 +473,8 @@
String name = reader.getLocalName();
if (name.equals("backup-dir"))
- {
- if (version != null && version.equals(VERSION_LOG_1_1))
- {
- String dir = readContent();
- if (dir.equals("."))
- {
- String path = logFile.getParentFile().getCanonicalPath();
+ conf.setBackupDir(new File(readContent()));
- conf.setBackupDir(new File(path));
- }
- else
- {
- conf.setBackupDir(new File(dir));
- }
- }
- else
- {
- conf.setBackupDir(new File(readContent()));
- }
- }
-
if (name.equals("repository"))
conf.setRepository(readContent());
@@ -711,32 +546,15 @@
{
this.logFile = logFile;
- writer =
- XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(this.logFile),
- Constants.DEFAULT_ENCODING);
+ writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(this.logFile));
writer.writeStartDocument();
- writer.writeStartElement("backup-chain-log");
-
- writer.writeStartElement("version-log");
- writer.writeCharacters(versionLog);
- writer.writeEndElement();
-
+ writer.writeStartElement("backup-cain-log");
writer.flush();
}
- public void writeWorkspaceEntry(WorkspaceEntry originalWorkspaceEntry) throws
JsonException, XMLStreamException
- {
- JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
- JsonValue json = generatorImpl.createJsonObject(originalWorkspaceEntry);
-
- writer.writeStartElement("original-workspace-config");
- writer.writeCData(json.toString());
- writer.writeEndElement();
- }
-
public synchronized void write(BackupConfig config, String fullBackupType, String
incrementalBackupType)
- throws XMLStreamException, IOException
+ throws XMLStreamException
{
writer.writeStartElement("backup-config");
@@ -751,14 +569,7 @@
if (config.getBackupDir() != null)
{
writer.writeStartElement("backup-dir");
-
- String path =
- (isRootBackupManagerDir(logFile) ?
config.getBackupDir().getCanonicalPath() : config
- .getBackupDir().getCanonicalPath()
- .replace(logFile.getParentFile().getCanonicalPath(),
""));
-
-
- writer.writeCharacters(path.equals("") ? "." : path);
+ writer.writeCharacters(config.getBackupDir().getAbsolutePath());
writer.writeEndElement();
}
@@ -789,7 +600,7 @@
writer.flush();
}
- public synchronized void write(JobEntryInfo info, BackupConfig config) throws
XMLStreamException, IOException
+ public synchronized void write(JobEntryInfo info) throws XMLStreamException
{
writer.writeStartElement("job-entry-info");
@@ -802,7 +613,7 @@
writer.writeEndElement();
writer.writeStartElement("url");
- writer.writeCharacters(getRelativeUrl(info.getURL(), config.getBackupDir()));
+ writer.writeCharacters(info.getURL().toString());
writer.writeEndElement();
writer.writeStartElement("date");
@@ -814,18 +625,6 @@
writer.flush();
}
- private String getRelativeUrl(URL url, File backupDir) throws IOException
- {
- String str = new File(url.getFile()).getCanonicalPath();
-
- return url.getProtocol() + ":" +
str.replace(config.getBackupDir().getCanonicalPath() + File.separator, "");
- }
-
- private boolean isRootBackupManagerDir(File log) throws IOException
- {
- return
(log.getCanonicalFile().getParentFile().getCanonicalPath().equals(rootDir.getCanonicalPath()));
- }
-
public synchronized void writeEndLog()
{
try
Deleted:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/ExtendedBackupManager.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/ExtendedBackupManager.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/ExtendedBackupManager.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -1,98 +0,0 @@
-/*
- * 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;
-
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 2010
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
- * @version $Id: ExtendedBackupManager.java 3545 2010-11-24 15:35:31Z areshetnyak $
- */
-public interface ExtendedBackupManager
- extends BackupManager
-{
-
- // TODO Will be uncommented after fix issue JCR-1054
- // /**
- // * Restore existing workspace. Previous data will be deleted.
- // * For getting status of workspace restore can use
- // * BackupManager.getLastRestore(String repositoryName, String workspaceName)
method
- // * WorkspaceEntry for restore should be contains in BackupChainLog.
- // *
- // * @param workspaceBackupIdentifier
- // * identifier to workspace backup.
- // * @param asynchronous
- // * if 'true' restore will be in asynchronous mode (i.e. in
separated thread)
- // * @throws BackupOperationException
- // * if backup operation exception occurred
- // * @throws BackupConfigurationException
- // * if configuration exception occurred
- // */
- // void restoreExistingWorkspace(String workspaceBackupIdentifier, boolean
asynchronous)
- // throws BackupOperationException, BackupConfigurationException;
- //
- // /**
- // * Restore existing repository. Previous data will be deleted.
- // * For getting status of repository restore can use
- // * BackupManager.getLastRestore(String repositoryName) method.
- // * ReprositoryEntry for restore should be contains in BackupChainLog.
- // *
- // * @param repositoryBackupIdentifier
- // * identifier to repository backup.
- // * @param asynchronous
- // * if 'true' restore will be in asynchronous mode (i.e. in
separated thread)
- // * @throws BackupOperationException
- // * if backup operation exception occurred
- // * @throws BackupConfigurationException
- // * if configuration exception occurred
- // */
- // void restoreExistingRepository(String repositoryBackupIdentifier, boolean
asynchronous)
- // throws BackupOperationException, BackupConfigurationException;
-
- /**
- * WorkspaceEntry for restore should be contains in BackupChainLog.
- *
- * @param workspaceBackupIdentifier
- * identifier to workspace backup.
- * @param asynchronous
- * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
- * @throws BackupOperationException
- * if backup operation exception occurred
- * @throws BackupConfigurationException
- * if configuration exception occurred
- */
- void restoreWorkspace(String workspaceBackupIdentifier, boolean asynchronous) throws
BackupOperationException,
- BackupConfigurationException;
-
- /**
- * ReprositoryEntry for restore should be contains in BackupChainLog.
- *
- * @param repositoryBackupIdentifier
- * identifier to repository backup.
- * @param asynchronous
- * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
- * @throws BackupOperationException
- * if backup operation exception occurred
- * @throws BackupConfigurationException
- * if configuration exception occurred
- */
- void restoreRepository(String repositoryBackupIdentifier, boolean asynchronous) throws
BackupOperationException,
- BackupConfigurationException;
-}
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -16,19 +16,18 @@
*/
package org.exoplatform.services.jcr.ext.backup;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
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;
@@ -37,19 +36,9 @@
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.events.StartElement;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.ws.frameworks.json.JsonHandler;
-import org.exoplatform.ws.frameworks.json.JsonParser;
-import org.exoplatform.ws.frameworks.json.impl.BeanBuilder;
-import org.exoplatform.ws.frameworks.json.impl.JsonDefaultHandler;
-import org.exoplatform.ws.frameworks.json.impl.JsonException;
-import org.exoplatform.ws.frameworks.json.impl.JsonGeneratorImpl;
-import org.exoplatform.ws.frameworks.json.impl.JsonParserImpl;
-import org.exoplatform.ws.frameworks.json.value.JsonValue;
/**
* Created by The eXo Platform SAS.
@@ -74,22 +63,15 @@
{
this.logFile = logFile;
- writer =
- XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(this.logFile),
- Constants.DEFAULT_ENCODING);
+ writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new
FileOutputStream(this.logFile));
writer.writeStartDocument();
writer.writeStartElement("repository-backup-chain-log");
+ writer.flush();
- writer.writeStartElement("version-log");
- writer.writeCharacters(versionLog);
- writer.writeEndElement();
-
writer.writeStartElement("start-time");
writer.writeCharacters(JCRDateFormat.format(startedTime));
writer.writeEndElement();
-
- writer.flush();
}
public void writeSystemWorkspaceName(String wsName) throws XMLStreamException
@@ -100,16 +82,14 @@
writer.flush();
}
- public void writeBackupsPath(List<String> wsLogFilePathList,
RepositoryBackupConfig config)
- throws XMLStreamException,
- IOException
+ public void writeBackupsPath(List<String> wsLogFilePathList) throws
XMLStreamException
{
writer.writeStartElement("workspaces-backup-info");
for (String path : wsLogFilePathList)
{
writer.writeStartElement("url");
- writer.writeCharacters(path.replace(config.getBackupDir().getCanonicalPath()
+ File.separator, ""));
+ writer.writeCharacters(path);
writer.writeEndElement();
}
@@ -119,7 +99,7 @@
}
public synchronized void write(RepositoryBackupConfig config, String
fullBackupType, String incrementalBackupType)
- throws XMLStreamException, IOException
+ throws XMLStreamException
{
writer.writeStartElement("repository-backup-config");
@@ -138,7 +118,7 @@
if (config.getBackupDir() != null)
{
writer.writeStartElement("backup-dir");
- writer.writeCharacters(config.getBackupDir().getCanonicalPath());
+ writer.writeCharacters(config.getBackupDir().getAbsolutePath());
writer.writeEndElement();
}
@@ -179,17 +159,6 @@
logger.error("Can't write end log", e);
}
}
-
- public synchronized void writeRepositoryEntry(RepositoryEntry rEntry) throws
JsonException, XMLStreamException
- {
-
- JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
- JsonValue json = generatorImpl.createJsonObject(rEntry);
-
- writer.writeStartElement("original-repository-config");
- writer.writeCData(json.toString());
- writer.writeEndElement();
- }
}
private class LogReader
@@ -200,17 +169,13 @@
private XMLStreamReader reader;
- private String version;
-
public LogReader(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
{
this.logFile = logFile;
- reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new
FileInputStream(logFile),
- Constants.DEFAULT_ENCODING);
+ reader = XMLInputFactory.newInstance().createXMLStreamReader(new
FileInputStream(logFile));
}
- public void readLogFile() throws UnsupportedEncodingException, Exception
+ public void readLogFile() throws XMLStreamException, MalformedURLException,
ValueFormatException
{
boolean endDocument = false;
@@ -241,15 +206,6 @@
if (name.equals("finish-time"))
finishedTime = JCRDateFormat.parse(readContent());
- if (name.equals("original-repository-config"))
- originalRepositoryEntry = readRepositoryEntry();
-
- if (name.equals("version-log"))
- {
- this.version = readContent();
- }
-
-
break;
case StartElement.END_DOCUMENT :
@@ -259,38 +215,8 @@
}
}
- private RepositoryEntry readRepositoryEntry() throws UnsupportedEncodingException,
Exception
+ private List<String> readWorkspaceBackupInfo() throws XMLStreamException
{
- String jsonRepositoryEntry = reader.getElementText();
-
- return (RepositoryEntry) (getObject(RepositoryEntry.class, jsonRepositoryEntry
- .getBytes(Constants.DEFAULT_ENCODING)));
- }
-
- /**
- * Will be created the Object from JSON binary data.
- *
- * @param cl
- * Class
- * @param data
- * binary data (JSON)
- * @return Object
- * @throws Exception
- * will be generated Exception
- */
- private Object getObject(Class cl, byte[] data) throws Exception
- {
- JsonHandler jsonHandler = new JsonDefaultHandler();
- JsonParser jsonParser = new JsonParserImpl();
- InputStream inputStream = new ByteArrayInputStream(data);
- jsonParser.parse(inputStream, jsonHandler);
- JsonValue jsonValue = jsonHandler.getJsonObject();
-
- return new BeanBuilder().createObject(cl, jsonValue);
- }
-
- private List<String> readWorkspaceBackupInfo() throws XMLStreamException,
IOException
- {
List<String> wsBackupInfo = new ArrayList<String>();
boolean endWorkspaceBackupInfo = false;
@@ -305,17 +231,7 @@
String name = reader.getLocalName();
if (name.equals("url"))
- {
- if (version != null && version.equals(VERSION_LOG_1_1))
- {
- String path = config.getBackupDir().getCanonicalPath() +
File.separator + readContent();
- wsBackupInfo.add(path);
- }
- else
- {
- wsBackupInfo.add(readContent());
- }
- }
+ wsBackupInfo.add(readContent());
break;
@@ -331,7 +247,7 @@
return wsBackupInfo;
}
- private BackupConfig readBackupConfig() throws XMLStreamException, IOException
+ private BackupConfig readBackupConfig() throws XMLStreamException
{
BackupConfig conf = new BackupConfig();
@@ -347,27 +263,8 @@
String name = reader.getLocalName();
if (name.equals("backup-dir"))
- {
- if (version != null && version.equals(VERSION_LOG_1_1))
- {
- String dir = readContent();
- if (dir.equals("."))
- {
- String path = logFile.getParentFile().getCanonicalPath();
+ conf.setBackupDir(new File(readContent()));
- conf.setBackupDir(new File(path));
- }
- else
- {
- conf.setBackupDir(new File(dir));
- }
- }
- else
- {
- conf.setBackupDir(new File(readContent()));
- }
- }
-
if (name.equals("backup-type"))
conf.setBackupType(Integer.valueOf(readContent()));
@@ -415,19 +312,82 @@
return content;
}
- public String getVersionLog()
+ private JobEntryInfo readJobEntryInfo() throws XMLStreamException,
MalformedURLException, ValueFormatException
{
- return version;
+ JobEntryInfo info = new JobEntryInfo();
+
+ boolean endJobEntryInfo = false;
+
+ while (!endJobEntryInfo)
+ {
+ int eventCode = reader.next();
+ switch (eventCode)
+ {
+
+ case StartElement.START_ELEMENT :
+ String name = reader.getLocalName();
+
+ if (name.equals("type"))
+ info.setType(getType(readContent()));
+
+ if (name.equals("state"))
+ info.setState(getState(readContent()));
+
+ if (name.equals("url"))
+ info.setURL(new URL(readContent()));
+
+ if (name.equals("date"))
+ info.setDate(JCRDateFormat.parse(readContent()));
+
+ break;
+
+ case StartElement.END_ELEMENT :
+ String tagName = reader.getLocalName();
+
+ if (tagName.equals("job-entry-info"))
+ endJobEntryInfo = true;
+ break;
+ }
+ }
+
+ return info;
}
+
+ private int getState(String content)
+ {
+ int state = -1;
+
+ if (content.equals("FINISHED"))
+ state = BackupJob.FINISHED;
+
+ if (content.equals("STARTING"))
+ state = BackupJob.STARTING;
+
+ if (content.equals("WAITING"))
+ state = BackupJob.WAITING;
+
+ if (content.equals("WORKING"))
+ state = BackupJob.WORKING;
+
+ return state;
+ }
+
+ private int getType(String content)
+ {
+ int type = -1;
+
+ if (content.equals("FULL"))
+ type = BackupJob.FULL;
+
+ if (content.equals("INCREMENTAL"))
+ type = BackupJob.INCREMENTAL;
+
+ return type;
+ }
}
protected static Log logger =
ExoLogger.getLogger("exo.jcr.component.ext.BackupChainLog");
- /**
- * Start for 1.1 version log will be stored relative paths.
- */
- protected static String VERSION_LOG_1_1 = "1.1";
-
public static final String PREFIX = "repository-backup-";
private static final String SUFFIX = ".xml";
@@ -456,10 +416,6 @@
private String increnetalBackupType;
- private RepositoryEntry originalRepositoryEntry;
-
- private final String versionLog;
-
/**
* @param logDirectory
* @param config
@@ -467,17 +423,15 @@
* @param wsLogFilePathList
* @param backupId
* @param startTime
- * @param rEntry
* @throws BackupOperationException
*/
public RepositoryBackupChainLog(File logDirectory, RepositoryBackupConfig config,
String fullBackupType,
String incrementalBackupType, String systemWorkspace, List<String>
wsLogFilePathList, String backupId,
- Calendar startTime, RepositoryEntry rEntry) throws BackupOperationException
+ Calendar startTime) throws BackupOperationException
{
try
{
this.finalized = false;
- this.versionLog = VERSION_LOG_1_1;
this.log = new File(logDirectory.getCanonicalPath() + File.separator + (PREFIX +
backupId + SUFFIX));
this.log.createNewFile();
this.backupId = backupId;
@@ -485,13 +439,11 @@
this.startedTime = Calendar.getInstance();
this.fullBackupType = fullBackupType;
this.increnetalBackupType = incrementalBackupType;
- this.originalRepositoryEntry = rEntry;
logWriter = new LogWriter(log);
logWriter.write(config, fullBackupType, incrementalBackupType);
logWriter.writeSystemWorkspaceName(systemWorkspace);
- logWriter.writeBackupsPath(wsLogFilePathList, config);
- logWriter.writeRepositoryEntry(rEntry);
+ logWriter.writeBackupsPath(wsLogFilePathList);
this.workspaceBackupsInfo = wsLogFilePathList;
this.workspaceSystem = systemWorkspace;
@@ -508,10 +460,6 @@
{
throw new BackupOperationException("Can not create backup log ...",
e);
}
- catch (JsonException e)
- {
- throw new BackupOperationException("Can not create backup log ...",
e);
- }
}
/**
@@ -527,7 +475,6 @@
{
logReader = new LogReader(log);
logReader.readLogFile();
- this.versionLog = logReader.getVersionLog();
}
catch (FileNotFoundException e)
{
@@ -539,16 +486,21 @@
throw new BackupOperationException(
"Can not read RepositoryBackupChainLog from file :" +
log.getAbsolutePath(), e);
}
- catch (UnsupportedEncodingException e)
+ catch (FactoryConfigurationError e)
{
throw new BackupOperationException(
"Can not read RepositoryBackupChainLog from file :" +
log.getAbsolutePath(), e);
}
- catch (Exception e)
+ catch (MalformedURLException e)
{
throw new BackupOperationException(
"Can not read RepositoryBackupChainLog from file :" +
log.getAbsolutePath(), e);
}
+ catch (ValueFormatException e)
+ {
+ throw new BackupOperationException(
+ "Can not read RepositoryBackupChainLog from file :" +
log.getAbsolutePath(), e);
+ }
}
/**
@@ -611,33 +563,6 @@
finishedTime = Calendar.getInstance();
finalized = true;
logWriter.writeEndLog();
-
- //copy backup chain log file in into Backupset files itself for portability
(e.g. on another server)
- try
- {
- InputStream in = new FileInputStream(log);
-
- File dest = new File(config.getBackupDir() + File.separator +
log.getName());
- if (!dest.exists())
- {
- OutputStream out = new FileOutputStream(dest);
-
- byte[] buf = new byte[(int) (log.length())];
- in.read(buf);
-
- String sConfig = new String(buf, Constants.DEFAULT_ENCODING);
- sConfig =
sConfig.replaceAll("<backup-dir>.+</backup-dir>",
"<backup-dir>.</backup-dir>");
-
- out.write(sConfig.getBytes(Constants.DEFAULT_ENCODING));
-
- in.close();
- out.close();
- }
- }
- catch (Exception e)
- {
- logger.error("Can't write log", e);
- }
}
}
@@ -674,15 +599,4 @@
return backupId;
}
- /**
- * Getting original repository configuration
- *
- * @return RepositoryEntry
- * return the original repository configuration
- */
- public RepositoryEntry getOriginalRepositoryEntry()
- {
- return originalRepositoryEntry;
- }
-
}
Deleted:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/WorkspaceRestoreException.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/WorkspaceRestoreException.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/WorkspaceRestoreException.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -1,54 +0,0 @@
-/*
- * 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;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 2010
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
- * @version $Id: WorkspaceRestoreException.java 3210 2010-09-28 12:01:50Z areshetnyak $
- */
-public class WorkspaceRestoreException
- extends BackupConfigurationException
-{
-
- /**
- * WorkspaceRestoreException constructor.
- *
- * @param message
- * String, the exception message
- */
- public WorkspaceRestoreException(String message)
- {
- super(message);
- }
-
- /**
- * WorkspaceRestoreException constructor.
- *
- * @param message
- * String, the exception message
- * @param e
- * Throwable, the cause exception
- */
- public WorkspaceRestoreException(String message, Throwable e)
- {
- super(message, e);
- }
-}
\ No newline at end of file
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -18,18 +18,6 @@
*/
package org.exoplatform.services.jcr.ext.backup.impl;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-
-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.BackupChainLog;
@@ -42,6 +30,17 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
/**
* Created by The eXo Platform SARL .<br/>
*
@@ -75,16 +74,12 @@
private Set<BackupJobListener> listeners = new
LinkedHashSet<BackupJobListener>();
public BackupChainImpl(BackupConfig config, File logDirectory, ManageableRepository
repository,
- String fullBackupType, String incrementalBackupType, String backupId, File
rootDir)
- throws BackupOperationException,
+ String fullBackupType, String incrementalBackupType, String backupId) throws
BackupOperationException,
BackupConfigurationException
{
this.config = config;
this.jobs = new ArrayList<BackupJob>();
-
- this.chainLog =
- new BackupChainLog(logDirectory, config, fullBackupType,
incrementalBackupType, backupId,
- getWorkspaceEntry(config.getWorkspace(), repository), rootDir);
+ this.chainLog = new BackupChainLog(logDirectory, config, fullBackupType,
incrementalBackupType, backupId);
this.timeStamp = Calendar.getInstance();
this.backupId = backupId;
@@ -118,29 +113,6 @@
+ "_PeriodTimer_" + new
SimpleDateFormat("yyyyMMdd.HHmmss.SSS").format(new Date()), true);
}
- private WorkspaceEntry getWorkspaceEntry(String workspace, ManageableRepository
repository)
- throws BackupOperationException
- {
- WorkspaceEntry wEntry = null;
-
- for (WorkspaceEntry entry : repository.getConfiguration().getWorkspaceEntries())
- {
- if (entry.getName().equals(workspace))
- {
- wEntry = entry;
- break;
- }
- }
-
- if (wEntry == null)
- {
- throw new BackupOperationException("Worksapce \"" + workspace +
"\" was not exsisted in repository \""
- + repository.getConfiguration().getName() + "\".");
- }
-
- return wEntry;
- }
-
/**
* Add all listeners to a given job. Used in startBackup() which itself is
synchronized.
*
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -66,13 +66,10 @@
import org.exoplatform.services.jcr.ext.backup.BackupJobListener;
import org.exoplatform.services.jcr.ext.backup.BackupManager;
import org.exoplatform.services.jcr.ext.backup.BackupOperationException;
-import org.exoplatform.services.jcr.ext.backup.ExtendedBackupManager;
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.backup.RepositoryRestoreExeption;
-import org.exoplatform.services.jcr.ext.backup.WorkspaceRestoreException;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
import org.exoplatform.services.jcr.ext.registry.RegistryEntry;
import org.exoplatform.services.jcr.ext.registry.RegistryService;
@@ -101,8 +98,7 @@
* @version $Id: $
*/
-public class BackupManagerImpl
- implements ExtendedBackupManager, Startable
+public class BackupManagerImpl implements BackupManager, Startable
{
protected static Log log =
ExoLogger.getLogger("exo.jcr.component.ext.BackupManagerImpl");
@@ -596,7 +592,7 @@
String reposytoryName = (repositoryName == null ? config.getRepository() :
repositoryName);
String workspaceName = workspaceEntry.getName();
- // ws should not exists.
+ // ws should be registered not created
if (!workspaceAlreadyExist(reposytoryName, workspaceName))
{
@@ -643,7 +639,7 @@
}
}
else
- throw new BackupConfigurationException("Workspace \"" +
workspaceName + "\" should not exists.");
+ throw new BackupConfigurationException("Workspace should exists " +
workspaceName);
}
private boolean workspaceAlreadyExist(String repository, String workspace) throws
RepositoryException,
@@ -684,8 +680,8 @@
validateBackupConfig(config);
BackupChain bchain =
- new BackupChainImpl(config, logsDirectory,
repoService.getRepository(config.getRepository()),
- fullBackupType, incrementalBackupType, IdGenerator.generate(),
logsDirectory);
+ new BackupChainImpl(config, logsDirectory,
repoService.getRepository(config.getRepository()), fullBackupType,
+ incrementalBackupType, IdGenerator.generate());
bchain.addListener(messagesListener);
bchain.addListener(jobListener);
@@ -1502,7 +1498,7 @@
RepositoryBackupChain repositoryBackupChain =
new RepositoryBackupChainImpl(config, logsDirectory, repository, fullBackupType,
incrementalBackupType,
- IdGenerator.generate());
+ IdGenerator.generate());
repositoryBackupChain.startBackup();
@@ -1557,142 +1553,4 @@
}
return null;
}
-
- // TODO Will be uncommented after fix issue JCR-1054
- // /**
- // * {@inheritDoc}
- // */
- // public void restoreExistingRepository(String repositoryBackupIdentifier, boolean
asynchronous)
- // throws BackupOperationException, BackupConfigurationException
- // {
- // RepositoryBackupChainLog backupChainLog = null;
- //
- // for (RepositoryBackupChainLog chainLog : getRepositoryBackupsLogs())
- // {
- // if (chainLog.getBackupId().equals(repositoryBackupIdentifier))
- // {
- // backupChainLog = chainLog;
- // break;
- // }
- // }
- //
- // if (backupChainLog == null)
- // {
- // throw new BackupConfigurationException("Can not founf backup of
repository with id \""
- // + repositoryBackupIdentifier + "\"");
- // }
- //
- // this.restoreExistingRepository(backupChainLog,
backupChainLog.getOriginalRepositoryEntry(), asynchronous);
- //
- // }
-
- // TODO Will be uncommented after fix issue JCR-1054
- // /**
- // * {@inheritDoc}
- // */
- // public void restoreExistingWorkspace(String workspaceBackupIdentifier, boolean
asynchronous)
- // throws BackupOperationException, BackupConfigurationException
- // {
- // BackupChainLog backupChainLog = null;
- //
- // for (BackupChainLog chainLog : getBackupsLogs())
- // {
- // if (chainLog.getBackupId().equals(workspaceBackupIdentifier))
- // {
- // backupChainLog = chainLog;
- // break;
- // }
- // }
- //
- // if (backupChainLog == null)
- // {
- // throw new BackupConfigurationException("Can not founf backup of
workspace with id \""
- // + workspaceBackupIdentifier + "\"");
- // }
- //
- // this.restoreExistingWorkspace(backupChainLog,
backupChainLog.getBackupConfig().getRepository(), backupChainLog
- // .getOriginalWorkspaceEntry(), asynchronous);
- //
- // }
-
- /**
- * {@inheritDoc}
- */
- public void restoreRepository(String repositoryBackupIdentifier, boolean
asynchronous)
- throws BackupOperationException, BackupConfigurationException
- {
- RepositoryBackupChainLog backupChainLog = null;
-
- for (RepositoryBackupChainLog chainLog : getRepositoryBackupsLogs())
- {
- if (chainLog.getBackupId().equals(repositoryBackupIdentifier))
- {
- backupChainLog = chainLog;
- break;
- }
- }
-
- if (backupChainLog == null)
- {
- throw new BackupConfigurationException("Can not founf backup of repository
with id \""
- + repositoryBackupIdentifier + "\"");
- }
-
- try
- {
- this.restore(backupChainLog, backupChainLog.getOriginalRepositoryEntry(),
asynchronous);
- }
- catch (RepositoryException e)
- {
- throw new RepositoryRestoreExeption("Repository \"" +
backupChainLog.getOriginalRepositoryEntry().getName()
- + "\" was not restored", e);
- }
- catch (RepositoryConfigurationException e)
- {
- throw new RepositoryRestoreExeption("Repository \"" +
backupChainLog.getOriginalRepositoryEntry().getName()
- + "\" was not restored", e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void restoreWorkspace(String workspaceBackupIdentifier, boolean asynchronous)
- throws BackupOperationException, BackupConfigurationException
- {
- BackupChainLog backupChainLog = null;
-
- for (BackupChainLog chainLog : getBackupsLogs())
- {
- if (chainLog.getBackupId().equals(workspaceBackupIdentifier))
- {
- backupChainLog = chainLog;
- break;
- }
- }
-
- if (backupChainLog == null)
- {
- throw new BackupConfigurationException("Can not founf backup of workspace
with id \""
- + workspaceBackupIdentifier + "\"");
- }
-
- try
- {
- this.restore(backupChainLog, backupChainLog.getBackupConfig().getRepository(),
backupChainLog
- .getOriginalWorkspaceEntry(), asynchronous);
- }
- catch (RepositoryException e)
- {
- throw new WorkspaceRestoreException("Workapce \"" +
backupChainLog.getOriginalWorkspaceEntry().getName()
- + "\" was not restored in repository \"" +
backupChainLog.getBackupConfig().getRepository() + "\"", e);
- }
- catch (RepositoryConfigurationException e)
- {
-
- throw new WorkspaceRestoreException("Workapce \"" +
backupChainLog.getOriginalWorkspaceEntry().getName()
- + "\" was not restored in repository \"" +
backupChainLog.getBackupConfig().getRepository() + "\"", e);
- }
-
- }
}
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/RepositoryBackupChainImpl.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -68,8 +68,7 @@
private int state;
public RepositoryBackupChainImpl(RepositoryBackupConfig config, File logDirectory,
ManageableRepository repository,
- String fullBackupType, String incrementalBackupType, String
repositoryBackupId)
- throws BackupOperationException,
+ String fullBackupType, String incrementalBackupType, String
repositoryBackupId) throws BackupOperationException,
BackupConfigurationException
{
this.config = config;
@@ -90,8 +89,8 @@
wsBackupConfig.setIncrementalJobPeriod(config.getIncrementalJobPeriod());
BackupChain bchain =
- new BackupChainImpl(wsBackupConfig, config.getBackupDir(), repository,
fullBackupType,
- incrementalBackupType, IdGenerator.generate(), logDirectory);
+ new BackupChainImpl(wsBackupConfig, config.getBackupDir(), repository,
+ fullBackupType, incrementalBackupType, IdGenerator.generate());
wsLogFilePathList.add(bchain.getLogFilePath());
workspaceBackups.add(bchain);
@@ -104,8 +103,7 @@
repository.getConfiguration().getSystemWorkspaceName(),
wsLogFilePathList,
this.repositoryBackupId,
- startTime,
-
repository.getConfiguration());
+ startTime);
state = INITIALIZED;
}
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -52,8 +52,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter
Nedonosko</a>
* @version $Id: AbstractBackupTestCase.java 760 2008-02-07 15:08:07Z pnedonosko $
*/
-public class AbstractBackupTestCase
- extends BaseStandaloneTest
+public class AbstractBackupTestCase extends BaseStandaloneTest
{
protected SessionImpl ws1Session;
@@ -64,24 +63,7 @@
protected BackupManager backup;
- // TODO Will be uncommented after fix issue JCR-1054
- // /**
- // * Database cleaner.
- // */
- // private DBCleanerService dbCleanerService = new DBCleanerService();
- //
- // /**
- // * Value storage cleaner.
- // */
- // private ValueStorageCleanHelper valueStorageCleanHelper = new
ValueStorageCleanHelper();
- //
- // /**
- // * Index storage cleaner.
- // */
- // private IndexCleanHelper indexCleanHelper = new IndexCleanHelper();
-
- class LogFilter
- implements FileFilter
+ class LogFilter implements FileFilter
{
public boolean accept(File pathname)
@@ -112,7 +94,7 @@
ws1TestRoot = ws1Session.getRootNode().addNode("backupTest");
ws1Session.save();
addContent(ws1TestRoot, 1, 10, 1);
-
+
}
else
{
@@ -124,7 +106,7 @@
}
// ws2
- ws2Session = (SessionImpl) repository.login(credentials, "ws2");
+ ws2Session = (SessionImpl)repository.login(credentials, "ws2");
}
@Override
@@ -133,24 +115,17 @@
for (String wsName : repository.getWorkspaceNames())
{
- try
+ if ("ws1".equals(wsName))
{
- 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();
- }
+ ws1Session = (SessionImpl) repository.login(credentials, "ws1");
+ ws1Session.getRootNode().getNode("backupTest").remove();
+ ws1Session.save();
}
- catch (PathNotFoundException e)
+ else
{
- //skip
+ SessionImpl ws = (SessionImpl)repository.login(credentials, wsName);
+ ws.getRootNode().getNode("backupTest").remove();
+ ws.save();
}
}
@@ -159,13 +134,13 @@
protected WorkspaceEntry makeWorkspaceEntry(String name, String sourceName)
{
- WorkspaceEntry ws1e = (WorkspaceEntry)
ws1Session.getContainer().getComponentInstanceOfType(WorkspaceEntry.class);
+ WorkspaceEntry ws1e =
(WorkspaceEntry)ws1Session.getContainer().getComponentInstanceOfType(WorkspaceEntry.class);
WorkspaceEntry ws1back = new WorkspaceEntry();
ws1back.setName(name);
// RepositoryContainer rcontainer = (RepositoryContainer)
// container.getComponentInstanceOfType(RepositoryContainer.class);
- ws1back.setUniqueName(((RepositoryImpl) ws1Session.getRepository()).getName() +
"_" + ws1back.getName()); // EXOMAN
+ ws1back.setUniqueName(((RepositoryImpl)ws1Session.getRepository()).getName() +
"_" + ws1back.getName()); // EXOMAN
ws1back.setAccessManager(ws1e.getAccessManager());
ws1back.setCache(ws1e.getCache());
@@ -198,49 +173,45 @@
}
ContainerEntry ce =
- new
ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
params);
+ new
ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
params);
ws1back.setContainer(ce);
return ws1back;
}
-
- protected RepositoryEntry makeRepositoryEntry(String repoName, RepositoryEntry
baseRepoEntry, String sourceName,
- Map<String, String> workspaceMapping)
+
+ 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();
+ 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.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.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)
+
+ protected WorkspaceEntry makeWorkspaceEntry(WorkspaceEntry baseWorkspaceEntry, String
wsName, String repoName, String sourceName)
{
WorkspaceEntry ws1back = new WorkspaceEntry();
ws1back.setName(wsName);
@@ -269,7 +240,7 @@
if (newp.getName().equals("source-name"))
newp.setValue(sourceName);
else if (newp.getName().equals("swap-directory"))
- newp.setValue("target/temp/swap/" + repoName + "_" +
wsName);
+ newp.setValue("target/temp/swap/" + repoName + "_" +
wsName);
else if (newp.getName().equals("multi-db"))
newp.setValue("false");
@@ -277,19 +248,18 @@
}
ContainerEntry ce =
- new
ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
params);
+ 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
+ int startIndex, int stopIndex) throws RepositoryConfigurationException,
RepositoryException,
+ BackupOperationException, BackupConfigurationException
{
// restore
- RepositoryEntry re =
- (RepositoryEntry)
ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+ RepositoryEntry re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
WorkspaceEntry ws1back = makeWorkspaceEntry(workspaceName, datasourceName);
repository.configWorkspace(ws1back);
@@ -304,12 +274,12 @@
SessionImpl back1 = null;
try
{
- back1 = (SessionImpl) repository.login(credentials, ws1back.getName());
+ back1 = (SessionImpl)repository.login(credentials, ws1back.getName());
Node ws1backTestRoot = back1.getRootNode().getNode("backupTest");
for (int i = startIndex; i < stopIndex; i++)
{
assertEquals("Restored content should be same",
"property-" + i, ws1backTestRoot.getNode("node_" + i)
- .getProperty("exo:data").getString());
+ .getProperty("exo:data").getString());
}
}
catch (Exception e)
@@ -328,8 +298,8 @@
}
protected void addContent(Node node, int startIndex, int stopIndex, long sleepTime)
throws ValueFormatException,
- VersionException, LockException, ConstraintViolationException,
ItemExistsException, PathNotFoundException,
- RepositoryException, InterruptedException
+ VersionException, LockException, ConstraintViolationException, ItemExistsException,
PathNotFoundException,
+ RepositoryException, InterruptedException
{
for (int i = startIndex; i <= stopIndex; i++)
{
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupManager.java 2010-12-01
15:42:53 UTC (rev 3586)
@@ -18,6 +18,14 @@
*/
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.SessionImpl;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -28,15 +36,6 @@
import javax.jcr.RepositoryException;
import javax.jcr.lock.Lock;
-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.SessionImpl;
-
-
/**
* Created by The eXo Platform SAS.
* Author : Peter Nedonosko peter.nedonosko(a)exoplatform.com.ua
@@ -49,74 +48,74 @@
{
public void testFullBackupRestore() throws Exception
- {
- // backup
- File backDir = new File("target/backup/ws1");
- backDir.mkdirs();
+ {
+ // backup
+ File backDir = new File("target/backup/ws1");
+ backDir.mkdirs();
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
+ BackupConfig config = new BackupConfig();
+ config.setRepository(repository.getName());
+ config.setWorkspace("ws1");
+ config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
- config.setBackupDir(backDir);
+ config.setBackupDir(backDir);
- backup.startBackup(config);
+ backup.startBackup(config);
- BackupChain bch = backup.findBackup(repository.getName(), "ws1");
+ BackupChain bch = backup.findBackup(repository.getName(), "ws1");
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
+ // wait till full backup will be stopped
+ while (bch.getFullBackupState() != BackupJob.FINISHED)
+ {
+ Thread.yield();
+ Thread.sleep(50);
+ }
- // stop fullBackup
+ // stop fullBackup
- if (bch != null)
- backup.stopBackup(bch);
- else
- fail("Can't get fullBackup chain");
+ if (bch != null)
+ backup.stopBackup(bch);
+ else
+ fail("Can't get fullBackup chain");
- // restore
- RepositoryEntry re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
- WorkspaceEntry ws1back = makeWorkspaceEntry("ws1back",
"jdbcjcr_backup_only_use_1");
+ // restore
+ RepositoryEntry re =
(RepositoryEntry)ws1Session.getContainer().getComponentInstanceOfType(RepositoryEntry.class);
+ WorkspaceEntry ws1back = makeWorkspaceEntry("ws1back",
"jdbcjcr_backup_only_use_1");
- // BackupChainLog bchLog = new BackupChainLog(backDir, rconfig);
- File backLog = new File(bch.getLogFilePath());
- if (backLog.exists())
- {
- BackupChainLog bchLog = new BackupChainLog(backLog);
+ // BackupChainLog bchLog = new BackupChainLog(backDir, rconfig);
+ File backLog = new File(bch.getLogFilePath());
+ if (backLog.exists())
+ {
+ BackupChainLog bchLog = new BackupChainLog(backLog);
- assertNotNull(bchLog.getStartedTime());
- assertNotNull(bchLog.getFinishedTime());
+ assertNotNull(bchLog.getStartedTime());
+ assertNotNull(bchLog.getFinishedTime());
- backup.restore(bchLog, re.getName(), ws1back, false);
+ backup.restore(bchLog, re.getName(), ws1back, false);
- // check
- SessionImpl back1 = null;
- try
- {
- back1 = (SessionImpl)repository.login(credentials, "ws1back");
- 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();
- }
+ // check
+ SessionImpl back1 = null;
+ try
+ {
+ back1 = (SessionImpl)repository.login(credentials, "ws1back");
+ Node ws1backTestRoot = back1.getRootNode().getNode("backupTest");
+ assertEquals("Restored content should be same",
"property-5", ws1backTestRoot.getNode("node_5")
+ .getProperty("exo:data").getString());
}
- else
- fail("There are no backup files in " + backDir.getAbsolutePath());
+ 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 testIncrementalBackupRestore() throws Exception
{
@@ -1222,288 +1221,4 @@
else
fail("There are no backup files in " + backDir.getAbsolutePath());
}
-
- // TODO Will be uncommented after fix issue JCR-1054
- /*public void testExistedWorkspaceRestoreWithConfig() throws Exception
- {
- // backup
- File backDir = new File("target/backup/ws1");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
-
- config.setBackupDir(backDir);
-
- backup.startBackup(config);
-
- BackupChain bch = backup.findBackup(repository.getName(), "ws1");
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // stop fullBackup
- if (bch != null)
- backup.stopBackup(bch);
- else
- fail("Can't get fullBackup chain");
-
- super.tearDown();
-
- File backLog = new File(bch.getLogFilePath());
- if (backLog.exists())
- {
- BackupChainLog bchLog = new BackupChainLog(backLog);
-
- assertNotNull(bchLog.getStartedTime());
- assertNotNull(bchLog.getFinishedTime());
-
- backup.restoreExistingWorkspace(bchLog.getBackupId(), false);
-
- // check
- SessionImpl back1 = null;
- try
- {
- back1 = (SessionImpl) repository.login(credentials, "ws1");
- 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 testExistedRepositoryRestoreWithConfig() throws Exception
- {
- // backup
- File backDir = new File("target/backup/db1");
- backDir.mkdirs();
-
- RepositoryBackupConfig config = new RepositoryBackupConfig();
- String repoName = repository.getName();
- config.setRepository(repoName);
- 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);
-
- // check
- super.tearDown();
-
- // restore
- File backLog = new File(bch.getLogFilePath());
- if (backLog.exists())
- {
- RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
-
- assertNotNull(bchLog.getStartedTime());
- assertNotNull(bchLog.getFinishedTime());
-
- backup.restoreExistingRepository(bchLog.getBackupId(), false);
-
- assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL,
backup.getLastRepositoryRestore(repoName)
- .getStateRestore());
-
- // check
- ManageableRepository restoredRepository =
repositoryService.getRepository(repoName);
-
- for (String wsName : restoredRepository.getWorkspaceNames())
- {
- SessionImpl back1 = null;
- try
- {
- back1 = (SessionImpl) restoredRepository.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 testWorkspaceRestoreWithConfig() throws Exception
- {
- // backup
- File backDir = new File("target/backup/ws1");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_BACKUP_ONLY);
-
- config.setBackupDir(backDir);
-
- backup.startBackup(config);
-
- BackupChain bch = backup.findBackup(repository.getName(), "ws1");
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // stop fullBackup
-
- if (bch != null)
- backup.stopBackup(bch);
- else
- fail("Can't get fullBackup chain");
-
- //TODO
- super.tearDown();
- removeWorkspaceFully(repository.getName(), "ws1");
-
- File backLog = new File(bch.getLogFilePath());
- if (backLog.exists())
- {
- BackupChainLog bchLog = new BackupChainLog(backLog);
-
- assertNotNull(bchLog.getStartedTime());
- assertNotNull(bchLog.getFinishedTime());
-
- backup.restoreWorkspace(bchLog.getBackupId(), false);
-
- // check
- SessionImpl back1 = null;
- try
- {
- back1 = (SessionImpl) repository.login(credentials, "ws1");
- 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 testRepositoryRestoreWithConfig() throws Exception
- {
- // backup
- File backDir = new File("target/backup");
- backDir.mkdirs();
-
- RepositoryBackupConfig config = new RepositoryBackupConfig();
- String repoName = repository.getName();
- config.setRepository(repoName);
- 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);
-
- //TODO
- super.tearDown();
- removeRepositoryFully(repository.getName());
-
- // restore
- File backLog = new File(bch.getLogFilePath());
- if (backLog.exists())
- {
- RepositoryBackupChainLog bchLog = new RepositoryBackupChainLog(backLog);
-
- assertNotNull(bchLog.getStartedTime());
- assertNotNull(bchLog.getFinishedTime());
-
- backup.restoreRepository(bchLog.getBackupId(), false);
-
- assertEquals(JobWorkspaceRestore.RESTORE_SUCCESSFUL,
backup.getLastRepositoryRestore(repoName)
- .getStateRestore());
-
- // check
- ManageableRepository restoredRepository =
repositoryService.getRepository(repoName);
-
- for (String wsName : restoredRepository.getWorkspaceNames())
- {
- SessionImpl back1 = null;
- try
- {
- back1 = (SessionImpl) restoredRepository.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());
- }*/
}
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
===================================================================
---
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2010-12-01
15:00:37 UTC (rev 3585)
+++
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2010-12-01
15:42:53 UTC (rev 3586)
@@ -473,55 +473,5 @@
reinitialization, the task will have new time values for the backup
operation cycle as the chainPeriod and incrementalPeriod will be applied
again. That behaviour may be changed in the future.</para>
-
- <para></para>
-
- <section>
- <title>Restore a workspace or a repository using original
- configuration</title>
-
- <para>The Backup manager allows you to restore a repository or a
- workspace using the original configuration stored into the backup
- log:</para>
-
- <programlisting> /**
- * WorkspaceEntry for restore should be contains in BackupChainLog.
- *
- * @param workspaceBackupIdentifier
- * identifier to workspace backup.
- * @param asynchronous
- * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
- * @throws BackupOperationException
- * if backup operation exception occurred
- * @throws BackupConfigurationException
- * if configuration exception occurred
- */
- void restoreWorkspace(String workspaceBackupIdentifier, boolean asynchronous) throws
BackupOperationException,
- BackupConfigurationException;
-
- /**
- * ReprositoryEntry for restore should be contains in BackupChainLog.
- *
- * @param repositoryBackupIdentifier
- * identifier to repository backup.
- * @param asynchronous
- * if 'true' restore will be in asynchronous mode (i.e. in separated
thread)
- * @throws BackupOperationException
- * if backup operation exception occurred
- * @throws BackupConfigurationException
- * if configuration exception occurred
- */
- void restoreRepository(String repositoryBackupIdentifier, boolean asynchronous) throws
BackupOperationException,
- BackupConfigurationException;</programlisting>
- </section>
-
- <section>
- <title>Backup set portability</title>
-
- <para>The Backup log is stored during the Backup operation into two
- different locations: backup-dir directory of BackupService to support
- interactive operations via Backup API (e.g. console) and backup set
- files for portability (e.g. on another server).</para>
- </section>
</section>
</chapter>