exo-jcr SVN: r5477 - in jcr/branches/1.12.x/patch/1.12.12-GA: JCR-1705 and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-18 03:01:32 -0500 (Wed, 18 Jan 2012)
New Revision: 5477
Added:
jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1705/
jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1705/JCR-1705.patch
Log:
JCR-1705: patch proposed
Added: jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1705/JCR-1705.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1705/JCR-1705.patch (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.12-GA/JCR-1705/JCR-1705.patch 2012-01-18 08:01:32 UTC (rev 5477)
@@ -0,0 +1,32 @@
+Index: pom.xml
+===================================================================
+--- pom.xml (revision 5473)
++++ pom.xml (working copy)
+@@ -45,7 +45,7 @@
+ <org.exoplatform.kernel.version>2.2.12-GA-SNAPSHOT</org.exoplatform.kernel.version>
+ <org.exoplatform.core.version>2.3.12-GA-SNAPSHOT</org.exoplatform.core.version>
+ <org.exoplatform.ws.version>2.1.12-GA-SNAPSHOT</org.exoplatform.ws.version>
+- <org.exoplatform.doc-style.version>1</org.exoplatform.doc-style.version>
++ <org.exoplatform.doc-style.version>2</org.exoplatform.doc-style.version>
+ <version.assembly.plugin>2.2.1</version.assembly.plugin>
+ </properties>
+
+Index: exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
+===================================================================
+--- exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml (revision 5473)
++++ exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml (working copy)
+@@ -91,12 +91,12 @@
+ <formats>
+ <format>
+ <formatName>html</formatName>
+- <stylesheetResource>classpath:/xslt/org/exojcr/xhtml.xsl</stylesheetResource>
++ <stylesheetResource>classpath:xslt/org/exojcr/xhtml.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+- <stylesheetResource>classpath:/xslt/org/exojcr/xhtml-single.xsl</stylesheetResource>
++ <stylesheetResource>classpath:xslt/org/exojcr/xhtml-single.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <!--format>
14 years, 3 months
exo-jcr SVN: r5476 - in docs-style/trunk: exo-docbook-xslt and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-18 02:50:37 -0500 (Wed, 18 Jan 2012)
New Revision: 5476
Modified:
docs-style/trunk/exo-docbook-xslt/pom.xml
docs-style/trunk/exo-jdocbook-style/pom.xml
docs-style/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: docs-style/trunk/exo-docbook-xslt/pom.xml
===================================================================
--- docs-style/trunk/exo-docbook-xslt/pom.xml 2012-01-18 07:50:32 UTC (rev 5475)
+++ docs-style/trunk/exo-docbook-xslt/pom.xml 2012-01-18 07:50:37 UTC (rev 5476)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.exoplatform.doc</groupId>
<artifactId>parent</artifactId>
- <version>2</version>
+ <version>3-SNAPSHOT</version>
</parent>
<name>eXoJCR - DocBook XSLT</name>
Modified: docs-style/trunk/exo-jdocbook-style/pom.xml
===================================================================
--- docs-style/trunk/exo-jdocbook-style/pom.xml 2012-01-18 07:50:32 UTC (rev 5475)
+++ docs-style/trunk/exo-jdocbook-style/pom.xml 2012-01-18 07:50:37 UTC (rev 5476)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.exoplatform.doc</groupId>
<artifactId>parent</artifactId>
- <version>2</version>
+ <version>3-SNAPSHOT</version>
</parent>
<name>eXoJCR - Documentation Styles</name>
Modified: docs-style/trunk/pom.xml
===================================================================
--- docs-style/trunk/pom.xml 2012-01-18 07:50:32 UTC (rev 5475)
+++ docs-style/trunk/pom.xml 2012-01-18 07:50:37 UTC (rev 5476)
@@ -11,12 +11,12 @@
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<name>eXoJCR - Doc Style</name>
- <version>2</version>
+ <version>3-SNAPSHOT</version>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/docs-style/tags/2</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/docs-style/tags/2</developerConnection>
- <url>http://fisheye.jboss.org/browse/exo-jcr/docs-style/tags/2</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/docs-style/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/docs-style/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/docs-style/trunk</url>
</scm>
<modules>
14 years, 3 months
exo-jcr SVN: r5475 - docs-style/tags.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-18 02:50:32 -0500 (Wed, 18 Jan 2012)
New Revision: 5475
Added:
docs-style/tags/2/
Log:
[maven-scm] copy for tag 2
14 years, 3 months
exo-jcr SVN: r5474 - in docs-style/trunk: exo-docbook-xslt and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-18 02:50:20 -0500 (Wed, 18 Jan 2012)
New Revision: 5474
Modified:
docs-style/trunk/exo-docbook-xslt/pom.xml
docs-style/trunk/exo-jdocbook-style/pom.xml
docs-style/trunk/pom.xml
Log:
[maven-release-plugin] prepare release 2
Modified: docs-style/trunk/exo-docbook-xslt/pom.xml
===================================================================
--- docs-style/trunk/exo-docbook-xslt/pom.xml 2012-01-17 15:21:04 UTC (rev 5473)
+++ docs-style/trunk/exo-docbook-xslt/pom.xml 2012-01-18 07:50:20 UTC (rev 5474)
@@ -1,43 +1,43 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.exoplatform.doc</groupId>
- <artifactId>exo-docbook-xslt</artifactId>
- <packaging>jar</packaging>
-
- <parent>
- <groupId>org.exoplatform.doc</groupId>
- <artifactId>parent</artifactId>
- <version>2-SNAPSHOT</version>
- </parent>
-
- <name>eXoJCR - DocBook XSLT</name>
- <description>
- The main project to transform DocBook XML into XHTML and other formats for
- eXoJCR Documentation.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>net.sf.docbook</groupId>
- <artifactId>docbook</artifactId>
- <version>1.74.0</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.docs</groupId>
- <artifactId>highlight</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
-
- <build>
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav</artifactId>
- <version>1.0-beta-2</version>
- </extension>
- </extensions>
- </build>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.exoplatform.doc</groupId>
+ <artifactId>exo-docbook-xslt</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.exoplatform.doc</groupId>
+ <artifactId>parent</artifactId>
+ <version>2</version>
+ </parent>
+
+ <name>eXoJCR - DocBook XSLT</name>
+ <description>
+ The main project to transform DocBook XML into XHTML and other formats for
+ eXoJCR Documentation.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.docbook</groupId>
+ <artifactId>docbook</artifactId>
+ <version>1.74.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.docs</groupId>
+ <artifactId>highlight</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ </build>
+</project>
Modified: docs-style/trunk/exo-jdocbook-style/pom.xml
===================================================================
--- docs-style/trunk/exo-jdocbook-style/pom.xml 2012-01-17 15:21:04 UTC (rev 5473)
+++ docs-style/trunk/exo-jdocbook-style/pom.xml 2012-01-18 07:50:20 UTC (rev 5474)
@@ -1,38 +1,38 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.exoplatform.doc</groupId>
- <artifactId>exo-jdocbook-style</artifactId>
- <packaging>jdocbook-style</packaging>
-
- <parent>
- <groupId>org.exoplatform.doc</groupId>
- <artifactId>parent</artifactId>
- <version>2-SNAPSHOT</version>
- </parent>
-
- <name>eXoJCR - Documentation Styles</name>
- <description>
- The JDocBook styles for the eXoJCR Documentation.
- </description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.jboss.maven.plugins</groupId>
- <artifactId>maven-jdocbook-style-plugin</artifactId>
- <version>1.0.0</version>
- <extensions>true</extensions>
- </plugin>
- </plugins>
-
- <extensions>
- <extension>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav</artifactId>
- <version>1.0-beta-2</version>
- </extension>
- </extensions>
- </build>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.exoplatform.doc</groupId>
+ <artifactId>exo-jdocbook-style</artifactId>
+ <packaging>jdocbook-style</packaging>
+
+ <parent>
+ <groupId>org.exoplatform.doc</groupId>
+ <artifactId>parent</artifactId>
+ <version>2</version>
+ </parent>
+
+ <name>eXoJCR - Documentation Styles</name>
+ <description>
+ The JDocBook styles for the eXoJCR Documentation.
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-style-plugin</artifactId>
+ <version>1.0.0</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav</artifactId>
+ <version>1.0-beta-2</version>
+ </extension>
+ </extensions>
+ </build>
+</project>
Modified: docs-style/trunk/pom.xml
===================================================================
--- docs-style/trunk/pom.xml 2012-01-17 15:21:04 UTC (rev 5473)
+++ docs-style/trunk/pom.xml 2012-01-18 07:50:20 UTC (rev 5474)
@@ -1,26 +1,26 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.exoplatform</groupId>
- <artifactId>foundation-parent</artifactId>
- <version>7</version>
- </parent>
-
- <groupId>org.exoplatform.doc</groupId>
- <artifactId>parent</artifactId>
- <packaging>pom</packaging>
- <name>eXoJCR - Doc Style</name>
- <version>2-SNAPSHOT</version>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/docs-style/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/docs-style/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/exo-jcr/docs-style/trunk</url>
- </scm>
-
- <modules>
- <module>exo-docbook-xslt</module>
- <module>exo-jdocbook-style</module>
- </modules>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.exoplatform</groupId>
+ <artifactId>foundation-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.exoplatform.doc</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <name>eXoJCR - Doc Style</name>
+ <version>2</version>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/docs-style/tags/2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/docs-style/tags/2</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/docs-style/tags/2</url>
+ </scm>
+
+ <modules>
+ <module>exo-docbook-xslt</module>
+ <module>exo-jdocbook-style</module>
+ </modules>
+</project>
14 years, 3 months
exo-jcr SVN: r5473 - in jcr/branches/1.15.x/exo.jcr.component.ext/src/test: resources/conf/standalone and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-17 10:21:04 -0500 (Tue, 17 Jan 2012)
New Revision: 5473
Modified:
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml
Log:
EXOJCR-1707: Refactoring DBCleanService, Fix configuration
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java 2012-01-17 15:20:29 UTC (rev 5472)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/usecase/TestBackupRestore.java 2012-01-17 15:21:04 UTC (rev 5473)
@@ -713,9 +713,11 @@
// clean and rollback first
repositoryDBCleaner.clean();
+
conn.rollback();
repositoryDBCleaner.rollback();
+
conn.commit();
checkConent(repositoryName);
@@ -723,6 +725,7 @@
// clean
repositoryDBCleaner.clean();
repositoryDBCleaner.commit();
+
conn.commit();
}
else
@@ -769,9 +772,11 @@
{
// clean and rollback first
workspaceDBCleaner.clean();
+
conn.rollback();
workspaceDBCleaner.rollback();
+
conn.commit();
checkConent(repositoryName);
@@ -779,6 +784,7 @@
// clean
workspaceDBCleaner.clean();
workspaceDBCleaner.commit();
+
conn.commit();
}
finally
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml 2012-01-17 15:20:29 UTC (rev 5472)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config-backup.xml 2012-01-17 15:21:04 UTC (rev 5473)
@@ -234,7 +234,7 @@
<property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
<property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
<property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
- <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr6" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr8" />
<property name="jbosscache-shareable" value="true" />
</properties>
</lock-manager>
14 years, 3 months
exo-jcr SVN: r5472 - jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-17 10:20:29 -0500 (Tue, 17 Jan 2012)
New Revision: 5472
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java
Log:
EXOJCR-1707: Refactoring DBCleanService, Fix cleaning scripts
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java 2012-01-17 15:19:38 UTC (rev 5471)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java 2012-01-17 15:20:29 UTC (rev 5472)
@@ -79,7 +79,8 @@
* data without any violations.
*
* <br>
- * This method does not invoke commit or rollback on {@link Connection}.
+ * This method does not invoke commit or rollback on {@link Connection} but
+ * needed autocommit mode can be set.
*
* @throws DBCleanException
*/
@@ -101,7 +102,8 @@
* (related to specific database) or does nothing.
*
* <br>
- * This method does not invoke commit or rollback on {@link Connection}.
+ * This method does not invoke commit or rollback on {@link Connection} but
+ * needed autocommit mode can be set.
*
* @throws DBCleanException
*/
@@ -122,7 +124,8 @@
* (related to specific database) or does nothing.
*
* <br>
- * This method does not invoke commit or rollback on {@link Connection}.
+ * This method does not invoke commit or rollback on {@link Connection} but
+ * needed autocommit mode can be set.
*
* @throws DBCleanException
*/
14 years, 3 months
exo-jcr SVN: r5471 - in jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: clean/rdbms and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-17 10:19:38 -0500 (Tue, 17 Jan 2012)
New Revision: 5471
Added:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleaningScipts.java
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleanScipts.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleanerTool.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScripts.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/OracleCleaningScipts.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/SybaseCleaningScipts.java
Log:
EXOJCR-1707: Refactoring DBCleanService, Fix cleaning scripts
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -20,6 +20,7 @@
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.services.database.utils.DialectConstants;
import org.exoplatform.services.database.utils.DialectDetecter;
import org.exoplatform.services.database.utils.JDBCUtils;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -126,6 +127,8 @@
*/
protected List<String> successfulExecuted;
+ protected boolean dbCleanerInAutoCommit;
+
/**
* Constructor DBRestore.
*
@@ -147,6 +150,7 @@
this.tables = tables;
this.dbCleaner = dbCleaner;
this.dialect = DialectDetecter.detect(jdbcConn.getMetaData());
+ this.dbCleanerInAutoCommit = dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_SYBASE);
}
/**
@@ -197,6 +201,7 @@
try
{
dbCleaner.commit();
+
jdbcConn.commit();
}
catch (SQLException e)
@@ -219,6 +224,7 @@
jdbcConn.rollback();
dbCleaner.rollback();
+
jdbcConn.commit();
}
catch (SQLException e)
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -170,10 +170,11 @@
}
String dialect = resolveDialect(wsEntry);
+ boolean autoCommit = dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_SYBASE);
DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry);
- return new DBCleanerTool(jdbcConn, scripts.getCleaningScripts(), scripts.getCommittingScripts(),
+ return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(),
scripts.getRollbackingScripts());
}
@@ -195,10 +196,11 @@
boolean multiDb = getMultiDbParameter(wsEntry);
String dialect = resolveDialect(wsEntry);
+ boolean autoCommit = dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_SYBASE);
DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, wsEntry);
- return new DBCleanerTool(jdbcConn, scripts.getCleaningScripts(), scripts.getCommittingScripts(),
+ return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(),
scripts.getRollbackingScripts());
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanerTool.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -45,6 +45,8 @@
protected final Connection connection;
+ protected final boolean autoCommit;
+
protected final List<String> rollbackingScripts = new ArrayList<String>();
protected final List<String> committingScripts = new ArrayList<String>();
@@ -57,11 +59,14 @@
* @param connection
* connection to database which will be used in cleaning, take in account DBCleanerTool does not
* close connection
+ * @param autoCommit
+ * auto commit mode which will be set during script execution
*/
- DBCleanerTool(Connection connection, Collection<String> cleaningScripts, Collection<String> committingScripts,
- Collection<String> rollbackingScripts)
+ DBCleanerTool(Connection connection, boolean autoCommit, Collection<String> cleaningScripts,
+ Collection<String> committingScripts, Collection<String> rollbackingScripts)
{
this.connection = connection;
+ this.autoCommit = autoCommit;
this.cleaningScripts.addAll(cleaningScripts);
this.committingScripts.addAll(committingScripts);
@@ -86,7 +91,7 @@
}
catch (SQLException e)
{
- throw new DBCleanException(e);
+ throw new DBCleanException(JDBCUtils.getFullMessage(e), e);
}
}
@@ -108,7 +113,7 @@
}
catch (SQLException e)
{
- throw new DBCleanException(e);
+ throw new DBCleanException(JDBCUtils.getFullMessage(e), e);
}
}
@@ -129,7 +134,7 @@
}
catch (SQLException e)
{
- throw new DBCleanException(e);
+ throw new DBCleanException(JDBCUtils.getFullMessage(e), e);
}
}
@@ -142,7 +147,7 @@
}
/**
- * Execute script on database.
+ * Execute script on database. Set auto commit mode if needed.
*
* @param scripts
* the scripts for execution
@@ -150,10 +155,14 @@
*/
protected void execute(List<String> scripts) throws SQLException
{
- SecurityManager security = System.getSecurityManager();
- if (security != null)
+ SecurityHelper
+ .validateSecurityPermissions(new RuntimePermission[]{JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION});
+
+ // set needed auto commit mode
+ boolean autoCommit = connection.getAutoCommit();
+ if (autoCommit != this.autoCommit)
{
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ connection.setAutoCommit(this.autoCommit);
}
Statement st = connection.createStatement();
@@ -183,18 +192,32 @@
{
LOG.error("Can't close the Statement." + e);
}
+
+ // restore previous auto commit mode
+ if (autoCommit != this.autoCommit)
+ {
+ connection.setAutoCommit(autoCommit);
+ }
}
}
protected void executeQuery(final Statement statement, final String sql) throws SQLException
{
- SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
+ try
{
- public Object run() throws Exception
+ SecurityHelper.doPrivilegedSQLExceptionAction(new PrivilegedExceptionAction<Object>()
{
- statement.executeUpdate(sql);
- return null;
- }
- });
+ public Object run() throws Exception
+ {
+ statement.executeUpdate(sql);
+ return null;
+ }
+ });
+ }
+ catch (SQLException e)
+ {
+ LOG.error("Query execution \"" + sql + "\" failed");
+ throw e;
+ }
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleanerTool.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleanerTool.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DummyDBCleanerTool.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -34,7 +34,7 @@
*/
public DummyDBCleanerTool()
{
- super(null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>());
+ super(null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>());
}
/**
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleanScipts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleanScipts.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleanScipts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2012 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.clean.rdbms.scripts;
-
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.clean.rdbms.DBCleanException;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
- * @version $Id: DB2DBCleanScipts.java 34360 2009-07-22 23:58:59Z tolusha $
- */
-public class DB2CleanScipts extends DBCleaningScripts
-{
-
- /**
- * DB2CleanScipts constructor.
- */
- public DB2CleanScipts(String dialect, RepositoryEntry rEntry) throws DBCleanException
- {
- super(dialect, rEntry);
-
- prepareDroppingTablesApproachScripts();
- }
-
- /**
- * DB2CleanScipts constructor.
- */
- public DB2CleanScipts(String dialect, WorkspaceEntry wEntry) throws DBCleanException
- {
- super(dialect, wEntry);
-
- if (multiDb)
- {
- prepareDroppingTablesApproachScripts();
- }
- else
- {
- prepareSimpleCleaningApproachScripts();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- protected Collection<String> getConstraintRemovingScripts()
- {
- List<String> scripts = new ArrayList<String>();
-
- String constraintName = "JCR_FK_" + tablePrefix + "ITEM_PAREN";
- scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
-
- return scripts;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Collection<String> getConstraintAddingScripts()
- {
- List<String> scripts = new ArrayList<String>();
-
- String constraintName =
- "JCR_FK_" + tablePrefix + "ITEM_PAREN FOREIGN KEY(PARENT_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
- scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT" + constraintName);
-
- return scripts;
- }
-
- /**
- * {@inheritDoc}
- */
- protected void prepareSimpleCleaningApproachScripts()
- {
- super.prepareSimpleCleaningApproachScripts();
-
- rollbackingScripts.clear();
- }
-}
Added: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleaningScipts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleaningScipts.java (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DB2CleaningScipts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.clean.rdbms.scripts;
+
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.clean.rdbms.DBCleanException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
+ * @version $Id: DB2DBCleanScipts.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public class DB2CleaningScipts extends DBCleaningScripts
+{
+
+ /**
+ * DB2CleaningScipts constructor.
+ */
+ public DB2CleaningScipts(String dialect, RepositoryEntry rEntry) throws DBCleanException
+ {
+ super(dialect, rEntry);
+
+ prepareDroppingTablesApproachScripts();
+ }
+
+ /**
+ * DB2CleaningScipts constructor.
+ */
+ public DB2CleaningScipts(String dialect, WorkspaceEntry wEntry) throws DBCleanException
+ {
+ super(dialect, wEntry);
+
+ if (multiDb)
+ {
+ prepareDroppingTablesApproachScripts();
+ }
+ else
+ {
+ prepareSimpleCleaningApproachScripts();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Collection<String> getFKRemovingScripts()
+ {
+ List<String> scripts = new ArrayList<String>();
+
+ String constraintName = "JCR_FK_" + tablePrefix + "ITEM_PAREN";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
+
+ return scripts;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Collection<String> getFKAddingScripts()
+ {
+ List<String> scripts = new ArrayList<String>();
+
+ String constraintName =
+ "JCR_FK_" + tablePrefix + "ITEM_PAREN FOREIGN KEY(PARENT_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT " + constraintName);
+
+ return scripts;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void prepareSimpleCleaningApproachScripts()
+ {
+ super.prepareSimpleCleaningApproachScripts();
+
+ rollbackingScripts.clear();
+ }
+}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScripts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScripts.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScripts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -116,14 +116,16 @@
{
cleaningScripts.addAll(getTablesRenamingScripts());
cleaningScripts.addAll(getDBInitializationScripts());
- cleaningScripts.addAll(getConstraintRemovingScripts());
+ cleaningScripts.addAll(getFKRemovingScripts());
+ cleaningScripts.addAll(getConstraintsRemovingScripts());
cleaningScripts.addAll(getIndexesDroppingScripts());
committingScripts.addAll(getOldTablesDroppingScripts());
committingScripts.addAll(getIndexesAddingScripts());
- committingScripts.addAll(getConstraintAddingScripts());
+ committingScripts.addAll(getConstraintsAddingScripts());
+ committingScripts.addAll(getFKAddingScripts());
- rollbackingScripts.addAll(getTableDroppingScripts());
+ rollbackingScripts.addAll(getTablesDroppingScripts());
rollbackingScripts.addAll(getOldTablesRenamingScripts());
}
@@ -134,13 +136,13 @@
*/
protected void prepareDroppingTablesApproachScripts() throws DBCleanException
{
- cleaningScripts.addAll(getTableDroppingScripts());
+ cleaningScripts.addAll(getTablesDroppingScripts());
cleaningScripts.addAll(getDBInitializationScripts());
- cleaningScripts.addAll(getConstraintRemovingScripts());
+ cleaningScripts.addAll(getFKRemovingScripts());
cleaningScripts.addAll(getIndexesDroppingScripts());
committingScripts.addAll(getIndexesAddingScripts());
- committingScripts.addAll(getConstraintAddingScripts());
+ committingScripts.addAll(getFKAddingScripts());
}
/**
@@ -148,15 +150,31 @@
*/
protected void prepareSimpleCleaningApproachScripts()
{
- cleaningScripts.addAll(getConstraintRemovingScripts());
+ cleaningScripts.addAll(getFKRemovingScripts());
cleaningScripts.addAll(getSingleDbWorkspaceCleaningScripts());
- committingScripts.addAll(getConstraintAddingScripts());
+ committingScripts.addAll(getFKAddingScripts());
- rollbackingScripts.addAll(getConstraintAddingScripts());
+ rollbackingScripts.addAll(getFKAddingScripts());
}
/**
+ * Returns SQL scripts for adding constraints.
+ */
+ protected Collection<String> getConstraintsAddingScripts()
+ {
+ return new ArrayList<String>();
+ }
+
+ /**
+ * Returns SQL scripts for removing constraints.
+ */
+ protected Collection<String> getConstraintsRemovingScripts()
+ {
+ return new ArrayList<String>();
+ }
+
+ /**
* Returns SQL scripts for renaming new JCR tables to new ones.
*/
protected Collection<String> getOldTablesRenamingScripts()
@@ -191,9 +209,9 @@
}
/**
- * Returns SQL scripts for removing constraint.
+ * Returns SQL scripts for removing FK on JCR_ITEM table.
*/
- protected Collection<String> getConstraintRemovingScripts()
+ protected Collection<String> getFKRemovingScripts()
{
List<String> scripts = new ArrayList<String>();
@@ -204,9 +222,9 @@
}
/**
- * Returns SQL scripts for adding constraint.
+ * Returns SQL scripts for adding FK on JCR_ITEM table.
*/
- protected Collection<String> getConstraintAddingScripts()
+ protected Collection<String> getFKAddingScripts()
{
List<String> scripts = new ArrayList<String>();
@@ -234,7 +252,7 @@
/**
* Returns SQL scripts for dropping existed JCR tables.
*/
- protected Collection<String> getTableDroppingScripts()
+ protected Collection<String> getTablesDroppingScripts()
{
List<String> scripts = new ArrayList<String>();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/DBCleaningScriptsFactory.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -44,7 +44,7 @@
else if (dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_DB2)
|| dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_DB2V8))
{
- return new DB2CleanScipts(dialect, wsEntry);
+ return new DB2CleaningScipts(dialect, wsEntry);
}
else if (dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_MSSQL))
{
@@ -88,7 +88,7 @@
else if (dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_DB2)
|| dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_DB2V8))
{
- return new DB2CleanScipts(dialect, rEntry);
+ return new DB2CleaningScipts(dialect, rEntry);
}
else if (dialect.equalsIgnoreCase(DialectConstants.DB_DIALECT_MSSQL))
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -74,8 +74,8 @@
cleaningScripts.addAll(getIndexesDroppingScripts());
String constraintName =
- "JCR_FK_" + tablePrefix + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + multiDb + "ITEM(ID)";
- committingScripts.add("ALTER TABLE JCR_" + multiDb + "VALUE ADD CONSTRAINT " + constraintName);
+ "JCR_FK_" + tablePrefix + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
+ committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/OracleCleaningScipts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/OracleCleaningScipts.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/OracleCleaningScipts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -63,37 +63,48 @@
}
/**
+ * R{@inheritDoc}
+ */
+ protected Collection<String> getConstraintsAddingScripts()
+ {
+ Collection<String> scripts = new ArrayList<String>();
+
+ String constraintName = "JCR_PK_" + tablePrefix + "VALUE PRIMARY KEY(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
+
+ constraintName = "JCR_PK_" + tablePrefix + "ITEM PRIMARY KEY(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT " + constraintName);
+
+ constraintName =
+ "JCR_FK_" + tablePrefix + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
+
+ constraintName = "JCR_PK_" + tablePrefix + "REF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "REF ADD CONSTRAINT " + constraintName);
+
+ return scripts;
+ }
+
+ /**
* {@inheritDoc}
*/
- protected void prepareRenamingApproachScripts() throws DBCleanException
+ protected Collection<String> getConstraintsRemovingScripts()
{
- super.prepareRenamingApproachScripts();
+ Collection<String> scripts = new ArrayList<String>();
String constraintName = "JCR_PK_" + tablePrefix + "VALUE";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
constraintName = "JCR_FK_" + tablePrefix + "VALUE_PROPERTY";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
constraintName = "JCR_PK_" + tablePrefix + "ITEM";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
constraintName = "JCR_PK_" + tablePrefix + "REF";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "REF DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "REF DROP CONSTRAINT " + constraintName);
- constraintName = "JCR_PK_" + tablePrefix + "VALUE PRIMARY KEY(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
-
- constraintName = "JCR_PK_" + tablePrefix + "ITEM PRIMARY KEY(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT " + constraintName);
-
- constraintName =
- "JCR_FK_" + multiDb + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
-
- constraintName = "JCR_PK_" + tablePrefix + "REF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "REF ADD CONSTRAINT " + constraintName);
-
+ return scripts;
}
/**
@@ -146,22 +157,39 @@
/**
* {@inheritDoc}
*/
- protected Collection<String> getTableDroppingScripts()
+ protected Collection<String> getTablesDroppingScripts()
{
- Collection<String> scripts = super.getTableDroppingScripts();
+ Collection<String> scripts = new ArrayList<String>();
scripts.add("DROP TRIGGER BI_JCR_" + tablePrefix + "VALUE");
scripts.add("DROP SEQUENCE JCR_" + tablePrefix + "VALUE_SEQ");
+ scripts.addAll(super.getTablesDroppingScripts());
+
return scripts;
}
/**
* {@inheritDoc}
*/
+ protected Collection<String> getOldTablesDroppingScripts()
+ {
+ Collection<String> scripts = new ArrayList<String>();
+
+ scripts.add("DROP TRIGGER BI_JCR_" + tablePrefix + "VALUE_OLD");
+ scripts.add("DROP SEQUENCE JCR_" + tablePrefix + "VALUE_SEQ_OLD");
+
+ scripts.addAll(super.getOldTablesDroppingScripts());
+
+ return scripts;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
protected Collection<String> getTablesRenamingScripts()
{
- Collection<String> scripts = super.getTableDroppingScripts();
+ Collection<String> scripts = new ArrayList<String>();
// JCR_VALUE
scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE RENAME TO JCR_" + tablePrefix + "VALUE_OLD");
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/SybaseCleaningScipts.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/SybaseCleaningScipts.java 2012-01-17 14:06:21 UTC (rev 5470)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/SybaseCleaningScipts.java 2012-01-17 15:19:38 UTC (rev 5471)
@@ -65,28 +65,40 @@
/**
* {@inheritDoc}
*/
- protected void prepareRenamingApproachScripts() throws DBCleanException
+ protected Collection<String> getConstraintsAddingScripts()
{
- super.prepareRenamingApproachScripts();
+ Collection<String> scripts = new ArrayList<String>();
+ String constraintName = "JCR_PK_" + tablePrefix + "ITEM PRIMARY KEY(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT " + constraintName);
+
+ constraintName = "JCR_PK_" + tablePrefix + "VALUE PRIMARY KEY(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
+
+ constraintName =
+ "JCR_FK_" + tablePrefix + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
+
+ return scripts;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Collection<String> getConstraintsRemovingScripts()
+ {
+ Collection<String> scripts = new ArrayList<String>();
+
String constraintName = "JCR_FK_" + tablePrefix + "VALUE_PROPERTY";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
constraintName = "JCR_PK_" + tablePrefix + "ITEM";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM DROP CONSTRAINT " + constraintName);
constraintName = "JCR_PK_" + tablePrefix + "VALUE";
- cleaningScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
+ scripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE DROP CONSTRAINT " + constraintName);
- constraintName = "JCR_PK_" + tablePrefix + "ITEM PRIMARY KEY(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "ITEM ADD CONSTRAINT " + constraintName);
-
- constraintName = "JCR_PK_" + tablePrefix + "VALUE PRIMARY KEY(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
-
- constraintName =
- "JCR_FK_" + tablePrefix + "VALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_" + tablePrefix + "ITEM(ID)";
- committingScripts.add("ALTER TABLE JCR_" + tablePrefix + "VALUE ADD CONSTRAINT " + constraintName);
+ return scripts;
}
/**
@@ -114,16 +126,16 @@
try
{
- scripts.add(DBInitializerHelper.getObjectScript("CREATE UNIQUE INDEX JCR_IDX_" + tablePrefix
- + "ITEM_PARENT ON JCR_" + tablePrefix + "ITEM", multiDb, dialect));
- scripts.add(DBInitializerHelper.getObjectScript("CREATE UNIQUE INDEX JCR_IDX_" + multiDb
- + "ITEM_PARENT_ID ON JCR_" + tablePrefix + "ITEM", multiDb, dialect));
- scripts.add(DBInitializerHelper.getObjectScript("CREATE UNIQUE INDEX JCR_IDX_" + multiDb
- + "ITEM_N_ORDER_NUM ON JCR_" + tablePrefix + "ITEM", multiDb, dialect));
- scripts.add(DBInitializerHelper.getObjectScript("CREATE UNIQUE INDEX JCR_IDX_" + multiDb
- + "VALUE_PROPERTY ON JCR_" + tablePrefix + "VALUE", multiDb, dialect));
- scripts.add(DBInitializerHelper.getObjectScript("CREATE UNIQUE INDEX JCR_IDX_" + multiDb
- + "REF_PROPERTY ON JCR_" + tablePrefix + "REF", multiDb, dialect));
+ scripts.add(DBInitializerHelper.getObjectScript("INDEX JCR_IDX_" + tablePrefix + "ITEM_PARENT ON JCR_"
+ + tablePrefix + "ITEM", multiDb, dialect));
+ scripts.add(DBInitializerHelper.getObjectScript("INDEX JCR_IDX_" + tablePrefix + "ITEM_PARENT_ID ON JCR_"
+ + tablePrefix + "ITEM", multiDb, dialect));
+ scripts.add(DBInitializerHelper.getObjectScript("INDEX JCR_IDX_" + tablePrefix + "ITEM_N_ORDER_NUM ON JCR_"
+ + tablePrefix + "ITEM", multiDb, dialect));
+ scripts.add(DBInitializerHelper.getObjectScript("INDEX JCR_IDX_" + tablePrefix + "VALUE_PROPERTY ON JCR_"
+ + tablePrefix + "VALUE", multiDb, dialect));
+ scripts.add(DBInitializerHelper.getObjectScript("JCR_IDX_" + tablePrefix + "REF_PROPERTY ON JCR_"
+ + tablePrefix + "REF", multiDb, dialect));
}
catch (RepositoryConfigurationException e)
{
@@ -138,7 +150,7 @@
*/
protected Collection<String> getTablesRenamingScripts()
{
- Collection<String> scripts = super.getTableDroppingScripts();
+ Collection<String> scripts = new ArrayList<String>();
scripts.add("sp_rename JCR_" + tablePrefix + "VALUE, JCR_" + tablePrefix + "VALUE_OLD");
scripts.add("sp_rename JCR_" + tablePrefix + "ITEM, JCR_" + tablePrefix + "ITEM_OLD");
@@ -155,7 +167,7 @@
*/
protected Collection<String> getOldTablesRenamingScripts()
{
- Collection<String> scripts = super.getTableDroppingScripts();
+ Collection<String> scripts = new ArrayList<String>();
scripts.add("sp_rename JCR_" + tablePrefix + "VALUE_OLD, JCR_" + tablePrefix + "VALUE");
scripts.add("sp_rename JCR_" + tablePrefix + "ITEM_OLD, JCR_" + tablePrefix + "ITEM");
14 years, 3 months
exo-jcr SVN: r5470 - 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-01-17 09:06:21 -0500 (Tue, 17 Jan 2012)
New Revision: 5470
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-1719: added new initial parameters for WebDavServiceImpl
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-01-17 13:28:57 UTC (rev 5469)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-01-17 14:06:21 UTC (rev 5470)
@@ -23,6 +23,7 @@
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;
@@ -78,8 +79,10 @@
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;
@@ -143,12 +146,20 @@
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;
@@ -305,6 +316,12 @@
}
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());
+ }
}
/**
@@ -388,6 +405,23 @@
}
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());
+ }
+ }
}
/**
@@ -1174,8 +1208,8 @@
NodeType nodeType = ntm.getNodeType(contentNodeType);
NodeTypeUtil.checkContentResourceType(nodeType);
- return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName)).put(
- session, path(repoPath), inputStream, fileNodeType, contentNodeType,
+ return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName),
+ readOnlyMimeTypes).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-01-17 13:28:57 UTC (rev 5469)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-01-17 14:06:21 UTC (rev 5470)
@@ -24,7 +24,9 @@
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;
@@ -57,6 +59,12 @@
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.
@@ -64,7 +72,15 @@
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>();
}
/**
@@ -76,10 +92,33 @@
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
@@ -231,7 +270,23 @@
{
Node content = node.getNode("jcr:content");
- content.setProperty("jcr:mimeType", mimeType);
+
+ /*
+ 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);
+ }
+
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-01-17 13:28:57 UTC (rev 5469)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-01-17 14:06:21 UTC (rev 5470)
@@ -184,6 +184,39 @@
.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-01-17 13:28:57 UTC (rev 5469)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-01-17 14:06:21 UTC (rev 5470)
@@ -209,7 +209,12 @@
<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-01-17 13:28:57 UTC (rev 5469)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-01-17 14:06:21 UTC (rev 5470)
@@ -1,58 +1,79 @@
-<?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>
@@ -68,7 +89,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 -->
@@ -83,7 +104,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-->
@@ -93,9 +114,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>
@@ -106,8 +127,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>
@@ -117,7 +138,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>
@@ -133,209 +154,313 @@
<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>
14 years, 3 months
exo-jcr SVN: r5469 - 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-01-17 08:28:57 -0500 (Tue, 17 Jan 2012)
New Revision: 5469
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-1719: added new initial parameters for WebDavServiceImpl
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-01-17 13:16:44 UTC (rev 5468)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-01-17 13:28:57 UTC (rev 5469)
@@ -23,6 +23,7 @@
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;
@@ -78,8 +79,10 @@
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;
@@ -143,12 +146,20 @@
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;
@@ -305,6 +316,12 @@
}
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());
+ }
}
/**
@@ -386,6 +403,24 @@
}
}
+
+ /*
+ * 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);
}
@@ -1174,8 +1209,8 @@
NodeType nodeType = ntm.getNodeType(contentNodeType);
NodeTypeUtil.checkContentResourceType(nodeType);
- return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName)).put(
- session, path(repoPath), inputStream, fileNodeType, contentNodeType,
+ return new PutCommand(nullResourceLocks, uriInfo.getBaseUriBuilder().path(getClass()).path(repoName),
+ readOnlyMimeTypes).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-01-17 13:16:44 UTC (rev 5468)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java 2012-01-17 13:28:57 UTC (rev 5469)
@@ -24,7 +24,9 @@
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;
@@ -57,6 +59,12 @@
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.
@@ -64,7 +72,15 @@
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>();
}
/**
@@ -76,10 +92,33 @@
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
@@ -231,7 +270,23 @@
{
Node content = node.getNode("jcr:content");
- content.setProperty("jcr:mimeType", mimeType);
+
+ /*
+ 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);
+ }
+
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-01-17 13:16:44 UTC (rev 5468)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/java/org/exoplatform/services/jcr/webdav/command/TestPut.java 2012-01-17 13:28:57 UTC (rev 5469)
@@ -184,6 +184,39 @@
.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-01-17 13:16:44 UTC (rev 5468)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2012-01-17 13:28:57 UTC (rev 5469)
@@ -209,7 +209,12 @@
<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-01-17 13:16:44 UTC (rev 5468)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/protocols/webdav.xml 2012-01-17 13:28:57 UTC (rev 5469)
@@ -1,58 +1,79 @@
-<?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>
@@ -68,7 +89,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 -->
@@ -83,7 +104,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-->
@@ -93,9 +114,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>
@@ -106,8 +127,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>
@@ -117,7 +138,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>
@@ -133,209 +154,313 @@
<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>
14 years, 3 months
exo-jcr SVN: r5468 - jcr/branches/1.15.x/applications/exo.jcr.applications.jonas.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-17 08:16:44 -0500 (Tue, 17 Jan 2012)
New Revision: 5468
Modified:
jcr/branches/1.15.x/applications/exo.jcr.applications.jonas/pom.xml
Log:
EXOJCR-1718: Jonas starup failed
Modified: jcr/branches/1.15.x/applications/exo.jcr.applications.jonas/pom.xml
===================================================================
--- jcr/branches/1.15.x/applications/exo.jcr.applications.jonas/pom.xml 2012-01-17 12:46:53 UTC (rev 5467)
+++ jcr/branches/1.15.x/applications/exo.jcr.applications.jonas/pom.xml 2012-01-17 13:16:44 UTC (rev 5468)
@@ -178,7 +178,7 @@
</fileset>
</copy>
- <delete file="${exo.projects.directory.working}/exo-jonas/externals/commons/jonas/carol/jgroups-all.jar" />
+ <delete file="${exo.projects.directory.working}/exo-jonas/lib/commons/jonas/carol/jgroups-all.jar" />
</tasks>
</configuration>
<dependencies>
14 years, 3 months