[exo-jcr-commits] exo-jcr SVN: r2130 - in jcr/trunk/exo.jcr.component.ext/src: test/java/org/exoplatform/services/jcr/ext/backup/server and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Mar 25 10:27:02 EDT 2010
Author: tolusha
Date: 2010-03-25 10:27:01 -0400 (Thu, 25 Mar 2010)
New Revision: 2130
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/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
EXOJCR-549: add infoBackupRepositoryCompleted() method
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-25 14:12:58 UTC (rev 2129)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2010-03-25 14:27:01 UTC (rev 2130)
@@ -154,6 +154,11 @@
public static final String COMPLETED_BACKUPS_INFO = "/info/backup/completed";
/**
+ * The completed repository backups info operations.
+ */
+ public static final String COMPLETED_BACKUPS_REPOSITORY_INFO = "/info/backup/repository/completed";
+
+ /**
* The backup service info operations.
*/
public static final String BACKUP_SERVICE_INFO = "/info";
@@ -969,6 +974,39 @@
}
/**
+ * Will be returned the list short info of completed backups .
+ *
+ * @return Response return the response
+ */
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ @RolesAllowed("administrators")
+ @Path("/info/backup/repository/completed")
+ public Response infoBackupRepositoryCompleted()
+ {
+ try
+ {
+ List<ShortInfo> completedList = new ArrayList<ShortInfo>();
+
+ for (RepositoryBackupChainLog chainLog : backupManager.getRepositoryBackupsLogs())
+ if (backupManager.findBackup(chainLog.getBackupId()) == null)
+ completedList.add(new ShortInfo(ShortInfo.COMPLETED, chainLog));
+
+ ShortInfoList list = new ShortInfoList(completedList);
+
+ return Response.ok(list).cacheControl(noCache).build();
+ }
+ catch (Throwable e)
+ {
+ log.error("Can not get information about completed backups", e);
+
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
+ "Can not get information about completed backups" + e.getMessage()).type(MediaType.TEXT_PLAIN)
+ .cacheControl(noCache).build();
+ }
+ }
+
+ /**
* Will be returned the list short info of current and completed backups. Filtered by specific
* workspace.
*
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2010-03-25 14:12:58 UTC (rev 2129)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2010-03-25 14:27:01 UTC (rev 2130)
@@ -726,7 +726,7 @@
MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
ContainerRequestUserRole creq =
new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
- + HTTPBackupAgent.Constants.OperationType.COMPLETED_BACKUPS_INFO), new URI(""), null,
+ + HTTPBackupAgent.Constants.OperationType.COMPLETED_BACKUPS_REPOSITORY_INFO), new URI(""), null,
new InputHeadersMap(headers));
ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
More information about the exo-jcr-commits
mailing list