[exo-jcr-commits] exo-jcr SVN: r4216 - in jcr/trunk/exo.jcr.component.ext/src: main/java/org/exoplatform/services/jcr/ext/backup/server and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Apr 7 09:46:19 EDT 2011


Author: areshetnyak
Date: 2011-04-07 09:46:18 -0400 (Thu, 07 Apr 2011)
New Revision: 4216

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
   jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
JCR-1563 : Th parameter "backup-set-path" was used QueryPqram 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	2011-04-07 07:16:39 UTC (rev 4215)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java	2011-04-07 13:46:18 UTC (rev 4216)
@@ -350,7 +350,7 @@
 
          if (!PrivilegedFileHelper.exists(configFile))
          {
-            throw new RepositoryRestoreExeption("The backup set is not contains original repositpry configuration : "
+            throw new RepositoryRestoreExeption("The backup set is not contains original repository configuration : "
                      + PrivilegedFileHelper.getCanonicalPath(getBackupConfig().getBackupDir()));
          }
 

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	2011-04-07 07:16:39 UTC (rev 4215)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java	2011-04-07 13:46:18 UTC (rev 4216)
@@ -70,6 +70,7 @@
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.CacheControl;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -837,9 +838,9 @@
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("administrators")
-   @Path("/restore/backup-set/{repo}/{backup-set-path:.*}/{remove-Existing}")
+   @Path("/restore/backup-set/{repo}/{remove-Existing}")
    public Response restoreBackupSet(WorkspaceEntry wEntry, @PathParam("repo") String repository,
-            @PathParam("backup-set-path") String backupSetPath, @PathParam("remove-Existing") Boolean removeExisting)
+            @QueryParam("backup-set-path") String backupSetPath, @PathParam("remove-Existing") Boolean removeExisting)
    {
       String failMessage;
       Response.Status status;
@@ -1135,8 +1136,8 @@
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("administrators")
-   @Path("/restore/backup-set/{backup-set-path:.*}/{remove-Existing}")
-   public Response restoreFromBackupSet(@PathParam("backup-set-path") String backupSetPath,
+   @Path("/restore/backup-set/{remove-Existing}")
+   public Response restoreFromBackupSet(@QueryParam("backup-set-path") String backupSetPath,
             @PathParam("remove-Existing") Boolean removeExisting)
    {
       String failMessage = null;
@@ -1611,9 +1612,9 @@
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RolesAllowed("administrators")
-   @Path("/restore-repository/backup-set/{backup-set-path:.*}/{remove-Existing}")
+   @Path("/restore-repository/backup-set/{remove-Existing}")
    public Response restoreRepositoryBackupSet(RepositoryEntry rEntry,
-            @PathParam("backup-set-path") String backupSetPath,
+            @QueryParam("backup-set-path") String backupSetPath,
             @PathParam("remove-Existing") Boolean removeExisting)
    {
       String failMessage;

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	2011-04-07 07:16:39 UTC (rev 4215)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java	2011-04-07 13:46:18 UTC (rev 4216)
@@ -1472,8 +1472,9 @@
          headers.putSingle("Content-Type", "application/json; charset=UTF-8");
          ContainerRequestUserRole creq =
             new ContainerRequestUserRole("POST", new URI(HTTP_BACKUP_AGENT_PATH
-               + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "db6" + "/" + backupSetPath + "/"
-               + "true"), new URI(""), new ByteArrayInputStream(json.toString().getBytes("UTF-8")),
+                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "db6" + "/" + "true"
+                           + "?backup-set-path=" + backupSetPath), new URI(""), new ByteArrayInputStream(json
+                           .toString().getBytes("UTF-8")),
                new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
@@ -1575,8 +1576,8 @@
          MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
-                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath + "/"
-                           + "true"), new URI(""), null, new InputHeadersMap(headers));
+                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "true"
+                           + "?backup-set-path=" + backupSetPath), new URI(""), null, new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
          ContainerResponse cres = new ContainerResponse(responseWriter);
@@ -1678,8 +1679,8 @@
          MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
-                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath + "/"
-                           + "false"), new URI(""), null, new InputHeadersMap(headers));
+                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "false"
+                           + "?backup-set-path=" + backupSetPath), new URI(""), null, new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
          ContainerResponse cres = new ContainerResponse(responseWriter);
@@ -1807,7 +1808,7 @@
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("POST", new URI(HTTP_BACKUP_AGENT_PATH
                            + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "db6" + "/"
-                           + backupSetPath + "/" + "false"), new URI(""), new ByteArrayInputStream(json.toString()
+                           + "false" + "?backup-set-path=" + backupSetPath), new URI(""), new ByteArrayInputStream(json.toString()
                            .getBytes("UTF-8")), new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
@@ -2579,8 +2580,7 @@
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("POST", new URI(HTTP_BACKUP_AGENT_PATH
                            + HTTPBackupAgent.Constants.OperationType.RESTORE_REPOSITORY_BACKUP_SET + "/"
-                           + backupSetPath + "/"
-                           + "true"),
+                           + "true" + "?backup-set-path=" + backupSetPath),
                            new URI(""), new ByteArrayInputStream(json.toString().getBytes("UTF-8")),
                            new InputHeadersMap(headers));
 
@@ -2728,7 +2728,7 @@
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("POST", new URI(HTTP_BACKUP_AGENT_PATH
                            + HTTPBackupAgent.Constants.OperationType.RESTORE_REPOSITORY_BACKUP_SET + "/"
-                           + backupSetPath + "/" + "false"), new URI(""), new ByteArrayInputStream(json.toString()
+                           + "false" + "?backup-set-path=" + backupSetPath), new URI(""), new ByteArrayInputStream(json.toString()
                            .getBytes("UTF-8")), new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
@@ -2829,8 +2829,8 @@
          MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
-                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath + "/"
-                           + "true"), new URI(""), null, new InputHeadersMap(headers));
+                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "true"
+                           + "?backup-set-path=" + backupSetPath), new URI(""), null, new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
          ContainerResponse cres = new ContainerResponse(responseWriter);
@@ -2931,8 +2931,8 @@
          MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
          ContainerRequestUserRole creq =
                   new ContainerRequestUserRole("GET", new URI(HTTP_BACKUP_AGENT_PATH
-                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath + "/"
-                           + "false"), new URI(""), null, new InputHeadersMap(headers));
+                           + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + "false"
+                           + "?backup-set-path=" + backupSetPath), new URI(""), null, new InputHeadersMap(headers));
 
          ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
          ContainerResponse cres = new ContainerResponse(responseWriter);



More information about the exo-jcr-commits mailing list