Author: areshetnyak
Date: 2010-03-26 05:04:50 -0400 (Fri, 26 Mar 2010)
New Revision: 2152
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/server/HTTPBackupAgent.java
Log:
EXOJCR-549 : The implementation backup/restore whole repository in HTTPBackupAgent.
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 2010-03-26
08:51:55 UTC (rev 2151)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2010-03-26
09:04:50 UTC (rev 2152)
@@ -165,10 +165,6 @@
private XMLStreamReader reader;
- private BackupConfig config;
-
- private List<JobEntryInfo> jobEntriesNormalize;
-
public LogReader(File logFile) throws FileNotFoundException, XMLStreamException,
FactoryConfigurationError
{
this.logFile = logFile;
@@ -215,16 +211,6 @@
}
}
- public BackupConfig getBackupConfig()
- {
- return config;
- }
-
- public List<JobEntryInfo> getJobEntryInfoNormalizeList()
- {
- return jobEntriesNormalize;
- }
-
private List<String> readWorkspaceBackupInfo() throws XMLStreamException
{
List<String> wsBackupInfo = new ArrayList<String>();
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-26
08:51:55 UTC (rev 2151)
+++
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-26
09:04:50 UTC (rev 2152)
@@ -1432,7 +1432,61 @@
.cacheControl(noCache).build();
}
}
+
+ /**
+ * Will be returned the detailed information about last restores.
+ *
+ * @return Response return the response
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @RolesAllowed("administrators")
+ @Path("/info/restores-repository")
+ public Response infoRestoresRepository()
+ {
+ try
+ {
+ List<JobRepositoryRestore> restoreJobs =
backupManager.getRepositoryRestores();
+ List<JobRepositoryRestore> jobs = new
ArrayList<JobRepositoryRestore>();
+
+ for (int i = restoreJobs.size() - 1; i >= 0; i--)
+ {
+ JobRepositoryRestore job = restoreJobs.get(i);
+ boolean isUnique = true;
+ for (JobRepositoryRestore unJob : jobs)
+ {
+ if (unJob.getRepositoryName().equals(job.getRepositoryName()))
+ isUnique = false;
+ }
+
+ if (isUnique)
+ jobs.add(job);
+ }
+
+ List<ShortInfo> list = new ArrayList<ShortInfo>();
+
+ for (JobRepositoryRestore job : jobs)
+ {
+ ShortInfo info =
+ new ShortInfo(ShortInfo.RESTORE, job.getRepositoryBackupChainLog(),
job.getStartTime(), job.getEndTime(), job
+ .getStateRestore(), job.getRepositoryName());
+ list.add(info);
+ }
+
+ return Response.ok(new ShortInfoList(list)).cacheControl(noCache).build();
+
+ }
+ catch (Throwable e)
+ {
+ log.error("Can not get information about current repository
restores.", e);
+
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
+ "Can not get information about current repository restores : " +
e.getMessage()).type(MediaType.TEXT_PLAIN)
+ .cacheControl(noCache).build();
+ }
+ }
+
/**
* Will be returned the default workspace configuration.
*
Show replies by date