exo-jcr SVN: r4220 - in jcr/trunk: exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-04-11 04:35:21 -0400 (Mon, 11 Apr 2011)
New Revision: 4220
Modified:
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
Log:
JCR-1563 : The parameter "backup-set-path" was used QueryPqram in HTTPBackupAgent.
Modified: jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-04-08 14:36:25 UTC (rev 4219)
+++ jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-04-11 08:35:21 UTC (rev 4220)
@@ -52,6 +52,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import javax.ws.rs.core.Response;
@@ -469,6 +470,13 @@
BackupAgentResponse response = null;
String sURL = null;
+ String backupSetPathEncoded = null;
+
+ if (backupSetPath != null)
+ {
+ backupSetPathEncoded = URLEncoder.encode(backupSetPath, "UTF-8");
+ }
+
if (workspaceName != null)
{
if (config != null)
@@ -484,7 +492,8 @@
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
+ HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/"
- + repositoryName + "/" + backupSetPath + "/" + removeExists;
+ + repositoryName
+ + "/" + removeExists + "?backup-set-path=" + backupSetPathEncoded;
}
WorkspaceEntry wEntry = null;
@@ -529,8 +538,7 @@
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
+ HTTPBackupAgent.Constants.OperationType.RESTORE_REPOSITORY_BACKUP_SET + "/"
- + backupSetPath + "/"
- + removeExists;
+ + removeExists + "?backup-set-path=" + backupSetPathEncoded;
}
RepositoryEntry wEntry = null;
@@ -613,8 +621,8 @@
{
sURL =
path + HTTPBackupAgent.Constants.BASE_URL
- + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + backupSetPath + "/"
- + removeExists;
+ + HTTPBackupAgent.Constants.OperationType.RESTORE_BACKUP_SET + "/" + removeExists
+ + "?backup-set-path=" + backupSetPathEncoded;
}
response = transport.executeGET(sURL);
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-08 14:36:25 UTC (rev 4219)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2011-04-11 08:35:21 UTC (rev 4220)
@@ -3161,4 +3161,35 @@
}
}
}
+
+ public void testStartBackupRepository_OnWin() throws Exception
+ {
+ Session session_db6_ws2 = repositoryService.getRepository("db6").login(credentials, "ws2");
+ assertNotNull(session_db6_ws2);
+
+ session_db6_ws2.getRootNode().addNode("NODE_NAME_TO_TEST");
+ session_db6_ws2.save();
+
+ File f = new File("E:\\data\\exo-working\\temp\\backup");
+
+ BackupConfigBean configBean = new BackupConfigBean(BackupManager.FULL_AND_INCREMENTAL, f.getPath(), 10000l);
+
+ JsonGeneratorImpl generatorImpl = new JsonGeneratorImpl();
+ JsonValue json = generatorImpl.createJsonObject(configBean);
+
+ MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ headers.putSingle("Content-Type", "application/json; charset=UTF-8");
+ ContainerRequestUserRole creq =
+ new ContainerRequestUserRole("POST", new URI(HTTP_BACKUP_AGENT_PATH
+ + HTTPBackupAgent.Constants.OperationType.START_BACKUP_REPOSITORY + "/db6"), new URI(""),
+ new ByteArrayInputStream(json.toString().getBytes("UTF-8")), new InputHeadersMap(headers));
+
+ ByteArrayContainerResponseWriter responseWriter = new ByteArrayContainerResponseWriter();
+ ContainerResponse cres = new ContainerResponse(responseWriter);
+ handler.handleRequest(creq, cres);
+
+ assertEquals(200, cres.getStatus());
+
+ Thread.sleep(10000);
+ }
}
15 years
exo-jcr SVN: r4219 - core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/jaas.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-04-08 10:36:25 -0400 (Fri, 08 Apr 2011)
New Revision: 4219
Modified:
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/jaas/AbstractLoginModule.java
Log:
EXOJCR-1298: Don't informative error at DefaultLoginModule.login() when the container is null.
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/jaas/AbstractLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/jaas/AbstractLoginModule.java 2011-04-07 14:59:04 UTC (rev 4218)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/jaas/AbstractLoginModule.java 2011-04-08 14:36:25 UTC (rev 4219)
@@ -113,7 +113,15 @@
if (container instanceof RootContainer)
{
container = RootContainer.getInstance().getPortalContainer(portalContainerName);
+ if (container == null)
+ {
+ throw new Exception("The eXo container is null, because the current container is a RootContainer and there is no PortalContainer with the name '" + portalContainerName + "'.");
+ }
}
+ else if (container == null)
+ {
+ throw new Exception("The eXo container is null, because the current container is null.");
+ }
return container;
}
15 years
exo-jcr SVN: r4218 - in jcr/trunk/exo.jcr.component.ext/src: test/java/org/exoplatform/services/jcr/ext/backup/server and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-04-07 10:59:04 -0400 (Thu, 07 Apr 2011)
New Revision: 4218
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:
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/server/HTTPBackupAgent.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2011-04-07 14:58:38 UTC (rev 4217)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgent.java 2011-04-07 14:59:04 UTC (rev 4218)
@@ -56,6 +56,8 @@
import java.io.File;
import java.io.FilenameFilter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.List;
@@ -840,14 +842,31 @@
@RolesAllowed("administrators")
@Path("/restore/backup-set/{repo}/{remove-Existing}")
public Response restoreBackupSet(WorkspaceEntry wEntry, @PathParam("repo") String repository,
- @QueryParam("backup-set-path") String backupSetPath, @PathParam("remove-Existing") Boolean removeExisting)
+ @QueryParam("backup-set-path") String backupSetPathEncoded, @PathParam("remove-Existing") Boolean removeExisting)
{
String failMessage;
Response.Status status;
Throwable exception;
+ String backupSetPath = null;
+
try
{
+ backupSetPath = URLDecoder.decode(backupSetPathEncoded, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ log.error("Can not start restore the workspace '" + "/" + repository + "/" + wEntry.getName()
+ + "' from backup set '" + backupSetPath + "'", e);
+
+ return Response.status(Response.Status.BAD_REQUEST).entity(
+ "Can not start restore the workspace '" + "/" + repository + "/" + wEntry.getName()
+ + "' from backup set '" + backupSetPath + "' : " + e.getMessage())
+ .type(MediaType.TEXT_PLAIN).cacheControl(noCache).build();
+ }
+
+ try
+ {
validateOneRestoreInstants(repository, wEntry.getName());
File backupSetDir = (new File(backupSetPath));
@@ -1137,13 +1156,28 @@
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed("administrators")
@Path("/restore/backup-set/{remove-Existing}")
- public Response restoreFromBackupSet(@QueryParam("backup-set-path") String backupSetPath,
+ public Response restoreFromBackupSet(@QueryParam("backup-set-path") String backupSetPathEncoded,
@PathParam("remove-Existing") Boolean removeExisting)
{
String failMessage = null;
Response.Status status = null;
Throwable exception = null;
+
+ String backupSetPath = null;
+ try
+ {
+ backupSetPath = URLDecoder.decode(backupSetPathEncoded, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ log.error("Can not start restore from backup set '" + backupSetPathEncoded + "'", e);
+
+ return Response.status(Response.Status.BAD_REQUEST).entity(
+ "Can not start restore from backup set '" + backupSetPathEncoded + "' : " + e.getMessage()).type(
+ MediaType.TEXT_PLAIN).cacheControl(noCache).build();
+ }
+
File backupSetDir = (new File(backupSetPath));
File backuplog = null;
@@ -1614,15 +1648,32 @@
@RolesAllowed("administrators")
@Path("/restore-repository/backup-set/{remove-Existing}")
public Response restoreRepositoryBackupSet(RepositoryEntry rEntry,
- @QueryParam("backup-set-path") String backupSetPath,
+ @QueryParam("backup-set-path") String backupSetPathEncoded,
@PathParam("remove-Existing") Boolean removeExisting)
{
String failMessage;
Response.Status status;
Throwable exception;
+ String backupSetPath = null;
+
try
{
+ backupSetPath = URLDecoder.decode(backupSetPathEncoded, "UTF-8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ log.error("Can not start restore the repository '" + "/" + rEntry.getName() + "' from backup set '"
+ + backupSetPath + "'", e);
+
+ return Response.status(Response.Status.BAD_REQUEST).entity(
+ "Can not start restore the repository '" + "/" + rEntry.getName() + "' from backup set '"
+ + backupSetPath + "' : " + e.getMessage()).type(MediaType.TEXT_PLAIN).cacheControl(noCache)
+ .build();
+ }
+
+ try
+ {
validateOneRepositoryRestoreInstants(rEntry.getName());
File backupSetDir = (new File(backupSetPath));
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 14:58:38 UTC (rev 4217)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2011-04-07 14:59:04 UTC (rev 4218)
@@ -68,6 +68,7 @@
import java.io.File;
import java.io.InputStream;
import java.net.URI;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -1425,7 +1426,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -1553,7 +1554,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -1655,7 +1656,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -1758,7 +1759,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -2512,7 +2513,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -2659,7 +2660,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -2806,7 +2807,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
@@ -2907,7 +2908,7 @@
{
if (bcl.getBackupId().equals(id))
{
- backupSetPath = bcl.getBackupConfig().getBackupDir().getCanonicalPath();
+ backupSetPath = URLEncoder.encode(bcl.getBackupConfig().getBackupDir().getCanonicalPath(), "UTF-8");
break;
}
}
15 years
exo-jcr SVN: r4217 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: ispn and 2 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-04-07 10:58:38 -0400 (Thu, 07 Apr 2011)
New Revision: 4217
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerIoModeHandler.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1275 : Unregister stale multiIndex instance from IOmode and UpdateMonitor listeners.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerIoModeHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerIoModeHandler.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerIoModeHandler.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -90,4 +90,13 @@
{
listeners.add(listener);
}
+
+ /**
+ * Removes IndexerIoModeListener from the list of listeners
+ * @param listener
+ */
+ public void removeIndexerIoModeListener(IndexerIoModeListener listener)
+ {
+ listeners.remove(listener);
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -175,6 +175,14 @@
}
/**
+ * @see org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor#removeIndexUpdateMonitorListener(org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitorListener)
+ */
+ public void removeIndexUpdateMonitorListener(IndexUpdateMonitorListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
* Method will be invoked when a cache entry has been modified only in READ_ONLY mode.
*
* @param event
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -180,6 +180,14 @@
}
/**
+ * @see org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor#removeIndexUpdateMonitorListener(org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitorListener)
+ */
+ public void removeIndexUpdateMonitorListener(IndexUpdateMonitorListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
* Called when a node of the cache has been modified. It will be used to trigger events
* when the value of <code>updateInProgress</code> has been changed remotely
* @param event the event
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/DefaultIndexUpdateMonitor.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -76,4 +76,12 @@
listeners.add(listener);
}
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor#removeIndexUpdateMonitorListener(org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitorListener)
+ */
+ public void removeIndexUpdateMonitorListener(IndexUpdateMonitorListener listener)
+ {
+ listeners.remove(listener);
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexUpdateMonitor.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -43,4 +43,10 @@
*/
void addIndexUpdateMonitorListener(IndexUpdateMonitorListener listener);
+ /**
+ * Removes listener of type {@link IndexUpdateMonitorListener}
+ * @param listener the listener to remove
+ */
+ void removeIndexUpdateMonitorListener(IndexUpdateMonitorListener listener);
+
}
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-07 13:46:18 UTC (rev 4216)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-07 14:58:38 UTC (rev 4217)
@@ -28,9 +28,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.NodeDataIndexing;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
-import org.exoplatform.services.jcr.impl.backup.Suspendable;
import org.exoplatform.services.jcr.impl.core.query.IndexRecovery;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
@@ -1341,6 +1339,8 @@
{
log.error("Exception while closing directory.", e);
}
+ modeHandler.removeIndexerIoModeListener(this);
+ indexUpdateMonitor.removeIndexUpdateMonitorListener(this);
this.stopped = true;
}
}
15 years
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.
by do-not-reply@jboss.org
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);
15 years
exo-jcr SVN: r4215 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-04-07 03:16:39 -0400 (Thu, 07 Apr 2011)
New Revision: 4215
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1275 : Fix closing issue in MultiIndex when node is in ReadOnly mode.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-06 13:56:58 UTC (rev 4214)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-07 07:16:39 UTC (rev 4215)
@@ -467,7 +467,7 @@
.info("Index can'b be retrieved from coordinator now, because it is offline. Possibly coordinator node performs reindexing now. Switching to local re-indexing.");
}
}
-
+
if (!indexCreated)
{
if (handler.getIndexRecoveryMode().equals(SearchIndex.INDEX_RECOVERY_MODE_FROM_COORDINATOR))
@@ -1289,60 +1289,60 @@
*/
void close()
{
- if (modeHandler.getMode().equals(IndexerIoMode.READ_WRITE))
- {
- // stop index merger
- // when calling this method we must not lock this MultiIndex, otherwise
- // a deadlock might occur
- merger.dispose();
+ // stop index merger
+ // when calling this method we must not lock this MultiIndex, otherwise
+ // a deadlock might occur
+ merger.dispose();
- synchronized (this)
+ synchronized (this)
+ {
+ // stop timer
+ if (flushTask != null)
{
- // stop timer
- if (flushTask != null)
- {
- flushTask.cancel();
- }
+ flushTask.cancel();
+ }
- // commit / close indexes
+ // commit / close indexes
+ try
+ {
+ releaseMultiReader();
+ }
+ catch (IOException e)
+ {
+ log.error("Exception while closing search index.", e);
+ }
+ if (modeHandler.getMode().equals(IndexerIoMode.READ_WRITE))
+ {
try
{
- releaseMultiReader();
- }
- catch (IOException e)
- {
- log.error("Exception while closing search index.", e);
- }
- try
- {
flush();
}
catch (IOException e)
{
log.error("Exception while closing search index.", e);
}
- volatileIndex.close();
- for (int i = 0; i < indexes.size(); i++)
- {
- ((PersistentIndex)indexes.get(i)).close();
- }
+ }
+ volatileIndex.close();
+ for (int i = 0; i < indexes.size(); i++)
+ {
+ ((PersistentIndex)indexes.get(i)).close();
+ }
- // close indexing queue
- indexingQueue.close();
+ // close indexing queue
+ indexingQueue.close();
- // finally close directory
- try
- {
- indexDir.close();
- }
- catch (IOException e)
- {
- log.error("Exception while closing directory.", e);
- }
+ // finally close directory
+ try
+ {
+ indexDir.close();
}
+ catch (IOException e)
+ {
+ log.error("Exception while closing directory.", e);
+ }
+ this.stopped = true;
}
- this.stopped = true;
}
/**
15 years
exo-jcr SVN: r4214 - in jcr/trunk/exo.jcr.component.webdav/src: main/java/org/exoplatform/services/jcr/webdav/command/propfind and 4 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-04-06 09:56:58 -0400 (Wed, 06 Apr 2011)
New Revision: 4214
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java
Log:
EXOJCR-1284: fixed file names and pathes URL encoding/decoding
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -35,7 +35,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.HashSet;
import java.util.Set;
@@ -172,7 +171,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- xmlStreamWriter.writeCharacters(URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8"));
+ xmlStreamWriter.writeCharacters(resource.getIdentifier().toASCIIString());
xmlStreamWriter.writeEndElement();
PropstatGroupedRepresentation propstat = new PropstatGroupedRepresentation(resource, properties, false);
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -32,7 +32,6 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
-import java.net.URLDecoder;
import java.util.Set;
import javax.jcr.RepositoryException;
@@ -172,7 +171,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- String href = URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8");
+ String href = resource.getIdentifier().toASCIIString();
if (resource.isCollection())
{
xmlStreamWriter.writeCharacters(href + "/");
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -37,7 +37,6 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -155,7 +154,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- xmlStreamWriter.writeCharacters(URLDecoder.decode(uri.toASCIIString(), "UTF-8"));
+ xmlStreamWriter.writeCharacters(uri.toASCIIString());
xmlStreamWriter.writeEndElement();
Map<String, Set<HierarchicalProperty>> propStats = getPropStat();
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -31,9 +31,7 @@
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
-import java.io.UnsupportedEncodingException;
import java.net.URI;
-import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
@@ -428,10 +426,8 @@
writer.writeStartElement(XML_NODE);
writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
- String itemName = URLDecoder.decode(node.getName(), "UTF-8");
- writer.writeAttribute(XML_NAME, itemName);
- String itemPath = node.getPath();
- writer.writeAttribute(XML_HREF, rootHref + itemPath);
+ writer.writeAttribute(XML_NAME, node.getName());
+ writer.writeAttribute(XML_HREF, rootHref + TextUtil.escape(node.getPath(), '%', true));
// add properties
for (PropertyIterator pi = node.getProperties(); pi.hasNext();)
{
@@ -447,8 +443,8 @@
{
Node childNode = ni.nextNode();
writer.writeStartElement(XML_NODE);
- writer.writeAttribute(XML_NAME, URLDecoder.decode(childNode.getName(), "UTF-8"));
- String childNodeHref = rootHref + URLDecoder.decode(childNode.getPath(), "UTF-8");
+ writer.writeAttribute(XML_NAME, childNode.getName());
+ String childNodeHref = rootHref + TextUtil.escape(childNode.getPath(), '%', true);
writer.writeAttribute(XML_HREF, childNodeHref);
writer.writeEndElement();
}
@@ -463,10 +459,6 @@
{
LOG.error("Error has occured while xml processing : ", e);
}
- catch (UnsupportedEncodingException e)
- {
- LOG.warn(e.getMessage());
- }
finally
{
try
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -20,8 +20,6 @@
import org.exoplatform.common.util.HierarchicalProperty;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -136,21 +134,8 @@
}
writeAttributes(xmlStreamWriter, prop);
+ xmlStreamWriter.writeCharacters(prop.getValue());
- if (prop.getName().getLocalPart().equals("displayname") && containsEncodedChar(prop.getValue()))
- {
- try
- {
- xmlStreamWriter.writeCharacters(URLDecoder.decode(prop.getValue(), "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- } else {
- xmlStreamWriter.writeCharacters(prop.getValue());
- }
-
xmlStreamWriter.writeEndElement();
}
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -39,6 +39,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.net.URLDecoder;
import java.security.Principal;
import java.util.HashMap;
import java.util.HashSet;
@@ -125,6 +126,42 @@
assertEquals(HTTPStatus.MULTISTATUS, containerResponseFind.getStatus());
}
+ /**
+ * Here we test WebDAV PROPFIND method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters and 'displayname' element containing
+ * non-latin characters.
+ * @throws Exception
+ */
+ public void testSimplePropFindWithNonLatin() throws Exception
+ {
+ // prepare file name and content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+ String content = TestUtils.getFileContent();
+ TestUtils.addContent(session, decodedfileName, new ByteArrayInputStream(content.getBytes()), nt_webdave_file, "");
+ TestUtils.addNodeProperty(session, decodedfileName, authorProp, author);
+
+ ContainerResponse response =
+ service(WebDAVMethods.PROPFIND, getPathWS() + "/" + encodedfileName, "", null, allPropsXML.getBytes());
+
+ // serialize response entity to string
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ PropFindResponseEntity entity = (PropFindResponseEntity)response.getEntity();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======PropFind response==========");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertTrue(resp.contains(decodedfileName));
+ }
+
public void testPropFind() throws Exception
{
String content = TestUtils.getFileContent();
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -25,6 +25,7 @@
import org.exoplatform.services.rest.impl.ContainerResponse;
import java.io.ByteArrayOutputStream;
+import java.net.URLDecoder;
import java.util.Calendar;
import javax.jcr.Node;
@@ -159,6 +160,52 @@
}
+ /**
+ * Here we test WebDAV PROPPATCH method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters.
+ * @throws Exception
+ */
+ public void testPropPatchWithNonLatin() throws Exception
+ {
+
+ // prepare file names, content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+
+ Node node = session.getRootNode().addNode(decodedfileName, nt_webdave_file);
+ node.setProperty(authorProp, author);
+
+ node.addNode("jcr:content", "nt:resource");
+ Node content = node.getNode("jcr:content");
+ content.setProperty("jcr:mimeType", "text/xml");
+ content.setProperty("jcr:lastModified", Calendar.getInstance());
+ content.setProperty("jcr:data", "data");
+ node.addMixin("mix:lockable");
+ session.save();
+ node.lock(true, true);
+ session.save();
+
+ ContainerResponse response =
+ service(WebDAVMethods.PROPPATCH, getPathWS() + "/" + encodedfileName, "", null, patch.getBytes());
+
+ // serialize response entity to string
+ PropPatchResponseEntity entity = (PropPatchResponseEntity)response.getEntity();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======PropPatch response=========");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertFalse(resp.contains(decodedfileName));
+ }
+
// public void testPropPatch() throws Exception {
// String description = "test description property";
// String rights = "test rights property";
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java 2011-04-06 11:24:39 UTC (rev 4213)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java 2011-04-06 13:56:58 UTC (rev 4214)
@@ -28,6 +28,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.net.URLDecoder;
import javax.ws.rs.core.MediaType;
@@ -45,6 +46,9 @@
private final String fileContent = "TEST FILE CONTENT...";
+ private final String sql = "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>"
+ + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')" + "</D:sql>" + "</D:searchrequest>";
+
public void testBasicSearch() throws Exception
{
@@ -55,10 +59,6 @@
// "</D:xpath>" +
// "</D:searchrequest>";
- String sql =
- "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>" + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')"
- + "</D:sql>" + "</D:searchrequest>";
-
InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
TestUtils.addContent(session, fileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
ContainerResponse response = service(WebDAVMethods.SEARCH, getPathWS(), "", null, sql.getBytes());
@@ -70,6 +70,41 @@
assertTrue(result.contains(fileName));
}
+ /**
+ * Here we test WebDAV SEARCH method implementation for correct response
+ * if request contains encoded non-latin characters. We send a request with
+ * corresponding character sequence and expect to receive response containing
+ * 'href' element with URL encoded characters and 'displayname' element containing
+ * non-latin characters.
+ * @throws Exception
+ */
+ public void testBasicSearchWithNonLatin() throws Exception
+ {
+ // prepare file name, content
+ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
+ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
+ InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
+ TestUtils.addContent(session, decodedfileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
+
+ ContainerResponse response = service(WebDAVMethods.SEARCH, getPathWS(), "", null, sql.getBytes());
+
+ // serialize response entity to string
+ SearchResultResponseEntity entity = (SearchResultResponseEntity)response.getEntity();
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ entity.write(outputStream);
+ String resp = outputStream.toString();
+
+ System.out.println("=======Search response============");
+ System.out.println(resp);
+ System.out.println("=======Decoded file name==========");
+ System.out.println(decodedfileName);
+ System.out.println("==================================");
+
+ assertTrue(resp.contains(encodedfileName));
+ assertTrue(resp.contains(decodedfileName));
+
+ }
+
@Override
protected String getRepositoryName()
{
15 years
exo-jcr SVN: r4213 - jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1605.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-04-06 07:24:39 -0400 (Wed, 06 Apr 2011)
New Revision: 4213
Modified:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1605/JCR-1605.patch
Log:
JCR-1605: patch update
Modified: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1605/JCR-1605.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1605/JCR-1605.patch 2011-04-06 09:07:57 UTC (rev 4212)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1605/JCR-1605.patch 2011-04-06 11:24:39 UTC (rev 4213)
@@ -1,6 +1,286 @@
+Index: exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java
+===================================================================
+--- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java (revision 4209)
++++ exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropPatch.java (working copy)
+@@ -25,6 +25,7 @@
+ import org.exoplatform.services.rest.impl.ContainerResponse;
+
+ import java.io.ByteArrayOutputStream;
++import java.net.URLDecoder;
+ import java.util.Calendar;
+
+ import javax.jcr.Node;
+@@ -159,6 +160,52 @@
+
+ }
+
++ /**
++ * Here we test WebDAV PROPPATCH method implementation for correct response
++ * if request contains encoded non-latin characters. We send a request with
++ * corresponding character sequence and expect to receive response containing
++ * 'href' element with URL encoded characters.
++ * @throws Exception
++ */
++ public void testPropPatchWithNonLatin() throws Exception
++ {
++
++ // prepare file names, content
++ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
++ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
++
++ Node node = session.getRootNode().addNode(decodedfileName, nt_webdave_file);
++ node.setProperty(authorProp, author);
++
++ node.addNode("jcr:content", "nt:resource");
++ Node content = node.getNode("jcr:content");
++ content.setProperty("jcr:mimeType", "text/xml");
++ content.setProperty("jcr:lastModified", Calendar.getInstance());
++ content.setProperty("jcr:data", "data");
++ node.addMixin("mix:lockable");
++ session.save();
++ node.lock(true, true);
++ session.save();
++
++ ContainerResponse response =
++ service(WebDAVMethods.PROPPATCH, getPathWS() + "/" + encodedfileName, "", null, patch.getBytes());
++
++ // serialize response entity to string
++ PropPatchResponseEntity entity = (PropPatchResponseEntity)response.getEntity();
++ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
++ entity.write(outputStream);
++ String resp = outputStream.toString();
++
++ System.out.println("=======PropPatch response=========");
++ System.out.println(resp);
++ System.out.println("=======Decoded file name==========");
++ System.out.println(decodedfileName);
++ System.out.println("==================================");
++
++ assertTrue(resp.contains(encodedfileName));
++ assertFalse(resp.contains(decodedfileName));
++ }
++
+ // public void testPropPatch() throws Exception {
+ // String description = "test description property";
+ // String rights = "test rights property";
+Index: exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java
+===================================================================
+--- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java (revision 4209)
++++ exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPropFind.java (working copy)
+@@ -30,6 +30,7 @@
+
+ import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
++import java.net.URLDecoder;
+
+ import javax.jcr.Node;
+ import javax.ws.rs.core.HttpHeaders;
+@@ -101,6 +102,42 @@
+ assertEquals(HTTPStatus.MULTISTATUS, containerResponseFind.getStatus());
+ }
+
++ /**
++ * Here we test WebDAV PROPFIND method implementation for correct response
++ * if request contains encoded non-latin characters. We send a request with
++ * corresponding character sequence and expect to receive response containing
++ * 'href' element with URL encoded characters and 'displayname' element containing
++ * non-latin characters.
++ * @throws Exception
++ */
++ public void testSimplePropFindWithNonLatin() throws Exception
++ {
++ // prepare file name and content
++ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
++ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
++ String content = TestUtils.getFileContent();
++ TestUtils.addContent(session, decodedfileName, new ByteArrayInputStream(content.getBytes()), nt_webdave_file, "");
++ TestUtils.addNodeProperty(session, decodedfileName, authorProp, author);
++
++ ContainerResponse response =
++ service(WebDAVMethods.PROPFIND, getPathWS() + "/" + encodedfileName, "", null, allPropsXML.getBytes());
++
++ // serialize response entity to string
++ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
++ PropFindResponseEntity entity = (PropFindResponseEntity)response.getEntity();
++ entity.write(outputStream);
++ String resp = outputStream.toString();
++
++ System.out.println("=======PropFind response==========");
++ System.out.println(resp);
++ System.out.println("=======Decoded file name==========");
++ System.out.println(decodedfileName);
++ System.out.println("==================================");
++
++ assertTrue(resp.contains(encodedfileName));
++ assertTrue(resp.contains(decodedfileName));
++ }
++
+ public void testPropFind() throws Exception
+ {
+ String content = TestUtils.getFileContent();
+Index: exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java
+===================================================================
+--- exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java (revision 4209)
++++ exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestSearch.java (working copy)
+@@ -28,6 +28,7 @@
+ import java.io.ByteArrayInputStream;
+ import java.io.ByteArrayOutputStream;
+ import java.io.InputStream;
++import java.net.URLDecoder;
+
+ import javax.ws.rs.core.MediaType;
+
+@@ -45,6 +46,10 @@
+
+ private final String fileContent = "TEST FILE CONTENT...";
+
++ private final String sql = "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>"
++ + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')" + "</D:sql>" + "</D:searchrequest>";
++
++
+ public void testBasicSearch() throws Exception
+ {
+
+@@ -55,9 +60,6 @@
+ // "</D:xpath>" +
+ // "</D:searchrequest>";
+
+- String sql =
+- "<D:searchrequest xmlns:D='DAV:'>" + "<D:sql>" + "SELECT * FROM nt:resource WHERE contains(*, 'TEST')"
+- + "</D:sql>" + "</D:searchrequest>";
+
+ InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
+ TestUtils.addContent(session, fileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
+@@ -70,6 +72,41 @@
+ assertTrue(result.contains(fileName));
+ }
+
++ /**
++ * Here we test WebDAV SEARCH method implementation for correct response
++ * if request contains encoded non-latin characters. We send a request with
++ * corresponding character sequence and expect to receive response containing
++ * 'href' element with URL encoded characters and 'displayname' element containing
++ * non-latin characters.
++ * @throws Exception
++ */
++ public void testBasicSearchWithNonLatin() throws Exception
++ {
++ // prepare file name, content
++ String encodedfileName = "%e3%81%82%e3%81%84%e3%81%86%e3%81%88%e3%81%8a";
++ String decodedfileName = URLDecoder.decode(encodedfileName, "UTF-8");
++ InputStream inputStream = new ByteArrayInputStream(fileContent.getBytes());
++ TestUtils.addContent(session, decodedfileName, inputStream, defaultFileNodeType, MediaType.TEXT_PLAIN);
++
++ ContainerResponse response = service(WebDAVMethods.SEARCH, getPathWS(), "", null, sql.getBytes());
++
++ // serialize response entity to string
++ SearchResultResponseEntity entity = (SearchResultResponseEntity)response.getEntity();
++ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
++ entity.write(outputStream);
++ String resp = outputStream.toString();
++
++ System.out.println("=======Search response============");
++ System.out.println(resp);
++ System.out.println("=======Decoded file name==========");
++ System.out.println(decodedfileName);
++ System.out.println("==================================");
++
++ assertTrue(resp.contains(encodedfileName));
++ assertTrue(resp.contains(decodedfileName));
++
++ }
++
+ @Override
+ protected String getRepositoryName()
+ {
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java (revision 4209)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/xml/PropertyWriteUtil.java (working copy)
+@@ -20,8 +20,6 @@
+
+ import org.exoplatform.common.util.HierarchicalProperty;
+
+-import java.io.UnsupportedEncodingException;
+-import java.net.URLDecoder;
+ import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.Map;
+@@ -135,21 +133,8 @@
+ }
+
+ writeAttributes(xmlStreamWriter, prop);
++ xmlStreamWriter.writeCharacters(prop.getValue());
+
+- if (prop.getName().getLocalPart().equals("displayname") && containsEncodedChar(prop.getValue()))
+- {
+- try
+- {
+- xmlStreamWriter.writeCharacters(URLDecoder.decode(prop.getValue(), "UTF-8"));
+- }
+- catch (UnsupportedEncodingException e)
+- {
+- e.printStackTrace();
+- }
+- } else {
+- xmlStreamWriter.writeCharacters(prop.getValue());
+- }
+-
+ xmlStreamWriter.writeEndElement();
+ }
+ }
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java (revision 4209)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java (working copy)
+@@ -29,9 +29,7 @@
+ import java.io.InputStream;
+ import java.io.PipedInputStream;
+ import java.io.PipedOutputStream;
+-import java.io.UnsupportedEncodingException;
+ import java.net.URI;
+-import java.net.URLDecoder;
+ import java.util.ArrayList;
+ import java.util.Calendar;
+ import java.util.HashSet;
+@@ -418,10 +416,8 @@
+ writer.writeStartElement(XML_NODE);
+ writer.writeAttribute(PREFIX_XMLNS, PREFIX_LINK);
+ writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
+- String itemName = URLDecoder.decode(node.getName(), "UTF-8");
+- writer.writeAttribute(XML_NAME, itemName);
+- String itemPath = node.getPath();
+- writer.writeAttribute(XML_HREF, rootHref + itemPath);
++ writer.writeAttribute(XML_NAME, node.getName());
++ writer.writeAttribute(XML_HREF, rootHref + TextUtil.escape(node.getPath(), '%', true));
+ // add properties
+ for (PropertyIterator pi = node.getProperties(); pi.hasNext();)
+ {
+@@ -437,8 +433,8 @@
+ {
+ Node childNode = ni.nextNode();
+ writer.writeStartElement(XML_NODE);
+- writer.writeAttribute(XML_NAME, URLDecoder.decode(childNode.getName(), "UTF-8"));
+- String childNodeHref = rootHref + URLDecoder.decode(childNode.getPath(), "UTF-8");
++ writer.writeAttribute(XML_NAME, childNode.getName());
++ String childNodeHref = rootHref + TextUtil.escape(childNode.getPath(), '%', true);
+ writer.writeAttribute(XML_HREF, childNodeHref);
+ writer.writeEndElement();
+ }
+@@ -453,10 +449,6 @@
+ {
+ LOG.error("Error has occured while xml processing : ", e);
+ }
+- catch (UnsupportedEncodingException e)
+- {
+- LOG.warn(e.getMessage());
+- }
+ finally
+ {
+ try
Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java
===================================================================
---- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java (revision 4188)
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java (revision 4209)
+++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/propfind/PropFindResponseEntity.java (working copy)
@@ -32,7 +32,6 @@
import java.io.OutputStream;
@@ -10,13 +290,54 @@
import java.util.Set;
import javax.jcr.RepositoryException;
-@@ -172,7 +171,8 @@
+@@ -172,7 +171,7 @@
xmlStreamWriter.writeStartElement("DAV:", "response");
xmlStreamWriter.writeStartElement("DAV:", "href");
- String href = URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8");
+ String href = resource.getIdentifier().toASCIIString();
-+
if (resource.isCollection())
{
xmlStreamWriter.writeCharacters(href + "/");
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java (revision 4209)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/dasl/SearchResultResponseEntity.java (working copy)
+@@ -35,7 +35,6 @@
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.net.URI;
+-import java.net.URLDecoder;
+ import java.util.HashSet;
+ import java.util.Set;
+
+@@ -172,7 +171,7 @@
+ xmlStreamWriter.writeStartElement("DAV:", "response");
+
+ xmlStreamWriter.writeStartElement("DAV:", "href");
+- xmlStreamWriter.writeCharacters(URLDecoder.decode(resource.getIdentifier().toASCIIString(), "UTF-8"));
++ xmlStreamWriter.writeCharacters(resource.getIdentifier().toASCIIString());
+ xmlStreamWriter.writeEndElement();
+
+ PropstatGroupedRepresentation propstat = new PropstatGroupedRepresentation(resource, properties, false);
+Index: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java
+===================================================================
+--- exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java (revision 4209)
++++ exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java (working copy)
+@@ -37,7 +37,6 @@
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.net.URI;
+-import java.net.URLDecoder;
+ import java.util.HashMap;
+ import java.util.HashSet;
+ import java.util.List;
+@@ -155,7 +154,7 @@
+
+ xmlStreamWriter.writeStartElement("DAV:", "response");
+ xmlStreamWriter.writeStartElement("DAV:", "href");
+- xmlStreamWriter.writeCharacters(URLDecoder.decode(uri.toASCIIString(), "UTF-8"));
++ xmlStreamWriter.writeCharacters(uri.toASCIIString());
+ xmlStreamWriter.writeEndElement();
+
+ Map<String, Set<HierarchicalProperty>> propStats = getPropStat();
15 years
exo-jcr SVN: r4212 - in jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl: rdbms and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-06 05:07:57 -0400 (Wed, 06 Apr 2011)
New Revision: 4212
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
Log:
EXOJCR-1291: Components should be resumed in reverse order
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-04-06 08:07:53 UTC (rev 4211)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-04-06 09:07:57 UTC (rev 4212)
@@ -39,6 +39,7 @@
import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -116,7 +117,7 @@
for (Suspendable component : suspendableComponents)
{
component.suspend();
- resumeComponents.add(component);
+ resumeComponents.add(0, component); // ensure that first component will be resumed as last
}
}
@@ -160,16 +161,19 @@
}
// resume components
- for (int i = 0; i < resumeComponents.size(); i++)
+ Iterator<Suspendable> iter = resumeComponents.iterator();
+ while (iter.hasNext())
{
try
{
- resumeComponents.remove(i).resume();
+ iter.next().resume();
}
catch (ResumeException e)
{
log.error("Can't resume component", e);
}
+
+ iter.remove();
}
// incremental restore
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-04-06 08:07:53 UTC (rev 4211)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-04-06 09:07:57 UTC (rev 4212)
@@ -35,6 +35,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
@@ -83,7 +84,7 @@
for (Suspendable component : suspendableComponents)
{
component.suspend();
- resumeComponents.add(component);
+ resumeComponents.add(0, component); // ensure that first component will be resumed as last
}
// get all restorers
@@ -115,16 +116,19 @@
}
// resume components
- for (int i = 0; i < resumeComponents.size(); i++)
+ Iterator<Suspendable> iter = resumeComponents.iterator();
+ while (iter.hasNext())
{
try
{
- resumeComponents.remove(i).resume();
+ iter.next().resume();
}
catch (ResumeException e)
{
log.error("Can't resume component", e);
}
+
+ iter.remove();
}
// incremental restore
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java 2011-04-06 08:07:53 UTC (rev 4211)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java 2011-04-06 09:07:57 UTC (rev 4212)
@@ -130,7 +130,7 @@
for (Suspendable component : suspendableComponents)
{
component.suspend();
- resumeComponents.add(component);
+ resumeComponents.add(0, component); // ensure that first component will be resumed as last
}
List<Backupable> backupableComponents =
15 years
exo-jcr SVN: r4211 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/faq.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-06 04:07:53 -0400 (Wed, 06 Apr 2011)
New Revision: 4211
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/faq/jcr-faq.xml
Log:
EXOJCR-1290: correct using mutilingial content on MySQL
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/faq/jcr-faq.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/faq/jcr-faq.xml 2011-04-06 07:55:50 UTC (rev 4210)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/faq/jcr-faq.xml 2011-04-06 08:07:53 UTC (rev 4211)
@@ -174,10 +174,17 @@
<section>
<title>How to setup eXo JCR for mutilingial content on MySQL?</title>
- <para>MySQL database should be configured to use single-byte encoding,
- e.g. "latin1". eXo JCR application (e.g. GateIn) should use JCR
- dialect "MySQL-UTF8".</para>
+ <para>To allow multiple character sets to be sent from the client, the
+ UTF-8 encoding should be used, either by configuring utf8 as the
+ default server character set, or by configuring the JDBC driver to use
+ UTF-8 through the characterEncoding property. MySQL database should be
+ created in single-byte encoding, e.g. "latin1": </para>
+ <programlisting>CREATE DATABASE db1 CHARACTER SET latin1 COLLATE latin1_general_cs;</programlisting>
+
+ <para>eXo JCR application (e.g. GateIn) should use JCR dialect
+ "MySQL-UTF8".</para>
+
<para>In other words: MySQL database default encoding and JCR dialect
cannot be UTF8 both. Use single-byte encoding (e.g. "latin1") for
database and "mysql-utf8" dialect for eXo JCR.</para>
@@ -453,7 +460,7 @@
<itemizedlist>
<listitem>
- <para> Remote sites can be visualized as different buildings
+ <para>Remote sites can be visualized as different buildings
seperated by a WAN network.</para>
</listitem>
</itemizedlist>
15 years