exo-jcr SVN: r4250 - in jcr/tags/1.12.8_CP01: applications and 24 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-04-19 06:38:33 -0400 (Tue, 19 Apr 2011)
New Revision: 4250
Modified:
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole.dist/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.browser/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.config/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.fckeditor/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jboss/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jonas/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.rest/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.tomcat/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.cluster.testclient/pom.xml
jcr/tags/1.12.8_CP01/applications/exo.jcr.ear/pom.xml
jcr/tags/1.12.8_CP01/applications/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.ext/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.ftp/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.statistics/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.connectors.localadapter/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.docs/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.framework.command/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.framework.ftpclient/pom.xml
jcr/tags/1.12.8_CP01/exo.jcr.framework.web/pom.xml
jcr/tags/1.12.8_CP01/packaging/module/pom.xml
jcr/tags/1.12.8_CP01/pom.xml
Log:
PLF-1483 update the version number to 1.12.8_CP01
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.backupconsole</artifactId>
<name>eXo JCR :: Applications :: Backup Console</name>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole.dist/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole.dist/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.backupconsole.dist/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.backupconsole.dist</artifactId>
<name>eXo JCR :: Applications :: Backup Console Binary Distribution</name>
@@ -37,7 +37,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.backupconsole</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</dependency>
<dependency>
<groupId>org.exoplatform.jcr</groupId>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.browser/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.browser/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.browser/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.browser</artifactId>
<packaging>war</packaging>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.config/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.config/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.config/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.config</artifactId>
<packaging>pom</packaging>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.fckeditor/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.fckeditor/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.fckeditor/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.fckeditor</artifactId>
<packaging>war</packaging>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jboss/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jboss/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jboss/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -40,7 +40,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.ear</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
<type>ear</type>
<scope>runtime</scope>
</dependency>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jonas/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jonas/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.jonas/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -40,7 +40,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.ear</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
<type>ear</type>
<scope>runtime</scope>
</dependency>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.rest/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.rest/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.rest/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.applications.rest</artifactId>
<packaging>war</packaging>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.tomcat/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.tomcat/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.applications.tomcat/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
<relativePath>exo.jcr.applications.config</relativePath>
</parent>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.cluster.testclient/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.cluster.testclient/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.cluster.testclient/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.cluster.testclient</artifactId>
<name>eXo JCR :: Cluster :: Test Client</name>
Modified: jcr/tags/1.12.8_CP01/applications/exo.jcr.ear/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/exo.jcr.ear/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/exo.jcr.ear/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.ear</artifactId>
<packaging>ear</packaging>
Modified: jcr/tags/1.12.8_CP01/applications/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/applications/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/applications/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,12 +22,12 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jcr-applications-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
<name>eXo JCR :: Applications :: Reactor</name>
<packaging>pom</packaging>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.core/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.component.core</artifactId>
<name>eXo JCR :: Component :: Core Service</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.ext/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.ext/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.component.ext</artifactId>
<name>eXo JCR :: Component :: Extension Service</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.ftp/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.ftp/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.ftp/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.component.ftp</artifactId>
<name>eXo JCR :: Component :: FTP Service</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.statistics/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.statistics/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.statistics/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.component.statistics</artifactId>
<name>eXo JCR :: Component :: Statistics Provider</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.component.webdav/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.component.webdav</artifactId>
<name>eXo JCR :: Component :: Webdav Service</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.connectors.localadapter/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.connectors.localadapter/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.connectors.localadapter/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.connectors.localadapter</artifactId>
<packaging>rar</packaging>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.docs.developer</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.docs/exo.jcr.docs.developer/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.docs</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.docs/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.docs/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.docs/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.framework.command/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.framework.command/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.framework.command/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.framework.command</artifactId>
<name>eXo JCR :: Framework :: Command</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.framework.ftpclient/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.framework.ftpclient/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.framework.ftpclient/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.framework.ftpclient</artifactId>
<name>eXo JCR :: Framework :: FTP Client</name>
Modified: jcr/tags/1.12.8_CP01/exo.jcr.framework.web/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/exo.jcr.framework.web/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/exo.jcr.framework.web/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>exo.jcr.framework.web</artifactId>
<name>eXo JCR :: Framework :: Web</name>
Modified: jcr/tags/1.12.8_CP01/packaging/module/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/packaging/module/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/packaging/module/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -4,7 +4,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
</parent>
<artifactId>jcr.packaging.module</artifactId>
<packaging>pom</packaging>
Modified: jcr/tags/1.12.8_CP01/pom.xml
===================================================================
--- jcr/tags/1.12.8_CP01/pom.xml 2011-04-19 10:13:07 UTC (rev 4249)
+++ jcr/tags/1.12.8_CP01/pom.xml 2011-04-19 10:38:33 UTC (rev 4250)
@@ -29,7 +29,7 @@
<groupId>org.exoplatform.jcr</groupId>
<artifactId>jcr-parent</artifactId>
- <version>1.12.8-GA</version>
+ <version>1.12.8_CP01</version>
<packaging>pom</packaging>
<name>eXo JCR</name>
15 years
exo-jcr SVN: r4249 - jcr/tags.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-04-19 06:13:07 -0400 (Tue, 19 Apr 2011)
New Revision: 4249
Added:
jcr/tags/1.12.8_CP01/
Log:
PLF-1483 copy the tag 1.12.8-GA
15 years
exo-jcr SVN: r4248 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-04-19 03:34:38 -0400 (Tue, 19 Apr 2011)
New Revision: 4248
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java
Log:
EXOJCR-1294 : The creation sessions from custom ACLs was implemented.
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/DynamicIdentity.java 2011-04-19 07:34:38 UTC (rev 4248)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.access;
+
+import org.exoplatform.services.security.IdentityConstants;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2011
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: FakeUserIdentity.java 111 2011-11-11 11:11:11Z rainf0x $
+ */
+public class DynamicIdentity
+ extends IdentityConstants
+{
+ public static final String DYNAMIC = "__dynamic".intern();
+}
15 years
exo-jcr SVN: r4247 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core and 9 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-04-19 03:09:35 -0400 (Tue, 19 Apr 2011)
New Revision: 4247
Added:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
jcr/trunk/exo.jcr.component.ext/src/test/resources/test.policy
Log:
EXOJCR-1294 : The creation sessions from custom ACLs was implemented.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -192,7 +192,9 @@
}
else if (user.isMemberOf(ace.getMembershipEntry()))
+ {
return true;
+ }
}
}
return false;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -23,9 +23,11 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
+import org.exoplatform.services.security.MembershipEntry;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collection;
import javax.jcr.NamespaceRegistry;
import javax.jcr.NoSuchWorkspaceException;
@@ -127,6 +129,15 @@
Session getSystemSession(String workspaceName) throws RepositoryException;
/**
+ * @param workspaceName - name of workspace
+ * @param membershipEntries - list of memberships
+ * @return the Dynamic session (session with Dynamic identity)
+ * @throws RepositoryException
+ */
+ Session getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException;
+
+ /**
* @return array of workspace names
*/
String[] getWorkspaceNames();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -26,6 +26,8 @@
{
public static final RuntimePermission CREATE_SYSTEM_SESSION_PERMISSION = new RuntimePermission("createSystemSession");
+
+ public static final RuntimePermission CREATE_DYNAMIC_SESSION_PERMISSION = new RuntimePermission("createDynamicSession");
public static final RuntimePermission INVOKE_INTERNAL_API_PERMISSION = new RuntimePermission("invokeInternalAPI");
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -20,6 +20,7 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.access.AuthenticationPolicy;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -41,6 +42,8 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.MembershipEntry;
import org.picocontainer.ComponentAdapter;
import java.io.IOException;
@@ -51,6 +54,7 @@
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -84,7 +88,7 @@
*/
private static final CredentialsImpl SYSTEM_CREDENTIALS = new CredentialsImpl(SystemIdentity.SYSTEM,
"".toCharArray());
-
+
/**
* Logger.
*/
@@ -396,6 +400,29 @@
}
/**
+ * {@inheritDoc}
+ */
+ public SessionImpl getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException
+ {
+
+ if (getState() == OFFLINE)
+ LOG.warn("Repository " + getName() + " is OFFLINE.");
+
+ WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(workspaceName);
+ if (workspaceContainer == null || !workspaceContainer.getWorkspaceInitializer().isWorkspaceInitialized())
+ {
+ throw new RepositoryException("Workspace " + workspaceName + " not found or workspace is not initialized");
+ }
+
+ SessionFactory sessionFactory = workspaceContainer.getSessionFactory();
+
+ Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);
+
+ return sessionFactory.createSession(new ConversationState(id));
+ }
+
+ /**
* @return system workspace name as it configured in jcr configuration
*/
public String getSystemWorkspaceName()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -21,6 +21,7 @@
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManager;
@@ -132,6 +133,15 @@
security.checkPermission(JCRRuntimePermissions.CREATE_SYSTEM_SESSION_PERMISSION);
}
}
+ else if (DynamicIdentity.DYNAMIC.equals(user.getIdentity().getUserId()))
+ {
+ // Need privileges to get Dynamic session.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.CREATE_DYNAMIC_SESSION_PERMISSION);
+ }
+ }
if (tService == null)
{
if (SessionReference.isStarted())
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -25,10 +25,12 @@
import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
+import org.exoplatform.services.security.MembershipEntry;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
+import java.util.Collection;
import javax.jcr.Credentials;
import javax.jcr.LoginException;
@@ -133,6 +135,18 @@
/*
* (non-Javadoc)
* @see
+ * org.exoplatform.services.jcr.core.ManageableRepository#getDynamicSession
+ * (java.lang.String)
+ */
+ public Session getDynamicSession(String workspaceName, Collection<MembershipEntry> membershipEntries)
+ throws RepositoryException
+ {
+ return delegatee.getDynamicSession(workspaceName, membershipEntries);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
* org.exoplatform.services.jcr.core.ManageableRepository#getWorkspaceNames()
*/
public String[] getWorkspaceNames()
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -23,9 +23,13 @@
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.security.MembershipEntry;
import java.security.AccessControlException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
import javax.jcr.Session;
@@ -72,7 +76,7 @@
public void testUser() throws Exception
{
// Mary only node, Mary membership is '*:/exo', seems it's user
- NodeImpl maryNode = (NodeImpl)testRoot.addNode("mary");
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary");
maryNode.addMixin("exo:privilegeable");
if (!session.getUserID().equals("mary"))
{
@@ -175,4 +179,100 @@
}
}
+ /**
+ * Check if Dynamic user has rights to a node with user "mary".
+ *
+ * @throws Exception
+ */
+ public void testDynamicUserRead() throws Exception
+ {
+ // Mary only node, Mary membership is '*:/platform/users', seems it's user
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary_dynamic");
+ maryNode.addMixin("exo:privilegeable");
+ if (!session.getUserID().equals("mary"))
+ {
+ maryNode.setPermission("*:/platform/users", new String[] {PermissionType.READ});
+ maryNode.setPermission("mary", PermissionType.ALL);
+ maryNode.removePermission(session.getUserID());
+ }
+ maryNode.removePermission(SystemIdentity.ANY);
+ testRoot.save();
+
+ Session marySession =
+ repository.login(new CredentialsImpl("mary", "exo".toCharArray()), session.getWorkspace().getName());
+ NodeImpl myNode = (NodeImpl) marySession.getItem(maryNode.getPath());
+ Node test = myNode.addNode("test");
+ test.setProperty("property", "any data");
+ myNode.save();
+
+ //Dynamic session fail read
+ List<MembershipEntry> dynamicMembershipEntries = new ArrayList<MembershipEntry>();
+ dynamicMembershipEntries.add(new MembershipEntry("/platform/administrators"));
+
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ fail("Dynamic session with membership '*:/platform/users' should not read node with membership '*:/platform/users'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //Dynamic session successful read
+ dynamicMembershipEntries = new ArrayList<MembershipEntry>();
+ dynamicMembershipEntries.add(new MembershipEntry("/platform/users"));
+
+ //check get
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+
+ e.printStackTrace();
+ fail("Dynamic session with membership '*:/platform/users' should read node with membership '*:/platform/users'. Exception message :"
+ + e.getMessage());
+ }
+
+ //check add
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.addNode("test2");
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not add child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //check remove
+ try
+ {
+ Session dynamicSession =
+ repository.getDynamicSession(session.getWorkspace().getName(), dynamicMembershipEntries);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.getNode("test").remove();
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not remove child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy 2011-04-19 07:09:35 UTC (rev 4247)
@@ -8,6 +8,7 @@
grant codeBase "@TEST_CLASSES@-"{
permission java.lang.RuntimePermission "createSystemSession";
+ permission java.lang.RuntimePermission "createDynamicSession";
permission java.lang.RuntimePermission "manageRepository";
permission java.lang.RuntimePermission "accessRPCService";
permission java.lang.RuntimePermission "invokeInternalAPI";
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.ext.common;
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.DynamicIdentity;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedSession;
import org.exoplatform.services.jcr.core.ManageableRepository;
@@ -28,6 +30,7 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import javax.jcr.LoginException;
@@ -113,6 +116,29 @@
return new SessionProvider(new ConversationState(id));
}
+ public static SessionProvider createProvider(List<AccessControlEntry> accessList)
+ {
+ if (accessList == null || accessList.isEmpty())
+ {
+ return createAnonimProvider();
+ }
+ else
+ {
+ HashSet<MembershipEntry> membershipEntries = new HashSet<MembershipEntry>();
+
+ for (AccessControlEntry ace : accessList)
+ {
+ membershipEntries.add(ace.getMembershipEntry());
+ }
+
+ Identity id = new Identity(DynamicIdentity.DYNAMIC, membershipEntries);
+ ConversationState conversationState = new ConversationState(id);
+ ConversationState.setCurrent(conversationState);
+ return new SessionProvider(conversationState);
+ }
+
+ }
+
/**
* Gets the session from internal cache or creates and caches new one.
*
@@ -142,11 +168,19 @@
if (session == null)
{
-
- if (!isSystem)
+ ConversationState conversationState = ConversationState.getCurrent();
+ if (conversationState != null && conversationState.getIdentity().getUserId().equals(DynamicIdentity.DYNAMIC))
+ {
+ session = (ExtendedSession) repository.getDynamicSession(workspaceName, conversationState.getIdentity().getMemberships());
+ }
+ else if (!isSystem)
+ {
session = (ExtendedSession)repository.login(workspaceName);
+ }
else
+ {
session = (ExtendedSession)repository.getSystemSession(workspaceName);
+ }
session.registerLifecycleListener(this);
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/BaseStandaloneTest.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -54,6 +54,7 @@
import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
+import javax.jcr.Session;
import javax.jcr.ValueFactory;
import javax.jcr.Workspace;
@@ -160,10 +161,10 @@
log.info("tearDown() BEGIN " + getClass().getName() + "." + getName());
if (session != null)
{
+ Session sysSession = repository.getSystemSession(session.getWorkspace().getName());
try
{
- session.refresh(false);
- Node rootNode = session.getRootNode();
+ Node rootNode = sysSession.getRootNode();
if (rootNode.hasNodes())
{
// clean test root
@@ -177,7 +178,7 @@
node.remove();
}
}
- session.save();
+ sysSession.save();
}
}
catch (Exception e)
@@ -187,6 +188,7 @@
}
finally
{
+ sysSession.logout();
session.logout();
}
}
Added: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java 2011-04-19 07:09:35 UTC (rev 4247)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.ext.common;
+
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.PermissionType;
+import org.exoplatform.services.jcr.access.SystemIdentity;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
+import org.exoplatform.services.jcr.ext.common.SessionProvider;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Session;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2011
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: DynamicSessionProviderTest.java 111 2011-11-11 11:11:11Z rainf0x $
+ */
+public class DynamicSessionProviderTest
+ extends BaseStandaloneTest
+{
+ private NodeImpl testRoot;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ testRoot = (NodeImpl)root.addNode("testDynamicSession");
+ root.save();
+ }
+
+ public void testDynamicSession() throws Exception
+ {
+ // Mary only node, Mary membership is '*:/platform/users', seems it's user
+ NodeImpl maryNode = (NodeImpl) testRoot.addNode("mary_dynamic");
+ maryNode.addMixin("exo:privilegeable");
+ if (!session.getUserID().equals("mary"))
+ {
+ maryNode.setPermission("*:/platform/users", new String[] {PermissionType.READ});
+ maryNode.setPermission("mary", PermissionType.ALL);
+ maryNode.removePermission(session.getUserID());
+ }
+ maryNode.removePermission(SystemIdentity.ANY);
+ testRoot.save();
+
+ Session marySession =
+ repository.login(new CredentialsImpl("mary", "exo".toCharArray()), session.getWorkspace().getName());
+ NodeImpl myNode = (NodeImpl) marySession.getItem(maryNode.getPath());
+ NodeImpl test = (NodeImpl) myNode.addNode("test");
+ test.setProperty("property", "any data");
+ myNode.save();
+ marySession.logout();
+
+ //Dynamic session fail read
+ List<AccessControlEntry> accessControlEntries = new ArrayList<AccessControlEntry>();
+ accessControlEntries.add(new AccessControlEntry("*:/platform/administrators", "READ"));
+ SessionProvider dynamicProvider = SessionProvider.createProvider(accessControlEntries);
+
+ Session dynamicSession = null;
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ fail("Dynamic session with membership '*:/platform/users' should not read node with membership '*:/platform/users'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //Dynamic session successful read
+ accessControlEntries = new ArrayList<AccessControlEntry>();
+ accessControlEntries.add(new AccessControlEntry("*:/platform/users", "READ"));
+ dynamicProvider = SessionProvider.createProvider(accessControlEntries);
+
+ //check get
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+ //ok
+ }
+ catch (AccessDeniedException e)
+ {
+
+ e.printStackTrace();
+ fail("Dynamic session with membership '*:/platform/users' should read node with membership '*:/platform/users'. Exception message :"
+ + e.getMessage());
+ }
+
+ //check add
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.addNode("test2");
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not add child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+
+ //check remove
+ try
+ {
+ dynamicSession = dynamicProvider.getSession(session.getWorkspace().getName(), repository);
+ NodeImpl maryNodeDynamic = (NodeImpl) dynamicSession.getItem(maryNode.getPath());
+
+ maryNodeDynamic.getNode("test").remove();
+ maryNodeDynamic.save();
+ fail("Dynamic session with membership '*:/platform/users' should be not remove child node with membership '*:/platform/users READ'");
+ }
+ catch (AccessDeniedException e)
+ {
+ //ok
+ }
+ }
+}
Modified: jcr/trunk/exo.jcr.component.ext/src/test/resources/test.policy
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/test.policy 2011-04-18 12:38:22 UTC (rev 4246)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/test.policy 2011-04-19 07:09:35 UTC (rev 4247)
@@ -8,6 +8,7 @@
grant codeBase "@TEST_CLASSES@-"{
permission java.lang.RuntimePermission "createSystemSession";
+ permission java.lang.RuntimePermission "createDynamicSession";
permission java.lang.RuntimePermission "manageRepository";
permission java.lang.RuntimePermission "invokeInternalAPI";
permission java.lang.RuntimePermission "accessRPCService";
15 years
exo-jcr SVN: r4246 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-18 08:38:22 -0400 (Mon, 18 Apr 2011)
New Revision: 4246
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
Log:
EXOJCR-1292: Allow to know the current repository status
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-18 12:28:50 UTC (rev 4245)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-18 12:38:22 UTC (rev 4246)
@@ -237,7 +237,10 @@
{
try
{
- component.resume();
+ if (component.isSuspended())
+ {
+ component.resume();
+ }
}
catch (ResumeException e)
{
15 years
exo-jcr SVN: r4245 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-18 08:28:50 -0400 (Mon, 18 Apr 2011)
New Revision: 4245
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
Log:
EXOJCR-1292: Allow to know the current repository status
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-18 11:50:55 UTC (rev 4244)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-18 12:28:50 UTC (rev 4245)
@@ -242,4 +242,9 @@
delegatee.setState(state);
}
+ public String getStateTitle()
+ {
+ return delegatee.getStateTitle();
+ }
+
}
15 years
exo-jcr SVN: r4244 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-18 07:50:55 -0400 (Mon, 18 Apr 2011)
New Revision: 4244
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
Log:
EXOJCR-1292: Allow to know the current repository status
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-18 11:19:31 UTC (rev 4243)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-18 11:50:55 UTC (rev 4244)
@@ -179,4 +179,11 @@
*/
int getState();
+ /**
+ * Returns the string representation of current repository state.
+ *
+ * @return repository state
+ */
+ String getStateTitle();
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-18 11:19:31 UTC (rev 4243)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-18 11:50:55 UTC (rev 4244)
@@ -180,7 +180,7 @@
case ManageableRepository.OFFLINE :
break;
case ManageableRepository.READONLY :
- setReadOnly();
+ setReadOnly(true);
break;
case ManageableRepository.SUSPENDED :
suspend();
@@ -193,12 +193,12 @@
/**
* Set all components readonly.
*/
- private void setReadOnly()
+ private void setReadOnly(boolean readOnly)
{
List<ReadOnlySupport> components = getComponentInstancesOfType(ReadOnlySupport.class);
for (ReadOnlySupport component : components)
{
- component.setReadOnly(true);
+ component.setReadOnly(readOnly);
}
}
@@ -224,29 +224,20 @@
}
/**
- * Set all components online.
+ * Suspend all components in workspace.
*
* @throws RepositoryException
*/
- private void setOnline() throws RepositoryException
+ private void resume() throws RepositoryException
{
- List<ReadOnlySupport> readOnlyComponents = getComponentInstancesOfType(ReadOnlySupport.class);
- for (ReadOnlySupport component : readOnlyComponents)
- {
- component.setReadOnly(false);
- }
+ List<Suspendable> components = getComponentInstancesOfType(Suspendable.class);
+ Collections.reverse(components);
- List<Suspendable> suspendableComponents = getComponentInstancesOfType(Suspendable.class);
- Collections.reverse(suspendableComponents);
-
- for (Suspendable component : suspendableComponents)
+ for (Suspendable component : components)
{
try
{
- if (component.isSuspended())
- {
- component.resume();
- }
+ component.resume();
}
catch (ResumeException e)
{
@@ -255,4 +246,14 @@
}
}
+ /**
+ * Set all components online.
+ *
+ * @throws RepositoryException
+ */
+ private void setOnline() throws RepositoryException
+ {
+ setReadOnly(false);
+ resume();
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java 2011-04-18 11:19:31 UTC (rev 4243)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java 2011-04-18 11:50:55 UTC (rev 4244)
@@ -121,7 +121,7 @@
@ManagedDescription("Returns repository state.")
public String getState()
{
- return repository.toString();
+ return repository.getStateTitle();
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-18 11:19:31 UTC (rev 4243)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-18 11:50:55 UTC (rev 4244)
@@ -692,32 +692,32 @@
/**
* {@inheritDoc}
*/
- @Override
- public String toString()
+ public String getStateTitle()
{
- String stateTitle;
switch (getState())
{
case ONLINE :
- stateTitle = "online";
- break;
+ return "online";
case OFFLINE :
- stateTitle = "offline";
- break;
+ return "offline";
case READONLY :
- stateTitle = "readonly";
- break;
+ return "readonly";
case SUSPENDED :
- stateTitle = "suspended";
- break;
+ return "suspended";
default :
- stateTitle = "undefined";
- break;
+ return "undefined";
}
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
String defaultWorkspaceName = config.getDefaultWorkspaceName();
return String.format(
"Repository {\n name: %s;\n system workspace: %s;\n default workspace: %s;\n workspaces: %s;\n state: %s \n}",
- name, systemWorkspaceName, defaultWorkspaceName, Arrays.toString(getWorkspaceNames()), stateTitle);
+ name, systemWorkspaceName, defaultWorkspaceName, Arrays.toString(getWorkspaceNames()), getStateTitle());
}
}
15 years
exo-jcr SVN: r4243 - jcr/trunk/exo.jcr.component.core.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-04-18 07:19:31 -0400 (Mon, 18 Apr 2011)
New Revision: 4243
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
EXOJCR-1308: System properties have been added to prevent failing tests on some Linux distribution due to JGroups
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-04-18 09:37:53 UTC (rev 4242)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-04-18 11:19:31 UTC (rev 4243)
@@ -396,11 +396,26 @@
<name>jbosscache-shareable</name>
<value>${jbosscache.shareable}</value>
</property>
- <!-- Uncomment the line below if you want to enable the statistics -->
- <!--property>
- <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
- <value>true</value>
- </property-->
+ <!-- Uncomment the line below if you want to enable the statistics -->
+ <!--property>
+ <name>JDBCWorkspaceDataContainer.statistics.enabled</name>
+ <value>true</value>
+ </property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>org/exoplatform/services/jcr/api/**/Test*.java</include>
@@ -605,6 +620,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>org/apache/jackrabbit/test/api/*Test.java</include>
@@ -682,6 +712,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<!-- From default tests -->
@@ -761,6 +806,21 @@
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>true</value>
</property-->
+ <!-- We add this system property due to some incompatibility between IPv6 and
+ some JVM of Linux distributions such as Ubuntu and Fedora-->
+ <property>
+ <name>java.net.preferIPv4Stack</name>
+ <value>true</value>
+ </property>
+ <!-- Avoid the firewall -->
+ <property>
+ <name>bind.address</name>
+ <value>127.0.0.1</value>
+ </property>
+ <property>
+ <name>jgroups.stack</name>
+ <value>udp</value>
+ </property>
</systemProperties>
<includes>
<include>**/**/reading_/Test*.java</include>
15 years
exo-jcr SVN: r4242 - in jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl: rdbms and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-18 05:37:53 -0400 (Mon, 18 Apr 2011)
New Revision: 4242
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
Log:
EXOJCR-1292: Allow to know the current repository status
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-04-18 07:58:53 UTC (rev 4241)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingRepositorySameConfigRestore.java 2011-04-18 09:37:53 UTC (rev 4242)
@@ -18,8 +18,10 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.ext.backup.BackupChainLog;
import org.exoplatform.services.jcr.ext.backup.RepositoryBackupChainLog;
@@ -29,8 +31,6 @@
import org.exoplatform.services.jcr.impl.backup.DataRestor;
import org.exoplatform.services.jcr.impl.backup.JCRRestor;
import org.exoplatform.services.jcr.impl.backup.JdbcBackupable;
-import org.exoplatform.services.jcr.impl.backup.ResumeException;
-import org.exoplatform.services.jcr.impl.backup.Suspendable;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
@@ -39,10 +39,10 @@
import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.jcr.RepositoryException;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
import javax.sql.DataSource;
@@ -77,9 +77,6 @@
// list of data restorers
List<DataRestor> dataRestorer = new ArrayList<DataRestor>();
- // the list of components to resume
- List<Suspendable> resumeComponents = new ArrayList<Suspendable>();
-
try
{
WorkspaceEntry wsEntry = repositoryEntry.getWorkspaceEntries().get(0);
@@ -107,20 +104,8 @@
jdbcConn.setAutoCommit(false);
}
- // suspend all components
- for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
- {
- List<Suspendable> suspendableComponents =
- repositoryService.getRepository(this.repositoryEntry.getName()).getWorkspaceContainer(wEntry.getName())
- .getComponentInstancesOfType(Suspendable.class);
+ repositoryService.getRepository(this.repositoryEntry.getName()).setState(ManageableRepository.SUSPENDED);
- for (Suspendable component : suspendableComponents)
- {
- component.suspend();
- resumeComponents.add(0, component); // ensure that first component will be resumed as last
- }
- }
-
// collect all restorers
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
@@ -161,21 +146,8 @@
}
// resume components
- Iterator<Suspendable> iter = resumeComponents.iterator();
- while (iter.hasNext())
- {
- try
- {
- iter.next().resume();
- }
- catch (ResumeException e)
- {
- log.error("Can't resume component", e);
- }
+ repositoryService.getRepository(this.repositoryEntry.getName()).setState(ManageableRepository.ONLINE);
- iter.remove();
- }
-
// incremental restore
for (WorkspaceEntry wEntry : repositoryEntry.getWorkspaceEntries())
{
@@ -232,17 +204,18 @@
}
}
- for (Suspendable component : resumeComponents)
+ try
{
- try
- {
- component.resume();
- }
- catch (ResumeException e)
- {
- log.error("Can't resume component " + component.getClass(), e);
- }
+ repositoryService.getRepository(this.repositoryEntry.getName()).setState(ManageableRepository.ONLINE);
}
+ catch (RepositoryException e)
+ {
+ log.error("Can't resume repository", e);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ log.error("Can't resume repository", e);
+ }
}
}
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-04-18 07:58:53 UTC (rev 4241)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceSameConfigRestore.java 2011-04-18 09:37:53 UTC (rev 4242)
@@ -17,7 +17,9 @@
package org.exoplatform.services.jcr.ext.backup.impl;
import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.ext.backup.BackupChainLog;
import org.exoplatform.services.jcr.ext.backup.BackupManager;
@@ -26,8 +28,6 @@
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestor;
import org.exoplatform.services.jcr.impl.backup.JCRRestor;
-import org.exoplatform.services.jcr.impl.backup.ResumeException;
-import org.exoplatform.services.jcr.impl.backup.Suspendable;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.log.ExoLogger;
@@ -35,9 +35,10 @@
import java.io.File;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import javax.jcr.RepositoryException;
+
/**
* Created by The eXo Platform SAS.
*
@@ -71,22 +72,11 @@
// list of data restorers
List<DataRestor> dataRestorer = new ArrayList<DataRestor>();
- // the list of components to resume
- List<Suspendable> resumeComponents = new ArrayList<Suspendable>();
-
try
{
- // suspend all components
- List<Suspendable> suspendableComponents =
- repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
- .getComponentInstancesOfType(Suspendable.class);
+ repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
+ .setState(ManageableRepository.SUSPENDED);
- for (Suspendable component : suspendableComponents)
- {
- component.suspend();
- resumeComponents.add(0, component); // ensure that first component will be resumed as last
- }
-
// get all restorers
List<Backupable> backupable =
repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
@@ -115,22 +105,9 @@
restorer.commit();
}
- // resume components
- Iterator<Suspendable> iter = resumeComponents.iterator();
- while (iter.hasNext())
- {
- try
- {
- iter.next().resume();
- }
- catch (ResumeException e)
- {
- log.error("Can't resume component", e);
- }
+ repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
+ .setState(ManageableRepository.ONLINE);
- iter.remove();
- }
-
// incremental restore
DataManager dataManager =
(WorkspacePersistentDataManager)repositoryService.getRepository(repositoryName)
@@ -178,17 +155,19 @@
}
}
- for (Suspendable component : resumeComponents)
+ try
{
- try
- {
- component.resume();
- }
- catch (ResumeException e)
- {
- log.error("Can't resume component", e);
- }
+ repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
+ .setState(ManageableRepository.ONLINE);
}
+ catch (RepositoryException e)
+ {
+ log.error("Can't resume component", e);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ log.error("Can't resume component", e);
+ }
}
}
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java 2011-04-18 07:58:53 UTC (rev 4241)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/rdbms/FullBackupJob.java 2011-04-18 09:37:53 UTC (rev 4242)
@@ -19,16 +19,12 @@
package org.exoplatform.services.jcr.ext.backup.impl.rdbms;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.backup.BackupConfig;
import org.exoplatform.services.jcr.ext.backup.impl.AbstractFullBackupJob;
import org.exoplatform.services.jcr.ext.backup.impl.FileNameProducer;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
-import org.exoplatform.services.jcr.impl.backup.ResumeException;
-import org.exoplatform.services.jcr.impl.backup.SuspendException;
-import org.exoplatform.services.jcr.impl.backup.Suspendable;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -36,7 +32,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@@ -54,11 +49,6 @@
protected static Log log = ExoLogger.getLogger("exo.jcr.component.ext.FullBackupJob");
/**
- * Workspace configuration.
- */
- private WorkspaceEntry workspaceEntry;
-
- /**
* {@inheritDoc}
*/
@Override
@@ -104,35 +94,10 @@
{
notifyListeners();
- List<Suspendable> suspendableComponents =
- repository.getWorkspaceContainer(workspaceName).getComponentInstancesOfType(Suspendable.class);
-
- // the list of components to resume
- List<Suspendable> resumeComponents = new ArrayList<Suspendable>();
-
try
{
- for (WorkspaceEntry entry : repository.getConfiguration().getWorkspaceEntries())
- {
- if (entry.getName().equals(workspaceName))
- {
- workspaceEntry = entry;
- break;
- }
- }
+ repository.getWorkspaceContainer(workspaceName).setState(ManageableRepository.SUSPENDED);
- if (workspaceEntry == null)
- {
- throw new RepositoryException("Workpace [" + workspaceName + "] is absent in repository configuration");
- }
-
- // suspend all components
- for (Suspendable component : suspendableComponents)
- {
- component.suspend();
- resumeComponents.add(0, component); // ensure that first component will be resumed as last
- }
-
List<Backupable> backupableComponents =
repository.getWorkspaceContainer(workspaceName).getComponentInstancesOfType(Backupable.class);
@@ -142,11 +107,6 @@
component.backup(new File(getStorageURL().getFile()));
}
}
- catch (SuspendException e)
- {
- log.error("Full backup failed " + getStorageURL().getPath(), e);
- notifyError("Full backup failed", e);
- }
catch (BackupException e)
{
log.error("Full backup failed " + getStorageURL().getPath(), e);
@@ -159,18 +119,15 @@
}
finally
{
- for (Suspendable component : resumeComponents)
+ try
{
- try
- {
- component.resume();
- }
- catch (ResumeException e)
- {
- log.error("Full backup failed " + getStorageURL().getPath(), e);
- notifyError("Full backup failed", e);
- }
+ repository.getWorkspaceContainer(workspaceName).setState(ManageableRepository.ONLINE);
}
+ catch (RepositoryException e)
+ {
+ log.error("Full backup failed " + getStorageURL().getPath(), e);
+ notifyError("Full backup failed", e);
+ }
}
state = FINISHED;
15 years
exo-jcr SVN: r4241 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: dataflow and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-18 03:58:53 -0400 (Mon, 18 Apr 2011)
New Revision: 4241
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Suspendable.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
Log:
EXOJCR-1292: Allow to know the current repository status
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -60,6 +60,16 @@
final int READONLY = 2;
/**
+ * Repository SUSPENDED status.
+ */
+ final int SUSPENDED = 3;
+
+ /**
+ * Repository UNDEFINED status.
+ */
+ final int UNDEFINED = 4;
+
+ /**
* Add the items persistence listener to the named workspace.
*
* @param workspaceName - name of workspace
@@ -160,7 +170,7 @@
*
* @param repository state
*/
- void setState(int state);
+ void setState(int state) throws RepositoryException;
/**
* Returns repository state.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/WorkspaceContainerFacade.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -18,10 +18,18 @@
*/
package org.exoplatform.services.jcr.core;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
+import org.exoplatform.services.jcr.impl.ReadOnlySupport;
import org.exoplatform.services.jcr.impl.WorkspaceContainer;
+import org.exoplatform.services.jcr.impl.backup.ResumeException;
+import org.exoplatform.services.jcr.impl.backup.SuspendException;
+import org.exoplatform.services.jcr.impl.backup.Suspendable;
+import java.util.Collections;
import java.util.List;
+import javax.jcr.RepositoryException;
+
/**
* Created by The eXo Platform SAS .<br/> An entry point to the implementation, used for extending
* functionality
@@ -92,4 +100,159 @@
{
container.registerComponentInstance(key, component);
}
+
+ /**
+ * Returns current workspace state.
+ *
+ * @param state
+ * @throws RepositoryException
+ */
+ public int getState()
+ {
+ boolean hasROComponents = false;
+ boolean hasRWComponents = false;
+ List<ReadOnlySupport> readOnlyComponents = getComponentInstancesOfType(ReadOnlySupport.class);
+ for (ReadOnlySupport component : readOnlyComponents)
+ {
+ if (component.isReadOnly())
+ {
+ hasROComponents = true;
+ }
+ else
+ {
+ hasRWComponents = true;
+ }
+ }
+
+ boolean hasSuspendedComponents = false;
+ boolean hasResumedComponents = false;
+ List<Suspendable> suspendableComponents = getComponentInstancesOfType(Suspendable.class);
+ for (Suspendable component : suspendableComponents)
+ {
+ if (component.isSuspended())
+ {
+ hasSuspendedComponents = true;
+ }
+ else
+ {
+ hasResumedComponents = true;
+ }
+ }
+
+ if (hasSuspendedComponents && !hasResumedComponents && !hasROComponents)
+ {
+ return ManageableRepository.SUSPENDED;
+ }
+ else if (hasROComponents && !hasRWComponents && !hasSuspendedComponents)
+ {
+ return ManageableRepository.READONLY;
+ }
+ else if (!hasSuspendedComponents && !hasROComponents)
+ {
+ return ManageableRepository.ONLINE;
+ }
+ else
+ {
+ return ManageableRepository.UNDEFINED;
+ }
+ }
+
+ /**
+ * Set new workspace state.
+ *
+ * @param state
+ * @throws RepositoryException
+ */
+ public void setState(int state) throws RepositoryException
+ {
+ // Need privileges to manage repository.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
+ switch (state)
+ {
+ case ManageableRepository.ONLINE :
+ setOnline();
+ break;
+ case ManageableRepository.OFFLINE :
+ break;
+ case ManageableRepository.READONLY :
+ setReadOnly();
+ break;
+ case ManageableRepository.SUSPENDED :
+ suspend();
+ break;
+ default :
+ return;
+ }
+ }
+
+ /**
+ * Set all components readonly.
+ */
+ private void setReadOnly()
+ {
+ List<ReadOnlySupport> components = getComponentInstancesOfType(ReadOnlySupport.class);
+ for (ReadOnlySupport component : components)
+ {
+ component.setReadOnly(true);
+ }
+ }
+
+ /**
+ * Suspend all components in workspace.
+ *
+ * @throws RepositoryException
+ */
+ private void suspend() throws RepositoryException
+ {
+ List<Suspendable> components = getComponentInstancesOfType(Suspendable.class);
+ for (Suspendable component : components)
+ {
+ try
+ {
+ component.suspend();
+ }
+ catch (SuspendException e)
+ {
+ throw new RepositoryException("Can't suspend component", e);
+ }
+ }
+ }
+
+ /**
+ * Set all components online.
+ *
+ * @throws RepositoryException
+ */
+ private void setOnline() throws RepositoryException
+ {
+ List<ReadOnlySupport> readOnlyComponents = getComponentInstancesOfType(ReadOnlySupport.class);
+ for (ReadOnlySupport component : readOnlyComponents)
+ {
+ component.setReadOnly(false);
+ }
+
+ List<Suspendable> suspendableComponents = getComponentInstancesOfType(Suspendable.class);
+ Collections.reverse(suspendableComponents);
+
+ for (Suspendable component : suspendableComponents)
+ {
+ try
+ {
+ if (component.isSuspended())
+ {
+ component.resume();
+ }
+ }
+ catch (ResumeException e)
+ {
+ throw new RepositoryException("Can't resume component", e);
+ }
+ }
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PersistentDataManager.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
+import org.exoplatform.services.jcr.impl.ReadOnlySupport;
/**
* Created by The eXo Platform SAS.
@@ -29,7 +30,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id: PersistentDataManager.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-public interface PersistentDataManager extends DataManager
+public interface PersistentDataManager extends DataManager, ReadOnlySupport
{
void addItemPersistenceListener(ItemsPersistenceListener listener);
@@ -40,29 +41,4 @@
void removeItemPersistenceListenerFilter(ItemsPersistenceListenerFilter filter);
- /**
- * Status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @return true - if write-operations allowed, false - otherwise.
- */
- boolean isReadOnly();
-
- /**
- * Set status of write-operations restrictions.
- *
- * Read-only status is descriptive within the container, i.e. will not prevent any write
- * operation.
- *
- * Used in DataManager implementations.
- *
- * @param status
- * , true - if write-operations allowed, false - otherwise.
- */
- void setReadOnly(boolean status);
-
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ReadOnlySupport.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 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;
+
+/**
+ * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
+ * @version $Id: ReadOnlySupport.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public interface ReadOnlySupport
+{
+
+ /**
+ * Status of write-operations restrictions.
+ *
+ * Read-only status is descriptive within the container, i.e. will not prevent any write
+ * operation.
+ *
+ * Used in DataManager implementations.
+ *
+ * @return true - if write-operations allowed, false - otherwise.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Set status of write-operations restrictions.
+ *
+ * Read-only status is descriptive within the container, i.e. will not prevent any write
+ * operation.
+ *
+ * Used in DataManager implementations.
+ *
+ * @param status
+ * , true - if write-operations allowed, false - otherwise.
+ */
+ void setReadOnly(boolean status);
+
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -34,7 +34,6 @@
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.jcr.impl.backup.RepositorySuspendController;
import org.exoplatform.services.jcr.impl.core.AddNamespacePluginHolder;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.NamespaceDataPersister;
Copied: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java (from rev 4234, jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositorySuspendController.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2009 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;
+
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.picocontainer.Startable;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Allows via JMX suspend and resume repository's components.
+ *
+ * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
+ * @version $Id: RepositorySuspendController.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+@Managed
+@NameTemplate(@Property(key = "service", value = "RepositorySuspendController"))
+public class RepositorySuspendController implements Startable
+{
+ /**
+ * The current repository.
+ */
+ private final ManageableRepository repository;
+
+ /**
+ * Logger.
+ */
+ protected static Log log = ExoLogger.getLogger("exo.jcr.component.core.RepositorySuspendController");
+
+ /**
+ * RepositoryController constructor.
+ */
+ public RepositorySuspendController(ManageableRepository repository)
+ {
+ this.repository = repository;
+ }
+
+ /**
+ * Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.
+ *
+ * @return repository state
+ */
+ @Managed
+ @ManagedDescription("Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.")
+ public String suspend()
+ {
+ // Need privileges to manage repository.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
+ try
+ {
+ repository.setState(ManageableRepository.SUSPENDED);
+ }
+ catch (RepositoryException e)
+ {
+ log.error(e);
+ }
+
+ return getState();
+ }
+
+ /**
+ * Resume repository. All previously suspended threads continue working.
+ *
+ * @return repository state
+ */
+ @Managed
+ @ManagedDescription("Resume repository. All previously suspended threads continue working.")
+ public String resume()
+ {
+ // Need privileges to manage repository.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
+ try
+ {
+ repository.setState(ManageableRepository.ONLINE);
+ }
+ catch (RepositoryException e)
+ {
+ log.error(e);
+ }
+
+ return getState();
+ }
+
+ /**
+ * Returns repository state.
+ */
+ @Managed
+ @ManagedDescription("Returns repository state.")
+ public String getState()
+ {
+ return repository.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start()
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop()
+ {
+ }
+}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2009 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.backup;
-
-import org.exoplatform.management.annotations.Managed;
-import org.exoplatform.management.annotations.ManagedDescription;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.jcr.core.ManageableRepository;
-import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.picocontainer.Startable;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Allows via JMX suspend and resume repository's components.
- *
- * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
- * @version $Id: RepositorySuspendController.java 34360 2009-07-22 23:58:59Z tolusha $
- */
-@Managed
-@NameTemplate(@Property(key = "service", value = "RepositorySuspendController"))
-public class RepositorySuspendController implements Startable
-{
- /**
- * Repository ONLINE status.
- */
- private final String ONLINE = "online";
-
- /**
- * Repository SUSPENDED state.
- */
- private final String SUSPENDED = "suspended";
-
- /**
- * Undefined state.
- */
- private final String UNDEFINED = "undefined";
-
- private final ManageableRepository repository;
-
- /**
- * Logger.
- */
- protected static Log log = ExoLogger.getLogger("exo.jcr.component.core.RepositorySuspendController");
-
- /**
- * RepositoryController constructor.
- */
- public RepositorySuspendController(ManageableRepository repository)
- {
- this.repository = repository;
- }
-
- /**
- * Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.
- *
- * @return repository state
- */
- @Managed
- @ManagedDescription("Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.")
- public String suspend()
- {
- // Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
-
- for (Suspendable component : getSuspendableComponents())
- {
- try
- {
- component.suspend();
- }
- catch (SuspendException e)
- {
- log.error("Can't suspend component", e);
- }
- }
-
- return getState();
- }
-
- /**
- * Resume repository. All previously suspended threads continue working.
- *
- * @return repository state
- */
- @Managed
- @ManagedDescription("Resume repository. All previously suspended threads continue working.")
- public String resume()
- {
- // Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
-
- List<Suspendable> components = getSuspendableComponents();
- Collections.reverse(components);
-
- for (Suspendable component : components)
- {
- try
- {
- if (component.isSuspended())
- {
- component.resume();
- }
- }
- catch (ResumeException e)
- {
- log.error("Can't resume component", e);
- }
- }
-
- return getState();
- }
-
- /**
- * Returns repository state.
- */
- @Managed
- @ManagedDescription("Returns repository state.")
- public String getState()
- {
- String state = ONLINE;
-
- boolean hasSuspendedComponents = false;
- boolean hasOnlineComponents = false;
-
- for (Suspendable component : getSuspendableComponents())
- {
- if (component.isSuspended())
- {
- hasSuspendedComponents = true;
-
- if (hasOnlineComponents)
- {
- return UNDEFINED;
- }
-
- state = SUSPENDED;
- }
- else
- {
- hasOnlineComponents = true;
- if (hasSuspendedComponents)
- {
- return UNDEFINED;
- }
- }
- }
-
- return state;
- }
-
- /**
- * {@inheritDoc}
- */
- public void start()
- {
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop()
- {
- }
-
- private List<Suspendable> getSuspendableComponents()
- {
- List<Suspendable> components = new ArrayList<Suspendable>();
- for (String workspaceName : repository.getWorkspaceNames())
- {
- components.addAll(repository.getWorkspaceContainer(workspaceName).getComponentInstancesOfType(
- Suspendable.class));
- }
-
- return components;
- }
-}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Suspendable.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Suspendable.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/Suspendable.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -27,14 +27,14 @@
/**
* Suspend component.
*
- * @throws SuspendException of error occurred
+ * @throws SuspendException if error occurred
*/
void suspend() throws SuspendException;
/**
* Resume component.
*
- * @throws ResumeException of error occurred
+ * @throws ResumeException if error occurred
*/
void resume() throws ResumeException;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -137,7 +137,7 @@
/**
* Repository state. OFFLINE by default.
*/
- private int state = OFFLINE;
+ private boolean isOffline = true;
/**
* RepositoryImpl constructor.
@@ -648,60 +648,55 @@
*/
public int getState()
{
- return state;
+ if (isOffline)
+ {
+ return OFFLINE;
+ }
+
+ Integer state = null;
+ for (String workspaceName : getWorkspaceNames())
+ {
+ int workspaceState = getWorkspaceContainer(workspaceName).getState();
+ if (state == null)
+ {
+ state = workspaceState;
+ }
+ else if (state != workspaceState)
+ {
+ return UNDEFINED;
+ }
+ }
+
+ return state == null ? ONLINE : state;
}
/**
* {@inheritDoc}
*/
- public void setState(int state)
+ public void setState(int state) throws RepositoryException
{
- // Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
+ if (getState() != ONLINE && !(state == ONLINE || state == OFFLINE))
{
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ throw new RepositoryException("First switch repository to ONLINE and then to needed state.\n" + toString());
}
- switch (state)
+ // set state for all workspaces
+ for (String workspaceName : getWorkspaceNames())
{
- case ONLINE :
- // set ONLINE all workspaces
- setAllWorkspacesReadOnly(false);
- break;
- case OFFLINE :
- // TODO do nothing
- break;
- case READONLY :
- // set READONLY all workspaces
- setAllWorkspacesReadOnly(true);
- break;
+ getWorkspaceContainer(workspaceName).setState(state);
}
- this.state = state;
+ isOffline = state == OFFLINE;
}
/**
- * Set all repository workspaces ReadOnly status.
- *
- * @param wsStatus ReadOnly workspace status
+ * {@inheritDoc}
*/
- private void setAllWorkspacesReadOnly(boolean wsStatus)
- {
- WorkspaceContainerFacade wsFacade;
- for (String workspaceName : getWorkspaceNames())
- {
- wsFacade = getWorkspaceContainer(workspaceName);
- PersistentDataManager dataManager = (PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);
- dataManager.setReadOnly(wsStatus);
- }
- }
-
@Override
public String toString()
{
String stateTitle;
- switch (state)
+ switch (getState())
{
case ONLINE :
stateTitle = "online";
@@ -712,13 +707,17 @@
case READONLY :
stateTitle = "readonly";
break;
+ case SUSPENDED :
+ stateTitle = "suspended";
+ break;
default :
stateTitle = "undefined";
+ break;
}
+
String defaultWorkspaceName = config.getDefaultWorkspaceName();
return String.format(
"Repository {\n name: %s;\n system workspace: %s;\n default workspace: %s;\n workspaces: %s;\n state: %s \n}",
name, systemWorkspaceName, defaultWorkspaceName, Arrays.toString(getWorkspaceNames()), stateTitle);
}
-
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-15 19:11:33 UTC (rev 4240)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/jndi/BindableRepositoryImpl.java 2011-04-18 07:58:53 UTC (rev 4241)
@@ -237,7 +237,7 @@
return delegatee.getState();
}
- public void setState(int state)
+ public void setState(int state) throws RepositoryException
{
delegatee.setState(state);
}
15 years