exo-jcr SVN: r4280 - in kernel/trunk: exo.kernel.commons and 13 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-26 03:22:51 -0400 (Tue, 26 Apr 2011)
New Revision: 4280
Modified:
kernel/trunk/exo.kernel.commons.test/pom.xml
kernel/trunk/exo.kernel.commons/pom.xml
kernel/trunk/exo.kernel.component.cache/pom.xml
kernel/trunk/exo.kernel.component.command/pom.xml
kernel/trunk/exo.kernel.component.common/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
kernel/trunk/exo.kernel.container/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
kernel/trunk/exo.kernel.mc-integration/pom.xml
kernel/trunk/packaging/module/pom.xml
kernel/trunk/pom.xml
Log:
EXOJCR-1299: change version to snapshot
Modified: kernel/trunk/exo.kernel.commons/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.commons/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.commons</artifactId>
Modified: kernel/trunk/exo.kernel.commons.test/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.commons.test</artifactId>
Modified: kernel/trunk/exo.kernel.component.cache/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.cache</artifactId>
Modified: kernel/trunk/exo.kernel.component.command/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.command</artifactId>
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.common</artifactId>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -19,7 +19,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.infinispan.v4</artifactId>
<name>eXo Kernel :: Cache Extension :: Infinispan Implementation</name>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
<name>eXo Kernel :: Cache Extension :: JBoss Cache Implementation</name>
Modified: kernel/trunk/exo.kernel.container/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.container/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.container/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
<name>eXo Kernel :: Container</name>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.mc-int</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.mc-int-demo</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.mc-int-tests</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.mc-kernel-extras</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<artifactId>mc-integration-parent</artifactId>
Modified: kernel/trunk/packaging/module/pom.xml
===================================================================
--- kernel/trunk/packaging/module/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/packaging/module/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
+++ kernel/trunk/pom.xml 2011-04-26 07:22:51 UTC (rev 4280)
@@ -30,7 +30,7 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.0-GA-SNAPSHOT</version>
<packaging>pom</packaging>
<name>eXo Kernel</name>
15 years
exo-jcr SVN: r4279 - in kernel/trunk: exo.kernel.commons and 13 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-26 02:56:11 -0400 (Tue, 26 Apr 2011)
New Revision: 4279
Modified:
kernel/trunk/exo.kernel.commons.test/pom.xml
kernel/trunk/exo.kernel.commons/pom.xml
kernel/trunk/exo.kernel.component.cache/pom.xml
kernel/trunk/exo.kernel.component.command/pom.xml
kernel/trunk/exo.kernel.component.common/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
kernel/trunk/exo.kernel.container/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
kernel/trunk/exo.kernel.mc-integration/pom.xml
kernel/trunk/packaging/module/pom.xml
kernel/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: kernel/trunk/exo.kernel.commons/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.commons/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.commons</artifactId>
Modified: kernel/trunk/exo.kernel.commons.test/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.commons.test</artifactId>
Modified: kernel/trunk/exo.kernel.component.cache/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.component.cache</artifactId>
Modified: kernel/trunk/exo.kernel.component.command/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.component.command</artifactId>
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.component.common</artifactId>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -19,7 +19,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.infinispan.v4</artifactId>
<name>eXo Kernel :: Cache Extension :: Infinispan Implementation</name>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
<name>eXo Kernel :: Cache Extension :: JBoss Cache Implementation</name>
Modified: kernel/trunk/exo.kernel.container/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.container/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.container/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
<name>eXo Kernel :: Container</name>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.mc-int</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.mc-int-demo</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.mc-int-tests</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>exo.kernel.mc-kernel-extras</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<artifactId>mc-integration-parent</artifactId>
Modified: kernel/trunk/packaging/module/pom.xml
===================================================================
--- kernel/trunk/packaging/module/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/packaging/module/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2011-04-26 06:55:42 UTC (rev 4278)
+++ kernel/trunk/pom.xml 2011-04-26 06:56:11 UTC (rev 4279)
@@ -30,7 +30,7 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2</version>
+ <version>2.3.0-GA</version>
<packaging>pom</packaging>
<name>eXo Kernel</name>
@@ -43,9 +43,9 @@
</properties>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/tags/2.3.0-CR2</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/tags/2.3.0-CR2</developerConnection>
- <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/tags/2.3.0-CR2</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/trunk</url>
</scm>
<modules>
15 years
exo-jcr SVN: r4278 - kernel/tags.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-26 02:55:42 -0400 (Tue, 26 Apr 2011)
New Revision: 4278
Added:
kernel/tags/2.3.0-CR2/
Log:
[maven-scm] copy for tag 2.3.0-CR2
15 years
exo-jcr SVN: r4277 - in kernel/trunk: exo.kernel.commons and 13 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-26 02:55:17 -0400 (Tue, 26 Apr 2011)
New Revision: 4277
Modified:
kernel/trunk/exo.kernel.commons.test/pom.xml
kernel/trunk/exo.kernel.commons/pom.xml
kernel/trunk/exo.kernel.component.cache/pom.xml
kernel/trunk/exo.kernel.component.command/pom.xml
kernel/trunk/exo.kernel.component.common/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
kernel/trunk/exo.kernel.container/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
kernel/trunk/exo.kernel.mc-integration/pom.xml
kernel/trunk/packaging/module/pom.xml
kernel/trunk/pom.xml
Log:
[maven-release-plugin] prepare release 2.3.0-CR2
Modified: kernel/trunk/exo.kernel.commons/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.commons/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.commons</artifactId>
Modified: kernel/trunk/exo.kernel.commons.test/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.commons.test/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -16,7 +16,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.commons.test</artifactId>
Modified: kernel/trunk/exo.kernel.component.cache/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.component.cache/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.component.cache</artifactId>
Modified: kernel/trunk/exo.kernel.component.command/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.component.command/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.component.command</artifactId>
Modified: kernel/trunk/exo.kernel.component.common/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.component.common/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.component.common</artifactId>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -19,7 +19,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.infinispan.v4</artifactId>
<name>eXo Kernel :: Cache Extension :: Infinispan Implementation</name>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
<name>eXo Kernel :: Cache Extension :: JBoss Cache Implementation</name>
Modified: kernel/trunk/exo.kernel.container/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.container/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.container/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -12,7 +12,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
<name>eXo Kernel :: Container</name>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.mc-int</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-demo/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.mc-int-demo</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-int-tests/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.mc-int-tests</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.mc-integration/exo.kernel.mc-kernel-extras/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>mc-integration-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>exo.kernel.mc-kernel-extras</artifactId>
Modified: kernel/trunk/exo.kernel.mc-integration/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/exo.kernel.mc-integration/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<artifactId>mc-integration-parent</artifactId>
Modified: kernel/trunk/packaging/module/pom.xml
===================================================================
--- kernel/trunk/packaging/module/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/packaging/module/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2011-04-22 14:56:08 UTC (rev 4276)
+++ kernel/trunk/pom.xml 2011-04-26 06:55:17 UTC (rev 4277)
@@ -30,7 +30,7 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-CR2-SNAPSHOT</version>
+ <version>2.3.0-CR2</version>
<packaging>pom</packaging>
<name>eXo Kernel</name>
@@ -43,9 +43,9 @@
</properties>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/trunk</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/kernel/tags/2.3.0-CR2</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/kernel/tags/2.3.0-CR2</developerConnection>
+ <url>http://fisheye.jboss.org/browse/exo-jcr/kernel/tags/2.3.0-CR2</url>
</scm>
<modules>
15 years
exo-jcr SVN: r4276 - jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-22 10:56:08 -0400 (Fri, 22 Apr 2011)
New Revision: 4276
Modified:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/JCR-1616.patch
Log:
JCR-1616: patch updated
Modified: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/JCR-1616.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/JCR-1616.patch 2011-04-22 14:53:42 UTC (rev 4275)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1616/JCR-1616.patch 2011-04-22 14:56:08 UTC (rev 4276)
@@ -1,3 +1,122 @@
+Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java
+===================================================================
+--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java (revision 0)
++++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/nodetypes/TestNodeDefinition.java (revision 0)
+@@ -0,0 +1,114 @@
++/*
++ * Copyright (C) 2003-2007 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.api.nodetypes;
++
++import org.exoplatform.services.jcr.JcrAPIBaseTest;
++import org.exoplatform.services.jcr.impl.core.NodeImpl;
++import org.exoplatform.services.jcr.impl.core.SessionImpl;
++
++import java.util.GregorianCalendar;
++
++import javax.jcr.Node;
++import javax.jcr.RepositoryException;
++import javax.jcr.version.Version;
++
++/**
++ * @author <a href="mailto:anatoliy.bazko@gmail.com">Anatoliy Bazko</a>
++ * @version $Id: TestNodeDefinitionWCM.java 34360 2009-07-22 23:58:59Z tolusha $
++ */
++public class TestNodeDefinition extends JcrAPIBaseTest
++{
++
++ public void testNodeTypeWCM1() throws Exception
++ {
++ NodeImpl someNode = (NodeImpl)session.getRootNode().addNode("someNode");
++ someNode.addMixin("mix:referenceable");
++
++ NodeImpl exoWebContent = (NodeImpl)session.getRootNode().addNode("exoWebContent", "exo:webContent");
++ exoWebContent.setProperty("exo:title", "tit");
++ session.save();
++
++ // add nt:file
++ NodeImpl ntFile1 = (NodeImpl)exoWebContent.addNode("ntFile-1", "nt:file");
++ NodeImpl jcrContent = (NodeImpl)ntFile1.addNode("jcr:content", "nt:resource");
++ jcrContent.setProperty("jcr:data", "");
++ jcrContent.setProperty("jcr:mimeType", "");
++ jcrContent.setProperty("jcr:lastModified", new GregorianCalendar());
++ session.save();
++
++ exoWebContent.addMixin("exo:actionable");
++ exoWebContent.setProperty("exo:actions", someNode);
++ session.save();
++
++ // add exo:actionStorage
++ NodeImpl actionStorage = (NodeImpl)exoWebContent.addNode("actionStorage", "exo:actionStorage");
++ session.save();
++
++ // add nt:file
++ NodeImpl ntFile2 = (NodeImpl)exoWebContent.addNode("ntFile-2", "nt:file");
++ jcrContent = (NodeImpl)ntFile2.addNode("jcr:content", "nt:resource");
++ jcrContent.setProperty("jcr:data", "");
++ jcrContent.setProperty("jcr:mimeType", "");
++ jcrContent.setProperty("jcr:lastModified", new GregorianCalendar());
++ session.save();
++
++ SessionImpl session = (SessionImpl)repository.login(credentials, WORKSPACE);
++
++ ntFile1 = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("ntFile-1");
++ assertEquals(ntFile1.getDefinition().getRequiredPrimaryTypes()[0].getName(), "nt:base");
++
++ ntFile2 = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("ntFile-2");
++ assertEquals(ntFile2.getDefinition().getRequiredPrimaryTypes()[0].getName(), "nt:base");
++
++ actionStorage = (NodeImpl)session.getRootNode().getNode("exoWebContent").getNode("actionStorage");
++ assertEquals(actionStorage.getDefinition().getRequiredPrimaryTypes()[0].getName(), "exo:actionStorage");
++ }
++
++ public void testNodeTypeWCM2() throws Exception
++ {
++ Node parent = session.getRootNode().addNode("parent", "exo:newsletterCategory");
++ parent.addNode("child", "nt:unstructured");
++ parent.setProperty("exo:newsletterCategoryTitle", "title");
++ session.save();
++ }
++
++ public void testNTVersionedChild() throws Exception
++ {
++ Node folder1 = session.getRootNode().addNode("folder1", "nt:folder");
++ Node folder2 = folder1.addNode("folder2", "nt:folder");
++ Node folder3 = folder2.addNode("folder3", "nt:folder");
++ folder1.addMixin("mix:versionable");
++ folder3.addMixin("mix:versionable");
++ session.save();
++
++ Version ver1 = folder1.checkin();
++ folder1.checkout();
++
++ folder3 =
++ (NodeImpl)session.getItem("/jcr:system/jcr:versionStorage/" + ver1.getParent().getUUID()
++ + "/1/jcr:frozenNode/folder2/folder3");
++
++ try
++ {
++ folder3.getDefinition();
++ }
++ catch (RepositoryException e)
++ {
++ fail();
++ }
++ }
++}
Index: exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml
===================================================================
--- exo.jcr.component.core/src/test/resources/conf/test/wcm-nodetypes.xml (revision 4266)
@@ -403,7 +522,7 @@
}
/**
-@@ -1009,4 +1034,21 @@
+@@ -1009,4 +1034,18 @@
return changesLog;
}
@@ -416,10 +535,7 @@
+
+ if (mixinTypes != null)
+ {
-+ for (int i = 0; i < mixinTypes.length; i++)
-+ {
-+ System.arraycopy(mixinTypes, 0, ntn, 1, mixinTypes.length);
-+ }
++ System.arraycopy(mixinTypes, 0, ntn, 1, mixinTypes.length);
+ }
+
+ return ntn;
15 years
exo-jcr SVN: r4275 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-04-22 10:53:42 -0400 (Fri, 22 Apr 2011)
New Revision: 4275
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
Log:
JCR-1310: Error when get node definition for node
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2011-04-22 12:19:42 UTC (rev 4274)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2011-04-22 14:53:42 UTC (rev 4275)
@@ -1050,10 +1050,7 @@
if (mixinTypes != null)
{
- for (int i = 0; i < mixinTypes.length; i++)
- {
- System.arraycopy(mixinTypes, 0, ntn, 1, mixinTypes.length);
- }
+ System.arraycopy(mixinTypes, 0, ntn, 1, mixinTypes.length);
}
return ntn;
15 years
exo-jcr SVN: r4274 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/query/ispn and 3 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-04-22 08:19:42 -0400 (Fri, 22 Apr 2011)
New Revision: 4274
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
Log:
EXOJCR-1280 : finished implementation of host JMX-based async reindexing
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -90,6 +90,14 @@
}
/**
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#getIndexerIoModeHandler()
+ */
+ public IndexerIoModeHandler getIndexerIoModeHandler()
+ {
+ return modeHandler;
+ }
+
+ /**
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setContext(org.exoplatform.services.jcr.impl.core.query.QueryHandlerContext)
*/
public void setContext(QueryHandlerContext context)
@@ -256,4 +264,12 @@
{
this.indexUpdateMonitor = indexUpdateMonitor;
}
-}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setOnline(boolean)
+ */
+ public void setOnline(boolean isOnline) throws IOException
+ {
+ setOnline(isOnline, false);
+ }
+}
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -224,4 +224,17 @@
{
return true;
}
+
+ /**
+ * If index is shared across the cluster, which means that all modifications or state changes must be
+ * replicated along cluster. I.e. when hot reindexing is started, the index marked as "shared" will be
+ * set in offline mode within whole cluster. But non-shared index, will only be switched to offline
+ * locally
+ *
+ * @return
+ */
+ public boolean isShared()
+ {
+ return false;
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -155,6 +155,8 @@
void setIndexerIoModeHandler(IndexerIoModeHandler handler) throws IOException;
+ IndexerIoModeHandler getIndexerIoModeHandler();
+
/**
* @return the name of the query class to use.
*/
@@ -198,13 +200,28 @@
/**
* Switches index into corresponding ONLINE or OFFLINE mode. Offline mode means that new indexing data is
- * collected but index is guaranteed to be unmodified during offline state.
+ * collected but index is guaranteed to be unmodified during offline state. Queries are denied in offline
+ * mode. Please refer to {{@link #setOnline(boolean, boolean)}} if queries must be allowed while index is
+ * offline.
*
* @param isOnline
+ * @throws IOException
*/
void setOnline(boolean isOnline) throws IOException;
/**
+ * Switches index into corresponding ONLINE or OFFLINE mode. Offline mode means that new indexing data is
+ * collected but index is guaranteed to be unmodified during offline state. Passing the allowQuery flag, can
+ * allow or deny performing queries on index during offline mode. AllowQuery is not used when setting index
+ * back online.
+ *
+ * @param isOnline
+ * @param allowQuery
+ * @throws IOException
+ */
+ void setOnline(boolean isOnline, boolean allowQuery) throws IOException;
+
+ /**
* Offline mode means that new indexing data is collected but index is guaranteed to be unmodified during
* offline state.
*
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -18,12 +18,16 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
-import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.WildcardQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
+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.document.DocumentReaderService;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
@@ -83,7 +87,9 @@
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -109,6 +115,8 @@
* @version $Id: SearchManager.java 1008 2009-12-11 15:14:51Z nzamosenchuk $
*/
@NonVolatile
+@Managed
+@NameTemplate(@Property(key = "service", value = "SearchManager"))
public class SearchManager implements Startable, MandatoryItemsPersistenceListener, Suspendable, Backupable,
TopologyChangeListener
{
@@ -118,6 +126,11 @@
*/
private static final Log log = ExoLogger.getLogger("exo.jcr.component.core.SearchManager");
+ /**
+ * Used to display date and time for JMX components
+ */
+ private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
protected final QueryHandlerEntry config;
/**
@@ -220,8 +233,15 @@
*/
private RemoteCommand requestForResponsibleForResuming;
- public SearchManager(ExoContainerContext ctx, WorkspaceEntry wEntry, RepositoryEntry rEntry, RepositoryService rService,
- QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
+ /**
+ * Switches index between online and offline modes
+ */
+ private RemoteCommand changeIndexState;
+
+ private String hotReindexingState = "not stated";
+
+ public SearchManager(ExoContainerContext ctx, WorkspaceEntry wEntry, RepositoryEntry rEntry,
+ RepositoryService rService, QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, SystemSearchManagerHolder parentSearchManager,
DocumentReaderService extractor, ConfigurationManager cfm, final RepositoryIndexSearcherHolder indexSearcherHolder)
throws RepositoryException, RepositoryConfigurationException
@@ -261,8 +281,8 @@
* if the search manager cannot be initialized
* @throws RepositoryConfigurationException
*/
- public SearchManager(ExoContainerContext ctx, WorkspaceEntry wEntry, RepositoryEntry rEntry, RepositoryService rService,
- QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
+ public SearchManager(ExoContainerContext ctx, WorkspaceEntry wEntry, RepositoryEntry rEntry,
+ RepositoryService rService, QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, SystemSearchManagerHolder parentSearchManager,
DocumentReaderService extractor, ConfigurationManager cfm,
final RepositoryIndexSearcherHolder indexSearcherHolder, RPCService rpcService) throws RepositoryException,
@@ -378,7 +398,7 @@
try
{
reader = ((SearchIndex)handler).getIndexReader();
- final Collection fields = reader.getFieldNames(IndexReader.FieldOption.ALL);
+ final Collection<?> fields = reader.getFieldNames(IndexReader.FieldOption.ALL);
for (final Object field : fields)
{
fildsSet.add((String)field);
@@ -871,17 +891,18 @@
try
{
- Class qHandlerClass = Class.forName(className, true, this.getClass().getClassLoader());
+ Class<?> qHandlerClass = Class.forName(className, true, this.getClass().getClassLoader());
try
{
// We first try a constructor with the workspace id
- Constructor constuctor = qHandlerClass.getConstructor(String.class, QueryHandlerEntry.class, ConfigurationManager.class);
+ Constructor<?> constuctor =
+ qHandlerClass.getConstructor(String.class, QueryHandlerEntry.class, ConfigurationManager.class);
handler = (QueryHandler)constuctor.newInstance(wsContainerId, config, cfm);
}
catch (NoSuchMethodException e)
{
// No constructor with the workspace id can be found so we use the default constructor
- Constructor constuctor = qHandlerClass.getConstructor(QueryHandlerEntry.class, ConfigurationManager.class);
+ Constructor<?> constuctor = qHandlerClass.getConstructor(QueryHandlerEntry.class, ConfigurationManager.class);
handler = (QueryHandler)constuctor.newInstance(config, cfm);
}
QueryHandler parentHandler = (this.parentSearchManager != null) ? parentSearchManager.getHandler() : null;
@@ -1071,9 +1092,23 @@
*/
public void setOnline(boolean isOnline) throws IOException
{
- handler.setOnline(isOnline);
+ // deny queries
+ handler.setOnline(isOnline, false);
}
+ /**
+ * Switches index into online or offline modes. Passing the allowQuery flag, can
+ * allow or deny performing queries on index during offline mode
+ *
+ * @param isOnline
+ * @param allowQuery
+ * @throws IOException
+ */
+ public void setOnline(boolean isOnline, boolean allowQuery) throws IOException
+ {
+ handler.setOnline(isOnline, allowQuery);
+ }
+
public boolean isOnline()
{
return handler.isOnline();
@@ -1108,6 +1143,186 @@
}
/**
+ * Public method, designed to be called via JMX, to perform "HOT" reindexing of the workspace
+ *
+ * @throws IOException
+ * @throws IllegalStateException
+ */
+ @Managed
+ @ManagedDescription("Starts hot async reindexing")
+ public void reindex(final boolean dropExisting) throws IllegalStateException
+ {
+ // checks
+ if (handler == null || handler.getIndexerIoModeHandler() == null || changesFilter == null)
+ {
+ throw new IllegalStateException("Index might have not been initialized yet.");
+ }
+ if (handler.getIndexerIoModeHandler().getMode() != IndexerIoMode.READ_WRITE)
+ {
+ throw new IllegalStateException(
+ "Index is not in READ_WRITE mode and reindexing can't be launched. Please start reindexing on coordinator node.");
+ }
+ if (isSuspended || !handler.isOnline())
+ {
+ throw new IllegalStateException("Can't start reindexing while index is "
+ + ((isSuspended) ? "SUSPENDED." : "already OFFLINE (it means that reindexing is in progress).") + ".");
+ }
+
+ log.info("Starting hot reindexing on the " + handler.getContext().getRepositoryName() + "/"
+ + handler.getContext().getContainer().getWorkspaceName() + ", with" + (dropExisting ? "" : "out")
+ + " dropping the existing indexes.");
+ // starting new thread, releasing JMX call
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ boolean successful = false;
+ hotReindexingState = "Running. Started at " + sdf.format(Calendar.getInstance().getTime());
+ try
+ {
+ isResponsibleForResuming = true;
+ // set offline cluster wide (will make merger disposed and volatile flushed)
+ if (rpcService != null && changesFilter.isShared())
+ {
+ rpcService.executeCommandOnAllNodes(changeIndexState, true, false, !dropExisting);
+ }
+ else
+ {
+ handler.setOnline(false, !dropExisting);
+ }
+ // launch reindexing thread safely, resume nodes if any exception occurs
+ if (handler instanceof SearchIndex)
+ {
+ ((SearchIndex)handler).getIndex().reindex(itemMgr);
+ successful = true;
+ }
+ else
+ {
+ log.error("This kind of QuerHandler class doesn't support hot reindxing.");
+ }
+ }
+ catch (RepositoryException e)
+ {
+ log.error("Error while reindexing the workspace", e);
+ }
+ catch (SecurityException e)
+ {
+ log.error("Can't change state to offline.", e);
+ }
+ catch (RPCException e)
+ {
+ log.error("Can't change state to offline.", e);
+ }
+ catch (IOException e)
+ {
+ log.error("Erroe while reindexing the workspace", e);
+ }
+ // safely change state back
+ finally
+ {
+ // finish, setting indexes back online
+ if (rpcService != null && changesFilter.isShared())
+ {
+ try
+ {
+ // if dropExisting, then queries are no allowed
+ rpcService.executeCommandOnAllNodes(changeIndexState, true, true, true);
+ }
+ catch (SecurityException e)
+ {
+ log.error("Error setting index back online in a cluster", e);
+ }
+ catch (RPCException e)
+ {
+ log.error("Error setting index back online in a cluster", e);
+ }
+ }
+ else
+ {
+ try
+ {
+ handler.setOnline(true, true);
+ }
+ catch (IOException e)
+ {
+ log.error("Error setting index back online locally");
+ }
+ }
+ if (successful)
+ {
+ hotReindexingState = "Finished at " + sdf.format(Calendar.getInstance().getTime());
+ log.info("Reindexing finished successfully.");
+ }
+ else
+ {
+ hotReindexingState = "Stopped with errors at " + sdf.format(Calendar.getInstance().getTime());
+ log.info("Reindexing halted with errors.");
+ }
+ isResponsibleForResuming = false;
+ }
+ }
+ }, "HotReindexing-" + handler.getContext().getRepositoryName() + "-"
+ + handler.getContext().getContainer().getWorkspaceName()).start();
+ }
+
+ @Managed
+ @ManagedDescription("Hot async reindexing state")
+ public String getHotReindexingState()
+ {
+ return hotReindexingState;
+ }
+
+ @Managed
+ @ManagedDescription("Index IO mode (READ_ONLY/READ_WRITE)")
+ public String getIOMode()
+ {
+ if (handler == null || handler.getIndexerIoModeHandler() == null)
+ {
+ return "not initialized";
+ }
+ return (handler.getIndexerIoModeHandler().getMode() == IndexerIoMode.READ_WRITE) ? "READ_WRITE" : "READ_ONLY";
+ }
+
+ @Managed
+ @ManagedDescription("Index state (Online/Offline(indexing))")
+ public String getState()
+ {
+ if (handler == null)
+ {
+ return "not initialized";
+ }
+ return handler.isOnline() ? "Online" : "Offline (indexing)";
+ }
+
+ @Managed
+ @ManagedDescription("QueryHandler class")
+ public String getQuerHandlerClass()
+ {
+ if (handler != null)
+ {
+ return handler.getClass().getCanonicalName();
+ }
+ else
+ {
+ return "not initialized";
+ }
+ }
+
+ @Managed
+ @ManagedDescription("ChangesFilter class")
+ public String getChangesFilterClass()
+ {
+ if (changesFilter != null)
+ {
+ return changesFilter.getClass().getCanonicalName();
+ }
+ else
+ {
+ return "not initialized";
+ }
+ }
+
+ /**
* Register remote commands.
*/
private void doInitRemoteCommands()
@@ -1159,10 +1374,32 @@
return isResponsibleForResuming;
}
});
+
+ changeIndexState = rpcService.registerCommand(new RemoteCommand()
+ {
+ public String getId()
+ {
+ return "org.exoplatform.services.jcr.impl.core.query.SearchManager-changeIndexerState-" + wsId + "-"
+ + (parentSearchManager == null);
+ }
+
+ public Serializable execute(Serializable[] args) throws Throwable
+ {
+ boolean isOnline = (Boolean)args[0];
+ boolean allowQuery = (args.length == 2) ? (Boolean)args[1] : false;
+ SearchManager.this.setOnline(isOnline, allowQuery);
+ return null;
+ }
+ });
+
}
protected void suspendLocally() throws SuspendException
{
+ if (!handler.isOnline())
+ {
+ throw new SuspendException("Can't suspend index, while reindexing in progeress.");
+ }
if (isSuspended)
{
throw new SuspendException("Component already suspended.");
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -158,4 +158,12 @@
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
}
}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter#isShared()
+ */
+ public boolean isShared()
+ {
+ return true;
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -215,4 +215,12 @@
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
}
}
+
+ /**
+ * @see org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter#isShared()
+ */
+ public boolean isShared()
+ {
+ return true;
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -53,7 +53,7 @@
/**
* Maps UUID {@link String}s to {@link Document}s.
*/
- private final Map pendingDocuments = new HashMap();
+ private final Map pendingDocuments = new HashMap(1);
/**
* Flag that indicates whether this indexing queue had been
@@ -143,7 +143,7 @@
public Document[] getFinishedDocuments()
{
checkInitialized();
- List finished = new ArrayList();
+ List finished = new ArrayList(1);
synchronized (this)
{
finished.addAll(pendingDocuments.values());
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -60,6 +60,7 @@
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.Map.Entry;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
@@ -113,7 +114,7 @@
/**
* Names of index directories that can be deleted.
*/
- private final Set deletable = new HashSet();
+ private final Set<String> deletable = new HashSet<String>();
/**
* List of open persistent indexes. This list may also contain an open
@@ -121,9 +122,14 @@
* registered with indexNames and <b>must not</b> be used in regular index
* operations (delete node, etc.)!
*/
- private final List indexes = new ArrayList();
+ private final List<PersistentIndex> indexes = new ArrayList<PersistentIndex>();
/**
+ * Contains list of open persistent indexes in case when hot async reindexing launched.
+ */
+ private final List<PersistentIndex> staleIndexes = new ArrayList<PersistentIndex>();
+
+ /**
* The internal namespace mappings of the query manager.
*/
private final NamespaceMappings nsMappings;
@@ -255,8 +261,8 @@
/**
* The unique id of the workspace corresponding to this multi index
*/
- final String workspaceId;
-
+ final String workspaceId;
+
/**
* Creates a new MultiIndex.
*
@@ -535,6 +541,51 @@
}
/**
+ * Recreates index by reindexing in runtime.
+ *
+ * @param stateMgr
+ * @throws RepositoryException
+ */
+ public void reindex(ItemDataConsumer stateMgr) throws IOException, RepositoryException
+ {
+ if (stopped)
+ {
+ throw new IllegalStateException("Can't invoke reindexing on closed index.");
+ }
+
+ if (online)
+ {
+ throw new IllegalStateException("Can't invoke reindexing while index still online.");
+ }
+
+ // traverse and index workspace
+ executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
+
+ long count;
+
+ // check if we have deal with RDBMS reindexing mechanism
+ Reindexable rdbmsReindexableComponent =
+ (Reindexable)handler.getContext().getContainer().getComponent(Reindexable.class);
+
+ if (handler.isRDBMSReindexing() && rdbmsReindexableComponent != null
+ && rdbmsReindexableComponent.isReindexingSupport())
+ {
+ count =
+ createIndex(rdbmsReindexableComponent.getNodeDataIndexingIterator(handler.getReindexingPageSize()),
+ indexingTree.getIndexingRoot());
+ }
+ else
+ {
+ count = createIndex(indexingTree.getIndexingRoot(), stateMgr);
+ }
+
+ executeAndLog(new Commit(getTransactionId()));
+ log.info("Created initial index for {} nodes", new Long(count));
+ releaseMultiReader();
+
+ }
+
+ /**
* Atomically updates the index by removing some documents and adding
* others.
*
@@ -548,7 +599,7 @@
* @throws IOException
* if an error occurs while updating the index.
*/
- synchronized void update(final Collection remove, final Collection add) throws IOException
+ synchronized void update(final Collection<String> remove, final Collection<Document> add) throws IOException
{
if (!online)
{
@@ -572,7 +623,7 @@
* @param add
* @throws IOException
*/
- private void doUpdateRO(final Collection remove, final Collection add) throws IOException
+ private void doUpdateRO(final Collection<String> remove, final Collection<Document> add) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
@@ -594,9 +645,9 @@
ReadOnlyIndexReader lastIndexReader = null;
try
{
- for (Iterator it = remove.iterator(); it.hasNext();)
+ for (Iterator<String> it = remove.iterator(); it.hasNext();)
{
- Term idTerm = new Term(FieldNames.UUID, (String)it.next());
+ Term idTerm = new Term(FieldNames.UUID, it.next());
volatileIndex.removeDocument(idTerm);
}
@@ -606,17 +657,16 @@
try
{
lastIndexReader =
- (lastIndexReaderId >= 0) ? ((PersistentIndex)indexes.get(lastIndexReaderId))
- .getReadOnlyIndexReader() : null;
+ (lastIndexReaderId >= 0) ? (indexes.get(lastIndexReaderId)).getReadOnlyIndexReader() : null;
}
catch (Throwable e)
{
// this is safe index reader retrieval. The last index already closed, possibly merged or any other exception that occurs here
}
- for (Iterator it = add.iterator(); it.hasNext();)
+ for (Iterator<Document> it = add.iterator(); it.hasNext();)
{
- Document doc = (Document)it.next();
+ Document doc = it.next();
if (doc != null)
{
// check if this item should be placed in own volatile index
@@ -642,8 +692,7 @@
lastIndexReaderId = indexes.size() - 1;
try
{
- lastIndexReader =
- ((PersistentIndex)indexes.get(lastIndexReaderId)).getReadOnlyIndexReader();
+ lastIndexReader = (indexes.get(lastIndexReaderId)).getReadOnlyIndexReader();
}
catch (Throwable e)
{
@@ -706,7 +755,7 @@
* @param add
* @throws IOException
*/
- private void doUpdateRW(final Collection remove, final Collection add) throws IOException
+ private void doUpdateRW(final Collection<String> remove, final Collection<Document> add) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
@@ -737,13 +786,13 @@
long transactionId = nextTransactionId++;
executeAndLog(new Start(transactionId));
- for (Iterator it = remove.iterator(); it.hasNext();)
+ for (Iterator<String> it = remove.iterator(); it.hasNext();)
{
- executeAndLog(new DeleteNode(transactionId, (String)it.next()));
+ executeAndLog(new DeleteNode(transactionId, it.next()));
}
- for (Iterator it = add.iterator(); it.hasNext();)
+ for (Iterator<Document> it = add.iterator(); it.hasNext();)
{
- Document doc = (Document)it.next();
+ Document doc = it.next();
if (doc != null)
{
executeAndLog(new AddNode(transactionId, doc));
@@ -784,7 +833,7 @@
{
List<String> processedIDs = offlineIndex.getProcessedIDs();
// remove all nodes placed in offline index
- update(processedIDs, Collections.EMPTY_LIST);
+ update(processedIDs, Collections.<Document> emptyList());
executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
@@ -815,21 +864,21 @@
* @param add
* @throws IOException
*/
- private void doUpdateOffline(final Collection remove, final Collection add) throws IOException
+ private void doUpdateOffline(final Collection<String> remove, final Collection<Document> add) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
public Object run() throws Exception
{
- for (Iterator it = remove.iterator(); it.hasNext();)
+ for (Iterator<String> it = remove.iterator(); it.hasNext();)
{
- Term idTerm = new Term(FieldNames.UUID, (String)it.next());
+ Term idTerm = new Term(FieldNames.UUID, it.next());
offlineIndex.removeDocument(idTerm);
}
- for (Iterator it = add.iterator(); it.hasNext();)
+ for (Iterator<Document> it = add.iterator(); it.hasNext();)
{
- Document doc = (Document)it.next();
+ Document doc = it.next();
if (doc != null)
{
offlineIndex.addDocuments(new Document[]{doc});
@@ -855,7 +904,7 @@
*/
void addDocument(Document doc) throws IOException
{
- update(Collections.EMPTY_LIST, Arrays.asList(new Document[]{doc}));
+ update(Collections.<String> emptyList(), Arrays.asList(new Document[]{doc}));
}
/**
@@ -868,7 +917,7 @@
*/
void removeDocument(String uuid) throws IOException
{
- update(Arrays.asList(new String[]{uuid}), Collections.EMPTY_LIST);
+ update(Arrays.asList(new String[]{uuid}), Collections.<Document> emptyList());
}
/**
@@ -899,7 +948,7 @@
}
for (int i = 0; i < indexes.size(); i++)
{
- PersistentIndex index = (PersistentIndex)indexes.get(i);
+ PersistentIndex index = indexes.get(i);
// only remove documents from registered indexes
if (indexNames.contains(index.getName()))
{
@@ -946,14 +995,14 @@
*/
synchronized IndexReader[] getIndexReaders(String[] indexNames, IndexListener listener) throws IOException
{
- Set names = new HashSet(Arrays.asList(indexNames));
- Map indexReaders = new HashMap();
+ Set<String> names = new HashSet<String>(Arrays.asList(indexNames));
+ Map<ReadOnlyIndexReader, PersistentIndex> indexReaders = new HashMap<ReadOnlyIndexReader, PersistentIndex>();
try
{
- for (Iterator it = indexes.iterator(); it.hasNext();)
+ for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();)
{
- PersistentIndex index = (PersistentIndex)it.next();
+ PersistentIndex index = it.next();
if (names.contains(index.getName()))
{
indexReaders.put(index.getReadOnlyIndexReader(listener), index);
@@ -963,10 +1012,11 @@
catch (IOException e)
{
// release readers obtained so far
- for (Iterator it = indexReaders.entrySet().iterator(); it.hasNext();)
+ for (Iterator<Entry<ReadOnlyIndexReader, PersistentIndex>> it = indexReaders.entrySet().iterator(); it
+ .hasNext();)
{
- Map.Entry entry = (Map.Entry)it.next();
- final ReadOnlyIndexReader reader = (ReadOnlyIndexReader)entry.getKey();
+ Map.Entry<ReadOnlyIndexReader, PersistentIndex> entry = it.next();
+ final ReadOnlyIndexReader reader = entry.getKey();
try
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
@@ -982,12 +1032,12 @@
{
log.warn("Exception releasing index reader: " + ex);
}
- ((PersistentIndex)entry.getValue()).resetListener();
+ (entry.getValue()).resetListener();
}
throw e;
}
- return (IndexReader[])indexReaders.keySet().toArray(new IndexReader[indexReaders.size()]);
+ return indexReaders.keySet().toArray(new IndexReader[indexReaders.size()]);
}
/**
@@ -1004,9 +1054,9 @@
synchronized PersistentIndex getOrCreateIndex(String indexName) throws IOException
{
// check existing
- for (Iterator it = indexes.iterator(); it.hasNext();)
+ for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();)
{
- PersistentIndex idx = (PersistentIndex)it.next();
+ PersistentIndex idx = it.next();
if (idx.getName().equals(indexName))
{
return idx;
@@ -1066,9 +1116,9 @@
synchronized boolean hasIndex(String indexName) throws IOException
{
// check existing
- for (Iterator it = indexes.iterator(); it.hasNext();)
+ for (Iterator<PersistentIndex> it = indexes.iterator(); it.hasNext();)
{
- PersistentIndex idx = (PersistentIndex)it.next();
+ PersistentIndex idx = it.next();
if (idx.getName().equals(indexName))
{
return true;
@@ -1094,7 +1144,8 @@
* @throws IOException
* if an exception occurs while replacing the indexes.
*/
- void replaceIndexes(String[] obsoleteIndexes, final PersistentIndex index, Collection deleted) throws IOException
+ void replaceIndexes(String[] obsoleteIndexes, final PersistentIndex index, Collection<Term> deleted)
+ throws IOException
{
if (handler.isInitializeHierarchyCache())
@@ -1128,11 +1179,11 @@
executeAndLog(new Start(Action.INTERNAL_TRANS_REPL_INDEXES));
}
// delete obsolete indexes
- Set names = new HashSet(Arrays.asList(obsoleteIndexes));
- for (Iterator it = names.iterator(); it.hasNext();)
+ Set<String> names = new HashSet<String>(Arrays.asList(obsoleteIndexes));
+ for (Iterator<String> it = names.iterator(); it.hasNext();)
{
// do not try to delete indexes that are already gone
- String indexName = (String)it.next();
+ String indexName = it.next();
if (indexNames.contains(indexName))
{
executeAndLog(new DeleteIndex(getTransactionId(), indexName));
@@ -1147,9 +1198,9 @@
executeAndLog(new AddIndex(getTransactionId(), index.getName()));
// delete documents in index
- for (Iterator it = deleted.iterator(); it.hasNext();)
+ for (Iterator<Term> it = deleted.iterator(); it.hasNext();)
{
- Term id = (Term)it.next();
+ Term id = it.next();
index.removeDocument(id);
}
index.commit();
@@ -1240,10 +1291,14 @@
// meantime -> check again
if (multiReader == null)
{
- List readerList = new ArrayList();
- for (int i = 0; i < indexes.size(); i++)
+ // if index in offline mode, due to hot async reindexing,
+ // need to return the reader containing only stale indexes (old),
+ // without newly created.
+ List<PersistentIndex> persistedIndexesList = online ? indexes : staleIndexes;
+ List<ReadOnlyIndexReader> readerList = new ArrayList<ReadOnlyIndexReader>();
+ for (int i = 0; i < persistedIndexesList.size(); i++)
{
- PersistentIndex pIdx = (PersistentIndex)indexes.get(i);
+ PersistentIndex pIdx = persistedIndexesList.get(i);
if (indexNames.contains(pIdx.getName()))
{
@@ -1261,8 +1316,7 @@
}
}
readerList.add(volatileIndex.getReadOnlyIndexReader());
- ReadOnlyIndexReader[] readers =
- (ReadOnlyIndexReader[])readerList.toArray(new ReadOnlyIndexReader[readerList.size()]);
+ ReadOnlyIndexReader[] readers = readerList.toArray(new ReadOnlyIndexReader[readerList.size()]);
multiReader = new CachingMultiIndexReader(readers, cache);
}
multiReader.acquire();
@@ -1330,7 +1384,7 @@
volatileIndex.close();
for (int i = 0; i < indexes.size(); i++)
{
- ((PersistentIndex)indexes.get(i)).close();
+ (indexes.get(i)).close();
}
// close indexing queue
@@ -1476,7 +1530,7 @@
// commit persistent indexes
for (int i = indexes.size() - 1; i >= 0; i--)
{
- PersistentIndex index = (PersistentIndex)indexes.get(i);
+ PersistentIndex index = indexes.get(i);
// only commit indexes we own
// index merger also places PersistentIndex instances in
// indexes,
@@ -1961,9 +2015,9 @@
{
synchronized (deletable)
{
- for (Iterator it = deletable.iterator(); it.hasNext();)
+ for (Iterator<String> it = deletable.iterator(); it.hasNext();)
{
- String indexName = (String)it.next();
+ String indexName = it.next();
if (directoryManager.delete(indexName))
{
it.remove();
@@ -2011,7 +2065,8 @@
*/
private synchronized void checkFlush()
{
- long idleTime = System.currentTimeMillis() - lastFlushTime;
+ // avoid frequent flushes during reindexing;
+ long idleTime = online ? System.currentTimeMillis() - lastFlushTime : 0;
long volatileTime = System.currentTimeMillis() - lastFileSystemFlushTime;
// do not flush if volatileIdleTime is zero or negative
if ((handler.getVolatileIdleTime() > 0 && idleTime > handler.getVolatileIdleTime() * 1000)
@@ -2075,7 +2130,7 @@
private void checkIndexingQueue(boolean transactionPresent)
{
Document[] docs = indexingQueue.getFinishedDocuments();
- Map finished = new HashMap();
+ Map<String, Document> finished = new HashMap<String, Document>();
for (int i = 0; i < docs.length; i++)
{
String uuid = docs[i].get(FieldNames.UUID);
@@ -2088,7 +2143,7 @@
log.info("updating index with {} nodes from indexing queue.", new Long(finished.size()));
// remove documents from the queue
- for (Iterator it = finished.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = finished.keySet().iterator(); it.hasNext();)
{
indexingQueue.removeDocument(it.next().toString());
}
@@ -2097,13 +2152,13 @@
{
if (transactionPresent)
{
- for (Iterator it = finished.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = finished.keySet().iterator(); it.hasNext();)
{
- executeAndLog(new DeleteNode(getTransactionId(), (String)it.next()));
+ executeAndLog(new DeleteNode(getTransactionId(), it.next()));
}
- for (Iterator it = finished.values().iterator(); it.hasNext();)
+ for (Iterator<Document> it = finished.values().iterator(); it.hasNext();)
{
- executeAndLog(new AddNode(getTransactionId(), (Document)it.next()));
+ executeAndLog(new AddNode(getTransactionId(), it.next()));
}
}
else
@@ -2839,9 +2894,9 @@
public void execute(MultiIndex index) throws IOException
{
// get index if it exists
- for (Iterator it = index.indexes.iterator(); it.hasNext();)
+ for (Iterator<PersistentIndex> it = index.indexes.iterator(); it.hasNext();)
{
- PersistentIndex idx = (PersistentIndex)it.next();
+ PersistentIndex idx = it.next();
if (idx.getName().equals(indexName))
{
idx.close();
@@ -2944,7 +2999,7 @@
for (int i = index.indexes.size() - 1; i >= 0; i--)
{
// only look in registered indexes
- PersistentIndex idx = (PersistentIndex)index.indexes.get(i);
+ PersistentIndex idx = index.indexes.get(i);
if (index.indexNames.contains(idx.getName()))
{
num = idx.removeDocument(idTerm);
@@ -3353,18 +3408,32 @@
log.info("Setting index back online");
offlineIndex.commit(true);
online = true;
+ // cleaning stale indexes
+ for (PersistentIndex staleIndex : staleIndexes)
+ {
+ deleteIndex(staleIndex);
+ }
//invoking offline index
invokeOfflineIndex();
+ staleIndexes.clear();
+ doInitIndexMerger();
+ merger.start();
}
// switching to OFFLINE
else
{
log.info("Setting index offline");
+ merger.dispose();
offlineIndex =
new OfflinePersistentIndex(handler.getTextAnalyzer(), handler.getSimilarity(), cache, indexingQueue,
directoryManager);
+ if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
+ {
+ flush();
+ }
+ releaseMultiReader();
+ staleIndexes.addAll(indexes);
online = false;
- flush();
}
}
else if (!online)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -125,9 +125,9 @@
* redo log.
* @throws IOException if an error occurs while reading from the redo log.
*/
- List getActions() throws IOException
+ List<MultiIndex.Action> getActions() throws IOException
{
- final List actions = new ArrayList();
+ final List<MultiIndex.Action> actions = new ArrayList<MultiIndex.Action>();
read(new ActionCollector()
{
public void collect(MultiIndex.Action a)
@@ -182,7 +182,7 @@
* Clears the redo log.
* @throws IOException if the redo log cannot be cleared.
*/
- void clear() throws IOException
+ synchronized void clear() throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
@@ -193,7 +193,15 @@
out.close();
out = null;
}
- dir.deleteFile(REDO_LOG);
+ try
+ {
+ dir.deleteFile(REDO_LOG);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw e;
+ }
entryCount = 0;
return null;
}
@@ -205,20 +213,20 @@
* @throws IOException if an error occurs while creating the
* output stream.
*/
- private void initOut() throws IOException
+ private synchronized void initOut() throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
{
- public Object run() throws Exception
- {
if (out == null)
{
OutputStream os = new IndexOutputStream(dir.createOutput(REDO_LOG));
out = new BufferedWriter(new OutputStreamWriter(os));
}
- return null;
- }
- });
+ return null;
+ }
+ });
}
/**
@@ -231,9 +239,9 @@
private void read(final ActionCollector collector) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
{
- public Object run() throws Exception
- {
if (!dir.fileExists(REDO_LOG))
{
return null;
@@ -269,9 +277,9 @@
}
}
}
- return null;
- }
- });
+ return null;
+ }
+ });
}
//-----------------------< internal >---------------------------------------
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -468,6 +468,11 @@
private boolean closed = false;
/**
+ * Allows or denies queries while index is offline.
+ */
+ private boolean allowQuery = true;
+
+ /**
* Text extractor for extracting text content of binary properties.
*/
private DocumentReaderService extractor;
@@ -486,7 +491,7 @@
* The unique id of the workspace corresponding to current instance of {@link SearchIndex}
*/
private final String wsId;
-
+
private final ConfigurationManager cfm;
/**
@@ -721,8 +726,8 @@
}
modeHandler.addIndexerIoModeListener(this);
- }
-
+ }
+
/**
* @return the wsId
*/
@@ -1299,9 +1304,8 @@
*/
protected IndexReader getIndexReader(boolean includeSystemIndex) throws IOException
{
- // deny query execution if index in offline mode
- // TODO Replace with special Exception Type
- if (!index.isOnline())
+ // deny query execution if index in offline mode and allowQuery is false
+ if (!index.isOnline() && !allowQuery)
{
throw new IndexOfflineIOException("Index is offline");
}
@@ -2133,7 +2137,7 @@
{
try
{
- Class analyzerClass = Class.forName(analyzerClassName);
+ Class<?> analyzerClass = Class.forName(analyzerClassName);
analyzer.setDefaultAnalyzer((Analyzer)analyzerClass.newInstance());
}
catch (Exception e)
@@ -2723,7 +2727,7 @@
{
try
{
- Class similarityClass = Class.forName(className);
+ Class<?> similarityClass = Class.forName(className);
similarity = (Similarity)similarityClass.newInstance();
}
catch (Exception e)
@@ -3072,11 +3076,19 @@
}
/**
- * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setOnline(boolean)
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setOnline(boolean, boolean)
*/
- public void setOnline(boolean isOnline) throws IOException
+ public void setOnline(boolean isOnline, boolean allowQuery) throws IOException
{
checkOpen();
+ if (isOnline)
+ {
+ this.allowQuery = true;
+ }
+ else
+ {
+ this.allowQuery = allowQuery;
+ }
index.setOnline(isOnline);
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2011-04-22 09:39:17 UTC (rev 4273)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2011-04-22 12:19:42 UTC (rev 4274)
@@ -108,19 +108,19 @@
}
/**
- * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setOnline(boolean)
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#isOnline()
*/
- public void setOnline(boolean isOnline)
+ public boolean isOnline()
{
- // TODO Auto-generated method stub
-
+ return true;
}
/**
- * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#isOnline()
+ * @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#setOnline(boolean, boolean)
*/
- public boolean isOnline()
+ public void setOnline(boolean isOnline, boolean allowQuery) throws IOException
{
- return true;
+ // TODO Auto-generated method stub
+
}
}
15 years
exo-jcr SVN: r4273 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/core.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-04-22 05:39:17 -0400 (Fri, 22 Apr 2011)
New Revision: 4273
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/core/digest-auth.xml
Log:
EXOJCR-1019: added info in docbook for digest auth config
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/core/digest-auth.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/core/digest-auth.xml 2011-04-22 09:06:08 UTC (rev 4272)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/core/digest-auth.xml 2011-04-22 09:39:17 UTC (rev 4273)
@@ -26,6 +26,9 @@
<section>
<title>Tomcat Server configuration</title>
+ <para>You need to fulfill a couple of steps. Firstly change login
+ configuration:</para>
+
<para>Edit config file located here:
exo-tomcat/webapps/rest.war/WEB-INF/web.xml</para>
@@ -43,11 +46,29 @@
configuration can be found at <ulink
url="http://tomcat.apache.org/tomcat-6.0-doc/config/realm.html">Apache
Tomcat Configuration Reference</ulink>.</para>
+
+ <para>Secondly you also need to specify new login module for
+ JAAS:</para>
+
+ <para>Edit config file located here: exo-tomcat/conf/jaas.conf</para>
+
+ <para>Replace</para>
+
+ <para><programlisting>exo-domain {
+ org.exoplatform.services.security.j2ee.TomcatLoginModule required;
+};</programlisting>for</para>
+
+ <para><programlisting>exo-domain {
+ org.exoplatform.services.security.j2ee.DigestAuthenticationTomcatLoginModule required;
+};</programlisting></para>
</section>
<section>
<title>Jetty server configuration</title>
+ <para>You need to fulfill a couple of steps. Firstly change login
+ configuration:</para>
+
<para>Edit config file located here:
exo-jetty/webapps/rest.war/WEB-INF/web.xml</para>
@@ -61,7 +82,20 @@
<para><programlisting><login-config>
<auth-method>DIGEST</auth-method>
<realm-name>eXo REST services</realm-name>
-</login-config></programlisting></para>
+</login-config></programlisting>Secondly you also need to specify new
+ login module for JAAS:</para>
+
+ <para>Edit config file located here: exo-jetty/jaas.conf</para>
+
+ <para>Replace</para>
+
+ <para><programlisting>exo-domain {
+ org.exoplatform.services.security.j2ee.JettyLoginModule required;
+};</programlisting>for</para>
+
+ <para><programlisting>exo-domain {
+ org.exoplatform.services.security.j2ee.DigestAuthenticationJettyLoginModule required;
+};</programlisting></para>
</section>
<section>
@@ -87,7 +121,7 @@
<para><programlisting><application-policy name="exo-domain">
<authentication>
- <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule"
+ <login-module code="org.exoplatform.services.security.j2ee.DigestAuthenticationJbossLoginModule"
flag="required">
<module-option name="usersProperties">props/jmx-console-users.properties</module-option>
<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
15 years
exo-jcr SVN: r4272 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2011-04-22 05:06:08 -0400 (Fri, 22 Apr 2011)
New Revision: 4272
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/OfflinePersistentIndex.java
Log:
EXOJCR-1221: some useless logs removed
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/OfflinePersistentIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/OfflinePersistentIndex.java 2011-04-22 08:36:08 UTC (rev 4271)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/OfflinePersistentIndex.java 2011-04-22 09:06:08 UTC (rev 4272)
@@ -23,8 +23,6 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Similarity;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.DirectoryManager;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
import java.io.IOException;
import java.util.ArrayList;
@@ -42,12 +40,6 @@
*/
public class OfflinePersistentIndex extends PersistentIndex
{
-
- /**
- * The logger
- */
- private static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.OfflinePersistentIndex");
-
public static final String NAME = "offline";
private List<String> processedIDs;
@@ -81,7 +73,6 @@
{
int count = super.removeDocument(idTerm);
processedIDs.add(idTerm.text());
- LOG.info("RM: " + idTerm.text());
return count;
}
@@ -91,7 +82,6 @@
super.addDocuments(docs);
for (Document doc : docs)
{
- LOG.info("add: " + doc.get(FieldNames.UUID));
processedIDs.add(doc.get(FieldNames.UUID));
}
}
15 years
exo-jcr SVN: r4271 - in core/trunk: exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/auth and 5 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-04-22 04:36:08 -0400 (Fri, 22 Apr 2011)
New Revision: 4271
Added:
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/ExtendedUserHandler.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestPasswordEncrypter.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJbossLoginModule.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationTomcatLoginModule.java
Removed:
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/DigestAuthenticator.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestAuthenticationHelper.java
Modified:
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/auth/OrganizationAuthenticatorImpl.java
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JbossLoginModule.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JettyLoginModule.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/TomcatLoginModule.java
Log:
EXOJCR-1019: digest auth redesigned
Deleted: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/DigestAuthenticator.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/DigestAuthenticator.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/DigestAuthenticator.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -1,43 +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.organization;
-
-import org.exoplatform.services.security.Credential;
-
-/**
- * Created by The eXo Platform SAS .
- *
- * @author Dmitry Kuleshov
- * @version $Id: $
- */
-
-public interface DigestAuthenticator
-{
- /**
- * Checks if user's credentials are valid.
- * It is more flexible because Credential may contain password context
- * or some other useful data.
- * @param credentials
- * @return return true if the username and the password matches
- * the database record, else return false.
- * @throws Exception throw an exception if cannot access the database
- */
- public boolean authenticate(Credential[] credentials) throws Exception;
-}
Added: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/ExtendedUserHandler.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/ExtendedUserHandler.java (rev 0)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/ExtendedUserHandler.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -0,0 +1,43 @@
+/*
+ * 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.organization;
+
+import org.exoplatform.services.security.PasswordEncrypter;
+
+/**
+ * Created by The eXo Platform SAS .
+ *
+ * @author Dmitry Kuleshov
+ * @version $Id: $
+ */
+
+public interface ExtendedUserHandler
+{
+ /**
+ * Checks if user's credentials are valid.
+ * It is more flexible because Credential may contain password context
+ * or some other useful data.
+ * @param credentials
+ * @return return true if the username and the password matches
+ * the database record, else return false.
+ * @throws Exception throw an exception if cannot access the database
+ */
+ public boolean authenticate(String username, String password, PasswordEncrypter pe) throws Exception;
+}
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/auth/OrganizationAuthenticatorImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/auth/OrganizationAuthenticatorImpl.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/auth/OrganizationAuthenticatorImpl.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -22,12 +22,13 @@
import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.organization.DigestAuthenticator;
+import org.exoplatform.services.organization.ExtendedUserHandler;
import org.exoplatform.services.organization.Membership;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.UserHandler;
import org.exoplatform.services.security.Authenticator;
import org.exoplatform.services.security.Credential;
+import org.exoplatform.services.security.DigestPasswordEncrypter;
import org.exoplatform.services.security.Identity;
import org.exoplatform.services.security.MembershipEntry;
import org.exoplatform.services.security.PasswordCredential;
@@ -37,6 +38,7 @@
import java.util.Collection;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
import javax.security.auth.login.LoginException;
@@ -114,16 +116,22 @@
*/
public String validateUser(Credential[] credentials) throws LoginException, Exception
{
- String user = null;
+ String username = null;
String password = null;
+ Map<String, String> passwordContext= null;
for (Credential cred : credentials)
{
if (cred instanceof UsernameCredential)
- user = ((UsernameCredential)cred).getUsername();
+ {
+ username = ((UsernameCredential)cred).getUsername();
+ }
if (cred instanceof PasswordCredential)
+ {
password = ((PasswordCredential)cred).getPassword();
+ passwordContext = ((PasswordCredential)cred).getPasswordContext();
+ }
}
- if (user == null || password == null)
+ if (username == null || password == null)
throw new LoginException("Username or Password is not defined");
if (this.encrypter != null)
@@ -132,20 +140,21 @@
begin(orgService);
boolean success;
Object userHandler = orgService.getUserHandler();
- if (userHandler instanceof DigestAuthenticator)
+ if (passwordContext != null && userHandler instanceof ExtendedUserHandler)
{
- success = ((DigestAuthenticator)userHandler).authenticate(credentials);
+ PasswordEncrypter pe = new DigestPasswordEncrypter(username, passwordContext);
+ success = ((ExtendedUserHandler)userHandler).authenticate(username, password, pe);
}
else
{
- success = ((UserHandler)userHandler).authenticate(user, password);
+ success = ((UserHandler)userHandler).authenticate(username, password);
}
end(orgService);
if (!success)
- throw new LoginException("Login failed for " + user.replace("\n", " ").replace("\r", " "));
+ throw new LoginException("Login failed for " + username.replace("\n", " ").replace("\r", " "));
- return user;
+ return username;
}
public void begin(OrganizationService orgService) throws Exception
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/mock/DummyOrganizationService.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -25,7 +25,7 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.services.organization.BaseOrganizationService;
-import org.exoplatform.services.organization.DigestAuthenticator;
+import org.exoplatform.services.organization.ExtendedUserHandler;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupEventListener;
import org.exoplatform.services.organization.GroupHandler;
@@ -43,16 +43,12 @@
import org.exoplatform.services.organization.impl.MembershipImpl;
import org.exoplatform.services.organization.impl.UserImpl;
import org.exoplatform.services.organization.impl.UserProfileImpl;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.DigestAuthenticationHelper;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
+import org.exoplatform.services.security.PasswordEncrypter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
/**
* @author benjaminmestrallet
@@ -154,7 +150,7 @@
}
}
- static public class UserHandlerImpl implements UserHandler, DigestAuthenticator
+ static public class UserHandlerImpl implements UserHandler, ExtendedUserHandler
{
private static final int DEFAULT_LIST_SIZE = 6;
@@ -303,31 +299,9 @@
{
}
- public boolean authenticate(String username, String password) throws Exception
+ public boolean authenticate(String username, String password, PasswordEncrypter pe) throws Exception
{
- return authenticate(new Credential[]{new UsernameCredential(username), new PasswordCredential(password)});
- }
-
- public boolean authenticate(Credential[] credentials) throws Exception
- {
- String username = null;
- String password = null;
- Map<String, String> passwordContext = null;
- for (Credential cred : credentials)
- {
- if (cred instanceof UsernameCredential)
- {
- username = ((UsernameCredential)cred).getUsername();
- }
- if (cred instanceof PasswordCredential)
- {
- password = ((PasswordCredential)cred).getPassword();
- passwordContext = ((PasswordCredential)cred).getPasswordContext();
- }
- }
-
Iterator<User> it = users.iterator();
-
User usr = null;
User temp = null;
while (it.hasNext())
@@ -346,7 +320,7 @@
{
return true;
}
- if (passwordContext == null)
+ if (pe == null)
{
if (usr.getPassword().equals(password))
{
@@ -357,7 +331,7 @@
else
{
// so we need calculate MD5 cast
- String dp = DigestAuthenticationHelper.calculatePassword(username, usr.getPassword(), passwordContext);
+ String dp = new String(pe.encrypt(usr.getPassword().getBytes()));
// to compare it to sent by client
if (dp.equals(password))
{
@@ -367,9 +341,13 @@
}
return false;
+
}
-
+ public boolean authenticate(String username, String password) throws Exception
+ {
+ return authenticate(username, password, null);
+ }
}
public static class GroupHandlerImpl implements GroupHandler
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -25,17 +25,14 @@
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.database.HibernateService;
import org.exoplatform.services.database.ObjectQuery;
-import org.exoplatform.services.organization.DigestAuthenticator;
+import org.exoplatform.services.organization.ExtendedUserHandler;
import org.exoplatform.services.organization.Query;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserEventListener;
import org.exoplatform.services.organization.UserEventListenerHandler;
import org.exoplatform.services.organization.UserHandler;
import org.exoplatform.services.organization.impl.UserImpl;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.DigestAuthenticationHelper;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
+import org.exoplatform.services.security.PasswordEncrypter;
import org.hibernate.Session;
import org.hibernate.Transaction;
@@ -45,13 +42,12 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
/**
* Created by The eXo Platform SAS Author : Mestrallet Benjamin benjmestrallet(a)users.sourceforge.net
* Author : Tuan Nguyen tuan08(a)users.sourceforge.net Date: Aug 22, 2003 Time: 4:51:21 PM
*/
-public class UserDAOImpl implements UserHandler, UserEventListenerHandler, DigestAuthenticator
+public class UserDAOImpl implements UserHandler, UserEventListenerHandler, ExtendedUserHandler
{
public static final String queryFindUserByName =
"from u in class org.exoplatform.services.organization.impl.UserImpl " + "where u.userName = ?";
@@ -179,40 +175,26 @@
public boolean authenticate(String username, String password) throws Exception
{
- return authenticate(new Credential[]{new UsernameCredential(username), new PasswordCredential(password)});
+ return authenticate(username, password, null);
}
- public boolean authenticate(Credential[] credentials) throws Exception
+ public boolean authenticate(String username, String password, PasswordEncrypter pe) throws Exception
{
- String username = null;
- String password = null;
- Map<String, String> passwordContext= null;
- for (Credential cred : credentials)
- {
- if (cred instanceof UsernameCredential)
- {
- username = ((UsernameCredential)cred).getUsername();
- }
- if (cred instanceof PasswordCredential)
- {
- password = ((PasswordCredential)cred).getPassword();
- passwordContext = ((PasswordCredential)cred).getPasswordContext();
- }
- }
-
User user = findUserByName(username);
if (user == null)
+ {
return false;
+ }
boolean authenticated;
- if (passwordContext == null)
+ if (pe == null)
{
authenticated = user.getPassword().equals(password);
}
else
{
- authenticated =
- DigestAuthenticationHelper.calculatePassword(username, user.getPassword(), passwordContext).equals(password);
+ String encryptedPassword = new String(pe.encrypt(user.getPassword().getBytes()));
+ authenticated = encryptedPassword.equals(password);
}
if (authenticated)
{
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/UserDAOImpl.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -28,7 +28,7 @@
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.organization.DigestAuthenticator;
+import org.exoplatform.services.organization.ExtendedUserHandler;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.GroupHandler;
import org.exoplatform.services.organization.Membership;
@@ -38,19 +38,15 @@
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserEventListener;
import org.exoplatform.services.organization.UserHandler;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.DigestAuthenticationHelper;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
+import org.exoplatform.services.security.PasswordEncrypter;
import java.util.Calendar;
import java.util.List;
-import java.util.Map;
/**
* Created by The eXo Platform SAS Apr 7, 2007
*/
-public class UserDAOImpl extends StandardSQLDAO<UserImpl> implements UserHandler, DigestAuthenticator
+public class UserDAOImpl extends StandardSQLDAO<UserImpl> implements UserHandler, ExtendedUserHandler
{
protected static Log log = ExoLogger.getLogger("exo.core.component.organization.jdbc.UserDAOImpl");
@@ -87,44 +83,32 @@
public boolean authenticate(String username, String password) throws Exception
{
- return authenticate(new Credential[]{new UsernameCredential(username), new PasswordCredential(password)});
+ return authenticate(username, password, null);
}
- public boolean authenticate(Credential[] credentials) throws Exception
+ public boolean authenticate(String username, String password, PasswordEncrypter pe) throws Exception
{
- String username = null;
- String password = null;
- Map<String, String> passwordContext = null;
- for (Credential cred : credentials)
- {
- if (cred instanceof UsernameCredential)
- {
- username = ((UsernameCredential)cred).getUsername();
- }
- if (cred instanceof PasswordCredential)
- {
- password = ((PasswordCredential)cred).getPassword();
- passwordContext = ((PasswordCredential)cred).getPasswordContext();
- }
- }
-
User user = findUserByName(username);
if (user == null)
+ {
return false;
+ }
boolean authenticated;
- if (passwordContext == null)
+ if (pe == null)
{
authenticated = user.getPassword().equals(password);
}
else
{
- authenticated =
- DigestAuthenticationHelper.calculatePassword(username, user.getPassword(), passwordContext).equals(password);
+ String encryptedPassword = new String(pe.encrypt(user.getPassword().getBytes()));
+ authenticated = encryptedPassword.equals(password);
}
if (log.isDebugEnabled())
+ {
log.debug("+++++++++++AUTHENTICATE USERNAME " + username + " AND PASS " + password + " - " + authenticated);
+ }
if (authenticated)
{
UserImpl userImpl = (UserImpl)user;
@@ -243,5 +227,4 @@
public void addUserEventListener(UserEventListener listener)
{
}
-
}
Deleted: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestAuthenticationHelper.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestAuthenticationHelper.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestAuthenticationHelper.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -1,111 +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.security;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Map;
-
-/**
- * @author Dmitry Kuleshov
- * @version $Id:$
- */
-
-public class DigestAuthenticationHelper
-{
-
- /**
- * Number of HEX digits used for A1, A2 strings and password encoding.
- * More information is settled in<a href=http://www.apps.ietf.org/rfc/rfc2617.html#sec-3.2.2>RFC-2617</a>.
- */
- private static int HASH_HEX_LENGTH = 32;
-
- public static String calculatePassword(String username, String originalPassword, Map<String, String> passwordContext)
- throws NoSuchAlgorithmException
- {
- // fetch needed data
- String nc = passwordContext.get("nc");
- String a2 = passwordContext.get("md5a2");
- String uri = passwordContext.get("uri");
- String qop = passwordContext.get("qop");
- String nonce = passwordContext.get("nonce");
- String realm = passwordContext.get("realmName");
- String cnonce = passwordContext.get("cnonce");
- String entity = passwordContext.get("entity");
- String method = passwordContext.get("method");
- if (realm == null)
- {
- // in case we have a jboss server, it uses 'realm' name
- realm = passwordContext.get("realm");
- }
- if (a2 == null)
- {
- // in case we have a jboss server, it uses 'a2hash' name
- a2 = passwordContext.get("a2hash");
- }
-
- MessageDigest md = MessageDigest.getInstance("MD5");
- // calculate MD5 hash of A1 string
- String a1 = username + ":" + realm + ":" + originalPassword;
- md.update(a1.getBytes());
- // encode A1 in HEX digits
- a1 = convertToHex(md.digest());
-
- // if encoded A2 MD5 hash is not supplied by server
- // we need to calculate it manually
- if (a2 == null)
- {
- if (qop.equals("auth"))
- {
- md.update((method + ":" + uri).getBytes());
- a2 = convertToHex(md.digest());
- }
- else if (qop.equals("auth-int"))
- {
- md.update((method + ":" + uri + ":" + convertToHex(entity.getBytes())).getBytes());
- a2 = convertToHex(md.digest());
- }
- }
-
- // create a digest using provided data
- String digest = a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2;
- md.update(digest.getBytes());
- // return encoded hash using HEX digits digest
- return convertToHex(md.digest());
- }
-
- public static String convertToHex(byte[] bin)
- {
- StringBuffer tmpStr = new StringBuffer(HASH_HEX_LENGTH);
- int digit;
-
- for (int i = 0; i < HASH_HEX_LENGTH / 2; i++)
- {
- // get integer presentation of left 4 bits of byte
- digit = (bin[i] >> 4) & 0xf;
- // append HEX digit
- tmpStr.append(Integer.toHexString(digit));
- // get integer presentation of right 4 bits of byte
- digit = bin[i] & 0xf;
- tmpStr.append(Integer.toHexString(digit));
-
- };
- return tmpStr.toString();
- }
-}
Added: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestPasswordEncrypter.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestPasswordEncrypter.java (rev 0)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/DigestPasswordEncrypter.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -0,0 +1,133 @@
+/*
+* 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.security;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Map;
+
+/**
+ * Created by The eXo Platform SAS.
+ * Encapsulates Digest Authentication encryption algorithm.
+ * More info <a href=http://www.faqs.org/rfcs/rfc2617.html>here</a>.
+ *
+ * @author Dmitry Kuleshov
+ * @version $Id: $
+ */
+
+public class DigestPasswordEncrypter implements PasswordEncrypter
+{
+ final private int HASH_HEX_LENGTH = 32;
+
+ final private Map<String, String> context;
+
+ final private String username;
+
+ public DigestPasswordEncrypter(String username, Map<String, String> context)
+ {
+ this.context = context;
+ this.username = username;
+ }
+
+ /**
+ * Number of HEX digits used for A1, A2 strings and password encoding.
+ * More information is settled in<a href=http://www.apps.ietf.org/rfc/rfc2617.html#sec-3.2.2>RFC-2617</a>.
+ */
+
+ private String convertToHex(byte[] bin)
+ {
+ StringBuffer tmpStr = new StringBuffer(HASH_HEX_LENGTH);
+ int digit;
+
+ for (int i = 0; i < HASH_HEX_LENGTH / 2; i++)
+ {
+ // get integer presentation of left 4 bits of byte
+ digit = (bin[i] >> 4) & 0xf;
+ // append HEX digit
+ tmpStr.append(Integer.toHexString(digit));
+ // get integer presentation of right 4 bits of byte
+ digit = bin[i] & 0xf;
+ tmpStr.append(Integer.toHexString(digit));
+
+ };
+ return tmpStr.toString();
+ }
+
+ public byte[] encrypt(byte[] plainPassword)
+ {
+ String nc = context.get("nc");
+ String a2 = context.get("md5a2");
+ String uri = context.get("uri");
+ String qop = context.get("qop");
+ String nonce = context.get("nonce");
+ String realm = context.get("realmName");
+ String cnonce = context.get("cnonce");
+ String entity = context.get("entity");
+ String method = context.get("method");
+ if (realm == null)
+ {
+ // in case we have a jboss server, it uses 'realm' name
+ realm = context.get("realm");
+ }
+ if (a2 == null)
+ {
+ // in case we have a jboss server, it uses 'a2hash' name
+ a2 = context.get("a2hash");
+ }
+
+ MessageDigest md = null;
+ try
+ {
+ md = MessageDigest.getInstance("MD5");
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ //TODO add exologger
+ }
+ // calculate MD5 hash of A1 string
+ String a1 = username + ":" + realm + ":" + new String(plainPassword);
+ md.update(a1.getBytes());
+ // encode A1 in HEX digits
+ a1 = convertToHex(md.digest());
+
+ // if encoded A2 MD5 hash is not supplied by server
+ // we need to calculate it manually
+ if (a2 == null)
+ {
+ if (qop.equals("auth"))
+ {
+ md.update((method + ":" + uri).getBytes());
+ a2 = convertToHex(md.digest());
+ }
+ else if (qop.equals("auth-int"))
+ {
+ md.update((method + ":" + uri + ":" + convertToHex(entity.getBytes())).getBytes());
+ a2 = convertToHex(md.digest());
+ }
+ }
+
+ // create a digest using provided data
+ String digest = a1 + ":" + nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + a2;
+ md.update(digest.getBytes());
+ // return encoded hash using HEX digits digest
+ return convertToHex(md.digest()).getBytes();
+
+ }
+}
Added: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJbossLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJbossLoginModule.java (rev 0)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJbossLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -0,0 +1,234 @@
+/*
+ * 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.security.j2ee;
+
+import org.exoplatform.services.security.Authenticator;
+import org.exoplatform.services.security.Credential;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.PasswordCredential;
+import org.exoplatform.services.security.UsernameCredential;
+import org.jboss.security.auth.callback.MapCallback;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+
+/**
+ * Created by The eXo Platform SAS .
+ *
+ * @author Dmitry Kuleshov
+ * @version $Id: $
+ */
+
+public class DigestAuthenticationJbossLoginModule extends JbossLoginModule
+{
+ /**
+ * To retrieve password context during Digest Authentication.
+ */
+ private MapCallback[] mapCallback = {new MapCallback()};
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean login() throws LoginException
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("In login of JbossLoginModule.");
+ }
+ try
+ {
+ if (sharedState.containsKey("exo.security.identity"))
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Use Identity from previous LoginModule");
+ }
+ identity = (Identity)sharedState.get("exo.security.identity");
+ }
+ else
+ {
+ if (!digestAuthenticationIsUsed())
+ {
+ return super.login();
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Try create identity");
+ }
+
+ Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
+
+ if (authenticator == null)
+ {
+ throw new LoginException("No Authenticator component found, check your configuration");
+ }
+
+ String userId = authenticator.validateUser(getCredentials());
+
+ identity = authenticator.createIdentity(userId);
+ sharedState.put("javax.security.auth.login.name", userId);
+ subject.getPrivateCredentials().add(getPassword());
+ subject.getPublicCredentials().add(getUsername());
+ }
+ return true;
+
+ }
+ catch (final Throwable e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(e.getMessage(), e);
+ }
+
+ throw new LoginException(e.getMessage());
+ }
+ }
+
+ /**
+ * An utility method handles mapCallback and also checks if digest authentication is used.
+ * @return true if digest authentication is used, otherwise - false
+ * @throws IOException
+ */
+ private boolean digestAuthenticationIsUsed() throws IOException
+ {
+ try
+ {
+ // here we're trying to handle mapCallback
+ // if it is handled successfully than digest
+ // authentication is used
+ callbackHandler.handle(mapCallback);
+ return true;
+ }
+ catch (UnsupportedCallbackException uce)
+ {
+ // otherwise UnsupportedCallbackException is thrown
+ return false;
+ }
+ }
+
+ /**
+ * An utility method to retrieve credentials. All needed for password hashing information
+ * is retrieved from MapCallback. NameCallback and PasswordCallback are used to correspondingly
+ * retrieve username and password.
+ * @return Credential
+ * @throws IOException
+ * @throws Exception
+ */
+ private Credential[] getCredentials() throws IOException
+ {
+ String username = null;
+ String password = null;
+ Map<String, String> passwordContext = new HashMap<String, String>();
+
+ passwordContext.put("qop", (String)mapCallback[0].getInfo("qop"));
+ passwordContext.put("nonce", (String)mapCallback[0].getInfo("nonce"));
+ passwordContext.put("cnonce", (String)mapCallback[0].getInfo("cnonce"));
+ passwordContext.put("a2hash", (String)mapCallback[0].getInfo("a2hash"));
+ passwordContext.put("nc", (String)mapCallback[0].getInfo("nc"));
+ passwordContext.put("realm", (String)mapCallback[0].getInfo("realm"));
+
+ try
+ {
+ Callback[] nameCallback = {new NameCallback("Username")};
+ callbackHandler.handle(nameCallback);
+ username = ((NameCallback)nameCallback[0]).getName();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving username from callback handler! ", e);
+ }
+ }
+
+ try
+ {
+ Callback[] passwordCallback = {new PasswordCallback("Password", false)};
+ callbackHandler.handle(passwordCallback);
+ password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
+ ((PasswordCallback)passwordCallback[0]).clearPassword();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving password from callback handler! ", e);
+ }
+ }
+
+ if (username == null || password == null)
+ {
+ return null;
+ }
+
+ return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
+ }
+
+ private UsernameCredential getUsername() throws IOException
+ {
+ String username = null;
+
+ try
+ {
+ Callback[] nameCallback = {new NameCallback("Username")};
+ callbackHandler.handle(nameCallback);
+ username = ((NameCallback)nameCallback[0]).getName();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving username from callback handler! ", e);
+ }
+ }
+
+ return new UsernameCredential(username);
+ }
+
+ private String getPassword() throws IOException
+ {
+ String password = null;
+
+ try
+ {
+ Callback[] passwordCallback = {new PasswordCallback("Password", false)};
+ callbackHandler.handle(passwordCallback);
+ password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
+ ((PasswordCallback)passwordCallback[0]).clearPassword();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving password from callback handler! ", e);
+ }
+ }
+
+ return password;
+ }
+}
Added: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java (rev 0)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -0,0 +1,249 @@
+/*
+ * 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.security.j2ee;
+
+import org.eclipse.jetty.plus.jaas.callback.ObjectCallback;
+import org.eclipse.jetty.security.authentication.DigestAuthenticator;
+import org.exoplatform.services.security.Authenticator;
+import org.exoplatform.services.security.Credential;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.PasswordCredential;
+import org.exoplatform.services.security.UsernameCredential;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+
+/**
+ * Created by The eXo Platform SAS .
+ *
+ * @author Dmitry Kuleshov
+ * @version $Id: $
+ */
+public class DigestAuthenticationJettyLoginModule extends JettyLoginModule
+{
+ /**
+ * To retrieve an object instance containing needed password context.
+ */
+ private Callback[] objectCallback = {new ObjectCallback()};
+
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean login() throws LoginException
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("In login of JettyLoginModule.");
+ }
+ try
+ {
+ if (sharedState.containsKey("exo.security.identity"))
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Use Identity from previous LoginModule");
+ }
+ identity = (Identity)sharedState.get("exo.security.identity");
+ }
+ else
+ {
+ if (!digestAuthenticationIsUsed())
+ {
+ return super.login();
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Try create identity");
+ }
+
+ Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
+
+ if (authenticator == null)
+ {
+ throw new LoginException("No Authenticator component found, check your configuration");
+ }
+
+ String userId = authenticator.validateUser(getCredentials());
+
+ identity = authenticator.createIdentity(userId);
+ sharedState.put("javax.security.auth.login.name", userId);
+ // TODO use PasswordCredential wrapper
+ subject.getPrivateCredentials().add(getPassword());
+ subject.getPublicCredentials().add(getUsername());
+ }
+ return true;
+
+ }
+ catch (final Throwable e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(e.getMessage(), e);
+ }
+
+ throw new LoginException(e.getMessage());
+ }
+ }
+
+ /**
+ * An utility method to handle object callback and also to checks if
+ * digest authentication is used during login operation.
+ * @return true if digest authentication is used, otherwise - false
+ * @throws IOException
+ * @throws UnsupportedCallbackException
+ */
+ private boolean digestAuthenticationIsUsed() throws IOException, UnsupportedCallbackException
+ {
+ callbackHandler.handle(objectCallback);
+ // in case we have a digest authentication
+ // objectCallback should contain a structured instance
+ // in case we have a basic authentication
+ // objectCallback should contain only a string with a password
+ return !(((ObjectCallback)objectCallback[0]).getObject() instanceof String);
+ }
+
+ /**
+ * An utility method to get Credentials from object callback instance.
+ * It uses reflection mechanism to get access to Digest inner class of
+ * DigestAuthenticator, which is provided by object callback as it
+ * contains all needed information for password hashing.
+ * @return Credential
+ * @throws NoSuchFieldException
+ * @throws SecurityException
+ * @throws IllegalAccessException
+ * @throws IllegalArgumentException
+ * @throws Exception
+ */
+ private Credential[] getCredentials()
+ {
+ Map<String, String> passwordContext = new HashMap<String, String>();
+ Set<String> contextElements = new HashSet<String>();
+ // object to contain DigestAuthenticator$Digest instance to get
+ // needed data from instance's fields
+ Object objectFromCallback = ((ObjectCallback)objectCallback[0]).getObject();
+ String username = null;
+ String password = null;
+ // to keep DigestAuthenticator$Digest representation
+ Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
+ contextElements.add("cnonce");
+ contextElements.add("method");
+ contextElements.add("nc");
+ contextElements.add("nonce");
+ contextElements.add("qop");
+ contextElements.add("realm");
+ contextElements.add("uri");
+
+ try
+ {
+ // here we're going to retrieve needed information from Digest class fields
+ Iterator<String> elementIterator = contextElements.iterator();
+ String element;
+ Field field;
+ while (elementIterator.hasNext())
+ {
+ element = elementIterator.next();
+ field = digestAuthenticatorClazz.getDeclaredField(element);
+ // need to set true as all needed fields are in private class, thus are private
+ field.setAccessible(true);
+ passwordContext.put(element, (String)field.get(objectFromCallback));
+ }
+
+ // get username
+ field = digestAuthenticatorClazz.getDeclaredField("username");
+ field.setAccessible(true);
+ username = (String)field.get(objectFromCallback);
+
+ // get password
+ field = digestAuthenticatorClazz.getDeclaredField("response");
+ field.setAccessible(true);
+ password = (String)field.get(objectFromCallback);
+ }
+ catch (Exception e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Could not get credentials.", e);
+ }
+ }
+
+ if (username == null || password == null)
+ {
+ return null;
+ }
+
+ return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
+ }
+
+ private UsernameCredential getUsername()
+ {
+ String username = null;
+ Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+ try
+ {
+ Field field = digestAuthenticatorClazz.getDeclaredField("username");
+ field.setAccessible(true);
+ username = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
+ }
+ catch (Exception e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Could not get username.", e);
+ }
+ }
+
+ return new UsernameCredential(username);
+ }
+
+ private String getPassword() throws SecurityException, NoSuchFieldException, IllegalArgumentException,
+ IllegalAccessException
+ {
+ String password = null;
+ Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+ try
+ {
+ Field field = digestAuthenticatorClazz.getDeclaredField("response");
+ field.setAccessible(true);
+ password = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
+ }
+ catch (Exception e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Could not get password.", e);
+ }
+ }
+
+ return password;
+ }
+
+}
Added: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationTomcatLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationTomcatLoginModule.java (rev 0)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationTomcatLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -0,0 +1,252 @@
+/*
+ * 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.security.j2ee;
+
+import org.exoplatform.services.security.Authenticator;
+import org.exoplatform.services.security.Credential;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.PasswordCredential;
+import org.exoplatform.services.security.UsernameCredential;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.TextInputCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+
+/**
+ * Created by The eXo Platform SAS .
+ *
+ * @author Dmitry Kuleshov
+ * @version $Id: $
+ */
+
+public class DigestAuthenticationTomcatLoginModule extends TomcatLoginModule
+{
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean login() throws LoginException
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("In login of ExtendedTomcatLoginModule.");
+ }
+ try
+ {
+ if (sharedState.containsKey("exo.security.identity"))
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Use Identity from previous LoginModule");
+ }
+ identity = (Identity)sharedState.get("exo.security.identity");
+ }
+ else
+ {
+ if (!digestAuthenticationIsUsed())
+ {
+ return super.login();
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Try create identity");
+ }
+
+ Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
+
+ if (authenticator == null)
+ {
+ throw new LoginException("No Authenticator component found, check your configuration");
+ }
+
+ String userId = authenticator.validateUser(getCredentials());
+
+ identity = authenticator.createIdentity(userId);
+ sharedState.put("javax.security.auth.login.name", userId);
+ subject.getPrivateCredentials().add(getPassword());
+ subject.getPublicCredentials().add(getUsername());
+ }
+ return true;
+
+ }
+ catch (final Throwable e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(e.getMessage(), e);
+ }
+
+ throw new LoginException(e.getMessage());
+ }
+ }
+
+ /**
+ * An utility class to get credentials. To retrieve password context we use TextInputCallback.
+ * NameCallback and PasswordCallback are used to correspondingly retrieve username and password.
+ * @return Credential
+ * @throws IOException
+ * @throws Exception
+ */
+ private Credential[] getCredentials() throws IOException
+ {
+
+ Map<String, String> passwordContext = new HashMap<String, String>();
+ Set<String> contextElements = new HashSet<String>();
+ Callback[] digestCallback = new Callback[1];
+ String username = null;
+ String password = null;
+
+ contextElements.add("cnonce");
+ contextElements.add("nc");
+ contextElements.add("nonce");
+ contextElements.add("qop");
+ contextElements.add("realmName");
+ contextElements.add("md5a2");
+
+ Iterator<String> elementIterator = contextElements.iterator();
+
+ String element;
+ while (elementIterator.hasNext())
+ {
+ element = elementIterator.next();
+ try
+ {
+ digestCallback[0] = new TextInputCallback(element);
+ callbackHandler.handle(digestCallback);
+ passwordContext.put(element, ((TextInputCallback)digestCallback[0]).getText());
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Unsupported callback type.", e);
+ }
+ }
+
+ }
+
+ try
+ {
+ Callback[] nameCallback = {new NameCallback("Username")};
+ callbackHandler.handle(nameCallback);
+ username = ((NameCallback)nameCallback[0]).getName();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving username from callback handler! ", e);
+ }
+ }
+
+ try
+ {
+ Callback[] passwordCallback = {new PasswordCallback("Password", false)};
+ callbackHandler.handle(passwordCallback);
+ password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
+ ((PasswordCallback)passwordCallback[0]).clearPassword();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving password from callback handler! ", e);
+ }
+ }
+
+ if (username == null || password == null)
+ {
+ return null;
+ }
+
+ return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
+ }
+
+ /**
+ * An utility method to check if digest authentication is used.
+ * @return true if digest authentication is used, otherwise - false
+ * @throws IOException
+ * @throws UnsupportedCallbackException
+ */
+ private boolean digestAuthenticationIsUsed() throws IOException, UnsupportedCallbackException
+ {
+ Callback[] authCallback = {new TextInputCallback("authMethod")};
+ callbackHandler.handle(authCallback);
+ String authMethod = (String)(((TextInputCallback)authCallback[0]).getText());
+
+ return "DIGEST".equalsIgnoreCase(authMethod);
+ }
+
+ private UsernameCredential getUsername() throws IOException
+ {
+ String username = null;
+
+ try
+ {
+ Callback[] nameCallback = {new NameCallback("Username")};
+ callbackHandler.handle(nameCallback);
+ username = ((NameCallback)nameCallback[0]).getName();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving username from callback handler! ", e);
+ }
+ }
+
+ return new UsernameCredential(username);
+ }
+
+ private String getPassword() throws IOException
+ {
+ String password = null;
+
+ try
+ {
+ Callback[] passwordCallback = {new PasswordCallback("Password", false)};
+ callbackHandler.handle(passwordCallback);
+ password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
+ ((PasswordCallback)passwordCallback[0]).clearPassword();
+ }
+ catch (UnsupportedCallbackException e)
+ {
+ if (log.isErrorEnabled())
+ {
+ log.error("Error on retrieving password from callback handler! ", e);
+ }
+ }
+
+ return password;
+ }
+
+
+}
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JbossLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JbossLoginModule.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JbossLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -21,33 +21,20 @@
import org.exoplatform.container.monitor.jvm.J2EEServerInfo;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.security.Authenticator;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.Identity;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
import org.exoplatform.services.security.jaas.DefaultLoginModule;
import org.exoplatform.services.security.jaas.JAASGroup;
import org.exoplatform.services.security.jaas.RolePrincipal;
import org.exoplatform.services.security.jaas.UserPrincipal;
-import org.jboss.security.auth.callback.MapCallback;
-import java.io.IOException;
import java.security.Principal;
import java.security.acl.Group;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
/**
@@ -60,14 +47,9 @@
public class JbossLoginModule extends DefaultLoginModule
{
/** . */
- private static Log log = ExoLogger.getLogger("exo.core.component.security.core.JbossLoginModule.class");
+ protected static Log log = ExoLogger.getLogger("exo.core.component.security.core.JbossLoginModule.class");
/**
- * To retrieve password context during Digest Authentication.
- */
- private MapCallback[] mapCallback = {new MapCallback()};
-
- /**
* {@inheritDoc}
*/
@Override
@@ -99,190 +81,6 @@
}
/**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public boolean login() throws LoginException
- {
- if (log.isDebugEnabled())
- {
- log.debug("In login of JbossLoginModule.");
- }
- try
- {
- if (sharedState.containsKey("exo.security.identity"))
- {
- if (log.isDebugEnabled())
- {
- log.debug("Use Identity from previous LoginModule");
- }
- identity = (Identity)sharedState.get("exo.security.identity");
- }
- else
- {
- if (!digestAuthenticationIsUsed())
- {
- return super.login();
- }
-
- if (log.isDebugEnabled())
- {
- log.debug("Try create identity");
- }
-
- Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
-
- if (authenticator == null)
- {
- throw new LoginException("No Authenticator component found, check your configuration");
- }
-
- String userId = authenticator.validateUser(getCredentials());
-
- identity = authenticator.createIdentity(userId);
- sharedState.put("javax.security.auth.login.name", userId);
- subject.getPrivateCredentials().add(getPassword());
- subject.getPublicCredentials().add(getUsername());
- }
- return true;
-
- }
- catch (final Throwable e)
- {
- if (log.isDebugEnabled())
- {
- log.debug(e.getMessage(), e);
- }
-
- throw new LoginException(e.getMessage());
- }
- }
-
- /**
- * An utility method handles mapCallback and also checks if digest authentication is used.
- * @return true if digest authentication is used, otherwise - false
- * @throws IOException
- */
- private boolean digestAuthenticationIsUsed() throws IOException
- {
- try
- {
- // here we're trying to handle mapCallback
- // if it is handled successfully than digest
- // authentication is used
- callbackHandler.handle(mapCallback);
- return true;
- }
- catch (UnsupportedCallbackException uce)
- {
- // otherwise UnsupportedCallbackException is thrown
- return false;
- }
- }
-
- /**
- * An utility method to retrieve credentials. All needed for password hashing information
- * is retrieved from MapCallback. NameCallback and PasswordCallback are used to correspondingly
- * retrieve username and password.
- * @return Credential
- * @throws IOException
- * @throws Exception
- */
- private Credential[] getCredentials() throws IOException
- {
- String username = null;
- String password = null;
- Map<String, String> passwordContext = new HashMap<String, String>();
-
- passwordContext.put("qop", (String)mapCallback[0].getInfo("qop"));
- passwordContext.put("nonce", (String)mapCallback[0].getInfo("nonce"));
- passwordContext.put("cnonce", (String)mapCallback[0].getInfo("cnonce"));
- passwordContext.put("a2hash", (String)mapCallback[0].getInfo("a2hash"));
- passwordContext.put("nc", (String)mapCallback[0].getInfo("nc"));
- passwordContext.put("realm", (String)mapCallback[0].getInfo("realm"));
-
- try
- {
- Callback[] nameCallback = {new NameCallback("Username")};
- callbackHandler.handle(nameCallback);
- username = ((NameCallback)nameCallback[0]).getName();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving username from callback handler! ", e);
- }
- }
-
- try
- {
- Callback[] passwordCallback = {new PasswordCallback("Password", false)};
- callbackHandler.handle(passwordCallback);
- password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
- ((PasswordCallback)passwordCallback[0]).clearPassword();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving password from callback handler! ", e);
- }
- }
-
- if (username == null || password == null)
- {
- return null;
- }
-
- return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
- }
-
- private UsernameCredential getUsername() throws IOException
- {
- String username = null;
-
- try
- {
- Callback[] nameCallback = {new NameCallback("Username")};
- callbackHandler.handle(nameCallback);
- username = ((NameCallback)nameCallback[0]).getName();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving username from callback handler! ", e);
- }
- }
-
- return new UsernameCredential(username);
- }
-
- private String getPassword() throws IOException
- {
- String password = null;
-
- try
- {
- Callback[] passwordCallback = {new PasswordCallback("Password", false)};
- callbackHandler.handle(passwordCallback);
- password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
- ((PasswordCallback)passwordCallback[0]).clearPassword();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving password from callback handler! ", e);
- }
- }
-
- return password;
- }
-
- /**
* Attempts eviction of the subject in the JBoss security manager cache.
*
* @return a boolean
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JettyLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JettyLoginModule.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/JettyLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -1,35 +1,16 @@
package org.exoplatform.services.security.j2ee;
-import org.eclipse.jetty.plus.jaas.callback.ObjectCallback;
-import org.eclipse.jetty.security.authentication.DigestAuthenticator;
-import org.exoplatform.services.security.Authenticator;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.Identity;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
import org.exoplatform.services.security.jaas.DefaultLoginModule;
import org.exoplatform.services.security.jaas.RolePrincipal;
import org.exoplatform.services.security.jaas.UserPrincipal;
-import java.io.IOException;
-import java.lang.reflect.Field;
import java.security.Principal;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
public class JettyLoginModule extends DefaultLoginModule
{
- /**
- * To retrieve an object instance containing needed password context.
- */
- private Callback[] objectCallback = {new ObjectCallback()};
@Override
public boolean commit() throws LoginException
@@ -54,199 +35,4 @@
}
}
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public boolean login() throws LoginException
- {
- if (log.isDebugEnabled())
- {
- log.debug("In login of JettyLoginModule.");
- }
- try
- {
- if (sharedState.containsKey("exo.security.identity"))
- {
- if (log.isDebugEnabled())
- {
- log.debug("Use Identity from previous LoginModule");
- }
- identity = (Identity)sharedState.get("exo.security.identity");
- }
- else
- {
- if (!digestAuthenticationIsUsed())
- {
- return super.login();
- }
-
- if (log.isDebugEnabled())
- {
- log.debug("Try create identity");
- }
-
- Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
-
- if (authenticator == null)
- {
- throw new LoginException("No Authenticator component found, check your configuration");
- }
-
- String userId = authenticator.validateUser(getCredentials());
-
- identity = authenticator.createIdentity(userId);
- sharedState.put("javax.security.auth.login.name", userId);
- // TODO use PasswordCredential wrapper
- subject.getPrivateCredentials().add(getPassword());
- subject.getPublicCredentials().add(getUsername());
- }
- return true;
-
- }
- catch (final Throwable e)
- {
- if (log.isDebugEnabled())
- {
- log.debug(e.getMessage(), e);
- }
-
- throw new LoginException(e.getMessage());
- }
- }
-
- /**
- * An utility method to handle object callback and also to checks if
- * digest authentication is used during login operation.
- * @return true if digest authentication is used, otherwise - false
- * @throws IOException
- * @throws UnsupportedCallbackException
- */
- private boolean digestAuthenticationIsUsed() throws IOException, UnsupportedCallbackException
- {
- callbackHandler.handle(objectCallback);
- // in case we have a digest authentication
- // objectCallback should contain a structured instance
- // in case we have a basic authentication
- // objectCallback should contain only a string with a password
- return !(((ObjectCallback)objectCallback[0]).getObject() instanceof String);
- }
-
- /**
- * An utility method to get Credentials from object callback instance.
- * It uses reflection mechanism to get access to Digest inner class of
- * DigestAuthenticator, which is provided by object callback as it
- * contains all needed information for password hashing.
- * @return Credential
- * @throws NoSuchFieldException
- * @throws SecurityException
- * @throws IllegalAccessException
- * @throws IllegalArgumentException
- * @throws Exception
- */
- private Credential[] getCredentials()
- {
- Map<String, String> passwordContext = new HashMap<String, String>();
- Set<String> contextElements = new HashSet<String>();
- // object to contain DigestAuthenticator$Digest instance to get
- // needed data from instance's fields
- Object objectFromCallback = ((ObjectCallback)objectCallback[0]).getObject();
- String username = null;
- String password = null;
- // to keep DigestAuthenticator$Digest representation
- Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
-
- contextElements.add("cnonce");
- contextElements.add("method");
- contextElements.add("nc");
- contextElements.add("nonce");
- contextElements.add("qop");
- contextElements.add("realm");
- contextElements.add("uri");
-
- try
- {
- // here we're going to retrieve needed information from Digest class fields
- Iterator<String> elementIterator = contextElements.iterator();
- String element;
- Field field;
- while (elementIterator.hasNext())
- {
- element = elementIterator.next();
- field = digestAuthenticatorClazz.getDeclaredField(element);
- // need to set true as all needed fields are in private class, thus are private
- field.setAccessible(true);
- passwordContext.put(element, (String)field.get(objectFromCallback));
- }
-
- // get username
- field = digestAuthenticatorClazz.getDeclaredField("username");
- field.setAccessible(true);
- username = (String)field.get(objectFromCallback);
-
- // get password
- field = digestAuthenticatorClazz.getDeclaredField("response");
- field.setAccessible(true);
- password = (String)field.get(objectFromCallback);
- }
- catch (Exception e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Could not get credentials.", e);
- }
- }
-
- if (username == null || password == null)
- {
- return null;
- }
-
- return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
- }
-
- private UsernameCredential getUsername()
- {
- String username = null;
- Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
- try
- {
- Field field = digestAuthenticatorClazz.getDeclaredField("username");
- field.setAccessible(true);
- username = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
- }
- catch (Exception e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Could not get username.", e);
- }
- }
-
- return new UsernameCredential(username);
- }
-
- private String getPassword() throws SecurityException, NoSuchFieldException, IllegalArgumentException,
- IllegalAccessException
- {
- String password = null;
- Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
- try
- {
- Field field = digestAuthenticatorClazz.getDeclaredField("response");
- field.setAccessible(true);
- password = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
- }
- catch (Exception e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Could not get password.", e);
- }
- }
-
- return password;
- }
-
}
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/TomcatLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/TomcatLoginModule.java 2011-04-21 18:32:09 UTC (rev 4270)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/TomcatLoginModule.java 2011-04-22 08:36:08 UTC (rev 4271)
@@ -18,28 +18,13 @@
*/
package org.exoplatform.services.security.j2ee;
-import org.exoplatform.services.security.Authenticator;
-import org.exoplatform.services.security.Credential;
-import org.exoplatform.services.security.Identity;
-import org.exoplatform.services.security.PasswordCredential;
-import org.exoplatform.services.security.UsernameCredential;
import org.exoplatform.services.security.jaas.DefaultLoginModule;
import org.exoplatform.services.security.jaas.RolePrincipal;
import org.exoplatform.services.security.jaas.UserPrincipal;
-import java.io.IOException;
import java.security.Principal;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.TextInputCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
/**
@@ -78,206 +63,4 @@
}
}
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- @Override
- public boolean login() throws LoginException
- {
- if (log.isDebugEnabled())
- {
- log.debug("In login of TomcatLoginModule.");
- }
- try
- {
- if (sharedState.containsKey("exo.security.identity"))
- {
- if (log.isDebugEnabled())
- {
- log.debug("Use Identity from previous LoginModule");
- }
- identity = (Identity)sharedState.get("exo.security.identity");
- }
- else
- {
- if (!digestAuthenticationIsUsed())
- {
- return super.login();
- }
-
- if (log.isDebugEnabled())
- {
- log.debug("Try create identity");
- }
-
- Authenticator authenticator = (Authenticator)getContainer().getComponentInstanceOfType(Authenticator.class);
-
- if (authenticator == null)
- {
- throw new LoginException("No Authenticator component found, check your configuration");
- }
-
- String userId = authenticator.validateUser(getCredentials());
-
- identity = authenticator.createIdentity(userId);
- sharedState.put("javax.security.auth.login.name", userId);
- subject.getPrivateCredentials().add(getPassword());
- subject.getPublicCredentials().add(getUsername());
- }
- return true;
-
- }
- catch (final Throwable e)
- {
- if (log.isDebugEnabled())
- {
- log.debug(e.getMessage(), e);
- }
-
- throw new LoginException(e.getMessage());
- }
- }
-
- /**
- * An utility class to get credentials. To retrieve password context we use TextInputCallback.
- * NameCallback and PasswordCallback are used to correspondingly retrieve username and password.
- * @return Credential
- * @throws IOException
- * @throws Exception
- */
- private Credential[] getCredentials() throws IOException
- {
-
- Map<String, String> passwordContext = new HashMap<String, String>();
- Set<String> contextElements = new HashSet<String>();
- Callback[] digestCallback = new Callback[1];
- String username = null;
- String password = null;
-
- contextElements.add("cnonce");
- contextElements.add("nc");
- contextElements.add("nonce");
- contextElements.add("qop");
- contextElements.add("realmName");
- contextElements.add("md5a2");
-
- Iterator<String> elementIterator = contextElements.iterator();
-
- String element;
- while (elementIterator.hasNext())
- {
- element = elementIterator.next();
- try
- {
- digestCallback[0] = new TextInputCallback(element);
- callbackHandler.handle(digestCallback);
- passwordContext.put(element, ((TextInputCallback)digestCallback[0]).getText());
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Unsupported callback type.", e);
- }
- }
-
- }
-
- try
- {
- Callback[] nameCallback = {new NameCallback("Username")};
- callbackHandler.handle(nameCallback);
- username = ((NameCallback)nameCallback[0]).getName();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving username from callback handler! ", e);
- }
- }
-
- try
- {
- Callback[] passwordCallback = {new PasswordCallback("Password", false)};
- callbackHandler.handle(passwordCallback);
- password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
- ((PasswordCallback)passwordCallback[0]).clearPassword();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving password from callback handler! ", e);
- }
- }
-
- if (username == null || password == null)
- {
- return null;
- }
-
- return new Credential[]{new UsernameCredential(username), new PasswordCredential(password, passwordContext)};
- }
-
- /**
- * An utility method to check if digest authentication is used.
- * @return true if digest authentication is used, otherwise - false
- * @throws IOException
- * @throws UnsupportedCallbackException
- */
- private boolean digestAuthenticationIsUsed() throws IOException, UnsupportedCallbackException
- {
- Callback[] authCallback = {new TextInputCallback("authMethod")};
- callbackHandler.handle(authCallback);
- String authMethod = (String)(((TextInputCallback)authCallback[0]).getText());
-
- return "DIGEST".equalsIgnoreCase(authMethod);
- }
-
- private UsernameCredential getUsername() throws IOException
- {
- String username = null;
-
- try
- {
- Callback[] nameCallback = {new NameCallback("Username")};
- callbackHandler.handle(nameCallback);
- username = ((NameCallback)nameCallback[0]).getName();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving username from callback handler! ", e);
- }
- }
-
- return new UsernameCredential(username);
- }
-
- private String getPassword() throws IOException
- {
- String password = null;
-
- try
- {
- Callback[] passwordCallback = {new PasswordCallback("Password", false)};
- callbackHandler.handle(passwordCallback);
- password = new String(((PasswordCallback)passwordCallback[0]).getPassword());
- ((PasswordCallback)passwordCallback[0]).clearPassword();
- }
- catch (UnsupportedCallbackException e)
- {
- if (log.isErrorEnabled())
- {
- log.error("Error on retrieving password from callback handler! ", e);
- }
- }
-
- return password;
- }
-
-
}
15 years