exo-jcr SVN: r5577 - jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-07 10:45:59 -0500 (Tue, 07 Feb 2012)
New Revision: 5577
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
Log:
EXOJCR-1713: remove parallel text extractions
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2012-02-07 15:18:44 UTC (rev 5576)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2012-02-07 15:45:59 UTC (rev 5577)
@@ -163,56 +163,43 @@
void addDocuments(final Document[] docs) throws IOException
{
final IndexWriter writer = getIndexWriter();
- DynamicPooledExecutor.Command[] commands = new DynamicPooledExecutor.Command[docs.length];
- for (int i = 0; i < docs.length; i++)
+
+ IOException ioExc = null;
+ try
{
- final Document doc = docs[i];
- // create a command for inverting the document
- commands[i] = new DynamicPooledExecutor.Command()
+ for (Document doc : docs)
{
- public Object call() throws Exception
+ try
{
- long time = System.currentTimeMillis();
writer.addDocument(doc);
- return new Long(System.currentTimeMillis() - time);
}
- };
- }
- DynamicPooledExecutor.Result[] results = EXECUTOR.executeAndWait(commands);
- invalidateSharedReader();
- IOException ex = null;
- for (int i = 0; i < results.length; i++)
- {
- if (results[i].getException() != null)
- {
- Throwable cause = results[i].getException().getCause();
- if (ex == null)
+ catch (Throwable e)
{
- // only throw the first exception
- if (cause instanceof IOException)
+ if (ioExc == null)
{
- ex = (IOException)cause;
+ if (e instanceof IOException)
+ {
+ ioExc = (IOException)e;
+ }
+ else
+ {
+ ioExc = Util.createIOException(e);
+ }
}
- else
- {
- throw Util.createIOException(cause);
- }
+
+ log.warn("Exception while inverting document", e);
}
- else
- {
- // all others are logged
- log.warn("Exception while inverting document", cause);
- }
}
- else
- {
- log.debug("Inverted document in {} ms", results[i].get());
- }
}
- if (ex != null)
+ finally
{
- throw ex;
+ invalidateSharedReader();
}
+
+ if (ioExc != null)
+ {
+ throw ioExc;
+ }
}
/**
12 years, 4 months
exo-jcr SVN: r5576 - jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-02-07 10:18:44 -0500 (Tue, 07 Feb 2012)
New Revision: 5576
Modified:
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
Log:
EXOJCR-1753: Infinispan-based replication doesn't work in clustered environment
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java 2012-02-07 15:18:14 UTC (rev 5575)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java 2012-02-07 15:18:44 UTC (rev 5576)
@@ -37,7 +37,7 @@
{
private String wsId;
- ChangesKey()
+ public ChangesKey()
{
super();
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java 2012-02-07 15:18:14 UTC (rev 5575)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java 2012-02-07 15:18:44 UTC (rev 5576)
@@ -30,7 +30,7 @@
*/
public class IndexInfosKey extends CacheKey
{
- IndexInfosKey()
+ public IndexInfosKey()
{
super();
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java 2012-02-07 15:18:14 UTC (rev 5575)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java 2012-02-07 15:18:44 UTC (rev 5576)
@@ -31,7 +31,7 @@
public class IndexUpdateKey extends CacheKey
{
- IndexUpdateKey()
+ public IndexUpdateKey()
{
super();
}
12 years, 4 months
exo-jcr SVN: r5575 - jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-02-07 10:18:14 -0500 (Tue, 07 Feb 2012)
New Revision: 5575
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
Log:
EXOJCR-1740: added some exclusions for testing purposes
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 15:08:36 UTC (rev 5574)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 15:18:14 UTC (rev 5575)
@@ -29,15 +29,16 @@
org.exoplatform.services.jcr.impl.storage.value.fs.TestRemoveFromValueStorage.testRemoveValue=read,getFile
org.exoplatform.services.jcr.impl.TestRepositoryCheckController.testIndexUsecaseMultipleDocuments=onSaveItems
org.exoplatform.services.jcr.impl.TestRepositoryCheckController.testIndexUsecaseDocumentNotExists=onSaveItems
-org.exoplatform.services.jcr.cluster.functional.WebdavRemoveNodeTest.testRemoveNode=addNode,getStatusCode
-org.exoplatform.services.jcr.cluster.functional.WebdavAddBLOBTest.testAddBLOB=getStatusCode,close
-org.exoplatform.services.jcr.cluster.functional.WebdavAddNodeTest.testAddNode=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavLockNodeTest.testLock=addDir
-org.exoplatform.services.jcr.cluster.functional.WebdavMoveNodeTest.testMoveNode=addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavRemoveNodeTest.testRemoveNode=addNode,getStatusCode,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavAddBLOBTest.testAddBLOB=getStatusCode,close,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavAddNodeTest.testAddNode=addNode,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavLockNodeTest.testLock=addDir,removeNode,addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavMoveNodeTest.testMoveNode=addNode,getNode,moveNode
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testFullTextSearch=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPathSearch=addDir
+org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPathSearch=addDir,addNode
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPropertyValueSearch=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.assertQuery=sqlQuery,xpathQuery
org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressEmptyDirectory=compressDirectory
org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressDirectory=compressDirectory,uncompressDirectory
org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressFile=compressDirectory,uncompressDirectory
12 years, 4 months
exo-jcr SVN: r5574 - jcr/trunk/exo.jcr.component.core/src/test/resources.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-02-07 10:08:36 -0500 (Tue, 07 Feb 2012)
New Revision: 5574
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
Log:
EXOJCR-1740: added some exclusions for testing purposes
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 12:12:58 UTC (rev 5573)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 15:08:36 UTC (rev 5574)
@@ -29,12 +29,13 @@
org.exoplatform.services.jcr.impl.storage.value.fs.TestRemoveFromValueStorage.testRemoveValue=read,getFile
org.exoplatform.services.jcr.impl.TestRepositoryCheckController.testIndexUsecaseMultipleDocuments=onSaveItems
org.exoplatform.services.jcr.impl.TestRepositoryCheckController.testIndexUsecaseDocumentNotExists=onSaveItems
-org.exoplatform.services.jcr.cluster.functional.WebdavRemoveNodeTest.testRemoveNode=addNode,getStatusCode
-org.exoplatform.services.jcr.cluster.functional.WebdavAddBLOBTest.testAddBLOB=getStatusCode,close
-org.exoplatform.services.jcr.cluster.functional.WebdavAddNodeTest.testAddNode=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavLockNodeTest.testLock=addDir
-org.exoplatform.services.jcr.cluster.functional.WebdavMoveNodeTest.testMoveNode=addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavRemoveNodeTest.testRemoveNode=addNode,getStatusCode,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavAddBLOBTest.testAddBLOB=getStatusCode,close,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavAddNodeTest.testAddNode=addNode,getNode
+org.exoplatform.services.jcr.cluster.functional.WebdavLockNodeTest.testLock=addDir,removeNode,addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavMoveNodeTest.testMoveNode=addNode,getNode,moveNode
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testFullTextSearch=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPathSearch=addDir
+org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPathSearch=addDir,addNode
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPropertyValueSearch=addNode
-org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode
+org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.assertQuery=sqlQuery,xpathQuery
+org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode,getNode
12 years, 4 months
exo-jcr SVN: r5573 - in jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: util/io and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-07 07:12:58 -0500 (Tue, 07 Feb 2012)
New Revision: 5573
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
Log:
EXOJCR-1576: add special method with deleting destination file
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-07 10:35:56 UTC (rev 5572)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-07 12:12:58 UTC (rev 5573)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.config;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
@@ -184,7 +184,7 @@
{
public Void run() throws IOException
{
- DirectoryHelper.renameFile(sourceConfig, backUp);
+ DirectoryHelper.deleteDstAndRename(sourceConfig, backUp);
return null;
}
});
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-07 10:35:56 UTC (rev 5572)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-07 12:12:58 UTC (rev 5573)
@@ -354,6 +354,31 @@
}
/**
+ * Rename file. Trying to remove destination first.
+ * If file can't be renamed in standard way the coping
+ * data will be used instead.
+ *
+ * @param srcFile
+ * source file
+ * @param dstFile
+ * destination file
+ * @throws IOException
+ * if any exception occurred
+ */
+ public static void deleteDstAndRename(File srcFile, File dstFile) throws IOException
+ {
+ if (dstFile.exists())
+ {
+ if (!dstFile.delete())
+ {
+ throw new IOException("Cannot delete " + dstFile);
+ }
+ }
+
+ renameFile(srcFile, dstFile);
+ }
+
+ /**
* Rename file. If file can't be renamed in standard way the coping
* data will be used instead.
*
12 years, 4 months
exo-jcr SVN: r5572 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config and 8 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-07 05:35:56 -0500 (Tue, 07 Feb 2012)
New Revision: 5572
Added:
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml
Log:
EXOJCR-1576: Adapted eXo JCR to GlusterFS
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -16,8 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.backup.rdbms;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@@ -96,27 +97,35 @@
*/
public void clean() throws BackupException
{
- for (int i = 0; i < dataDirs.size(); i++)
+ try
{
- File dataDir = dataDirs.get(i);
-
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File tmpDir = new File(tempDir, PREFIX + IdGenerator.generate());
- PrivilegedFileHelper.mkdirs(tmpDir);
- tmpDirs.add(tmpDir);
+ public Void run() throws IOException
+ {
+ for (int i = 0; i < dataDirs.size(); i++)
+ {
+ File dataDir = dataDirs.get(i);
- if (PrivilegedFileHelper.exists(dataDir))
- {
- DirectoryHelper.copyDirectory(dataDir, tmpDir);
- DirectoryHelper.removeDirectory(dataDir);
+ File tmpDir = new File(tempDir, PREFIX + IdGenerator.generate());
+ tmpDir.mkdirs();
+ tmpDirs.add(tmpDir);
+
+ if (dataDir.exists())
+ {
+ DirectoryHelper.copyDirectory(dataDir, tmpDir);
+ DirectoryHelper.removeDirectory(dataDir);
+ }
+ }
+
+ return null;
}
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -124,27 +133,37 @@
*/
public void restore() throws BackupException
{
- for (int i = 0; i < zipFiles.size(); i++)
+ try
{
- File zipFile = zipFiles.get(i);
- File dataDir = dataDirs.get(i);
-
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- if (PrivilegedFileHelper.isDirectory(zipFile))
+ public Void run() throws IOException
{
- DirectoryHelper.uncompressEveryFileFromDirectory(zipFile, dataDir);
+
+ for (int i = 0; i < zipFiles.size(); i++)
+ {
+ File zipFile = zipFiles.get(i);
+ File dataDir = dataDirs.get(i);
+
+ if (zipFile.isDirectory())
+ {
+ DirectoryHelper.uncompressEveryFileFromDirectory(zipFile, dataDir);
+ }
+ else
+ {
+ DirectoryHelper.uncompressDirectory(zipFile, dataDir);
+ }
+ }
+
+ return null;
}
- else
- {
- DirectoryHelper.uncompressDirectory(zipFile, dataDir);
- }
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
+
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -159,25 +178,33 @@
*/
public void rollback() throws BackupException
{
- for (int i = 0; i < tmpDirs.size(); i++)
+ try
{
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File tmpDir = tmpDirs.get(i);
- File dataDir = dataDirs.get(i);
+ public Void run() throws IOException
+ {
+ for (int i = 0; i < tmpDirs.size(); i++)
+ {
+ File tmpDir = tmpDirs.get(i);
+ File dataDir = dataDirs.get(i);
- if (PrivilegedFileHelper.exists(dataDir))
- {
- DirectoryHelper.removeDirectory(dataDir);
+ if (dataDir.exists())
+ {
+ DirectoryHelper.removeDirectory(dataDir);
+ }
+
+ DirectoryHelper.copyDirectory(tmpDir, dataDir);
+ }
+
+ return null;
}
-
- DirectoryHelper.copyDirectory(tmpDir, dataDir);
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -185,17 +212,25 @@
*/
public void close() throws BackupException
{
- for (File tmpDir : tmpDirs)
+ try
{
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- DirectoryHelper.removeDirectory(tmpDir);
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ public Void run() throws IOException
+ {
+ for (File tmpDir : tmpDirs)
+ {
+ DirectoryHelper.removeDirectory(tmpDir);
+ }
+
+ return null;
+ }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
dataDirs.clear();
zipFiles.clear();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -174,17 +174,25 @@
else
{
URL filePath = configurationService.getURL(param.getValue());
- File sourceConfig = new File(filePath.toURI());
+ final File sourceConfig = new File(filePath.toURI());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
- File backUp = new File(sourceConfig.getAbsoluteFile() + "_" + format.format(new Date()));
+ final File backUp = new File(sourceConfig.getAbsoluteFile() + "_" + format.format(new Date()));
+
try
{
- DirectoryHelper.renameFile(sourceConfig, backUp);
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ DirectoryHelper.renameFile(sourceConfig, backUp);
+ return null;
+ }
+ });
}
catch (IOException ioe)
{
throw new RepositoryException("Can't back up configuration on path "
- + PrivilegedFileHelper.getAbsolutePath(sourceConfig), ioe);
+ + PrivilegedFileHelper.getAbsolutePath(sourceConfig), ioe);
}
saveStream = PrivilegedFileHelper.fileOutputStream(sourceConfig);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -16,7 +16,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.core.query.lucene.OfflinePersistentIndex;
import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
@@ -33,6 +33,7 @@
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@@ -140,21 +141,27 @@
public Serializable execute(Serializable[] args) throws Throwable
{
- int indexDirLen = PrivilegedFileHelper.getAbsolutePath(indexDirectory).length();
-
- ArrayList<String> result = new ArrayList<String>();
- for (File file : DirectoryHelper.listFiles(indexDirectory))
+ return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<ArrayList<String>>()
{
- if (!file.isDirectory())
+ public ArrayList<String> run() throws IOException
{
- // if parent directory is not "offline" then add this file. Otherwise skip it.
- if (!file.getParent().endsWith(OfflinePersistentIndex.NAME))
+ int indexDirLen = indexDirectory.getAbsolutePath().length();
+
+ ArrayList<String> result = new ArrayList<String>();
+ for (File file : DirectoryHelper.listFiles(indexDirectory))
{
- result.add(PrivilegedFileHelper.getAbsolutePath(file).substring(indexDirLen));
+ if (!file.isDirectory())
+ {
+ // if parent directory is not "offline" then add this file. Otherwise skip it.
+ if (!file.getParent().endsWith(OfflinePersistentIndex.NAME))
+ {
+ result.add(file.getAbsolutePath().substring(indexDirLen));
+ }
+ }
}
+ return result;
}
- }
- return result;
+ });
}
});
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -21,9 +21,9 @@
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.WildcardQuery;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.management.annotations.Managed;
@@ -1623,7 +1623,17 @@
{
try
{
- DirectoryHelper.removeDirectory(getIndexDirectory());
+ final File indexDir = getIndexDirectory();
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ DirectoryHelper.removeDirectory(indexDir);
+
+ return null;
+ }
+ });
}
catch (IOException e)
{
@@ -1638,22 +1648,30 @@
/**
* {@inheritDoc}}
*/
- public void backup(File storageDir) throws BackupException
+ public void backup(final File storageDir) throws BackupException
{
try
{
- File indexDir = getIndexDirectory();
+ final File indexDir = getIndexDirectory();
- if (!PrivilegedFileHelper.exists(indexDir))
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- throw new BackupException("Can't backup index. Directory "
- + PrivilegedFileHelper.getCanonicalPath(indexDir) + " doesn't exists");
- }
- else
- {
- File destZip = new File(storageDir, getStorageName() + ".zip");
- DirectoryHelper.compressDirectory(indexDir, destZip);
- }
+ public Void run() throws IOException
+ {
+ if (!indexDir.exists())
+ {
+ throw new IOException("Can't backup index. Directory " + indexDir.getCanonicalPath()
+ + " doesn't exists");
+ }
+ else
+ {
+ File destZip = new File(storageDir, getStorageName() + ".zip");
+ DirectoryHelper.compressDirectory(indexDir, destZip);
+ }
+
+ return null;
+ }
+ });
}
catch (RepositoryConfigurationException e)
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
+import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
import java.io.File;
import java.io.FileFilter;
@@ -221,15 +222,27 @@
*/
public boolean rename(final String from, final String to)
{
- return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
+ final File src = new File(baseDir, from);
+ final File dest = new File(baseDir, to);
+
+ try
{
- public Boolean run()
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File src = new File(baseDir, from);
- File dest = new File(baseDir, to);
- return src.renameTo(dest);
- }
- });
+ public Void run() throws IOException
+ {
+ DirectoryHelper.renameFile(src, dest);
+
+ return null;
+ }
+ });
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ return true;
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -110,8 +110,8 @@
/**
* Indicates if the statistics has to be enabled.
*/
- public static final boolean STATISTICS_ENABLED =
- Boolean.valueOf(PrivilegedSystemHelper.getProperty("JDBCWorkspaceDataContainer.statistics.enabled"));
+ public static final boolean STATISTICS_ENABLED = Boolean.valueOf(PrivilegedSystemHelper
+ .getProperty("JDBCWorkspaceDataContainer.statistics.enabled"));
static
{
@@ -486,8 +486,8 @@
// by default
if (dbSourceName != null)
{
- return new GenericConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ return new GenericConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
}
return new GenericConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
@@ -537,8 +537,8 @@
}
// MULTIDB
- if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
- wsConfig.getContainer().getParameterValue(MULTIDB)))
+ if (!wsEntry.getContainer().getParameterValue(MULTIDB)
+ .equals(wsConfig.getContainer().getParameterValue(MULTIDB)))
{
throw new RepositoryConfigurationException("All workspaces must be " + MULTIDB + " or " + SINGLEDB
+ ". But " + wsEntry.getName() + "- multi-db=" + wsEntry.getContainer().getParameterValue(MULTIDB)
@@ -667,14 +667,14 @@
this.connFactory = defaultConnectionFactory();
dbInitializer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8 ||
- dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8
+ || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
if (dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only" +
- " if you don't expect any support and performances in read accesses are more important than the consistency" +
- " in your use-case. This dialect is only dedicated to the community.");
+ LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
+ + " if you don't expect any support and performances in read accesses are more important than the consistency"
+ + " in your use-case. This dialect is only dedicated to the community.");
}
if (dbSourceName != null)
{
@@ -728,8 +728,8 @@
if (dbSourceName != null)
{
this.connFactory =
- new HSQLDBConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ new HSQLDBConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
}
else
{
@@ -1036,11 +1036,20 @@
{
for (ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
{
- File valueStorageDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
- if (PrivilegedFileHelper.exists(valueStorageDir))
+ final File valueStorageDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- DirectoryHelper.removeDirectory(valueStorageDir);
- }
+ public Void run() throws IOException
+ {
+ if (valueStorageDir.exists())
+ {
+ DirectoryHelper.removeDirectory(valueStorageDir);
+ }
+
+ return null;
+ }
+ });
}
}
}
@@ -1061,7 +1070,7 @@
/**
* {@inheritDoc}
*/
- public void backup(File storageDir) throws BackupException
+ public void backup(final File storageDir) throws BackupException
{
ObjectWriter backupInfo = null;
@@ -1102,19 +1111,28 @@
// backup value storage
if (wsConfig.getContainer().getValueStorages() != null)
{
- for (ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
+ for (final ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
{
- File srcDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
- if (!PrivilegedFileHelper.exists(srcDir))
+ final File srcDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- throw new BackupException("Can't backup value storage. Directory " + srcDir.getName()
- + " doesn't exists");
- }
- else
- {
- File zipFile = new File(storageDir, "values-" + valueStorage.getId() + ".zip");
- DirectoryHelper.compressDirectory(srcDir, zipFile);
- }
+ public Void run() throws IOException
+ {
+ if (!srcDir.exists())
+ {
+ throw new IOException("Can't backup value storage. Directory " + srcDir.getName()
+ + " doesn't exists");
+ }
+ else
+ {
+ File zipFile = new File(storageDir, "values-" + valueStorage.getId() + ".zip");
+ DirectoryHelper.compressDirectory(srcDir, zipFile);
+ }
+
+ return null;
+ }
+ });
}
}
}
@@ -1157,7 +1175,7 @@
ObjectReader backupInfo = null;
try
{
- File storageDir = (File) context.getObject(DataRestoreContext.STORAGE_DIR);
+ File storageDir = (File)context.getObject(DataRestoreContext.STORAGE_DIR);
Connection jdbcConn = null;
if (context.getObject(DataRestoreContext.DB_CONNECTION) == null)
@@ -1179,11 +1197,11 @@
}
else
{
- jdbcConn = (Connection) context.getObject(DataRestoreContext.DB_CONNECTION);
+ jdbcConn = (Connection)context.getObject(DataRestoreContext.DB_CONNECTION);
}
backupInfo =
- new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
+ new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
"JDBCWorkspaceDataContainer.info")));
String srcContainerName = backupInfo.readString();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
import org.exoplatform.services.jcr.impl.storage.value.fs.CASableIOSupport;
import org.exoplatform.services.jcr.impl.storage.value.fs.FileDigestOutputStream;
+import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.util.IdGenerator;
@@ -175,11 +176,16 @@
// make sure parent dir exists
vcasFile.getParentFile().mkdirs();
+
// rename propetynamed file to hashnamed one
- if (!tempFile.renameTo(vcasFile))
+ try
{
+ DirectoryHelper.renameFile(tempFile, vcasFile);
+ }
+ catch (IOException e)
+ {
throw new VCASException("File " + tempFile.getAbsolutePath() + " can't be renamed to VCAS-named "
- + vcasFile.getAbsolutePath());
+ + vcasFile.getAbsolutePath(), e);
}
} // else - CASed Value already exists
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-07 10:35:56 UTC (rev 5572)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -56,12 +56,12 @@
{
List<File> result = new ArrayList<File>();
- if (!PrivilegedFileHelper.isDirectory(srcPath))
+ if (!srcPath.isDirectory())
{
- throw new IOException(PrivilegedFileHelper.getAbsolutePath(srcPath) + " is a directory");
+ throw new IOException(srcPath.getAbsolutePath() + " is a directory");
}
- for (File subFile : PrivilegedFileHelper.listFiles(srcPath))
+ for (File subFile : srcPath.listFiles())
{
result.add(subFile);
if (subFile.isDirectory())
@@ -85,14 +85,14 @@
*/
public static void copyDirectory(File srcPath, File dstPath) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
- if (!PrivilegedFileHelper.exists(dstPath))
+ if (!dstPath.exists())
{
- PrivilegedFileHelper.mkdirs(dstPath);
+ dstPath.mkdirs();
}
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
copyDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
@@ -105,8 +105,8 @@
try
{
- in = PrivilegedFileHelper.fileInputStream(srcPath);
- out = PrivilegedFileHelper.fileOutputStream(dstPath);
+ in = new FileInputStream(srcPath);
+ out = new FileOutputStream(dstPath);
transfer(in, out);
}
@@ -136,23 +136,23 @@
*/
public static void removeDirectory(File dir) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(dir))
+ if (dir.isDirectory())
{
- for (File subFile : PrivilegedFileHelper.listFiles(dir))
+ for (File subFile : dir.listFiles())
{
removeDirectory(subFile);
}
- if (!PrivilegedFileHelper.delete(dir))
+ if (!dir.delete())
{
- throw new IOException("Can't remove folder : " + PrivilegedFileHelper.getCanonicalPath(dir));
+ throw new IOException("Can't remove folder : " + dir.getCanonicalPath());
}
}
else
{
- if (!PrivilegedFileHelper.delete(dir))
+ if (!dir.delete())
{
- throw new IOException("Can't remove file : " + PrivilegedFileHelper.getCanonicalPath(dir));
+ throw new IOException("Can't remove file : " + dir.getCanonicalPath());
}
}
}
@@ -172,12 +172,12 @@
*/
public static void compressDirectory(File rootPath, File dstZipPath) throws IOException
{
- ZipOutputStream zip = PrivilegedFileHelper.zipOutputStream(dstZipPath);
+ ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(dstZipPath));
try
{
- if (PrivilegedFileHelper.isDirectory(rootPath))
+ if (rootPath.isDirectory())
{
- String files[] = PrivilegedFileHelper.list(rootPath);
+ String files[] = rootPath.list();
for (int i = 0; i < files.length; i++)
{
compressDirectory("", new File(rootPath, files[i]), zip);
@@ -203,12 +203,12 @@
*/
private static void compressDirectory(String relativePath, File srcPath, ZipOutputStream zip) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
zip.putNextEntry(new ZipEntry(relativePath + "/" + srcPath.getName() + "/"));
zip.closeEntry();
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
compressDirectory(relativePath + "/" + srcPath.getName(), new File(srcPath, files[i]), zip);
@@ -216,7 +216,7 @@
}
else
{
- InputStream in = PrivilegedFileHelper.fileInputStream(srcPath);
+ InputStream in = new FileInputStream(srcPath);
try
{
zip.putNextEntry(new ZipEntry(relativePath + "/" + srcPath.getName()));
@@ -247,7 +247,7 @@
*/
public static void uncompressDirectory(File srcZipPath, File dstDirPath) throws IOException
{
- ZipInputStream in = PrivilegedFileHelper.zipInputStream(srcZipPath);
+ ZipInputStream in = new ZipInputStream(new FileInputStream(srcZipPath));
ZipEntry entry = null;
try
@@ -255,15 +255,15 @@
while ((entry = in.getNextEntry()) != null)
{
File dstFile = new File(dstDirPath, entry.getName());
- PrivilegedFileHelper.mkdirs(dstFile.getParentFile());
+ dstFile.getParentFile().mkdirs();
if (entry.isDirectory())
{
- PrivilegedFileHelper.mkdirs(dstFile);
+ dstFile.mkdirs();
}
else
{
- OutputStream out = PrivilegedFileHelper.fileOutputStream(dstFile);
+ OutputStream out = new FileOutputStream(dstFile);
try
{
transfer(in, out);
@@ -296,14 +296,14 @@
*/
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
- if (!PrivilegedFileHelper.exists(dstPath))
+ if (!dstPath.exists())
{
- PrivilegedFileHelper.mkdirs(dstPath);
+ dstPath.mkdirs();
}
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
@@ -316,10 +316,10 @@
try
{
- in = PrivilegedFileHelper.zipInputStream(srcPath);
+ in = new ZipInputStream(new FileInputStream(srcPath));
in.getNextEntry();
- out = PrivilegedFileHelper.fileOutputStream(dstPath);
+ out = new FileOutputStream(dstPath);
transfer(in, out);
}
@@ -354,7 +354,8 @@
}
/**
- * Rename file.
+ * Rename file. If file can't be renamed in standard way the coping
+ * data will be used instead.
*
* @param srcFile
* source file
@@ -363,34 +364,21 @@
* @throws IOException
* if any exception occurred
*/
- public static synchronized void renameFile(File srcFile, File dstFile) throws IOException
+ public static void renameFile(File srcFile, File dstFile) throws IOException
{
- /* This is not atomic. If the program crashes between the call to
- delete() and the call to renameTo() then we're screwed, but I've
- been unable to figure out how else to do this... */
-
- if (PrivilegedFileHelper.exists(dstFile))
- if (!PrivilegedFileHelper.delete(dstFile))
- throw new IOException("Cannot delete " + dstFile);
-
// Rename the srcFile file to the new one. Unfortunately, the renameTo()
// method does not work reliably under some JVMs. Therefore, if the
// rename fails, we manually rename by copying the srcFile file to the new one
- if (!PrivilegedFileHelper.renameTo(srcFile, dstFile))
+ if (!srcFile.renameTo(dstFile))
{
InputStream in = null;
OutputStream out = null;
try
{
- in = PrivilegedFileHelper.fileInputStream(srcFile);
- out = PrivilegedFileHelper.fileOutputStream(dstFile);
- // see if the buffer needs to be initialized. Initialization is
- // only done on-demand since many VM's will never run into the renameTo
- // bug and hence shouldn't waste 1K of mem for no reason.
- transfer(in, out);
+ in = new FileInputStream(srcFile);
+ out = new FileOutputStream(dstFile);
- // delete the srcFile file.
- PrivilegedFileHelper.delete(srcFile);
+ transfer(in, out);
}
catch (IOException ioe)
{
@@ -410,6 +398,9 @@
out.close();
}
}
+
+ // delete the srcFile file.
+ srcFile.delete();
}
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-07 10:35:56 UTC (rev 5572)
@@ -38,3 +38,6 @@
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPathSearch=addDir
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPropertyValueSearch=addNode
org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressEmptyDirectory=compressDirectory
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressDirectory=compressDirectory,uncompressDirectory
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressFile=compressDirectory,uncompressDirectory
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml 2012-02-07 08:05:23 UTC (rev 5571)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml 2012-02-07 10:35:56 UTC (rev 5572)
@@ -160,6 +160,7 @@
<include>**/*.xls</include>
<include>**/*.groovy</include>
<include>**/login.conf</include>
+ <include>**/tsm-excludes.properties</include>
</includes>
</testResource>
</testResources>
Added: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties 2012-02-07 10:35:56 UTC (rev 5572)
@@ -0,0 +1,2 @@
+org.exoplatform.services.jcr.ext.backup.AbstractBackupTestCase.removeRepositoryFully=removeDirectory
+org.exoplatform.services.jcr.ext.backup.AbstractBackupTestCase.removeWorkspaceFully=removeDirectory
12 years, 4 months
exo-jcr SVN: r5571 - in jcr/trunk/exo.jcr.component.ext/src: test/java/org/exoplatform/services/jcr/ext/registry and 1 other directory.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-07 03:05:23 -0500 (Tue, 07 Feb 2012)
New Revision: 5571
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java
Log:
EXOJCR-1746: Removed Deprecated methods from RestRegistryService
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java 2012-02-06 13:36:29 UTC (rev 5570)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryService.java 2012-02-07 08:05:23 UTC (rev 5571)
@@ -93,98 +93,6 @@
@GET
@Produces(MediaType.APPLICATION_XML)
- @Path("/{repository}/")
- @Deprecated
- public Response getRegistry(@PathParam("repository") String repository, @Context UriInfo uriInfo)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return getRegistry(uriInfo);
- }
- catch (Exception e)
- {
- log.error("Get registry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @GET
- @Path("/{repository}/{entryPath:.+}/")
- @Produces(MediaType.APPLICATION_XML)
- @Deprecated
- public Response getEntry(@PathParam("repository") String repository, @PathParam("entryPath") String entryPath)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return getEntry(entryPath);
- }
- catch (Exception e)
- {
- log.error("Get registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @POST
- @Path("/{repository}/{groupName:.+}/")
- @Consumes(MediaType.APPLICATION_XML)
- @Deprecated
- public Response createEntry(InputStream entryStream, @PathParam("repository") String repository,
- @PathParam("groupName") String groupName, @Context UriInfo uriInfo)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return createEntry(entryStream, groupName, uriInfo);
- }
- catch (Exception e)
- {
- log.error("Create registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @PUT
- @Path("/{repository}/{groupName:.+}/")
- @Consumes(MediaType.APPLICATION_XML)
- @Deprecated
- public Response recreateEntry(InputStream entryStream, @PathParam("repository") String repository,
- @PathParam("groupName") String groupName, @Context UriInfo uriInfo,
- @QueryParam("createIfNotExist") boolean createIfNotExist)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return recreateEntry(entryStream, groupName, uriInfo, createIfNotExist);
- }
- catch (Exception e)
- {
- log.error("Re-create registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @DELETE
- @Path("/{repository}/{entryPath:.+}/")
- @Deprecated
- public Response removeEntry(@PathParam("repository") String repository, @PathParam("entryPath") String entryPath)
- {
- try
- {
- regService.getRepositoryService().setCurrentRepositoryName(repository);
- return removeEntry(entryPath);
- }
- catch (Exception e)
- {
- log.error("Remove registry entry failed", e);
- throw new WebApplicationException(e);
- }
- }
-
- @GET
- @Produces(MediaType.APPLICATION_XML)
public Response getRegistry(@Context UriInfo uriInfo)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java 2012-02-06 13:36:29 UTC (rev 5570)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/registry/RESTRegistryTest.java 2012-02-07 08:05:23 UTC (rev 5571)
@@ -90,8 +90,9 @@
log.info("-----REST-----");
+ repositoryService.setCurrentRepositoryName("db1");
DummyContainerResponseWriter wr = new DummyContainerResponseWriter();
- URI reqUri = new URI(baseUri.toString() + "/registry/db1/");
+ URI reqUri = new URI(baseUri.toString() + "/registry/");
ContainerResponse cres =
request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
@@ -100,14 +101,14 @@
// request to exo:services/exo_service
// response status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
// create exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES);
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES);
cres =
request(handler, wr, "POST", reqUri, baseUri, SERVICE_XML.getBytes(), new InputHeadersMap(
new MultivaluedMapImpl()));
@@ -116,14 +117,14 @@
// request to exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
log.info(new String(wr.getBody()));
// recreate exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES);
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES);
cres =
request(handler, wr, "PUT", reqUri, baseUri, SERVICE_XML.getBytes(), new InputHeadersMap(
new MultivaluedMapImpl()));
@@ -132,14 +133,14 @@
// delete exo:services/exo_service
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "DELETE", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(204, cres.getStatus());
// request to exo:services/exo_service
// request status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/exo_service");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/exo_service");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
@@ -153,40 +154,43 @@
ByteArrayOutputStream out = new ByteArrayOutputStream();
int rd = -1;
while ((rd = in.read()) != -1)
+ {
out.write(rd);
+ }
byte[] data = out.toByteArray();
+ repositoryService.setCurrentRepositoryName("db1");
// check for exo:services/group/test
// response status should be 404 (NOT_FOUND)
- URI reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/group/test");
+ URI reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/group/test");
ContainerResponse cres =
request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
// create exo:services/group/test
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/group/");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/group/");
cres = request(handler, wr, "POST", reqUri, baseUri, data, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(201, cres.getStatus());
assertEquals(new URI(reqUri + "test"), wr.getHeaders().getFirst(HttpHeaders.LOCATION));
// check again for exo:services/group/test
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/group/test");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/group/test");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(200, cres.getStatus());
log.info(new String(wr.getBody()));
// remove
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/group/");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/group/");
cres = request(handler, wr, "DELETE", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(204, cres.getStatus());
// check for exo:services/group/test
// response status should be 404 (NOT_FOUND)
wr.reset();
- reqUri = new URI(baseUri.toString() + "/registry/db1/" + RegistryService.EXO_SERVICES + "/group/test");
+ reqUri = new URI(baseUri.toString() + "/registry/" + RegistryService.EXO_SERVICES + "/group/test");
cres = request(handler, wr, "GET", reqUri, baseUri, null, new InputHeadersMap(new MultivaluedMapImpl()));
assertEquals(404, cres.getStatus());
assertNull(wr.getBody());
12 years, 4 months
exo-jcr SVN: r5570 - in jcr/branches/1.15.x: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command and 3 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-02-06 08:36:29 -0500 (Mon, 06 Feb 2012)
New Revision: 5570
Modified:
jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
Log:
EXOJCR-1750: changes reverted
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-02-06 13:18:56 UTC (rev 5569)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-02-06 13:36:29 UTC (rev 5570)
@@ -23,7 +23,6 @@
import org.exoplatform.commons.utils.MimeTypeResolver;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.container.xml.ValuesParam;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.app.ThreadLocalSessionProviderService;
@@ -79,10 +78,8 @@
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
@@ -146,20 +143,12 @@
public static final String FOLDER_ICON_PATH = "folder-icon-path";
- public static final String READ_ONLY_MIME_TYPES = "read-only-mime-types";
-
/**
* Logger.
*/
private static Log log = ExoLogger.getLogger("exo.jcr.component.webdav.WebDavServiceImpl");
/**
- * Set to keep all 'read-only' mime types. Mime-types listed here
- * are not allowed to be changed.
- */
- private Set<String> readOnlyMimeTypes = new HashSet<String>();
-
- /**
* Local Thread SessionProvider.
*/
private final ThreadLocalSessionProviderService sessionProviderService;
@@ -316,12 +305,6 @@
}
this.mimeTypeResolver = new MimeTypeResolver();
this.mimeTypeResolver.setDefaultMimeType(defaultFileMimeType);
-
- ValuesParam pReadOnlyMimeTypes = params.getValuesParam(READ_ONLY_MIME_TYPES);
- if (pReadOnlyMimeTypes != null)
- {
- readOnlyMimeTypes.addAll((List<String>)pReadOnlyMimeTypes.getValues());
- }
}
/**
@@ -405,23 +388,6 @@
}
this.mimeTypeResolver = new MimeTypeResolver();
this.mimeTypeResolver.setDefaultMimeType(defaultFileMimeType);
-
- /*
- * As this constructor receives Map<String, String> instead of InitParams
- * we cannot pass multi-valued parameters in the form of
- * String -> Collection
- * We pass a set of 'read-only' mime types as a single String
- * with mime types separated by comma (",")
- * i.e. "mimeType1, mimeType2, mimeType3"
- */
- paramValue = params.get(READ_ONLY_MIME_TYPES);
- if (paramValue != null)
- {
- for (String mimeType : paramValue.split(","))
- {
- readOnlyMimeTypes.add(mimeType.trim());
- }
- }
}
/**
@@ -1185,8 +1151,8 @@
NodeType nodeType = ntm.getNodeType(contentNodeType);
NodeTypeUtil.checkContentResourceType(nodeType);
- return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName),
- readOnlyMimeTypes).put(session, path(repoPath), inputStream, fileNodeType, contentNodeType,
+ return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName)).put(
+ session, path(repoPath), inputStream, fileNodeType, contentNodeType,
NodeTypeUtil.getMixinTypes(mixinTypes), mimeType, encoding, updatePolicyType, autoVersionType, tokens);
}
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-02-06 13:18:56 UTC (rev 5569)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-02-06 13:36:29 UTC (rev 5570)
@@ -24,9 +24,7 @@
import java.io.InputStream;
import java.util.Calendar;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
@@ -59,12 +57,6 @@
private final UriBuilder uriBuilder;
/**
- * Set to keep all 'read-only' mime types. Mime-types listed here
- * are not allowed to be changed.
- */
- private final Set<String> readOnlyMimeTypes;
-
- /**
* Constructor.
*
* @param nullResourceLocks resource locks.
@@ -72,15 +64,7 @@
public PutCommand(final NullResourceLocksHolder nullResourceLocks)
{
this.nullResourceLocks = nullResourceLocks;
- /* Since no UriBuilder instance provided initialize it with null
- * to indicate that "Location" header should not be used in "Created" response
- */
this.uriBuilder = null;
- /* Since no 'read-only' mime-types set provided create empty HashSet
- * which indicates that 'read-only' mime-types set is empty
- * so any mime-type property can be overwritten
- */
- this.readOnlyMimeTypes = new HashSet<String>();
}
/**
@@ -92,33 +76,10 @@
public PutCommand(final NullResourceLocksHolder nullResourceLocks, UriBuilder uriBuilder)
{
this.nullResourceLocks = nullResourceLocks;
- /* Since no UriBuilder instance provided initialize it with null
- * to indicate that "Location" header should not be used in "Created" response
- */
this.uriBuilder = uriBuilder;
- /* Since no 'read-only' mime-types set provided create empty HashSet
- * which indicates that 'read-only' mime-types set is empty
- * so any mime-type property can be overwritten
- */
- this.readOnlyMimeTypes = new HashSet<String>();
}
/**
- * Constructor.
- *
- * @param nullResourceLocks resource locks.
- * @param uriBuilder - provide data used in 'location' header
- * @param readOnlyMimeTypes set of 'read-only' mime types
- */
- public PutCommand(final NullResourceLocksHolder nullResourceLocks, UriBuilder uriBuilder,
- Set<String> readOnlyMimeTypes)
- {
- this.nullResourceLocks = nullResourceLocks;
- this.uriBuilder = uriBuilder;
- this.readOnlyMimeTypes = readOnlyMimeTypes;
- }
-
- /**
* Webdav Put method implementation.
*
* @param session current session
@@ -270,23 +231,7 @@
{
Node content = node.getNode("jcr:content");
-
- /*
- Workaround created to fix JCR-1704
-
- 1. If readOnlyMimeTypes is not initialized it is okay to set any mime-type you want
- 2. If readOnlyMimeTypes is empty, it won't be needed to call !content.hasProperty("jcr:mimeType")
- which represents a potential query, and again it is okay to set any mime-type you want
- 3. If jcr:mimeType property is not set, we can set it without worries
- 4. If jcr:mimeType property isn't in 'read-only' properties list,
- we can set it
- */
- if (readOnlyMimeTypes == null || readOnlyMimeTypes.isEmpty() || !content.hasProperty("jcr:mimeType")
- || !readOnlyMimeTypes.contains(content.getProperty("jcr:mimeType").getString()))
- {
- content.setProperty("jcr:mimeType", mimeType);
- }
-
+ content.setProperty("jcr:mimeType", mimeType);
if (encoding != null)
{
content.setProperty("jcr:encoding", encoding);
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-02-06 13:18:56 UTC (rev 5569)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-02-06 13:36:29 UTC (rev 5570)
@@ -184,39 +184,6 @@
.toString());
}
- /**
- * Testing if read-only mime-types properties, which can be set as initial parameters
- * for WebDavService, are indeed read-only.
- * More info can be found here: https://jira.exoplatform.org/browse/JCR-1704
- * @throws Exception
- */
- public void testReadOnlyMimeTypeProperties() throws Exception
- {
- String testMimeTypeProperty = "test/mime-type";
- String content = TestUtils.getFileContent();
- String path = TestUtils.getFileName();
- MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
-
- // setting content-type header
- // test/mime-type is defined in init params to be read only mime type
- headers.add(HttpHeaders.CONTENT_TYPE, testMimeTypeProperty);
- // putting a resource
- service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
-
- headers.clear();
- // setting content-type header again
- // this time we set MediaType.TEXT_HTML to replace previous mime type
- headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML);
- // putting one mopre time
- service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
-
- // gettin jcr:content node, which stores jcr:mimeType parameter
- Node node = session.getRootNode().getNode(TextUtil.relativizePath(path)).getNode("jcr:content");
-
- assertEquals("Mime-type property should not be changed.", testMimeTypeProperty, node.getProperty("jcr:mimeType")
- .getString());
- }
-
@Override
protected String getRepositoryName()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-02-06 13:18:56 UTC (rev 5569)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-02-06 13:36:29 UTC (rev 5570)
@@ -209,12 +209,7 @@
<name>folder-icon-path</name>
<value>/absolute/path/to/file</value>
</value-param>
-
- <values-param>
- <name>read-only-mime-types</name>
- <value>test/mime-type</value>
- </values-param>
-
+
</init-params>
</component>
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-02-06 13:18:56 UTC (rev 5569)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-02-06 13:36:29 UTC (rev 5570)
@@ -1,79 +1,58 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This document was created with Syntext Serna Free. -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- This document was created with Syntext Serna Free. --><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<chapter id="JCR.WebDAV">
- <?dbhtml filename="ch-webdav.html"?>
-
- <title>WebDAV</title>
-
+<?dbhtml filename="ch-webdav.html"?> <title>WebDAV</title>
<section>
<title>Related documents</title>
-
<itemizedlist>
<listitem>
- <para><link linkend="JCR.LinkProducerService">Link
- Producer</link></para>
+ <para><link linkend="JCR.LinkProducerService">Link Producer</link></para>
</listitem>
</itemizedlist>
</section>
-
<section>
<title>Introduction</title>
-
<para>The WebDAV protocol enables you to use the third party tools to
communicate with hierarchical content servers via HTTP. It is possible to
add and remove documents or a set of documents from a path on the server.
DeltaV is an extension of the WebDav protocol that allows managing
document versioning. Locking guarantees protection against multiple access
when writing resources. The ordering support allows changing the position
- of the resource in the list and sort the directory to make the directory
- tree viewed conveniently. The full-text search makes it easy to find the
+ of the resource in the list and sort the directory to make the directory tree viewed conveniently. The full-text search makes it easy to find the
necessary documents. You can search by using two languages: SQL and
XPATH.</para>
-
<para>In eXo JCR, we plug in the WebDAV layer - based on the code taken
from the extension modules of the reference implementation - on the top of
our JCR implementation so that it is possible to browse a workspace using
the third party tools (it can be Windows folders or Mac ones as well as a
Java WebDAV client, such as DAVExplorer or IE using File->Open as a Web
Folder).</para>
-
<para>Now WebDav is an extension of the REST service. To get the WebDav
server ready, you must deploy the REST application. Then, you can access
any workspaces of your repository by using the following URL:</para>
-
<para>Standalone mode:</para>
-
<para><uri>http://host:port/rest/jcr/{RepositoryName}/{WorkspaceName}/{Path}</uri></para>
-
<para>Portal mode:</para>
-
<para><uri>http://host:port/portal/rest/private/jcr/{RepositoryName}/{WorkspaceName}...</uri></para>
-
- <para>When accessing the WebDAV server with the
- URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you
- might also use "collaboration" (instead of "production") which is the
- default workspace in eXo products. You will be asked to enter your login
- and password. Those will then be checked by using the organization service
- that can be implemented thanks to an InMemory (dummy) module or a DB
- module or an LDAP one and the JCR user session will be created with the
- correct JCR Credentials.</para>
-
+ <para>When accessing the WebDAV server with the URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you might
+ also use "collaboration" (instead of "production") which is the default
+ workspace in eXo products. You will be asked to enter your login and
+ password. Those will then be checked by using the organization service
+ that can be implemented thanks to an InMemory (dummy) module or a DB module
+ or an LDAP one and the JCR user session will be created with the correct JCR
+ Credentials.</para>
<note>
- <para>If you try the "in ECM" option, add "@ecm" to the user's password.
- Alternatively, you may modify jaas.conf by adding the <emphasis
- role="bold">domain=ecm</emphasis> option as follows:</para>
-
+ <para>If you try the "in ECM"
+ option, add "@ecm" to the user's password. Alternatively, you may modify
+ jaas.conf by adding the <emphasis role="bold">domain=ecm</emphasis> option
+ as follows:</para>
<programlisting>exo-domain {
org.exoplatform.services.security.jaas.BasicLoginModule required domain=ecm;
};</programlisting>
</note>
</section>
-
<section>
<title>Configuration</title>
-
<programlisting language="xml"><component>
<key>org.exoplatform.services.webdav.WebDavServiceImpl</key>
<type>org.exoplatform.services.webdav.WebDavServiceImpl</type>
@@ -89,7 +68,7 @@
<!-- this is the value of WWW-Authenticate header -->
<value-param>
<name>auth-header</name>
- <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
+ <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
</value-param>
<!-- default node type which is used for the creation of collections -->
@@ -104,7 +83,7 @@
<value>nt:file</value>
</value-param>
- <!-- if MimeTypeResolver can't find the required mime type,
+ <!-- if MimeTypeResolver can't find the required mime type,
which conforms with the file extension, and the mimeType header is absent
in the HTTP request header, this parameter is used
as the default mime type-->
@@ -114,9 +93,9 @@
</value-param>
<!-- This parameter indicates one of the three cases when you update the content of the resource by PUT command.
- In case of "create-version", PUT command creates the new version of the resource if this resource exists.
- In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
- In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
+ In case of "create-version", PUT command creates the new version of the resource if this resource exists.
+ In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
+ In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
<value-param>
<name>update-policy</name>
@@ -127,8 +106,8 @@
<!--
This parameter determines how service responds to a method that attempts to modify file content.
- In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
- In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
+ In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
+ In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
-->
<value-param>
<name>auto-version</name>
@@ -138,7 +117,7 @@
<!--
This parameter is responsible for managing Cache-Control header value which will be returned to the client.
- You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
+ You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
-->
<value-param>
<name>cache-control</name>
@@ -154,313 +133,209 @@
<value>/absolute/path/to/file</value>
</value-param>
- <!--
- This parameter is responsible for definition of read-only mime-type properties.
- That basically means that all mime-types mentioned here will be set as read-only properties
- (i. e. you cannot change resource's mime-type after it is set).
- -->
- <values-param>
- <name>read-only-mime-types</name>
- <value>application/vnd.openxmlformats-officedocument.wordprocessingml.document</value>
- </values-param>
-
</init-params
</component></programlisting>
</section>
-
<section>
<title>Screenshots</title>
-
- <para>At present, eXo JCR WebDav server is tested by using MS Internet
- Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav
- Explorer</ulink>, <ulink
- url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos
- Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
-
+ <para>At present, eXo JCR WebDav server is tested by using MS Internet
+ Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav Explorer</ulink>, <ulink url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
<section>
<title>MS Internet Explorer</title>
-
<para>(File -> Open as Web Folder)</para>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_explorer.jpg" />
+ <imagedata fileref="images/protocols/webdav_explorer.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Dav Explorer</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_davexplorer.jpg" />
+ <imagedata fileref="images/protocols/webdav_davexplorer.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Xythos Drive</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_xythosdrive.jpg" />
+ <imagedata fileref="images/protocols/webdav_xythosdrive.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Microsoft Office 2003</title>
-
<para>(as client) (File->Open with typing http://... href in the file
name box)</para>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_msoffice2003.jpg" />
+ <imagedata fileref="images/protocols/webdav_msoffice2003.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Ubuntu Linux</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg" />
+ <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg"/>
</imageobject>
</mediaobject>
</section>
</section>
-
<section>
<title>Comparison table of WebDav and JCR commands</title>
-
<table>
- <title></title>
-
+ <title/>
<tgroup cols="2">
<thead>
<row>
<entry>WebDav</entry>
-
<entry>JCR</entry>
</row>
</thead>
-
<tbody>
<row>
<entry>COPY</entry>
-
<entry>Workspace.copy(...)</entry>
</row>
-
<row>
<entry>DELETE</entry>
-
<entry>Node.remove()</entry>
</row>
-
<row>
<entry>GET</entry>
-
<entry>Node.getProperty(...); Property.getValue()</entry>
</row>
-
<row>
<entry>HEAD</entry>
-
<entry>Node.getProperty(...); Property.getLength()</entry>
</row>
-
<row>
<entry>MKCOL</entry>
-
<entry>Node.addNode(...)</entry>
</row>
-
<row>
<entry>MOVE</entry>
-
<entry>Session.move(...) or Workspace.move(...)</entry>
</row>
-
<row>
<entry>PROPFIND</entry>
-
- <entry>Session.getNode(...); Node.getNode(...);
- Node.getNodes(...); Node.getProperties()</entry>
+ <entry>Session.getNode(...); Node.getNode(...); Node.getNodes(...); Node.getProperties()</entry>
</row>
-
<row>
<entry>PROPPATCH</entry>
-
- <entry>Node.setProperty(...);
- Node.getProperty(...).remove()</entry>
+ <entry>Node.setProperty(...); Node.getProperty(...).remove()</entry>
</row>
-
<row>
<entry>PUT</entry>
-
- <entry>Node.addNode("node","nt:file");
- Node.setProperty("jcr:data", "data")</entry>
+ <entry>Node.addNode("node","nt:file"); Node.setProperty("jcr:data", "data")</entry>
</row>
-
<row>
<entry>CHECKIN</entry>
-
<entry>Node.checkin()</entry>
</row>
-
<row>
<entry>CHECKOUT</entry>
-
<entry>Node.checkout()</entry>
</row>
-
<row>
<entry>REPORT</entry>
-
- <entry>Node.getVersionHistory(); VersionHistory.getAllVersions();
- Version.getProperties()</entry>
+ <entry>Node.getVersionHistory(); VersionHistory.getAllVersions(); Version.getProperties()</entry>
</row>
-
<row>
<entry>RESTORE</entry>
-
<entry>Node.restore(...)</entry>
</row>
-
<row>
<entry>UNCHECKOUT</entry>
-
<entry>Node.restore(...)</entry>
</row>
-
<row>
<entry>VERSION-CONTROL</entry>
-
- <entry>Node.addMixin("mix:versionable")</entry>
+ <entry>Node.addMixin("mix:versionable")</entry>
</row>
-
<row>
<entry>LOCK</entry>
-
<entry>Node.lock(...)</entry>
</row>
-
<row>
<entry>UNLOCK</entry>
-
<entry>Node.unlock()</entry>
</row>
-
<row>
<entry>ORDERPATCH</entry>
-
<entry>Node.orderBefore(...)</entry>
</row>
-
<row>
<entry>SEARCH</entry>
-
- <entry>Workspace.getQueryManager(); QueryManager.createQuery();
- Query.execute()</entry>
+ <entry>Workspace.getQueryManager(); QueryManager.createQuery(); Query.execute()</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
-
<section>
<title>Restrictions</title>
-
<para>There are some restrictions for WebDAV in different Operating
systems.</para>
-
<section>
<title>Windows 7</title>
-
<para>When you try to set up a web folder by “adding a network location”
or “map a network drive” through My Computer, you can get an error
- message saying that either “The folder you entered does not appear to be
- valid. Please choose another” or “Windows cannot access… Check the
- spelling of the name. Otherwise, there might be…”. These errors may
- appear when you are using SSL or non-SSL.</para>
-
- <para>To fix this, do as follows:</para>
-
+ message saying that either “The folder you entered does not appear to be valid.
+ Please choose another” or “Windows cannot access… Check the spelling of
+ the name. Otherwise, there might be…”. These errors may appear when you are
+ using SSL or non-SSL.</para>
+ <para>To fix this, do as follows:</para>
<orderedlist>
<listitem>
<para>Go to Windows Registry Editor.</para>
</listitem>
-
<listitem>
<para>Find a key:
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\services\WebClient\Parameters\BasicAuthLevel
.</para>
</listitem>
-
<listitem>
<para>Change the value to 2.</para>
</listitem>
</orderedlist>
</section>
-
- <section>
+ <section>
<title>Microsoft Office 2010</title>
-
- <para>If you have Microsoft Office 2010 applications or Microsoft Office
- 2007 applications installed on a client computer. From that client
- computer, you try to access an Office file that is stored on a web
- server that is configured for Basic authentication. The connection
- between your computer and the web server does not use Secure Sockets
- Layer (SSL). When you try to open or to download the file, you
- experience the following symptoms: <itemizedlist>
+ <para>If you have Microsoft Office 2010 applications or Microsoft Office 2007 applications installed on a client computer. From that client computer, you try to access an Office file that is stored on a web server that is configured for Basic authentication. The connection between your computer and the web server does not use Secure Sockets Layer (SSL). When you try to open or to download the file, you experience the following symptoms:
+ <itemizedlist>
<listitem>
<para>The Office file does not open or download.</para>
- </listitem>
-
+ </listitem>
<listitem>
- <para>You do not receive a Basic authentication password prompt
- when you try to open or to download the file.</para>
+ <para>You do not receive a Basic authentication password prompt when you try to open or to download the file.</para>
</listitem>
-
<listitem>
- <para>You do not receive an error message when you try to open the
- file. The associated Office application starts. However, the
- selected file does not open.</para>
+ <para>You do not receive an error message when you try to open the file. The associated Office application starts. However, the selected file does not open.</para>
</listitem>
- </itemizedlist></para>
-
- <para>To enable Basic authentication on the client computer, follow
- these steps:</para>
-
+ </itemizedlist>
+ </para>
+ <para>To enable Basic authentication on the client computer, follow these steps:</para>
<orderedlist>
<listitem>
- <para>Click Start, type regedit in the Start Search box, and then
- press Enter.</para>
+ <para>Click Start, type regedit in the Start Search box, and then press Enter.</para>
</listitem>
-
<listitem>
- <para>Locate and then click the following registry subkey:</para>
-
+ <para>Locate and then click the following registry subkey: </para>
<para>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet</para>
</listitem>
-
<listitem>
- <para>On the Edit menu, point to New, and then click DWORD
- Value.</para>
+ <para>On the Edit menu, point to New, and then click DWORD Value.</para>
</listitem>
-
<listitem>
<para>Type BasicAuthLevel, and then press Enter.</para>
</listitem>
-
<listitem>
<para>Right-click BasicAuthLevel, and then click Modify.</para>
</listitem>
-
<listitem>
<para>In the Value data box, type 2, and then click OK.</para>
</listitem>
12 years, 4 months
exo-jcr SVN: r5569 - in jcr/trunk: exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command and 3 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2012-02-06 08:18:56 -0500 (Mon, 06 Feb 2012)
New Revision: 5569
Modified:
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
Log:
EXOJCR-1750: changes reverted
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-02-06 12:24:08 UTC (rev 5568)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-02-06 13:18:56 UTC (rev 5569)
@@ -23,7 +23,6 @@
import org.exoplatform.commons.utils.MimeTypeResolver;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.container.xml.ValuesParam;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.app.ThreadLocalSessionProviderService;
@@ -79,10 +78,8 @@
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
@@ -146,20 +143,12 @@
public static final String FOLDER_ICON_PATH = "folder-icon-path";
- public static final String READ_ONLY_MIME_TYPES = "read-only-mime-types";
-
/**
* Logger.
*/
private static Log log = ExoLogger.getLogger("exo.jcr.component.webdav.WebDavServiceImpl");
/**
- * Set to keep all 'read-only' mime types. Mime-types listed here
- * are not allowed to be changed.
- */
- private Set<String> readOnlyMimeTypes = new HashSet<String>();
-
- /**
* Local Thread SessionProvider.
*/
private final ThreadLocalSessionProviderService sessionProviderService;
@@ -316,12 +305,6 @@
}
this.mimeTypeResolver = new MimeTypeResolver();
this.mimeTypeResolver.setDefaultMimeType(defaultFileMimeType);
-
- ValuesParam pReadOnlyMimeTypes = params.getValuesParam(READ_ONLY_MIME_TYPES);
- if (pReadOnlyMimeTypes != null)
- {
- readOnlyMimeTypes.addAll((List<String>)pReadOnlyMimeTypes.getValues());
- }
}
/**
@@ -403,24 +386,6 @@
}
}
-
- /*
- * As this constructor receives Map<String, String> instead of InitParams
- * we cannot pass multi-valued parameters in the form of
- * String -> Collection
- * We pass a set of 'read-only' mime types as a single String
- * with mime types separated by comma (",")
- * i.e. "mimeType1, mimeType2, mimeType3"
- */
- paramValue = params.get(READ_ONLY_MIME_TYPES);
- if (paramValue != null)
- {
- for (String mimeType : paramValue.split(","))
- {
- readOnlyMimeTypes.add(mimeType.trim());
- }
- }
-
this.mimeTypeResolver = new MimeTypeResolver();
this.mimeTypeResolver.setDefaultMimeType(defaultFileMimeType);
}
@@ -1209,8 +1174,8 @@
NodeType nodeType = ntm.getNodeType(contentNodeType);
NodeTypeUtil.checkContentResourceType(nodeType);
- return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName),
- readOnlyMimeTypes).put(session, path(repoPath), inputStream, fileNodeType, contentNodeType,
+ return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName)).put(
+ session, path(repoPath), inputStream, fileNodeType, contentNodeType,
NodeTypeUtil.getMixinTypes(mixinTypes), mimeType, encoding, updatePolicyType, autoVersionType, tokens);
}
Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-02-06 12:24:08 UTC (rev 5568)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-02-06 13:18:56 UTC (rev 5569)
@@ -24,9 +24,7 @@
import java.io.InputStream;
import java.util.Calendar;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
@@ -59,12 +57,6 @@
private final UriBuilder uriBuilder;
/**
- * Set to keep all 'read-only' mime types. Mime-types listed here
- * are not allowed to be changed.
- */
- private final Set<String> readOnlyMimeTypes;
-
- /**
* Constructor.
*
* @param nullResourceLocks resource locks.
@@ -72,15 +64,7 @@
public PutCommand(final NullResourceLocksHolder nullResourceLocks)
{
this.nullResourceLocks = nullResourceLocks;
- /* Since no UriBuilder instance provided initialize it with null
- * to indicate that "Location" header should not be used in "Created" response
- */
this.uriBuilder = null;
- /* Since no 'read-only' mime-types set provided create empty HashSet
- * which indicates that 'read-only' mime-types set is empty
- * so any mime-type property can be overwritten
- */
- this.readOnlyMimeTypes = new HashSet<String>();
}
/**
@@ -92,33 +76,10 @@
public PutCommand(final NullResourceLocksHolder nullResourceLocks, UriBuilder uriBuilder)
{
this.nullResourceLocks = nullResourceLocks;
- /* Since no UriBuilder instance provided initialize it with null
- * to indicate that "Location" header should not be used in "Created" response
- */
this.uriBuilder = uriBuilder;
- /* Since no 'read-only' mime-types set provided create empty HashSet
- * which indicates that 'read-only' mime-types set is empty
- * so any mime-type property can be overwritten
- */
- this.readOnlyMimeTypes = new HashSet<String>();
}
/**
- * Constructor.
- *
- * @param nullResourceLocks resource locks.
- * @param uriBuilder - provide data used in 'location' header
- * @param readOnlyMimeTypes set of 'read-only' mime types
- */
- public PutCommand(final NullResourceLocksHolder nullResourceLocks, UriBuilder uriBuilder,
- Set<String> readOnlyMimeTypes)
- {
- this.nullResourceLocks = nullResourceLocks;
- this.uriBuilder = uriBuilder;
- this.readOnlyMimeTypes = readOnlyMimeTypes;
- }
-
- /**
* Webdav Put method implementation.
*
* @param session current session
@@ -270,23 +231,7 @@
{
Node content = node.getNode("jcr:content");
-
- /*
- Workaround created to fix JCR-1704
-
- 1. If readOnlyMimeTypes is not initialized it is okay to set any mime-type you want
- 2. If readOnlyMimeTypes is empty, it won't be needed to call !content.hasProperty("jcr:mimeType")
- which represents a potential query, and again it is okay to set any mime-type you want
- 3. If jcr:mimeType property is not set, we can set it without worries
- 4. If jcr:mimeType property isn't in 'read-only' properties list,
- we can set it
- */
- if (readOnlyMimeTypes == null || readOnlyMimeTypes.isEmpty() || !content.hasProperty("jcr:mimeType")
- || !readOnlyMimeTypes.contains(content.getProperty("jcr:mimeType").getString()))
- {
- content.setProperty("jcr:mimeType", mimeType);
- }
-
+ content.setProperty("jcr:mimeType", mimeType);
if (encoding != null)
{
content.setProperty("jcr:encoding", encoding);
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-02-06 12:24:08 UTC (rev 5568)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-02-06 13:18:56 UTC (rev 5569)
@@ -184,39 +184,6 @@
.toString());
}
- /**
- * Testing if read-only mime-types properties, which can be set as initial parameters
- * for WebDavService, are indeed read-only.
- * More info can be found here: https://jira.exoplatform.org/browse/JCR-1704
- * @throws Exception
- */
- public void testReadOnlyMimeTypeProperties() throws Exception
- {
- String testMimeTypeProperty = "test/mime-type";
- String content = TestUtils.getFileContent();
- String path = TestUtils.getFileName();
- MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
-
- // setting content-type header
- // test/mime-type is defined in init params to be read only mime type
- headers.add(HttpHeaders.CONTENT_TYPE, testMimeTypeProperty);
- // putting a resource
- service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
-
- headers.clear();
- // setting content-type header again
- // this time we set MediaType.TEXT_HTML to replace previous mime type
- headers.add(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_HTML);
- // putting one mopre time
- service(WebDAVMethods.PUT, getPathWS() + path, "", headers, content.getBytes());
-
- // gettin jcr:content node, which stores jcr:mimeType parameter
- Node node = session.getRootNode().getNode(TextUtil.relativizePath(path)).getNode("jcr:content");
-
- assertEquals("Mime-type property should not be changed.", testMimeTypeProperty, node.getProperty("jcr:mimeType")
- .getString());
- }
-
@Override
protected String getRepositoryName()
{
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-02-06 12:24:08 UTC (rev 5568)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-02-06 13:18:56 UTC (rev 5569)
@@ -209,12 +209,7 @@
<name>folder-icon-path</name>
<value>/absolute/path/to/file</value>
</value-param>
-
- <values-param>
- <name>read-only-mime-types</name>
- <value>test/mime-type</value>
- </values-param>
-
+
</init-params>
</component>
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-02-06 12:24:08 UTC (rev 5568)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-02-06 13:18:56 UTC (rev 5569)
@@ -1,79 +1,58 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This document was created with Syntext Serna Free. -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- This document was created with Syntext Serna Free. --><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<chapter id="JCR.WebDAV">
- <?dbhtml filename="ch-webdav.html"?>
-
- <title>WebDAV</title>
-
+<?dbhtml filename="ch-webdav.html"?> <title>WebDAV</title>
<section>
<title>Related documents</title>
-
<itemizedlist>
<listitem>
- <para><link linkend="JCR.LinkProducerService">Link
- Producer</link></para>
+ <para><link linkend="JCR.LinkProducerService">Link Producer</link></para>
</listitem>
</itemizedlist>
</section>
-
<section>
<title>Introduction</title>
-
<para>The WebDAV protocol enables you to use the third party tools to
communicate with hierarchical content servers via HTTP. It is possible to
add and remove documents or a set of documents from a path on the server.
DeltaV is an extension of the WebDav protocol that allows managing
document versioning. Locking guarantees protection against multiple access
when writing resources. The ordering support allows changing the position
- of the resource in the list and sort the directory to make the directory
- tree viewed conveniently. The full-text search makes it easy to find the
+ of the resource in the list and sort the directory to make the directory tree viewed conveniently. The full-text search makes it easy to find the
necessary documents. You can search by using two languages: SQL and
XPATH.</para>
-
<para>In eXo JCR, we plug in the WebDAV layer - based on the code taken
from the extension modules of the reference implementation - on the top of
our JCR implementation so that it is possible to browse a workspace using
the third party tools (it can be Windows folders or Mac ones as well as a
Java WebDAV client, such as DAVExplorer or IE using File->Open as a Web
Folder).</para>
-
<para>Now WebDav is an extension of the REST service. To get the WebDav
server ready, you must deploy the REST application. Then, you can access
any workspaces of your repository by using the following URL:</para>
-
<para>Standalone mode:</para>
-
<para><uri>http://host:port/rest/jcr/{RepositoryName}/{WorkspaceName}/{Path}</uri></para>
-
<para>Portal mode:</para>
-
<para><uri>http://host:port/portal/rest/private/jcr/{RepositoryName}/{WorkspaceName}...</uri></para>
-
- <para>When accessing the WebDAV server with the
- URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you
- might also use "collaboration" (instead of "production") which is the
- default workspace in eXo products. You will be asked to enter your login
- and password. Those will then be checked by using the organization service
- that can be implemented thanks to an InMemory (dummy) module or a DB
- module or an LDAP one and the JCR user session will be created with the
- correct JCR Credentials.</para>
-
+ <para>When accessing the WebDAV server with the URL<uri>http://localhost:8080/rest/jcr/repository/production</uri>, you might
+ also use "collaboration" (instead of "production") which is the default
+ workspace in eXo products. You will be asked to enter your login and
+ password. Those will then be checked by using the organization service
+ that can be implemented thanks to an InMemory (dummy) module or a DB module
+ or an LDAP one and the JCR user session will be created with the correct JCR
+ Credentials.</para>
<note>
- <para>If you try the "in ECM" option, add "@ecm" to the user's password.
- Alternatively, you may modify jaas.conf by adding the <emphasis
- role="bold">domain=ecm</emphasis> option as follows:</para>
-
+ <para>If you try the "in ECM"
+ option, add "@ecm" to the user's password. Alternatively, you may modify
+ jaas.conf by adding the <emphasis role="bold">domain=ecm</emphasis> option
+ as follows:</para>
<programlisting>exo-domain {
org.exoplatform.services.security.jaas.BasicLoginModule required domain=ecm;
};</programlisting>
</note>
</section>
-
<section>
<title>Configuration</title>
-
<programlisting language="xml"><component>
<key>org.exoplatform.services.webdav.WebDavServiceImpl</key>
<type>org.exoplatform.services.webdav.WebDavServiceImpl</type>
@@ -89,7 +68,7 @@
<!-- this is the value of WWW-Authenticate header -->
<value-param>
<name>auth-header</name>
- <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
+ <value>Basic realm="eXo-Platform Webdav Server 1.6.1"</value>
</value-param>
<!-- default node type which is used for the creation of collections -->
@@ -104,7 +83,7 @@
<value>nt:file</value>
</value-param>
- <!-- if MimeTypeResolver can't find the required mime type,
+ <!-- if MimeTypeResolver can't find the required mime type,
which conforms with the file extension, and the mimeType header is absent
in the HTTP request header, this parameter is used
as the default mime type-->
@@ -114,9 +93,9 @@
</value-param>
<!-- This parameter indicates one of the three cases when you update the content of the resource by PUT command.
- In case of "create-version", PUT command creates the new version of the resource if this resource exists.
- In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
- In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
+ In case of "create-version", PUT command creates the new version of the resource if this resource exists.
+ In case of "replace" - if the resource exists, PUT command updates the content of the resource and its last modification date.
+ In case of "add", the PUT command tries to create the new resource with the same name (if the parent node allows same-name siblings).-->
<value-param>
<name>update-policy</name>
@@ -127,8 +106,8 @@
<!--
This parameter determines how service responds to a method that attempts to modify file content.
- In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
- In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
+ In case of "checkout-checkin" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout and followed by a checkin operation.
+ In case of "checkout" value, when a modification request is applied to a checked-in version-controlled resource, the request is automatically preceded by a checkout operation.
-->
<value-param>
<name>auto-version</name>
@@ -138,7 +117,7 @@
<!--
This parameter is responsible for managing Cache-Control header value which will be returned to the client.
- You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
+ You can use patterns like "text/*", "image/*" or wildcard to define the type of content.
-->
<value-param>
<name>cache-control</name>
@@ -154,313 +133,209 @@
<value>/absolute/path/to/file</value>
</value-param>
- <!--
- This parameter is responsible for definition of read-only mime-type properties.
- That basically means that all mime-types mentioned here will be set as read-only properties
- (i. e. you cannot change resource's mime-type after it is set).
- -->
- <values-param>
- <name>read-only-mime-types</name>
- <value>application/vnd.openxmlformats-officedocument.wordprocessingml.document</value>
- </values-param>
-
</init-params
</component></programlisting>
</section>
-
<section>
<title>Screenshots</title>
-
- <para>At present, eXo JCR WebDav server is tested by using MS Internet
- Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav
- Explorer</ulink>, <ulink
- url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos
- Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
-
+ <para>At present, eXo JCR WebDav server is tested by using MS Internet
+ Explorer, <ulink url="http://www.ics.uci.edu/~webdav">Dav Explorer</ulink>, <ulink url="http://www.xythos.com/home/xythos/products/xythos_drive.html">Xythos Drive</ulink>, Microsoft Office 2003 (as client), and Ubuntu Linux.</para>
<section>
<title>MS Internet Explorer</title>
-
<para>(File -> Open as Web Folder)</para>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_explorer.jpg" />
+ <imagedata fileref="images/protocols/webdav_explorer.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Dav Explorer</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_davexplorer.jpg" />
+ <imagedata fileref="images/protocols/webdav_davexplorer.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Xythos Drive</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_xythosdrive.jpg" />
+ <imagedata fileref="images/protocols/webdav_xythosdrive.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Microsoft Office 2003</title>
-
<para>(as client) (File->Open with typing http://... href in the file
name box)</para>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_msoffice2003.jpg" />
+ <imagedata fileref="images/protocols/webdav_msoffice2003.jpg"/>
</imageobject>
</mediaobject>
</section>
-
<section>
<title>Ubuntu Linux</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg" />
+ <imagedata fileref="images/protocols/webdav_ubuntulinux.jpg"/>
</imageobject>
</mediaobject>
</section>
</section>
-
<section>
<title>Comparison table of WebDav and JCR commands</title>
-
<table>
- <title></title>
-
+ <title/>
<tgroup cols="2">
<thead>
<row>
<entry>WebDav</entry>
-
<entry>JCR</entry>
</row>
</thead>
-
<tbody>
<row>
<entry>COPY</entry>
-
<entry>Workspace.copy(...)</entry>
</row>
-
<row>
<entry>DELETE</entry>
-
<entry>Node.remove()</entry>
</row>
-
<row>
<entry>GET</entry>
-
<entry>Node.getProperty(...); Property.getValue()</entry>
</row>
-
<row>
<entry>HEAD</entry>
-
<entry>Node.getProperty(...); Property.getLength()</entry>
</row>
-
<row>
<entry>MKCOL</entry>
-
<entry>Node.addNode(...)</entry>
</row>
-
<row>
<entry>MOVE</entry>
-
<entry>Session.move(...) or Workspace.move(...)</entry>
</row>
-
<row>
<entry>PROPFIND</entry>
-
- <entry>Session.getNode(...); Node.getNode(...);
- Node.getNodes(...); Node.getProperties()</entry>
+ <entry>Session.getNode(...); Node.getNode(...); Node.getNodes(...); Node.getProperties()</entry>
</row>
-
<row>
<entry>PROPPATCH</entry>
-
- <entry>Node.setProperty(...);
- Node.getProperty(...).remove()</entry>
+ <entry>Node.setProperty(...); Node.getProperty(...).remove()</entry>
</row>
-
<row>
<entry>PUT</entry>
-
- <entry>Node.addNode("node","nt:file");
- Node.setProperty("jcr:data", "data")</entry>
+ <entry>Node.addNode("node","nt:file"); Node.setProperty("jcr:data", "data")</entry>
</row>
-
<row>
<entry>CHECKIN</entry>
-
<entry>Node.checkin()</entry>
</row>
-
<row>
<entry>CHECKOUT</entry>
-
<entry>Node.checkout()</entry>
</row>
-
<row>
<entry>REPORT</entry>
-
- <entry>Node.getVersionHistory(); VersionHistory.getAllVersions();
- Version.getProperties()</entry>
+ <entry>Node.getVersionHistory(); VersionHistory.getAllVersions(); Version.getProperties()</entry>
</row>
-
<row>
<entry>RESTORE</entry>
-
<entry>Node.restore(...)</entry>
</row>
-
<row>
<entry>UNCHECKOUT</entry>
-
<entry>Node.restore(...)</entry>
</row>
-
<row>
<entry>VERSION-CONTROL</entry>
-
- <entry>Node.addMixin("mix:versionable")</entry>
+ <entry>Node.addMixin("mix:versionable")</entry>
</row>
-
<row>
<entry>LOCK</entry>
-
<entry>Node.lock(...)</entry>
</row>
-
<row>
<entry>UNLOCK</entry>
-
<entry>Node.unlock()</entry>
</row>
-
<row>
<entry>ORDERPATCH</entry>
-
<entry>Node.orderBefore(...)</entry>
</row>
-
<row>
<entry>SEARCH</entry>
-
- <entry>Workspace.getQueryManager(); QueryManager.createQuery();
- Query.execute()</entry>
+ <entry>Workspace.getQueryManager(); QueryManager.createQuery(); Query.execute()</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
-
<section>
<title>Restrictions</title>
-
<para>There are some restrictions for WebDAV in different Operating
systems.</para>
-
<section>
<title>Windows 7</title>
-
<para>When you try to set up a web folder by “adding a network location”
or “map a network drive” through My Computer, you can get an error
- message saying that either “The folder you entered does not appear to be
- valid. Please choose another” or “Windows cannot access… Check the
- spelling of the name. Otherwise, there might be…”. These errors may
- appear when you are using SSL or non-SSL.</para>
-
- <para>To fix this, do as follows:</para>
-
+ message saying that either “The folder you entered does not appear to be valid.
+ Please choose another” or “Windows cannot access… Check the spelling of
+ the name. Otherwise, there might be…”. These errors may appear when you are
+ using SSL or non-SSL.</para>
+ <para>To fix this, do as follows:</para>
<orderedlist>
<listitem>
<para>Go to Windows Registry Editor.</para>
</listitem>
-
<listitem>
<para>Find a key:
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlset\services\WebClient\Parameters\BasicAuthLevel
.</para>
</listitem>
-
<listitem>
<para>Change the value to 2.</para>
</listitem>
</orderedlist>
</section>
-
- <section>
+ <section>
<title>Microsoft Office 2010</title>
-
- <para>If you have Microsoft Office 2010 applications or Microsoft Office
- 2007 applications installed on a client computer. From that client
- computer, you try to access an Office file that is stored on a web
- server that is configured for Basic authentication. The connection
- between your computer and the web server does not use Secure Sockets
- Layer (SSL). When you try to open or to download the file, you
- experience the following symptoms: <itemizedlist>
+ <para>If you have Microsoft Office 2010 applications or Microsoft Office 2007 applications installed on a client computer. From that client computer, you try to access an Office file that is stored on a web server that is configured for Basic authentication. The connection between your computer and the web server does not use Secure Sockets Layer (SSL). When you try to open or to download the file, you experience the following symptoms:
+ <itemizedlist>
<listitem>
<para>The Office file does not open or download.</para>
- </listitem>
-
+ </listitem>
<listitem>
- <para>You do not receive a Basic authentication password prompt
- when you try to open or to download the file.</para>
+ <para>You do not receive a Basic authentication password prompt when you try to open or to download the file.</para>
</listitem>
-
<listitem>
- <para>You do not receive an error message when you try to open the
- file. The associated Office application starts. However, the
- selected file does not open.</para>
+ <para>You do not receive an error message when you try to open the file. The associated Office application starts. However, the selected file does not open.</para>
</listitem>
- </itemizedlist></para>
-
- <para>To enable Basic authentication on the client computer, follow
- these steps:</para>
-
+ </itemizedlist>
+ </para>
+ <para>To enable Basic authentication on the client computer, follow these steps:</para>
<orderedlist>
<listitem>
- <para>Click Start, type regedit in the Start Search box, and then
- press Enter.</para>
+ <para>Click Start, type regedit in the Start Search box, and then press Enter.</para>
</listitem>
-
<listitem>
- <para>Locate and then click the following registry subkey:</para>
-
+ <para>Locate and then click the following registry subkey: </para>
<para>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Common\Internet</para>
</listitem>
-
<listitem>
- <para>On the Edit menu, point to New, and then click DWORD
- Value.</para>
+ <para>On the Edit menu, point to New, and then click DWORD Value.</para>
</listitem>
-
<listitem>
<para>Type BasicAuthLevel, and then press Enter.</para>
</listitem>
-
<listitem>
<para>Right-click BasicAuthLevel, and then click Modify.</para>
</listitem>
-
<listitem>
<para>In the Value data box, type 2, and then click OK.</para>
</listitem>
12 years, 4 months
exo-jcr SVN: r5568 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-06 07:24:08 -0500 (Mon, 06 Feb 2012)
New Revision: 5568
Modified:
jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1730: Exception when stopping the coordinator in suspended cluster
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2012-02-06 12:23:19 UTC (rev 5567)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2012-02-06 12:24:08 UTC (rev 5568)
@@ -136,7 +136,10 @@
// re-read from FS current actual list.
try
{
- super.read();
+ if (!multiIndex.isStopped())
+ {
+ super.read();
+ }
}
catch (IOException e)
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2012-02-06 12:23:19 UTC (rev 5567)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2012-02-06 12:24:08 UTC (rev 5568)
@@ -76,7 +76,7 @@
/**
* {@link MultiIndex} instance for callbacking when list of indexes changed
*/
- private MultiIndex multiIndex;
+ protected MultiIndex multiIndex;
/**
* Creates a new IndexInfos using <code>"indexes"</code> as a filename.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-02-06 12:23:19 UTC (rev 5567)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-02-06 12:24:08 UTC (rev 5568)
@@ -3372,6 +3372,14 @@
}
/**
+ * @return true if index is stopped.
+ */
+ public boolean isStopped()
+ {
+ return stopped;
+ }
+
+ /**
* Switches index mode
*
* @param isOnline
Modified: jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-02-06 12:23:19 UTC (rev 5567)
+++ jcr/branches/1.15.x/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-02-06 12:24:08 UTC (rev 5568)
@@ -166,7 +166,10 @@
// re-read from FS current actual list.
try
{
- super.read();
+ if (!multiIndex.isStopped())
+ {
+ super.read();
+ }
}
catch (IOException e)
{
12 years, 4 months