JBoss Identity SVN: r496 - identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-05-12 10:23:14 -0400 (Tue, 12 May 2009)
New Revision: 496
Modified:
identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java
Log:
Added revision tag to javadoc for testing purposes
Modified: identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java 2009-05-12 14:20:49 UTC (rev 495)
+++ identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java 2009-05-12 14:23:14 UTC (rev 496)
@@ -35,7 +35,7 @@
* </p>
*
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
- * @version $$Revision: 1.1$$
+ * @version $$ Revision: 1.1 $$
*/
public class MockSTSConfiguration implements STSConfiguration
{
15 years, 8 months
JBoss Identity SVN: r495 - identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-05-12 10:20:49 -0400 (Tue, 12 May 2009)
New Revision: 495
Modified:
identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java
Log:
Added revision tag to javadoc for testing purposes
Modified: identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java 2009-05-12 12:28:05 UTC (rev 494)
+++ identity-federation/trunk/jboss-identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/wstrust/MockSTSConfiguration.java 2009-05-12 14:20:49 UTC (rev 495)
@@ -35,6 +35,7 @@
* </p>
*
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ * @version $$Revision: 1.1$$
*/
public class MockSTSConfiguration implements STSConfiguration
{
15 years, 8 months
JBoss Identity SVN: r494 - in idm/trunk: assembly and 15 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-12 08:28:05 -0400 (Tue, 12 May 2009)
New Revision: 494
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
switch version to 1.0.0-SNAPSHOT
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/assembly/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/distro/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/example/auth/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/example/simple/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-api/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-auth/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-cache/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-common/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-core/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-spi/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/integration/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/parent/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-12 12:21:26 UTC (rev 493)
+++ idm/trunk/pom.xml 2009-05-12 12:28:05 UTC (rev 494)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0.Alpha5</version>
+ <version>1.0.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 8 months
JBoss Identity SVN: r493 - idm/tags.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-12 08:21:26 -0400 (Tue, 12 May 2009)
New Revision: 493
Added:
idm/tags/1.0.0.Alpha5/
Log:
tag alpha5
Copied: idm/tags/1.0.0.Alpha5 (from rev 492, idm/trunk)
15 years, 8 months
JBoss Identity SVN: r492 - in idm/trunk: assembly and 16 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-12 07:47:08 -0400 (Tue, 12 May 2009)
New Revision: 492
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
switch version to 1.0.0.Alpha5
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/assembly/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/distro/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/example/auth/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/example/simple/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple JBoss Identity IDM Maven2 project</name>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-api/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-auth/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-cache/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-common/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-core/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-12 11:47:08 UTC (rev 492)
@@ -45,7 +45,7 @@
* @version : 0.1 $
*/
@Entity
-@Table(name = "jbid_io_creden", uniqueConstraints = {@UniqueConstraint(columnNames = {"IDENTITY_OBJECT_TYPE", "IDENTITY_OBJECT_ID"})})
+@Table(name = "jbid_io_creden", uniqueConstraints = {@UniqueConstraint(columnNames = {"CREDENTIAL_TYPE", "IDENTITY_OBJECT_ID"})})
public class HibernateIdentityObjectCredential implements IdentityObjectCredential
{
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-spi/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -8,12 +8,12 @@
<groupId>org.jboss.identity.idm.integration</groupId>
<artifactId>idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
</parent>
<properties>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/integration/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/parent/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -8,7 +8,7 @@
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<name>JBoss Identity IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
+++ idm/trunk/pom.xml 2009-05-12 11:47:08 UTC (rev 492)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Alpha5</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
15 years, 8 months
JBoss Identity SVN: r491 - in idm/trunk: distro and 36 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-12 05:32:57 -0400 (Tue, 12 May 2009)
New Revision: 491
Added:
idm/trunk/example/auth/
idm/trunk/example/auth/build-deploy.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/auth/src/
idm/trunk/example/auth/src/main/
idm/trunk/example/auth/src/main/java/
idm/trunk/example/auth/src/main/resources/
idm/trunk/example/auth/src/main/resources/META-INF/
idm/trunk/example/auth/src/main/resources/META-INF/idm-example-auth-jboss-beans.xml
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/context.xml
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/jboss-web.xml
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/web.xml
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/index.jsp
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/login.jsp
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/protected/
idm/trunk/example/auth/src/main/resources/idm-example-auth.war/protected/index.jsp
idm/trunk/example/auth/src/main/resources/jboss-idm.xml
idm/trunk/example/auth/src/main/resources/jboss.idm.hibernate.cfg.xml
idm/trunk/example/auth/src/main/resources/login-config.xml
idm/trunk/example/auth/src/main/resources/setup.txt
idm/trunk/example/auth/src/test/
idm/trunk/example/auth/src/test/java/
idm/trunk/example/auth/src/test/java/org/
idm/trunk/example/auth/src/test/java/org/jboss/
idm/trunk/example/auth/src/test/java/org/jboss/identity/
idm/trunk/example/auth/src/test/java/org/jboss/identity/idm/
idm/trunk/example/auth/src/test/resources/
Modified:
idm/trunk/distro/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/context/IdentitySessionContextImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java
idm/trunk/idm-testsuite/pom.xml
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
- Improvements in IDMService and JBossIdentityIDMLoginModule
- Example for JEE authentication
- Cleanup in poms formating
Modified: idm/trunk/distro/pom.xml
===================================================================
--- idm/trunk/distro/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/distro/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,102 +1,102 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>idm-distro</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>JBoss Identity IDM Distro </name>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-distro</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Distro </name>
- <parent>
- <groupId>org.jboss.identity</groupId>
- <artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
- <properties>
- <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
- <hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
- <hsqldb-version>1.8.0.7</hsqldb-version>
- <idm.version>1.0.0-SNAPSHOT</idm.version>
- <apache.ant.version>1.7.0</apache.ant.version>
- <izpack.version>4.2.1</izpack.version>
- <mysql.connector.version>5.0.8</mysql.connector.version>
- <postgresql.version>8.3-603.jdbc3</postgresql.version>
- <jtds.version>1.2.2</jtds.version>
+ <properties>
+ <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
+ <hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
+ <hsqldb-version>1.8.0.7</hsqldb-version>
+ <idm.version>1.0.0-SNAPSHOT</idm.version>
+ <apache.ant.version>1.7.0</apache.ant.version>
+ <izpack.version>4.2.1</izpack.version>
+ <mysql.connector.version>5.0.8</mysql.connector.version>
+ <postgresql.version>8.3-603.jdbc3</postgresql.version>
+ <jtds.version>1.2.2</jtds.version>
- </properties>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.jboss.identity</groupId>
- <artifactId>idm</artifactId>
- <version>${idm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.integration</groupId>
- <artifactId>idm-jboss5</artifactId>
- <version>${idm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.integration</groupId>
- <artifactId>idm-jboss5</artifactId>
- <classifier>config</classifier>
- <type>zip</type>
- <version>${idm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernate-commons-annotations}</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm</artifactId>
+ <version>${idm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.integration</groupId>
+ <artifactId>idm-jboss5</artifactId>
+ <version>${idm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.integration</groupId>
+ <artifactId>idm-jboss5</artifactId>
+ <classifier>config</classifier>
+ <type>zip</type>
+ <version>${idm.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>${hibernate-commons-annotations}</version>
+ </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-tools</artifactId>
- <version>${hibernate-tools-version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-tools</artifactId>
+ <version>${hibernate-tools-version}</version>
+ </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb-version}</version>
- </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb-version}</version>
+ </dependency>
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${apache.ant.version}</version>
- </dependency>
- <dependency>
- <groupId>izpack</groupId>
- <artifactId>standalone-compiler</artifactId>
- <version>${izpack.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>izpack</groupId>
+ <artifactId>standalone-compiler</artifactId>
+ <version>${izpack.version}</version>
+ </dependency>
- <!-- Database Drivers -->
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>${postgresql.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>${jtds.version}</version>
- </dependency>
+ <!-- Database Drivers -->
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.connector.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${postgresql.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>${jtds.version}</version>
+ </dependency>
- </dependencies>
+ </dependencies>
- <build>
- <finalName>jboss-identity</finalName>
- <plugins>
- <!-- plugin>
+ <build>
+ <finalName>jboss-identity</finalName>
+ <plugins>
+ <!-- plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -119,60 +119,60 @@
</execution>
</executions>
</plugin-->
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-2</version>
- <executions>
- <execution>
- <id>prepare-files-for-installer</id>
- <phase>process-resources</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>deploy-artifacts</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-deploy-artifacts.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <executions>
+ <execution>
+ <id>prepare-files-for-installer</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>deploy-artifacts</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-deploy-artifacts.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>izpack</id>
- <phase>package</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.test.classpath" refid="maven.test.classpath" />
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="maven.compile.classpath" refid="maven.compile.classpath" />
- <property name="database" value="${database}" />
- <property name="jboss.home" value="${jboss.home}" />
- <property name="jboss500.home" value="${jboss500.home}" />
- <property name="jbpm.target.container" value="${jbpm.target.container}" />
- <property name="product.name" value="${project.name}" />
- <property name="product.short.name" value="${artifactId}" />
- <property name="product.version" value="${project.version}" />
- <property name="user.home" value="${user.home}" />
- <property name="user.dir" value="${user.dir}" />
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>izpack</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.test.classpath" refid="maven.test.classpath" />
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="maven.compile.classpath" refid="maven.compile.classpath" />
+ <property name="database" value="${database}" />
+ <property name="jboss.home" value="${jboss.home}" />
+ <property name="jboss500.home" value="${jboss500.home}" />
+ <property name="jbpm.target.container" value="${jbpm.target.container}" />
+ <property name="product.name" value="${project.name}" />
+ <property name="product.short.name" value="${artifactId}" />
+ <property name="product.version" value="${project.version}" />
+ <property name="user.home" value="${user.home}" />
+ <property name="user.dir" value="${user.dir}" />
- <ant antfile="scripts/antrun-installer.xml" target="build-installer" inheritRefs="true"/>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
+ <ant antfile="scripts/antrun-installer.xml" target="build-installer" inheritRefs="true"/>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Added: idm/trunk/example/auth/build-deploy.xml
===================================================================
--- idm/trunk/example/auth/build-deploy.xml (rev 0)
+++ idm/trunk/example/auth/build-deploy.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<project name="deploy">
+
+ <target name="deploy">
+
+ <condition property="DEPLOY" value="${env.DEPLOY}">
+ <and>
+ <isset property="env.DEPLOY"/>
+ <not>
+ <isset property="DEPLOY"/>
+ </not>
+ </and>
+ </condition>
+
+ <antcall target="_deploy"/>
+
+ </target>
+
+ <target name="_deploy" if="DEPLOY" depends="evaluate_properties">
+
+
+ <fail message="Please set the environment variable JBOSS_HOME">
+ <condition>
+ <and>
+ <not>
+ <isset property="JBOSS_HOME"/>
+ </not>
+ </and>
+ </condition>
+ </fail>
+
+ <property name="toDir" value="${JBOSS_HOME}/server/default/deploy/"/>
+
+ <echo message="Copy artifact: ${artifact.to.copy} to ${toDir}"/>
+
+ <mkdir dir="${toDir}"/>
+
+ <copy todir="${toDir}" flatten="true"
+ file="${artifact.to.copy}" />
+ <!--<copy todir="${toDir}/${toArtifact}">-->
+ <!--<fileset dir="${artifact.to.copy}"/>-->
+ <!--</copy>-->
+
+ </target>
+
+
+
+
+
+
+
+ <target name="evaluate_properties">
+
+ <property environment="env"/>
+
+ <!--If properties are not in command line check if they are set in env-->
+ <condition property="JBOSS_HOME" value="${env.JBOSS_HOME}">
+ <and>
+ <isset property="env.JBOSS_HOME"/>
+ <not>
+ <isset property="JBOSS_HOME"/>
+ </not>
+ </and>
+ </condition>
+
+ </target>
+
+
+
+</project>
\ No newline at end of file
Added: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml (rev 0)
+++ idm/trunk/example/auth/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,161 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.identity.idm.example</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>example-auth</artifactId>
+ <packaging>jar</packaging>
+ <name>Example - JEE authentication</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>Example maven2 project using JBoss Identity IDM component.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity.idm.integration</groupId>
+ <artifactId>idm-jboss5</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-auth</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!--<version>2.4.3</version>-->
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <target>1.5</target>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/classes/</outputDirectory>
+ <overWriteReleases>true</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
+ <artifactId>maven-antrun-extended-plugin</artifactId>
+ <version>1.13</version>
+ <dependencies/>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <configuration>
+ <tasks>
+
+ <!-- Exploded -->
+ <copy todir="${basedir}/target/idm-example-auth-exploded.sar">
+ <fileset dir="${basedir}/target/classes"/>
+ </copy>
+
+
+
+ <!-- Packed -->
+
+ <jar destfile="${basedir}/target/idm-example-auth.war"
+ basedir="${basedir}/target/classes/idm-example-auth.war"
+ />
+
+ <jar destfile="${basedir}/target/idm-example-auth.sar">
+ <fileset dir="${basedir}/target/classes/"
+ excludes="idm-example-auth.war/**"/>
+ <fileset dir="${basedir}/target/"
+ includes="idm-example-auth.war"/>
+ </jar>
+
+ <!--<property name="artifact.to.copy"-->
+ <!--value="${basedir}/target/idm-example-auth-exploded.sar"/>-->
+ <!--<property name="toArtifact"-->
+ <!--value="idm-example-auth.sar-exploded"/>-->
+
+ <property name="artifact.to.copy"
+ value="${basedir}/target/idm-example-auth.sar"/>
+
+
+ <ant antfile="${basedir}/build-deploy.xml">
+ <target name="deploy"/>
+ </ant>
+
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: idm/trunk/example/auth/src/main/resources/META-INF/idm-example-auth-jboss-beans.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/META-INF/idm-example-auth-jboss-beans.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/META-INF/idm-example-auth-jboss-beans.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!--
+ IDM Service
+ -->
+ <bean name="idm.example.auth.IDMService"
+ class="org.jboss.identity.idm.integration.jboss5.IDMService">
+ <constructor>
+ <parameter>jboss-idm.xml</parameter>
+ </constructor>
+ <property name="doChecking">true</property>
+ <property name="setupLocation">setup.txt</property>
+ <property name="idmSessionFactoryJNDI">java:/IdentitySessionFactory</property>
+ <property name="hibernateSessionFactoryRegistryName">hibernateSessionFactory</property>
+ <property name="hibernateConfigLocation">jboss.idm.hibernate.cfg.xml</property>
+
+
+ <depends>TransactionManager</depends>
+ </bean>
+
+ <application-policy xmlns="urn:jboss:security-beans:1.0" name="ExampleJBossIdentityIDMSecurityRealm">
+ <authentication>
+ <login-module code = "org.jboss.identity.idm.auth.JBossIdentityIDMLoginModule"
+ flag = "required">
+ <module-option name="identitySessionFactoryJNDIName">java:/IdentitySessionFactory</module-option>
+ <module-option name="realmName">realm://JBossIdentity</module-option>
+ <module-option name="roleGroupTypeName">GROUP</module-option>
+ <module-option name="additionalRole">Authenticated</module-option>
+ <module-option name="transactionAware">true</module-option>
+ <!--<module-option name="userEnabledAttributeName"></module-option>-->
+ <!--<module-option name="associatedGroupType"></module-option>-->
+ <!--<module-option name="associatedGroupName"></module-option>-->
+ <!--<module-option name="validateUserNameCase"></module-option>-->
+ <!--<module-option name="userNameToLowerCase"></module-option>-->
+ </login-module>
+ </authentication>
+ </application-policy>
+
+
+
+</deployment>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/context.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/context.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/context.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<Context>
+
+</Context>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/jboss-web.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/jboss-web.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/jboss-web.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 5.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+<jboss-web>
+ <security-domain>ExampleJBossIdentityIDMSecurityRealm</security-domain>
+ <context-root>idm-example-auth</context-root>
+</jboss-web>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/web.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/web.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/WEB-INF/web.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,29 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>Simple Secured Application</display-name>
+
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Authenticated</web-resource-name>
+ <url-pattern>/protected/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Authenticated</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/login.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+ <security-role>
+ <role-name>Authenticated</role-name>
+ </security-role>
+
+</web-app>
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/index.jsp
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/index.jsp (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/index.jsp 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,31 @@
+<%@ page import="java.security.Principal" %>
+<html>
+<body>
+<h2>Hello World!</h2>
+<p>
+ Try to login with default users: user/user or admin/admin
+</p>
+<a href="./protected/">protected content</a>
+
+<%
+ String logout = request.getParameter("logout");
+ if (logout != null && logout.equals("true"))
+ {
+ request.getSession().invalidate();
+ }
+%>
+</br>
+<%
+ Principal principal = request.getUserPrincipal();
+ if (principal != null)
+ {
+%>
+Logged in user:
+<%
+ out.println(principal.getName());
+ }
+%>
+</br>
+<a href="./index.jsp?logout=true">Logout!</a>
+</body>
+</html>
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/login.jsp
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/login.jsp (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/login.jsp 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
+<META HTTP-EQUIV = "Pragma" CONTENT="no-cache">
+<title>Security Login Page </title>
+<body>
+<h2>Form Login</h2>
+<FORM METHOD=POST ACTION="j_security_check">
+<p>
+<strong> Enter user ID and password: </strong>
+<BR>
+<strong> User ID</strong> <input type="text" size="20" name="j_username">
+<strong> Password </strong> <input type="password" size="20" name="j_password">
+<BR>
+<BR>
+<strong> And then click this button: </strong>
+<input type="submit" name="login" value="Login">
+</p>
+
+</form>
+</body>
+</html>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/idm-example-auth.war/protected/index.jsp
===================================================================
--- idm/trunk/example/auth/src/main/resources/idm-example-auth.war/protected/index.jsp (rev 0)
+++ idm/trunk/example/auth/src/main/resources/idm-example-auth.war/protected/index.jsp 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,58 @@
+<%@ page import="java.security.Principal" %>
+<%@ page import="javax.naming.Context" %>
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="org.jboss.identity.idm.api.IdentitySessionFactory" %>
+<%@ page import="javax.naming.NamingException" %>
+<%@ page import="org.jboss.identity.idm.api.Group" %>
+<%@ page import="java.util.Collection" %>
+<%@ page import="org.jboss.identity.idm.api.IdentitySession" %>
+<%@ page language="java" contentType="text/html; charset=utf-8"
+ pageEncoding="utf-8"%>
+<%@ page import="java.security.Principal" %>
+<html>
+<body>
+<h2>Protected page!</h2>
+</br>
+Secured content. Logged in user:
+<%
+ Principal principal = request.getUserPrincipal();
+ if (principal != null)
+ {
+ out.println(principal.getName());
+ }
+%>
+
+</br>
+</br>
+<%
+ Context ctx = new InitialContext();
+ try
+ {
+ IdentitySessionFactory ids = (IdentitySessionFactory)ctx.lookup("java:/IdentitySessionFactory");
+ IdentitySession is = ids.getCurrentIdentitySession("realm://JBossIdentity");
+ is.beginTransaction();
+
+ Collection<Group> groups = is.getRelationshipManager().findAssociatedGroups(principal.getName(), "GROUP", null);
+
+ out.println("Groups associated with user: ");
+
+ for (Group group : groups)
+ {
+ out.println(group.getName());
+ }
+
+
+ }
+ catch (NamingException e)
+ {
+ out.println("Failed to obtain IdentitySessionFactory: ");
+ e.printStackTrace();
+ }
+
+%>
+
+</br>
+</br>
+<a href="../index.jsp?logout=true">Logout!</a>
+</body>
+</html>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/jboss-idm.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/jboss-idm.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/jboss-idm.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://JBossIdentity</id>
+ <repository-id-ref>JBoss_Identity_Repository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>JBoss_Identity_Repository</id>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Identity_DB_Store</default-identity-store-id>
+ <default-attribute-store-id>Identity_DB_Store</default-attribute-store-id>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Identity_DB_Store</id>
+ <class>org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials>
+ <credential-type>PASSWORD</credential-type>
+ </credentials>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <!--<option>-->
+ <!--<name>hibernateConfiguration</name>-->
+ <!--<value>jboss.idm.hibernate.cfg.xml</value>-->
+ <!--</option>-->
+ <option>
+ <name>hibernateSessionFactoryRegistryName</name>
+ <value>hibernateSessionFactory</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
Added: idm/trunk/example/auth/src/main/resources/jboss.idm.hibernate.cfg.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/jboss.idm.hibernate.cfg.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/jboss.idm.hibernate.cfg.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,79 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">false</property>
+
+ <property name="current_session_context_class">thread</property>
+
+ <property name="hibernate.connection.url">jdbc:hsqldb:mem:jbossidm</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+
+ <!--<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbid</property>-->
+ <!--<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>-->
+ <!--<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>-->
+ <!--<property name="hibernate.connection.username">root</property>-->
+ <!--<property name="hibernate.connection.password"></property>-->
+
+ <!--<property name="transaction.auto_close_session">true</property>-->
+ <!--<property name="transaction.flush_before_completion">true</property>-->
+ <!--<property name="hibernate.transaction.flush_before_completion">true</property>-->
+ <!--<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>-->
+ <!--<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>-->
+
+ <!--<property name="hibernate.hbm2ddl.auto">create-drop</property>-->
+
+ <!--<property name="connection.datasource"></property>-->
+
+
+
+
+ <!--Mapping classes-->
+ <!--all nessesary mappings are added programatically to the configuration-->
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Added: idm/trunk/example/auth/src/main/resources/login-config.xml
===================================================================
--- idm/trunk/example/auth/src/main/resources/login-config.xml (rev 0)
+++ idm/trunk/example/auth/src/main/resources/login-config.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,23 @@
+<?xml version='1.0'?>
+<!DOCTYPE policy PUBLIC
+ "-//JBoss//DTD JBOSS Security Config 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/security_config.dtd">
+
+<!--<policy>-->
+ <!--<application-policy name = "java:/jaas/ExampleJBossIdentityIDMSecurityRealm">-->
+ <!--<authentication>-->
+ <!--<login-module code = "org.jboss.identity.idm.auth.xxxJBossIdentityIDMLoginModule"-->
+ <!--flag = "required">-->
+ <!--<module-option name="identitySessionFactoryJNDIName">java:/IdentitySessionFactory</module-option>-->
+ <!--<module-option name="realmName">realm://JBossIdentity</module-option>-->
+ <!--<module-option name="roleGroupTypeName">GROUP</module-option>-->
+ <!--<module-option name="additionalRole">Authenticated</module-option>-->
+ <!--<module-option name="userEnabledAttributeName"></module-option>-->
+ <!--<module-option name="associatedGroupType"></module-option>-->
+ <!--<module-option name="associatedGroupName"></module-option>-->
+ <!--<module-option name="validateUserNameCase"></module-option>-->
+ <!--<module-option name="userNameToLowerCase"></module-option>-->
+ <!--</login-module>-->
+ <!--</authentication>-->
+ <!--</application-policy>-->
+<!--</policy>-->
Added: idm/trunk/example/auth/src/main/resources/setup.txt
===================================================================
--- idm/trunk/example/auth/src/main/resources/setup.txt (rev 0)
+++ idm/trunk/example/auth/src/main/resources/setup.txt 2009-05-12 09:32:57 UTC (rev 491)
@@ -0,0 +1,95 @@
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateRealm;
+import org.jboss.identity.idm.impl.api.PasswordCredential;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.util.Tools;
+
+
+try
+{
+ session = SessionFactory.openSession();
+ tx = session.beginTransaction();
+
+ HibernateRealm realm = new HibernateRealm("realm://JBossIdentity");
+ session.save(realm);
+
+ HibernateIdentityObjectType typeUser = new HibernateIdentityObjectType("USER");
+ HibernateIdentityObjectType typeGroup = new HibernateIdentityObjectType("GROUP");
+
+ session.save(typeUser);
+ session.save(typeGroup);
+
+ HibernateIdentityObject userUserObject = new HibernateIdentityObject("user", typeUser, realm);
+ HibernateIdentityObject userGroupObject = new HibernateIdentityObject("User", typeGroup, realm);
+ HibernateIdentityObject adminUserObject = new HibernateIdentityObject("admin", typeUser, realm);
+ HibernateIdentityObject adminGroupObject = new HibernateIdentityObject("Admin", typeGroup, realm);
+
+ session.save(userUserObject);
+ session.save(userGroupObject);
+ session.save(adminUserObject);
+ session.save(adminGroupObject);
+
+ HibernateIdentityObjectCredentialType passwordType = new HibernateIdentityObjectCredentialType("PASSWORD");
+
+ session.save(passwordType);
+
+ HibernateIdentityObjectCredential pass1 = new HibernateIdentityObjectCredential();
+ PasswordCredential passwordValue = new PasswordCredential("user");
+ pass1.setType(passwordType);
+ pass1.setTextValue(passwordValue.getEncodedValue().toString());
+ userUserObject.addCredential(pass1);
+
+ session.save(pass1);
+
+ HibernateIdentityObjectCredential pass2 = new HibernateIdentityObjectCredential();
+ passwordValue = new PasswordCredential("admin");
+ pass2.setType(passwordType);
+ pass2.setTextValue(passwordValue.getEncodedValue().toString());
+ adminUserObject.addCredential(pass2);
+
+
+ session.save(pass2);
+
+ HibernateIdentityObjectRelationshipType membership = new HibernateIdentityObjectRelationshipType("JBOSS_IDENTITY_MEMBERSHIP");
+
+ session.save(membership);
+
+ HibernateIdentityObjectRelationship rel1 = new HibernateIdentityObjectRelationship(membership, adminGroupObject, adminUserObject);
+ HibernateIdentityObjectRelationship rel2 = new HibernateIdentityObjectRelationship(membership, userGroupObject, adminUserObject);
+ HibernateIdentityObjectRelationship rel3 = new HibernateIdentityObjectRelationship(membership, userGroupObject, userUserObject);
+
+ session.save(rel1);
+ session.save(rel2);
+ session.save(rel3);
+
+ session.flush();
+
+ tx.commit();
+}
+finally
+{
+ IOTools.safeClose(session);
+}
+
+
+//IdentitySession identitySession = identitySessionFactory.getCurrentIdentitySession("realm://JBossIdentity");
+//identitySession.beginTransaction();
+//
+//User user = identitySession.getPersistenceManager().createUser("user");
+//User admin = identitySession.getPersistenceManager().createUser("admin");
+//
+//identitySession.getAttributesManager().updatePassword(user, "user");
+//identitySession.getAttributesManager().updatePassword(admin, "admin");
+//
+//Group userGroup = identitySession.getPersistenceManager().createGroup("User", "GROUP");
+//Group adminGroup = identitySession.getPersistenceManager().createGroup("Admin", "GROUP");
+//
+//identitySession.getRelationshipManager().associateUser(adminGroup, admin);
+//identitySession.getRelationshipManager().associateUser(userGroup, admin);
+//identitySession.getRelationshipManager().associateUser(userGroup, user);
+//identitySession.getTransaction().commit();
\ No newline at end of file
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/example/simple/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,118 +1,118 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity.idm.example</groupId>
- <version>1.0.0-SNAPSHOT</version>
- <artifactId>example-simple</artifactId>
- <packaging>jar</packaging>
- <name>Simple JBoss Identity IDM Maven2 example project</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>Example maven2 project using JBoss Identity IDM component.</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.identity.idm.example</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>example-simple</artifactId>
+ <packaging>jar</packaging>
+ <name>Example - Simple JBoss Identity IDM Maven2 project</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>Example maven2 project using JBoss Identity IDM component.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
- <dependencies>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-hibernate</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-ldap</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-cache</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.7</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>sun-opends</groupId>
- <artifactId>OpenDS</artifactId>
- <version>1.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>berkeleydb</groupId>
- <artifactId>je</artifactId>
- <version>3.2.76</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-cache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>sun-opends</groupId>
+ <artifactId>OpenDS</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>berkeleydb</groupId>
+ <artifactId>je</artifactId>
+ <version>3.2.76</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <target>1.5</target>
- <source>1.5</source>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <printSummary>true</printSummary>
- <disableXmlReport>false</disableXmlReport>
- <testFailureIgnore>false</testFailureIgnore>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- <forkMode>pertest</forkMode>
- <argLine>${surefire.jvm.args}</argLine>
- <useFile>false</useFile>
- <trimStackTrace>false</trimStackTrace>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <target>1.5</target>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+ <argLine>${surefire.jvm.args}</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-api/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -40,32 +40,32 @@
</dependencies>
<reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>org.jboss.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>org.jboss.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.2.5.GA</version>
- </docletArtifact>
- <additionalparam>
- -charset UTF-8
- -docencoding UTF-8
- -version
- -author
- -breakiterator
- -windowtitle "${project.name} ${project.version} API Reference"
- -doctitle "${project.name} ${project.version} API Reference"
- -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
- -link http://java.sun.com/javase/6/docs/api/
- -sourceclasspath ${project.build.outputDirectory}
- </additionalparam>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-auth/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,4 +1,4 @@
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
@@ -43,25 +43,25 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- <version>2.0.2.GA</version>
- <scope>provided</scope>
- </dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>provided</scope>
</dependency>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -69,32 +69,32 @@
</dependencies>
<reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>org.jboss.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>org.jboss.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.2.5.GA</version>
- </docletArtifact>
- <additionalparam>
- -charset UTF-8
- -docencoding UTF-8
- -version
- -author
- -breakiterator
- -windowtitle "${project.name} ${project.version} API Reference"
- -doctitle "${project.name} ${project.version} API Reference"
- -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
- -link http://java.sun.com/javase/6/docs/api/
- -sourceclasspath ${project.build.outputDirectory}
- </additionalparam>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -30,6 +30,7 @@
import org.jboss.identity.idm.common.transaction.Transactions;
import org.jboss.identity.idm.common.transaction.TransactionManagerProvider;
import org.jboss.identity.idm.common.exception.NoSuchUserException;
+import org.apache.log4j.Logger;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
@@ -40,11 +41,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.transaction.TransactionManager;
import java.util.Map;
-import java.util.Set;
-import java.util.Iterator;
import java.util.Collection;
-import java.util.logging.Logger;
-import java.util.logging.Level;
import java.security.acl.Group;
import java.security.Principal;
@@ -76,6 +73,8 @@
protected String userNameToLowerCase;
+ protected String manageTransaction;
+
private IdentitySessionFactory identitySessionFactory;
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
@@ -92,17 +91,19 @@
associatedGroupName = (String) options.get("associatedGroupName");
validateUserNameCase = (String) options.get("validateUserNameCase");
userNameToLowerCase = (String) options.get("userNameToLowerCase");
+ manageTransaction = (String) options.get("transactionAware");
// Some info
- if (log.isLoggable(Level.FINEST))
- log.finest("identitySessionFactoryJNDIName = " + identitySessionFactoryJNDIName);
- log.finest("realmName = " + realmName);
- log.finest("groupTypeName = " + roleGroupTypeName);
- log.finest("userEnabledAttributeName = " + userEnabledAttributeName);
- log.finest("additionalRole = " + additionalRole);
- log.finest("havingRole = " + associatedGroupName);
- log.finest("validateUserNameCase = " + validateUserNameCase);
- log.finest("userNameToLowerCase = " + userNameToLowerCase);
+ if (log.isDebugEnabled())
+ log.debug("identitySessionFactoryJNDIName = " + identitySessionFactoryJNDIName);
+ log.debug("realmName = " + realmName);
+ log.debug("groupTypeName = " + roleGroupTypeName);
+ log.debug("userEnabledAttributeName = " + userEnabledAttributeName);
+ log.debug("additionalRole = " + additionalRole);
+ log.debug("havingRole = " + associatedGroupName);
+ log.debug("validateUserNameCase = " + validateUserNameCase);
+ log.debug("userNameToLowerCase = " + userNameToLowerCase);
+ log.debug("transactionAware = " + manageTransaction);
}
protected String getUsersPassword() throws LoginException
@@ -165,17 +166,17 @@
}
else
{
- log.fine("Unexpected error while logging in");
+ log.info("Unexpected error while logging in");
return false;
} }
catch (Exception e)
{
- log.fine("Error when validating password: " + e);
+ log.info("Error when validating password: ",e);
}
}
catch (Exception e)
{
- log.finer("Failed to validate password: " + e);
+ log.info("Failed to validate password: ", e);
}
}
return false;
@@ -183,149 +184,199 @@
protected UserStatus getUserStatus(final String inputPassword)
{
- UserStatus result = UserStatus.OK;
+ UserStatus result = null;
- try {
- TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
- UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
- {
- public Object run() throws Exception
+ try {
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
{
- try
+ public Object run() throws Exception
{
IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+ ids.beginTransaction();
- User user = ids.getPersistenceManager().findUser(getUsername());
-
- // in case module implementation doesn't throw proper
- // exception...
- if (user == null)
+ if (manageTransaction != null && manageTransaction.equals("true"))
{
- throw new NoSuchUserException("UserModule returned null user object");
+ ids.beginTransaction();
}
- //This is because LDAP binds can be non case sensitive
- if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
- && !getUsername().equals(user.getId()))
+ UserStatus status = _getUserStatus(inputPassword);
+
+ if (manageTransaction != null && manageTransaction.equals("true"))
{
- return UserStatus.UNEXISTING;
+ ids.getTransaction().commit();
}
- //Enabled
- if (userEnabledAttributeName != null)
- {
+ return status;
+ }
+ });
+ if (tmp != null)
+ {
+ result = tmp;
+ }
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ return result;
- boolean enabled = false;
- try {
- Object enabledS;
- enabledS = ids.getAttributesManager().getAttribute(user, userEnabledAttributeName);
- if (enabledS != null) {
- enabled = new Boolean(enabledS.toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (!enabled) {
- return UserStatus.DISABLE;
- }
- }
- if (associatedGroupName != null && associatedGroupType != null)
- {
- boolean hasTheGroup = false;
+ }
- org.jboss.identity.idm.api.Group associatedGroup =
- ids.getPersistenceManager().findGroup(associatedGroupName, associatedGroupType);
- if (associatedGroup != null)
- {
- hasTheGroup = ids.getRelationshipManager().isAssociated(associatedGroup, user);
- }
+ protected UserStatus _getUserStatus(final String inputPassword) throws Exception
+ {
+ try
+ {
+ IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
- if (!hasTheGroup)
- {
- return UserStatus.NOTASSIGNEDTOROLE;
- }
- }
+ User user = ids.getPersistenceManager().findUser(getUsername());
- if (!ids.getAttributesManager().validatePassword(user, inputPassword))
- {
- return UserStatus.WRONGPASSWORD;
- }
+ // in case module implementation doesn't throw proper
+ // exception...
+ if (user == null)
+ {
+ throw new NoSuchUserException("UserModule returned null user object");
+ }
+ //This is because LDAP binds can be non case sensitive
+ if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
+ && !getUsername().equals(user.getId()))
+ {
+ return UserStatus.UNEXISTING;
+ }
+
+ //Enabled
+ if (userEnabledAttributeName != null)
+ {
+
+ boolean enabled = false;
+ try {
+ Object enabledS;
+ enabledS = ids.getAttributesManager().getAttribute(user, userEnabledAttributeName);
+ if (enabledS != null) {
+ enabled = new Boolean(enabledS.toString());
}
- catch (NoSuchUserException e1)
- {
- return UserStatus.UNEXISTING;
- }
- catch (Exception e)
- {
- throw new LoginException(e.toString());
- }
- return null;
+ } catch (Exception e) {
+ e.printStackTrace();
}
- });
- if (tmp != null)
+ if (!enabled) {
+ return UserStatus.DISABLE;
+ }
+ }
+
+ if (associatedGroupName != null && associatedGroupType != null)
{
- result = tmp;
+ boolean hasTheGroup = false;
+
+ org.jboss.identity.idm.api.Group associatedGroup =
+ ids.getPersistenceManager().findGroup(associatedGroupName, associatedGroupType);
+
+ if (associatedGroup != null)
+ {
+ hasTheGroup = ids.getRelationshipManager().isAssociated(associatedGroup, user);
+ }
+
+ if (!hasTheGroup)
+ {
+ return UserStatus.NOTASSIGNEDTOROLE;
+ }
}
- } catch (Exception e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
+
+ if (!ids.getAttributesManager().validatePassword(user, inputPassword))
+ {
+ return UserStatus.WRONGPASSWORD;
+ }
+
}
- return result;
+ catch (NoSuchUserException e1)
+ {
+ return UserStatus.UNEXISTING;
+ }
+ catch (Exception e)
+ {
+ throw new LoginException(e.toString());
+ }
+ return UserStatus.OK;
}
protected Group[] getRoleSets() throws LoginException
{
try {
- TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
- return (Group[]) Transactions.required(tm, new Transactions.Runnable()
- {
- public Object run() throws Exception
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ return (Group[]) Transactions.required(tm, new Transactions.Runnable()
{
- Group rolesGroup = new SimpleGroup("Roles");
+ public Object run() throws Exception
+ {
+ IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+ ids.beginTransaction();
- //
- if (additionalRole != null) {
- rolesGroup.addMember(createIdentity(additionalRole));
+ if (manageTransaction != null && manageTransaction.equals("true"))
+ {
+ ids.beginTransaction();
+ }
+
+ Group[] result = _getRoleSets();
+
+ if (manageTransaction != null && manageTransaction.equals("true"))
+ {
+ ids.getTransaction().commit();
+ }
+
+
+ return result;
}
+ });
+ } catch (Exception e) {
+ Throwable cause = e.getCause();
+ throw new LoginException(cause.toString());
+ }
- try {
- IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+ }
- User user = ids.getPersistenceManager().findUser(getUsername());
- Collection<org.jboss.identity.idm.api.Group> userGroups =
- ids.getRelationshipManager().findAssociatedGroups(user, roleGroupTypeName);
+ protected Group[] _getRoleSets() throws Exception
+ {
+ Group rolesGroup = new SimpleGroup("Roles");
- //
- for (org.jboss.identity.idm.api.Group userGroup : userGroups)
- {
- String roleName = userGroup.getName();
+ //
+ if (additionalRole != null) {
+ rolesGroup.addMember(createIdentity(additionalRole));
+ }
- try {
- Principal p = createIdentity(roleName);
- rolesGroup.addMember(p);
- } catch (Exception e) {
- log.finer("Failed to create principal " + roleName + " " + e);
- }
+ try {
- }
-
- } catch (Exception e) {
- throw new LoginException(e.toString());
- }
- //
- return new Group[] { rolesGroup };
+ IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+
+ User user = ids.getPersistenceManager().findUser(getUsername());
+ Collection<org.jboss.identity.idm.api.Group> userGroups =
+ ids.getRelationshipManager().findAssociatedGroups(user, roleGroupTypeName);
+
+ //
+ for (org.jboss.identity.idm.api.Group userGroup : userGroups)
+ {
+ String roleName = userGroup.getName();
+
+ try {
+ Principal p = createIdentity(roleName);
+ rolesGroup.addMember(p);
+ } catch (Exception e) {
+ log.info("Failed to create principal " + roleName, e);
}
- });
+
+ }
+
} catch (Exception e) {
- Throwable cause = e.getCause();
- throw new LoginException(cause.toString());
+ throw new LoginException(e.toString());
}
+ //
+ return new Group[] { rolesGroup };
+
}
+
+
/** Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal. */
protected Principal createIdentity(String username) throws Exception
{
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-cache/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -45,28 +45,28 @@
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>dataSourceName</name>
- <value>${dataSourceName}</value>
- </property>
- <property>
- <name>directoryName</name>
- <value>${directoryName}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
</project>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-common/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -33,46 +33,46 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
</dependencies>
<reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>org.jboss.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>org.jboss.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.2.5.GA</version>
- </docletArtifact>
- <additionalparam>
- -charset UTF-8
- -docencoding UTF-8
- -version
- -author
- -breakiterator
- -windowtitle "${project.name} ${project.version} API Reference"
- -doctitle "${project.name} ${project.version} API Reference"
- -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
- -link http://java.sun.com/javase/6/docs/api/
- -sourceclasspath ${project.build.outputDirectory}
- </additionalparam>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -40,14 +40,14 @@
</dependency>
<dependency>
<groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-spi</artifactId>
- <version>${project.version}</version>
+ <artifactId>idm-spi</artifactId>
+ <version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.8</version>
- </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.8</version>
+ </dependency>
<dependency>
<groupId>junit</groupId>
@@ -71,40 +71,40 @@
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>dataSourceName</name>
- <value>${dataSourceName}</value>
- </property>
- <property>
- <name>directoryName</name>
- <value>${directoryName}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
</project>
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -32,13 +32,15 @@
import java.util.Collection;
import java.util.List;
import java.util.LinkedList;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class GroupQueryExecutorImpl extends AbstractQueryExecutor
+public class GroupQueryExecutorImpl extends AbstractQueryExecutor implements Serializable
{
+ private static final long serialVersionUID = -6202216015171375769L;
public GroupQueryExecutorImpl(IdentitySession identitySession)
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryExecutorImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -32,13 +32,16 @@
import java.util.Collection;
import java.util.List;
import java.util.LinkedList;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class RoleQueryExecutorImpl extends AbstractQueryExecutor
+public class RoleQueryExecutorImpl extends AbstractQueryExecutor implements Serializable
{
+ private static final long serialVersionUID = -5943827542621450235L;
+
public RoleQueryExecutorImpl(IdentitySession identitySession)
{
super(identitySession);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -32,13 +32,16 @@
import java.util.Collection;
import java.util.List;
import java.util.LinkedList;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class UserQueryExecutorImpl extends AbstractQueryExecutor
+public class UserQueryExecutorImpl extends AbstractQueryExecutor implements Serializable
{
+ private static final long serialVersionUID = -4196998772910705233L;
+
public UserQueryExecutorImpl(IdentitySession identitySession)
{
super(identitySession);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/context/IdentitySessionContextImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/context/IdentitySessionContextImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/context/IdentitySessionContextImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -28,19 +28,23 @@
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
import org.jboss.identity.idm.impl.api.session.context.IdentityStoreInvocationContextResolver;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class IdentitySessionContextImpl implements IdentitySessionContext
+public class IdentitySessionContextImpl implements IdentitySessionContext, Serializable
{
private final IdentityStoreRepository identityStoreRepository;
private final IdentityObjectTypeMapper identityObjectTypeMapper;
- private final IdentityStoreInvocationContextResolver contextResolver;
+ private final IdentityStoreInvocationContextResolver contextResolver;
+ private static final long serialVersionUID = 6968037075942357128L;
+
public IdentitySessionContextImpl(IdentityStoreRepository identityStoreRepository, IdentityObjectTypeMapper identityObjectTypeMapper, IdentityStoreInvocationContextResolver contextResolver)
{
this.identityStoreRepository = identityStoreRepository;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -46,11 +46,13 @@
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public abstract class AbstractManager
+public abstract class AbstractManager implements Serializable
{
protected final IdentitySession identitySession;
@@ -95,6 +97,7 @@
protected User createUserFromId(String name)
{
+
return new SimpleUser(name);
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -42,13 +42,15 @@
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class AttributesManagerImpl extends AbstractManager implements AttributesManager
+public class AttributesManagerImpl extends AbstractManager implements AttributesManager, Serializable
{
+ private static final long serialVersionUID = 1285532201632609092L;
public AttributesManagerImpl(IdentitySession session)
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -40,15 +40,18 @@
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class PersistenceManagerImpl extends AbstractManager implements PersistenceManager
+public class PersistenceManagerImpl extends AbstractManager implements PersistenceManager, Serializable
{
private final PersistenceManagerFeaturesDescription featuresDescription;
+
+ private static final long serialVersionUID = -4691446225503953920L;
public PersistenceManagerImpl(IdentitySession session)
@@ -199,7 +202,13 @@
{
checkNotNullArgument(name, "User name");
- return createUser(getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType()));
+ IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType());
+
+ if (io != null)
+ {
+ return createUser(io);
+ }
+ return null;
}
public Collection<User> findUser(IdentitySearchCriteria criteria) throws IdentityException
@@ -223,13 +232,26 @@
checkNotNullArgument(name, "Group name");
checkNotNullArgument(groupType, "Group type");
- return createGroup(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType)));
+ IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType));
+
+ if (io != null)
+ {
+ return createGroup(io);
+ }
+ return null;
}
public Group findGroupById(String id) throws IdentityException
{
checkNotNullArgument(id, "Group id");
- return createGroup(getRepository().findIdentityObject(getInvocationContext(), id));
+
+ IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), id);
+
+ if (io != null)
+ {
+ return createGroup(io);
+ }
+ return null;
}
public Collection<Group> findGroup(String groupType, IdentitySearchCriteria criteria) throws IdentityException
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -46,12 +46,13 @@
import java.util.Set;
import java.util.HashSet;
import java.util.Arrays;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class RelationshipManagerImpl extends AbstractManager implements RelationshipManager
+public class RelationshipManagerImpl extends AbstractManager implements RelationshipManager, Serializable
{
RelationshipManagerFeaturesDescription featuresDescription;
@@ -62,6 +63,8 @@
return "JBOSS_IDENTITY_MEMBERSHIP";
}
};
+
+ private static final long serialVersionUID = -1054805796187123311L;
public RelationshipManagerImpl(IdentitySession session)
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -50,12 +50,13 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.HashMap;
+import java.io.Serializable;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class RoleManagerImpl extends AbstractManager implements RoleManager
+public class RoleManagerImpl extends AbstractManager implements RoleManager, Serializable
{
public static final IdentityObjectRelationshipType ROLE = new IdentityObjectRelationshipType()
{
@@ -66,6 +67,8 @@
};
private final RoleManagerFeaturesDescription featuresDescription;
+
+ private static final long serialVersionUID = 7246982831145808636L;
public RoleManagerImpl(IdentitySession session)
{
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -34,42 +34,42 @@
<version>${project.version}</version>
</dependency>
- <!-- hibernate -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>3.3.1.GA</version>
- </dependency>
- <dependency>
+ <!-- hibernate -->
+ <dependency>
<groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
- <!--Javassist as Hibernate's bytecode provider-->
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.4.GA</version>
- </dependency>
+ <!--Javassist as Hibernate's bytecode provider-->
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.4.GA</version>
+ </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-cglib-repack</artifactId>
- <version>2.1_3</version>
- </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-cglib-repack</artifactId>
+ <version>2.1_3</version>
+ </dependency>
- <!-- Hibernate logging set up -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.2</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
+ <!-- Hibernate logging set up -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
<dependency>
@@ -88,28 +88,28 @@
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>dataSourceName</name>
- <value>${dataSourceName}</value>
- </property>
- <property>
- <name>directoryName</name>
- <value>${directoryName}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
-
+
</project>
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectCredential.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -58,7 +58,7 @@
private Long id;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "IDENTITY_OBJECT_TYPE", nullable = false)
+ @JoinColumn(name = "CREDENTIAL_TYPE", nullable = false)
private HibernateIdentityObjectCredentialType type;
@ManyToOne(fetch = FetchType.EAGER)
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -153,6 +153,8 @@
// <IdentityObjectType name, <Attribute store mapping, Attribute name>
private Map<String, Map<String, String>> reverseAttributeMappings = new HashMap<String, Map<String, String>>();
+
+ private static final long serialVersionUID = -130355852189832805L;
static {
// List all supported criteria classes
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -37,7 +37,7 @@
<dependency>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit</artifactId>
- <version>1.2.2</version>
+ <version>1.2.2</version>
<scope>test</scope>
</dependency>
@@ -45,29 +45,29 @@
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>dataSourceName</name>
- <value>${dataSourceName}</value>
- </property>
- <property>
- <name>directoryName</name>
- <value>${directoryName}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
-
+
</project>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-spi/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -40,32 +40,32 @@
</dependencies>
<reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <doclet>org.jboss.apiviz.APIviz</doclet>
- <docletArtifact>
- <groupId>org.jboss.apiviz</groupId>
- <artifactId>apiviz</artifactId>
- <version>1.2.5.GA</version>
- </docletArtifact>
- <additionalparam>
- -charset UTF-8
- -docencoding UTF-8
- -version
- -author
- -breakiterator
- -windowtitle "${project.name} ${project.version} API Reference"
- -doctitle "${project.name} ${project.version} API Reference"
- -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
- -link http://java.sun.com/javase/6/docs/api/
- -sourceclasspath ${project.build.outputDirectory}
- </additionalparam>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+ -link http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -43,7 +43,7 @@
* @author Anil.Saldhana(a)redhat.com
* @since Jul 10, 2008
*/
-public interface IdentityStore extends AttributeStore
+public interface IdentityStore extends AttributeStore
{
/**
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -24,11 +24,13 @@
import org.jboss.identity.idm.common.exception.IdentityException;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface IdentityStoreSessionFactory
+public interface IdentityStoreSessionFactory extends Serializable
{
/**
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -40,11 +40,11 @@
</dependency>
<dependency>
<groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-ldap</artifactId>
- <version>${project.version}</version>
+ <artifactId>idm-ldap</artifactId>
+ <version>${project.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
@@ -76,87 +76,87 @@
<scope>test</scope>
</dependency>
- <!--JBoss Unit-->
+ <!--JBoss Unit-->
<dependency>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit</artifactId>
- <version>1.2.2</version>
+ <version>1.2.2</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.unit</groupId>
- <artifactId>portal-test</artifactId>
- <version>1.2.2</version>
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ <version>1.2.2</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>hibernate</groupId>
- <artifactId>hibernate3</artifactId>
- </exclusion>
- <exclusion>
- <groupId>sun-opends</groupId>
- <artifactId>opends-core</artifactId>
- </exclusion>
- </exclusions>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>hibernate</groupId>
+ <artifactId>hibernate3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>sun-opends</groupId>
+ <artifactId>opends-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- <dependency>
- <groupId>jboss.jbossas.core-libs</groupId>
- <artifactId>jboss-local-jdbc</artifactId>
- <version>4.0.4.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss.jbossas.core-libs</groupId>
- <artifactId>jboss-common-jdbc-wrapper</artifactId>
- <version>4.0.4.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-jdk</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <version>2.0.2.GA</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>apache-log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jboss-local-jdbc</artifactId>
+ <version>4.0.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jboss-common-jdbc-wrapper</artifactId>
+ <version>4.0.4.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-jdk</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>8.3-604.jdbc3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>1.2.2</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>8.3-604.jdbc3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
@@ -165,27 +165,27 @@
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <systemProperties>
- <property>
- <name>dataSourceName</name>
- <value>${dataSourceName}</value>
- </property>
- <property>
- <name>directoryName</name>
- <value>${directoryName}</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>dataSourceName</name>
+ <value>${dataSourceName}</value>
+ </property>
+ <property>
+ <name>directoryName</name>
+ <value>${directoryName}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
</project>
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -28,13 +28,15 @@
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship;
import org.jboss.identity.idm.impl.model.hibernate.HibernateRealm;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType;
+import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential;
import org.jboss.identity.idm.impl.IdentityTestPOJO;
+import org.jboss.identity.idm.impl.api.PasswordCredential;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Test;
import org.hibernate.Session;
import org.hibernate.Query;
-import static org.jboss.unit.api.Assert.*;
/**
@@ -68,9 +70,63 @@
Session session = getSessionFactory().getCurrentSession();
- HibernateRealm realm = new HibernateRealm("default");
- session.persist(realm);
+HibernateRealm realm = new HibernateRealm("realm://JBossIdentity");
+ session.save(realm);
+ HibernateIdentityObjectType typeUser = new HibernateIdentityObjectType("USER");
+ HibernateIdentityObjectType typeGroup = new HibernateIdentityObjectType("GROUP");
+
+ session.save(typeUser);
+ session.save(typeGroup);
+
+ HibernateIdentityObject userUserObject = new HibernateIdentityObject("user", typeUser, realm);
+ HibernateIdentityObject userGroupObject = new HibernateIdentityObject("User", typeGroup, realm);
+ HibernateIdentityObject adminUserObject = new HibernateIdentityObject("admin", typeUser, realm);
+ HibernateIdentityObject adminGroupObject = new HibernateIdentityObject("Admin", typeGroup, realm);
+
+ session.save(userUserObject);
+ session.save(userGroupObject);
+ session.save(adminUserObject);
+ session.save(adminGroupObject);
+
+ HibernateIdentityObjectCredentialType passwordType = new HibernateIdentityObjectCredentialType("PASSWORD");
+
+ session.save(passwordType);
+
+ HibernateIdentityObjectCredential pass1 = new HibernateIdentityObjectCredential();
+ PasswordCredential passwordValue = new PasswordCredential("user");
+ pass1.setType(passwordType);
+ pass1.setTextValue(passwordValue.getEncodedValue().toString());
+ userUserObject.addCredential(pass1);
+
+ session.save(pass1);
+
+ HibernateIdentityObjectCredential pass2 = new HibernateIdentityObjectCredential();
+ passwordValue = new PasswordCredential("admin");
+ pass2.setType(passwordType);
+ pass2.setTextValue(passwordValue.getEncodedValue().toString());
+ adminUserObject.addCredential(pass2);
+
+
+ session.save(pass2);
+
+ HibernateIdentityObjectRelationshipType membership = new HibernateIdentityObjectRelationshipType("JBOSS_IDENTITY_MEMBERSHIP");
+
+ session.save(membership);
+
+ HibernateIdentityObjectRelationship rel1 = new HibernateIdentityObjectRelationship(membership, adminGroupObject, adminUserObject);
+ HibernateIdentityObjectRelationship rel2 = new HibernateIdentityObjectRelationship(membership, userGroupObject, adminUserObject);
+ HibernateIdentityObjectRelationship rel3 = new HibernateIdentityObjectRelationship(membership, userGroupObject, userUserObject);
+
+ session.save(rel1);
+ session.save(rel2);
+ session.save(rel3);
+
+
+
+ HibernateRealm defaultRealm = new HibernateRealm("default");
+ session.persist(defaultRealm);
+
//
HibernateIdentityObjectType iot = new HibernateIdentityObjectType();
@@ -82,7 +138,7 @@
HibernateIdentityObject io = new HibernateIdentityObject();
io.setName("John Kowalski");
- io.setRealm(realm);
+ io.setRealm(defaultRealm);
io.setIdentityType(iot);
session.persist(io);
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,108 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <name>JBoss Identity IDM Integration JBoss5</name>
- <description>JBoss Identity IDM JBoss5</description>
+ <name>JBoss Identity IDM Integration JBoss5</name>
+ <description>JBoss Identity IDM JBoss5</description>
- <groupId>org.jboss.identity.integration</groupId>
- <artifactId>idm-jboss5</artifactId>
- <packaging>jar</packaging>
- <version>1.0.0-SNAPSHOT</version>
+ <groupId>org.jboss.identity.idm.integration</groupId>
+ <artifactId>idm-jboss5</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.0-SNAPSHOT</version>
- <parent>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-integration</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-integration</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
- <properties>
- <jboss.version>5.0.0.GA</jboss.version>
- </properties>
+ <properties>
+ <jboss.version>5.0.0.GA</jboss.version>
+ </properties>
- <dependencies>
+ <dependencies>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-core</artifactId>
- <version>${version}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-hibernate</artifactId>
- <version>${version}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-ldap</artifactId>
- <version>${version}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${version}</version>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.jboss.identity.idm</groupId>-->
+ <!--<artifactId>idm-cache</artifactId>-->
+ <!--<version>${version}</version>-->
+ <!--</dependency>-->
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-cache</artifactId>
- <version>${version}</version>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>1.2.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-core-uberjar</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.jboss.portal.common</groupId>
- <artifactId>common-common</artifactId>
- <version>1.2.3</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
+ <groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>${jboss.version}</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
<dependency>
- <groupId>bsh</groupId>
+ <groupId>bsh</groupId>
<artifactId>bsh</artifactId>
<version>1.3.0</version>
- </dependency>
+ </dependency>
- </dependencies>
+ </dependencies>
- <!-- Build -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>META-INF/idm-service-jboss-beans.xml</exclude>
- <exclude>*.xml</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
+ <!-- Build -->
+ <build>
+
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <finalName>idm-service.sar</finalName>
- <appendAssemblyId>true</appendAssemblyId>
- <descriptors>
- <descriptor>src/main/resources/assembly.xml</descriptor>
- </descriptors>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
</configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*.xml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>idm-service.sar</finalName>
+
+
+ <appendAssemblyId>true</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/resources/assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
Modified: idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
===================================================================
--- idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-05-12 09:32:57 UTC (rev 491)
@@ -12,18 +12,22 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.DatabaseMetaData;
-import java.util.logging.Logger;
import java.util.Iterator;
import java.util.Collection;
import java.lang.reflect.Method;
+import java.security.acl.Group;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.common.transaction.TransactionManagerProvider;
+import org.jboss.identity.idm.common.transaction.Transactions;
import org.jboss.portal.common.util.LoaderResource;
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.io.IOTools;
@@ -31,6 +35,7 @@
import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
+import org.hibernate.HibernateException;
import org.hibernate.dialect.DialectFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.AnnotationConfiguration;
@@ -39,6 +44,7 @@
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.metadata.ClassMetadata;
+import org.apache.log4j.Logger;
import bsh.Interpreter;
import bsh.EvalError;
@@ -186,8 +192,10 @@
InitialContext context = new InitialContext();
- IdentityConfiguration identityConfiguration = new IdentityConfigurationImpl().configure(getIdmConfigFile());
+ int check = RESULT_NONE;
+ final IdentityConfiguration identityConfiguration = new IdentityConfigurationImpl().configure(getIdmConfigFile());
+
// If hibernate config is present than create SessionFactory manually and register it into identity config
if (hibernateConfigLocation != null)
{
@@ -206,10 +214,17 @@
createHibernateSessionFactory();
-// if (getHibernateSessionFactoryJNDIName() != null)
-// {
-// context.bind(getHibernateSessionFactoryJNDIName(), hibernateSessionFactory);
-// }
+ if (getHibernateSessionFactoryJNDIName() != null)
+ {
+ try
+ {
+ context.bind(getHibernateSessionFactoryJNDIName(), hibernateSessionFactory);
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
if (getHibernateSessionFactoryRegistryName() != null)
{
@@ -217,37 +232,41 @@
register(hibernateSessionFactory, getHibernateSessionFactoryRegistryName());
}
- identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
- }
+ if (doChecking)
+ {
+ //check the schema
+ check = doCheck();
+ switch (check)
+ {
+ case RESULT_NONE:
+ break;
+ case RESULT_UPDATE:
+ updateSchema();
+ break;
+ case RESULT_CREATE:
+ createSchema();
+ createContent();
- int check = RESULT_NONE;
-
- if (doChecking)
- {
- //check the schema
- check = doCheck();
- switch (check)
- {
- case RESULT_NONE:
- break;
- case RESULT_UPDATE:
- updateSchema();
- break;
- case RESULT_CREATE:
- createSchema();
- break;
+ break;
+ }
}
}
- identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
+ try {
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
+ return null;
+ }
+ });
+ } catch (Exception e) {
- // If schema was created than
- if (check == RESULT_CREATE)
- {
- createContent();
+ throw new Exception("Cannot create IdentitySessionFactory", e);
}
-
context.bind(getIdmSessionFactoryJNDI(), identitySessionFactory);
logger.info("Started the JBoss Identity Management Service");
}
@@ -259,18 +278,41 @@
}
public void destroy() throws Exception {
- identitySessionFactory.close();
- InitialContext context = new InitialContext();
- context.unbind(getIdmSessionFactoryJNDI());
+
+ InitialContext context = new InitialContext();
+
+ try
+ {
+ if (identitySessionFactory != null)
+ {
+ identitySessionFactory.close();
+ if (getIdmSessionFactoryJNDI() != null)
+ {
+ context.unbind(getIdmSessionFactoryJNDI());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ logger.info(e); //To change body of catch statement use File | Settings | File Templates.
+ }
+
if (hibernateSessionFactory != null)
{
- if (getHibernateSessionFactoryJNDIName() != null)
+ try
{
- context.unbind(getHibernateSessionFactoryJNDIName());
+ if (getHibernateSessionFactoryJNDIName() != null)
+ {
+ context.unbind(getHibernateSessionFactoryJNDIName());
+ }
+
+ hibernateSessionFactory.close();
}
-
- hibernateSessionFactory.close();
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
}
logger.info("Stopped the JBoss Identity Management Service");
@@ -406,7 +448,7 @@
if (dialectName == null)
{
String dataSourceJNDI = config.getProperty(Environment.DATASOURCE);
- logger.finer("Detecting dialect with datasource " + dataSourceJNDI + " ...");
+ logger.debug("Detecting dialect with datasource " + dataSourceJNDI + " ...");
DataSource ds = (DataSource)new InitialContext().lookup(dataSourceJNDI);
Connection conn = null;
try
@@ -417,14 +459,14 @@
int databaseMajorVersion = getDatabaseMajorVersion(meta);
dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion).getClass().getName();
config.setProperty(Environment.DIALECT, dialectName);
- logger.finer("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
+ logger.debug("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
}
finally
{
IOTools.safeClose(conn);
}
}
- logger.finer("Using dialect " + dialectName);
+ logger.debug("Using dialect " + dialectName);
if ("org.hibernate.dialect.HSQLDialect".equals(dialectName))
{
logger.info("You are using the file based HSQL database, this is not recommended on a production environment and will not work properly on a clustered environment.");
@@ -480,14 +522,14 @@
// There was no sql grammar exception - schema is ok!
if (bad == 0)
{
- logger.finer("The schema was checked as valid");
+ logger.debug("The schema was checked as valid");
//do nothing
return RESULT_NONE;
}
// There is no existing valid schema;
else if (bad == numOfChecks)
{
- logger.finer("The schema was checked as not exists");
+ logger.debug("The schema was checked as not exists");
// Totaly invalid schema
return RESULT_CREATE;
}
@@ -495,19 +537,19 @@
else if (bad < numOfChecks)
{
// Schema needs updates;
- logger.finer("The schema was checked as need updates");
+ logger.debug("The schema was checked as need updates");
return RESULT_UPDATE;
}
// If here something gone wrong...
- logger.finer("The schema was checked as need to be created");
+ logger.debug("The schema was checked as need to be created");
return RESULT_CREATE;
}
public void createSchema()
{
- logger.finer("Creating database schema");
+ logger.debug("Creating database schema");
try
{
SchemaExport export = new SchemaExport(config);
@@ -515,13 +557,13 @@
}
catch (Exception e)
{
- logger.fine("Cannot create schema: " + e);
+ logger.debug("Cannot create schema: ", e);
}
}
public void destroySchema()
{
- logger.finer("Destroying database schema");
+ logger.debug("Destroying database schema");
try
{
SchemaExport export = new SchemaExport(config);
@@ -529,7 +571,7 @@
}
catch (Exception e)
{
- logger.finer("Cannot destroy schema:" + e);
+ logger.debug("Cannot destroy schema:", e);
}
}
@@ -550,29 +592,41 @@
{
try
{
- logger.fine("Creating database content");
- String script = setupResource.asString("UTF-8");
+ logger.info("Creating database content");
+ final String script = setupResource.asString("UTF-8");
// Create an interpreter and configures it
- Interpreter interpreter = new Interpreter();
+ final Interpreter interpreter = new Interpreter();
interpreter.setClassLoader(Thread.currentThread().getContextClassLoader());
interpreter.setOut(System.out);
- interpreter.set("hibernateSessionFactory", hibernateSessionFactory);
- interpreter.set("identitySessionFactory", identitySessionFactory);
- interpreter.eval(script);
+ interpreter.set("SessionFactory", hibernateSessionFactory);
+
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ interpreter.eval(script);
+ return null;
+ }
+ });
}
catch (EvalError e)
{
- logger.finer("Error in the bsh script:" + e);
+ logger.info("Error in the bsh script:", e);
}
catch (IllegalStateException e)
{
- logger.finer("Cannot load setup script:" + e);
+ logger.info("Cannot load setup script:", e);
}
+ catch (Exception e)
+ {
+ logger.info("Error in bsh script execution:", e);
+ }
}
else
{
- logger.fine("There is a setup URL but the not valid " + setupResource);
+ logger.info("There is a setup URL but the not valid " + setupResource);
}
}
}
@@ -581,7 +635,7 @@
public void updateSchema()
{
- logger.finer("Updating database schema");
+ logger.info("Updating database schema");
SchemaUpdate update = new SchemaUpdate(config);
update.execute(false, true);
}
@@ -600,7 +654,7 @@
}
catch (Throwable t)
{
- logger.finer("could not get database version from JDBC metadata");
+ logger.info("could not get database version from JDBC metadata");
return 0;
}
}
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/integration/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,40 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <name>JBoss Identity IDM Integration</name>
- <description>JBoss Identity IDM Integration</description>
+ <name>JBoss Identity IDM Integration</name>
+ <description>JBoss Identity IDM Integration</description>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-integration</artifactId>
- <packaging>pom</packaging>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-integration</artifactId>
+ <packaging>pom</packaging>
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
- </parent>
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
- <modules>
- <module>jboss5</module>
- </modules>
+ <modules>
+ <module>jboss5</module>
+ </modules>
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <!-- Plugins -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/parent/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,191 +1,191 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>3</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-parent</artifactId>
- <packaging>pom</packaging>
- <version>1.0.0-SNAPSHOT</version>
- <name>JBoss Identity IDM- Parent</name>
- <url>http://labs.jboss.org/portal/jbosssecurity/</url>
- <description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
- <licenses>
- <license>
- <name>lgpl</name>
- <url>http://repository.jboss.com/licenses/lgpl.txt</url>
- </license>
- </licenses>
- <organization>
- <name>JBoss Inc.</name>
- <url>http://www.jboss.org</url>
- </organization>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/idm/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossidentity/idm/trunk</developerConnection>
- </scm>
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-parent</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>JBoss Identity IDM- Parent</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity is a cross-cutting project that handles identity needs for the JEMS projects</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/idm/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossidentity/idm/trunk</developerConnection>
+ </scm>
- <build>
- <plugins>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/jbossidentity/tags</tagBase>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ <optimize>true</optimize>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
<plugin>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <tagBase>https://svn.jboss.org/repos/jbossidentity/tags</tagBase>
- </configuration>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+ <argLine>${surefire.jvm.args}</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ <systemProperties>
+ <property>
+ <name>java.util.logging.config.file</name>
+ <value>../parent/logging.properties</value>
+ </property>
+ </systemProperties>
+ </configuration>
</plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- <showDeprecation>true</showDeprecation>
- <showWarnings>true</showWarnings>
- <optimize>true</optimize>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- </plugin>
- </plugins>
- <pluginManagement>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <!-- Profiles -->
+ <profiles>
+
+ <profile>
+ <id>distro</id>
+ <modules>
+ <module>../distro</module>
+ </modules>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ <build>
<plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <printSummary>true</printSummary>
- <disableXmlReport>false</disableXmlReport>
- <testFailureIgnore>false</testFailureIgnore>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- <forkMode>pertest</forkMode>
- <argLine>${surefire.jvm.args}</argLine>
- <useFile>false</useFile>
- <trimStackTrace>false</trimStackTrace>
- <systemProperties>
- <property>
- <name>java.util.logging.config.file</name>
- <value>../parent/logging.properties</value>
- </property>
- </systemProperties>
- </configuration>
- </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
- </pluginManagement>
- </build>
-
- <!-- Profiles -->
- <profiles>
-
- <profile>
- <id>distro</id>
- <modules>
- <module>../distro</module>
- </modules>
- <properties>
- <skipTests>true</skipTests>
- </properties>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>provided-jdbc-driver</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>provided-jdbc-driver2</id>
- <dependencies>
- <dependency>
- <groupId>privided</groupId>
- <artifactId>jdbc-driver2</artifactId>
- <version>NA</version>
- <scope>system</scope>
- <systemPath>${provided.jdbc.driver.path2}</systemPath>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <layout>default</layout>
- <url>http://snapshots.jboss.org/maven2/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <dependencyManagement>
- <dependencies>
+ </build>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver</id>
+ <dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path}</systemPath>
</dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>provided-jdbc-driver2</id>
+ <dependencies>
<dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
+ <groupId>privided</groupId>
+ <artifactId>jdbc-driver2</artifactId>
+ <version>NA</version>
+ <scope>system</scope>
+ <systemPath>${provided.jdbc.driver.path2}</systemPath>
</dependency>
- </dependencies>
- </dependencyManagement>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
</project>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
+++ idm/trunk/pom.xml 2009-05-12 09:32:57 UTC (rev 491)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
@@ -14,19 +15,20 @@
<description>JBoss Identity is the identity project for JEMS projects</description>
<modules>
- <module>parent</module>
- <module>idm-common</module>
- <module>idm-spi</module>
- <module>idm-api</module>
- <module>idm-core</module>
- <module>idm-hibernate</module>
- <module>idm-ldap</module>
- <module>idm-cache</module>
- <module>idm-auth</module>
- <module>idm-testsuite</module>
- <module>integration</module>
- <module>assembly</module>
- <module>example/simple</module>
+ <module>parent</module>
+ <module>idm-common</module>
+ <module>idm-spi</module>
+ <module>idm-api</module>
+ <module>idm-core</module>
+ <module>idm-hibernate</module>
+ <module>idm-ldap</module>
+ <module>idm-cache</module>
+ <module>idm-auth</module>
+ <module>idm-testsuite</module>
+ <module>integration</module>
+ <module>assembly</module>
+ <module>example/simple</module>
+ <module>example/auth</module>
</modules>
15 years, 8 months
JBoss Identity SVN: r490 - in idm/trunk: assembly and 18 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-11 07:57:05 -0400 (Mon, 11 May 2009)
New Revision: 490
Added:
idm/trunk/example/simple/
Removed:
idm/trunk/example/maven2/
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/distro/scripts/assembly-deploy-artifacts.xml
idm/trunk/example/simple/pom.xml
idm/trunk/example/simple/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
idm/trunk/idm-api/pom.xml
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-cache/pom.xml
idm/trunk/idm-common/pom.xml
idm/trunk/idm-core/pom.xml
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-ldap/pom.xml
idm/trunk/idm-spi/pom.xml
idm/trunk/idm-testsuite/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
idm/trunk/integration/jboss5/src/main/resources/jboss.idm.hibernate.cfg.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/pom.xml
Log:
- changes in IDMService
- maven groupId change to org.jboss.identity.idm
- example dir/artifact rename
- attache examples to the main build
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/assembly/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,12 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-assemply</artifactId>
<packaging>pom</packaging>
<name>JBoss Identity IDM - Assembly</name>
Modified: idm/trunk/distro/scripts/assembly-deploy-artifacts.xml
===================================================================
--- idm/trunk/distro/scripts/assembly-deploy-artifacts.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/distro/scripts/assembly-deploy-artifacts.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -72,10 +72,26 @@
<outputDirectory>src</outputDirectory>
</fileSet>
<fileSet>
- <directory>../idm/src/main/java</directory>
+ <directory>../idm-core/src/main/java</directory>
<outputDirectory>src</outputDirectory>
</fileSet>
<fileSet>
+ <directory>../idm-hibernate/src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>../idm-ldap/src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>../idm-cache/src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>../idm-auth/src/main/java</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+ <fileSet>
<directory>../integration/jboss5/src/main/java</directory>
<outputDirectory>src</outputDirectory>
</fileSet>
Copied: idm/trunk/example/simple (from rev 485, idm/trunk/example/maven2)
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/maven2/pom.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/example/simple/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,10 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm.example</groupId>
<version>1.0.0-SNAPSHOT</version>
- <artifactId>idm-maven2-example</artifactId>
+ <artifactId>example-simple</artifactId>
<packaging>jar</packaging>
- <name>JBoss Identity IDM Maven2 example project</name>
+ <name>Simple JBoss Identity IDM Maven2 example project</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>Example maven2 project using JBoss Identity IDM component.</description>
<licenses>
@@ -42,11 +42,26 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
- <artifactId>idm</artifactId>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-cache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
Modified: idm/trunk/example/simple/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/example/simple/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -53,6 +53,7 @@
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>
+ <mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue"/>
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>
<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>
Modified: idm/trunk/idm-api/pom.xml
===================================================================
--- idm/trunk/idm-api/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-api/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -28,7 +28,7 @@
</scm>
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-auth/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -28,12 +28,12 @@
</scm>
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-api</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-cache/pom.xml
===================================================================
--- idm/trunk/idm-cache/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-cache/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-common/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
Modified: idm/trunk/idm-core/pom.xml
===================================================================
--- idm/trunk/idm-core/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-core/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -29,17 +29,17 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-spi</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-ldap/pom.xml
===================================================================
--- idm/trunk/idm-ldap/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-ldap/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-spi/pom.xml
===================================================================
--- idm/trunk/idm-spi/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-spi/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -28,7 +28,7 @@
</scm>
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: idm/trunk/idm-testsuite/pom.xml
===================================================================
--- idm/trunk/idm-testsuite/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/idm-testsuite/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
@@ -29,23 +29,23 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-cache</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-hibernate</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-ldap</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -11,7 +11,7 @@
<version>1.0.0-SNAPSHOT</version>
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
@@ -23,31 +23,41 @@
<dependencies>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-core</artifactId>
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-hibernate</artifactId>
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-ldap</artifactId>
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-cache</artifactId>
<version>${version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>${jboss.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ <version>1.3.0</version>
+ </dependency>
</dependencies>
Modified: idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java
===================================================================
--- idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/integration/jboss5/src/main/java/org/jboss/identity/idm/integration/jboss5/IDMService.java 2009-05-11 11:57:05 UTC (rev 490)
@@ -11,21 +11,44 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.sql.DatabaseMetaData;
import java.util.logging.Logger;
+import java.util.Iterator;
+import java.util.Collection;
+import java.lang.reflect.Method;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.jboss.aop.microcontainer.aspects.jmx.JMX;
import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.portal.common.util.LoaderResource;
+import org.jboss.portal.common.util.CLResourceLoader;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.net.URLTools;
+import org.hibernate.Session;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.hibernate.dialect.DialectFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.hibernate.tool.hbm2ddl.SchemaUpdate;
+import org.hibernate.exception.SQLGrammarException;
+import org.hibernate.metadata.ClassMetadata;
+import bsh.Interpreter;
+import bsh.EvalError;
/**
* Start the {@link IdentitySessionFactory}, and register it in the JNDI.
*
* @author Jeff Yu
- *
+ * @author Boleslaw Dawidowicz
+ * @author Julien Viet
*/
@JMX(exposedInterface=IDMServiceMBean.class, name="jboss.identity:service=IDMService")
public class IDMService implements IDMServiceMBean {
@@ -33,20 +56,54 @@
public final static String DEFAULT_JNDI = "java:/IdentitySessionFactory";
private static Logger logger = Logger.getLogger(IDMService.class.getName());
-
+
+ /** doCheck result - schema ok */
+ private static final int RESULT_NONE = 0;
+
+ /** doCheck result - schema need updates */
+ private static final int RESULT_UPDATE = 1;
+
+ /** doCheck result - schema not exist */
+ private static final int RESULT_CREATE = 2;
+
+ /** Hibernate config - if specified will be used to create SessionFactory*/
+ private String hibernateConfigLocation;
+
+ /** If hibernateConfigLocation option is present created SessionFactory will be registered in IdentityConfigurationRegistry
+ * with this name*/
+ private String hibernateSessionFactoryRegistryName;
+
+ /** If hibernateConfigLocation option is present created SessionFactory will be registered in JNDI with this name*/
+ private String hibernateSessionFactoryJNDIName;
+
+ /** BSH script. If "doChecking" option is set and schema need to be created provided script will be invoked. This will
+ * happen after IdentitySessionFactory is created. hibernateSessionFactory and identitySessionFactory object
+ * are accessible in the script. */
+ private String setupLocation;
+
+ /** If true checks the schema existence on start and create it if necessary. */
+ private boolean doChecking;
+
private String idmConfigFile;
private String idmSessionFactoryJNDI;
private String SQLScript;
- private IdentitySessionFactory sessionFactory;
-
+ private IdentitySessionFactory identitySessionFactory;
+
+ private SessionFactory hibernateSessionFactory;
+
private String exitSQL;
private String datasource;
-
- public IDMService(String idmConfigFile) {
+
+ /** The hibernate configuration object. */
+ protected Configuration config;
+
+
+
+ public IDMService(String idmConfigFile) {
this.idmConfigFile = idmConfigFile;
this.idmSessionFactoryJNDI = DEFAULT_JNDI;
}
@@ -70,30 +127,157 @@
public void setSQLScript(String script) {
SQLScript = script;
}
-
-
- public void start() throws Exception {
+
+ public String getHibernateConfigLocation()
+ {
+ return hibernateConfigLocation;
+ }
+
+ public void setHibernateConfigLocation(String hibernateConfigLocation)
+ {
+ this.hibernateConfigLocation = hibernateConfigLocation;
+ }
+
+ public String getSetupLocation()
+ {
+ return setupLocation;
+ }
+
+ public void setSetupLocation(String setupLocation)
+ {
+ this.setupLocation = setupLocation;
+ }
+
+ public boolean isDoChecking()
+ {
+ return doChecking;
+ }
+
+ public void setDoChecking(boolean doChecking)
+ {
+ this.doChecking = doChecking;
+ }
+
+ public String getHibernateSessionFactoryRegistryName()
+ {
+ return hibernateSessionFactoryRegistryName;
+ }
+
+ public void setHibernateSessionFactoryRegistryName(String hibernateSessionFactoryRegistryName)
+ {
+ this.hibernateSessionFactoryRegistryName = hibernateSessionFactoryRegistryName;
+ }
+
+ public String getHibernateSessionFactoryJNDIName()
+ {
+ return hibernateSessionFactoryJNDIName;
+ }
+
+ public void setHibernateSessionFactoryJNDIName(String hibernateSessionFactoryJNDIName)
+ {
+ this.hibernateSessionFactoryJNDIName = hibernateSessionFactoryJNDIName;
+ }
+
+ public void start() throws Exception {
logger.info("Starting the JBoss Identity Management Service");
if (needToInitializeDB()) {
initializeDB();
}
- sessionFactory = new IdentityConfigurationImpl().configure(getIdmConfigFile()).buildIdentitySessionFactory();
- InitialContext context = new InitialContext();
- context.bind(getIdmSessionFactoryJNDI(), sessionFactory);
+
+ InitialContext context = new InitialContext();
+
+ IdentityConfiguration identityConfiguration = new IdentityConfigurationImpl().configure(getIdmConfigFile());
+
+ // If hibernate config is present than create SessionFactory manually and register it into identity config
+ if (hibernateConfigLocation != null)
+ {
+ URL configURL = Thread.currentThread().getContextClassLoader().getResource(hibernateConfigLocation);
+ if (configURL == null)
+ {
+ throw new Exception("The config " + hibernateConfigLocation + " does not exist");
+ }
+
+ if (!URLTools.exists(configURL))
+ {
+ throw new Exception("The config " + configURL + " does not exist");
+ }
+
+ config = new AnnotationConfiguration().configure(configURL);
+
+ createHibernateSessionFactory();
+
+// if (getHibernateSessionFactoryJNDIName() != null)
+// {
+// context.bind(getHibernateSessionFactoryJNDIName(), hibernateSessionFactory);
+// }
+
+ if (getHibernateSessionFactoryRegistryName() != null)
+ {
+ identityConfiguration.getIdentityConfigurationRegistry().
+ register(hibernateSessionFactory, getHibernateSessionFactoryRegistryName());
+ }
+
+ identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
+ }
+
+ int check = RESULT_NONE;
+
+ if (doChecking)
+ {
+ //check the schema
+ check = doCheck();
+ switch (check)
+ {
+ case RESULT_NONE:
+ break;
+ case RESULT_UPDATE:
+ updateSchema();
+ break;
+ case RESULT_CREATE:
+ createSchema();
+ break;
+ }
+ }
+
+ identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
+
+ // If schema was created than
+ if (check == RESULT_CREATE)
+ {
+ createContent();
+ }
+
+
+ context.bind(getIdmSessionFactoryJNDI(), identitySessionFactory);
logger.info("Started the JBoss Identity Management Service");
}
-
- public void stop() throws Exception {
+
+
+
+ public void stop() throws Exception {
logger.info("Stopping the JBoss Identity Management Service");
}
public void destroy() throws Exception {
- sessionFactory.close();
+ identitySessionFactory.close();
InitialContext context = new InitialContext();
context.unbind(getIdmSessionFactoryJNDI());
+ if (hibernateSessionFactory != null)
+ {
+ if (getHibernateSessionFactoryJNDIName() != null)
+ {
+ context.unbind(getHibernateSessionFactoryJNDIName());
+
+ }
+
+ hibernateSessionFactory.close();
+ }
+
logger.info("Stopped the JBoss Identity Management Service");
}
+
+
public String getExitSQL() {
return exitSQL;
}
@@ -158,7 +342,7 @@
{
URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
String sql = new String(readStream(url.openStream()) , "UTF-8");
- sql = sql.replaceAll("(?m)^--([^\n]+)?$", ""); // Remove all commented lines
+ sql = sql.replaceAll("(?m)^SessionFactory --([^\n]+)?$", ""); // Remove all commented lines
final String[] statements ;
statements = sql.split(";");
@@ -201,4 +385,224 @@
}
+ private void createHibernateSessionFactory() throws Exception
+ {
+
+ // Force transaction manager lookup class and JTA env
+// setPropertyIfAbsent("transaction.auto_close_session", "true");
+// setPropertyIfAbsent("transaction.flush_before_completion", "true");
+// setPropertyIfAbsent("hibernate.transaction.flush_before_completion", "true");
+// setPropertyIfAbsent("hibernate.transaction.factory_class", "org.hibernate.transaction.JTATransactionFactory");
+// setPropertyIfAbsent("hibernate.transaction.manager_lookup_class", "org.hibernate.transaction.JBossTransactionManagerLookup");
+
+ // Set JNDI name if present and absent
+ if (getHibernateSessionFactoryJNDIName() != null)
+ {
+ setPropertyIfAbsent("hibernate.session_factory_name", getHibernateSessionFactoryJNDIName());
+ }
+
+ // Detect the dialect if necessary
+ String dialectName = config.getProperty(Environment.DIALECT);
+ if (dialectName == null)
+ {
+ String dataSourceJNDI = config.getProperty(Environment.DATASOURCE);
+ logger.finer("Detecting dialect with datasource " + dataSourceJNDI + " ...");
+ DataSource ds = (DataSource)new InitialContext().lookup(dataSourceJNDI);
+ Connection conn = null;
+ try
+ {
+ conn = ds.getConnection();
+ DatabaseMetaData meta = conn.getMetaData();
+ String databaseName = meta.getDatabaseProductName();
+ int databaseMajorVersion = getDatabaseMajorVersion(meta);
+ dialectName = DialectFactory.determineDialect(databaseName, databaseMajorVersion).getClass().getName();
+ config.setProperty(Environment.DIALECT, dialectName);
+ logger.finer("Detected dialect " + dialectName + ", database is (" + databaseName + "," + databaseMajorVersion + ")");
+ }
+ finally
+ {
+ IOTools.safeClose(conn);
+ }
+ }
+ logger.finer("Using dialect " + dialectName);
+ if ("org.hibernate.dialect.HSQLDialect".equals(dialectName))
+ {
+ logger.info("You are using the file based HSQL database, this is not recommended on a production environment and will not work properly on a clustered environment.");
+ }
+
+ hibernateSessionFactory = config.buildSessionFactory();
+
+
+
+ }
+
+
+
+ private void setPropertyIfAbsent(String name, String value)
+ {
+ if (config.getProperty(name) == null)
+ {
+ config.setProperty(name, value);
+ }
+ }
+
+ public int doCheck()
+ {
+ Session session = null;
+ int numOfChecks = 0;
+ int bad = 0;
+ try
+ {
+ session = hibernateSessionFactory.openSession();
+ Collection values = hibernateSessionFactory.getAllClassMetadata().values();
+ numOfChecks = values.size();
+ for (Iterator i = values.iterator(); i.hasNext();)
+ {
+ ClassMetadata cmd = (ClassMetadata)i.next();
+ Query query = session.createQuery("from " + cmd.getEntityName());
+ query.setFirstResult(0);
+ query.setMaxResults(0);
+ try
+ {
+ query.list();
+ }
+ catch (SQLGrammarException e)
+ {
+ // We consider that exception means that the schema does not exist
+ bad++;
+ }
+ }
+ }
+ finally
+ {
+ IOTools.safeClose(session);
+ }
+ // There was no sql grammar exception - schema is ok!
+ if (bad == 0)
+ {
+ logger.finer("The schema was checked as valid");
+ //do nothing
+ return RESULT_NONE;
+ }
+ // There is no existing valid schema;
+ else if (bad == numOfChecks)
+ {
+ logger.finer("The schema was checked as not exists");
+ // Totaly invalid schema
+ return RESULT_CREATE;
+ }
+ // Schema is partialy corrupted
+ else if (bad < numOfChecks)
+ {
+ // Schema needs updates;
+ logger.finer("The schema was checked as need updates");
+ return RESULT_UPDATE;
+ }
+
+ // If here something gone wrong...
+ logger.finer("The schema was checked as need to be created");
+ return RESULT_CREATE;
+ }
+
+
+ public void createSchema()
+ {
+ logger.finer("Creating database schema");
+ try
+ {
+ SchemaExport export = new SchemaExport(config);
+ export.create(false, true);
+ }
+ catch (Exception e)
+ {
+ logger.fine("Cannot create schema: " + e);
+ }
+ }
+
+ public void destroySchema()
+ {
+ logger.finer("Destroying database schema");
+ try
+ {
+ SchemaExport export = new SchemaExport(config);
+ export.drop(false, true);
+ }
+ catch (Exception e)
+ {
+ logger.finer("Cannot destroy schema:" + e);
+ }
+ }
+
+ public void createContent()
+ {
+
+ LoaderResource setupResource = null;
+
+ //
+ if (setupLocation != null && setupResource == null)
+ {
+ setupResource = new CLResourceLoader().getResource(setupLocation);
+ }
+
+ if (setupResource != null)
+ {
+ if (setupResource.exists())
+ {
+ try
+ {
+ logger.fine("Creating database content");
+ String script = setupResource.asString("UTF-8");
+
+ // Create an interpreter and configures it
+ Interpreter interpreter = new Interpreter();
+ interpreter.setClassLoader(Thread.currentThread().getContextClassLoader());
+ interpreter.setOut(System.out);
+ interpreter.set("hibernateSessionFactory", hibernateSessionFactory);
+ interpreter.set("identitySessionFactory", identitySessionFactory);
+ interpreter.eval(script);
+ }
+ catch (EvalError e)
+ {
+ logger.finer("Error in the bsh script:" + e);
+ }
+ catch (IllegalStateException e)
+ {
+ logger.finer("Cannot load setup script:" + e);
+ }
+ }
+ else
+ {
+ logger.fine("There is a setup URL but the not valid " + setupResource);
+ }
+ }
+ }
+
+
+
+ public void updateSchema()
+ {
+ logger.finer("Updating database schema");
+ SchemaUpdate update = new SchemaUpdate(config);
+ update.execute(false, true);
+ }
+
+
+ private int getDatabaseMajorVersion(DatabaseMetaData meta)
+ {
+ try
+ {
+ Method gdbmvMethod = DatabaseMetaData.class.getMethod("getDatabaseMajorVersion", null);
+ return ((Integer)gdbmvMethod.invoke(meta, null)).intValue();
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ return 0;
+ }
+ catch (Throwable t)
+ {
+ logger.finer("could not get database version from JDBC metadata");
+ return 0;
+ }
+ }
+
}
Modified: idm/trunk/integration/jboss5/src/main/resources/jboss.idm.hibernate.cfg.xml
===================================================================
--- idm/trunk/integration/jboss5/src/main/resources/jboss.idm.hibernate.cfg.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/integration/jboss5/src/main/resources/jboss.idm.hibernate.cfg.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -52,6 +52,7 @@
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>-->
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>-->
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>-->
+ <!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue"/>-->
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>-->
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>-->
<!--<mapping class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>-->
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/integration/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -5,13 +5,13 @@
<name>JBoss Identity IDM Integration</name>
<description>JBoss Identity IDM Integration</description>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-integration</artifactId>
<packaging>pom</packaging>
<!-- Parent -->
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/parent/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -5,7 +5,7 @@
<version>3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
+++ idm/trunk/pom.xml 2009-05-11 11:57:05 UTC (rev 490)
@@ -1,12 +1,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>idm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.identity</groupId>
+ <groupId>org.jboss.identity.idm</groupId>
<artifactId>jboss-identity-idm-pom</artifactId>
<packaging>pom</packaging>
<name>JBoss Identity - Aggregator</name>
@@ -26,6 +26,7 @@
<module>idm-testsuite</module>
<module>integration</module>
<module>assembly</module>
+ <module>example/simple</module>
</modules>
15 years, 8 months
JBoss Identity SVN: r489 - in idm/trunk: idm-api/src/main/java/org/jboss/identity/idm/api/cfg and 32 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-10 15:15:26 -0400 (Sun, 10 May 2009)
New Revision: 489
Added:
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/NoSuchUserException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/p3p/
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/NestedException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionManagerProvider.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/Transactions.java
Removed:
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/p3p/
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
idm/trunk/idm-common/pom.xml
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/FeatureNotSupportedException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityConfigurationException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/PolicyValidationException.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/p3p/P3PConstants.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/RepositoryIdentityStoreSessionImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/opends/OpenDSService.java
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap/LDAPIdentityObjectImpl.java
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityTypeNotSupportedException.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/model/IdentityObject.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/AttributeStore.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSession.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
Log:
Initial LoginModule code and some small refactorings
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Set;
import java.util.Map;
@@ -77,7 +77,7 @@
/**
* @param identityType
* @return names of supported attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Set<String> getSupportedAttributeNames(IdentityType identityType)
throws IdentityException;
@@ -85,7 +85,7 @@
/**
* @param id - IdentityType id
* @return names of supported attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Set<String> getSupportedAttributeNames(String id)
throws IdentityException;
@@ -95,7 +95,7 @@
*
* @param identity
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Map<String, Attribute> getAttributes(IdentityType identity) throws IdentityException;
@@ -104,7 +104,7 @@
*
* @param id
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Map<String, Attribute> getAttributes(String id) throws IdentityException;
@@ -114,7 +114,7 @@
* @param identity
* @param attributeName
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Attribute getAttribute(IdentityType identity, String attributeName) throws IdentityException;
@@ -124,7 +124,7 @@
* @param id
* @param attributeName
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Attribute getAttribute(String id, String attributeName) throws IdentityException;
@@ -134,7 +134,7 @@
*
* @param identity
* @param attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void updateAttributes(IdentityType identity, Attribute[] attributes)
throws IdentityException;
@@ -145,7 +145,7 @@
*
* @param id
* @param attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void updateAttributes(String id, Attribute[] attributes)
throws IdentityException;
@@ -156,7 +156,7 @@
*
* @param identity
* @param attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttributes(IdentityType identity, Attribute[] attributes)
throws IdentityException;
@@ -167,7 +167,7 @@
*
* @param id
* @param attributes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttributes(String id, Attribute[] attributes)
throws IdentityException;
@@ -179,7 +179,7 @@
* @param identity
* @param attributeName
* @param values
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttribute(IdentityType identity, String attributeName, Object[] values)
throws IdentityException;
@@ -191,7 +191,7 @@
* @param id
* @param attributeName
* @param values
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttribute(String id, String attributeName, Object[] values)
throws IdentityException;
@@ -203,7 +203,7 @@
* @param identity
* @param attributeName
* @param value
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttribute(IdentityType identity, String attributeName, Object value)
throws IdentityException;
@@ -215,7 +215,7 @@
* @param id
* @param attributeName
* @param value
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void addAttribute(String id, String attributeName, Object value)
throws IdentityException;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySession.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,8 +22,8 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.exception.FeatureNotSupportedException;
+import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.FeatureNotSupportedException;
import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.UserQuery;
@@ -53,19 +53,19 @@
/**
* Close this session
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void close() throws IdentityException;
/**
* Save all pending changes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void save() throws IdentityException;
/**
* Clear this session
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void clear() throws IdentityException;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Creates IdentitySession objects for a given Realm.
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Collection;
@@ -87,7 +87,7 @@
* @param user
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void removeUser(User user, boolean force) throws IdentityException;
@@ -97,7 +97,7 @@
* @param id
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void removeUser(String id, boolean force) throws IdentityException;
@@ -107,7 +107,7 @@
* @param group
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void removeGroup(Group group, boolean force) throws IdentityException;
@@ -117,7 +117,7 @@
* @param groupId
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void removeGroup(String groupId, boolean force) throws IdentityException;
@@ -125,7 +125,7 @@
/**
* @return a number of stored identities
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
int getUserCount()
throws IdentityException;
@@ -133,7 +133,7 @@
/**
* @param groupType
* @return a number of stored groups with a given type
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
int getGroupTypeCount(String groupType)
throws IdentityException;
@@ -143,7 +143,7 @@
*
* @param name
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
User findUser(String name) throws IdentityException;
@@ -163,7 +163,7 @@
* @param name
* @param groupType
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Group findGroup(String name, String groupType) throws IdentityException;
@@ -172,7 +172,7 @@
*
* @param id
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Group findGroupById(String id) throws IdentityException;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.io.InputStream;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Collection;
@@ -57,7 +57,7 @@
* <p>Associate groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroups(Collection<Group> parents, Collection<Group> members)
throws IdentityException;
@@ -66,7 +66,7 @@
* <p>Associate groups</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroups(Group parent, Collection<Group> members)
throws IdentityException;
@@ -75,7 +75,7 @@
* <p>Associate groups</p>
* @param parentIds
* @param memberIds
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroupsByIds(Collection<String> parentIds, Collection<String> memberIds)
throws IdentityException;
@@ -84,7 +84,7 @@
* <p>Associate groups</p>
* @param parentId
* @param memberIds
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroupsByIds(String parentId, Collection<String> memberIds)
throws IdentityException;
@@ -93,7 +93,7 @@
* <p>Associate groups</p>
* @param parent
* @param member
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroups(Group parent, Group member)
throws IdentityException;
@@ -102,7 +102,7 @@
* <p>Associate groups</p>
* @param parentId
* @param memberId
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateGroupsByIds(String parentId, String memberId)
throws IdentityException;
@@ -111,7 +111,7 @@
* <p>Associate identities to groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUsers(Collection<Group> parents, Collection<User> members)
throws IdentityException;
@@ -120,7 +120,7 @@
* <p>Associate identities to group</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUser(Group parent, Collection<User> members)
throws IdentityException;
@@ -129,7 +129,7 @@
* <p>Associate identities to groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUsersByIds(Collection<String> parents, Collection<String> members)
throws IdentityException;
@@ -138,7 +138,7 @@
* <p>Associate identities to groups</p>
* @param parentId
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUsersByIds(String parentId, Collection<String> members)
throws IdentityException;
@@ -147,7 +147,7 @@
* <p>Associate identities to groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUser(Group parents, User members)
throws IdentityException;
@@ -156,7 +156,7 @@
* <p>Associate identities to groups</p>
* @param parentGroupId
* @param memberid
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void associateUserByIds(String parentGroupId, String memberid)
throws IdentityException;
@@ -165,7 +165,7 @@
* <p>Disassociate groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateGroups(Collection<Group> parents, Collection<Group> members)
throws IdentityException;
@@ -174,7 +174,7 @@
* <p>Disassociate groups</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateGroups(Group parent, Collection<Group> members)
throws IdentityException;
@@ -183,7 +183,7 @@
* <p>Disassociate groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateGroupsByIds(Collection<String> parents, Collection<String> members)
throws IdentityException;
@@ -192,7 +192,7 @@
* <p>Disassociate groups</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateGroupsByIds(String parent, Collection<String> members)
throws IdentityException;
@@ -201,7 +201,7 @@
* <p>Disassociate identities from groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateUsers(Collection<Group> parents, Collection<User> members)
throws IdentityException;
@@ -210,7 +210,7 @@
* <p>Disassociate identities from groups</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateUsers(Group parent, Collection<User> members)
throws IdentityException;
@@ -219,7 +219,7 @@
* <p>Disassociate identities from groups</p>
* @param parents
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateUsersByIds(Collection<String> parents, Collection<String> members)
throws IdentityException;
@@ -228,7 +228,7 @@
* <p>Disassociate identities from groups</p>
* @param parent
* @param members
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void disassociateUsersByIds(String parent, Collection<String> members)
throws IdentityException;
@@ -238,7 +238,7 @@
* @param parents
* @param members
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
<G extends IdentityType, I extends IdentityType> boolean isAssociated(Collection<G> parents, Collection<I> members)
throws IdentityException;
@@ -248,7 +248,7 @@
* @param parents
* @param members
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
boolean isAssociatedByIds(Collection<String> parents, Collection<String> members)
throws IdentityException;
@@ -258,7 +258,7 @@
* @param parent
* @param member
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
<G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member)
throws IdentityException;
@@ -268,7 +268,7 @@
* @param parent
* @param member
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
boolean isAssociatedByIds(String parent, String member)
throws IdentityException;
@@ -287,7 +287,7 @@
* @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Group group,
String groupType,
@@ -306,7 +306,7 @@
* @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Group group,
String groupType,
@@ -326,7 +326,7 @@
* @param cascade if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(String groupId,
String groupType,
@@ -339,7 +339,7 @@
* @param user child identity
* @param groupType can be null
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user,
String groupType) throws IdentityException;
@@ -350,7 +350,7 @@
* @param user child identity
* @param groupType can be null
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user,
String groupType,
@@ -362,7 +362,7 @@
* @param userId - id of associated user
* @param groupType can be null
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(String userId,
String groupType,
@@ -373,7 +373,7 @@
*
* @param user child identity
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user,
IdentitySearchCriteria criteria) throws IdentityException;
@@ -383,7 +383,7 @@
*
* @param userId
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(String userId,
IdentitySearchCriteria criteria) throws IdentityException;
@@ -393,7 +393,7 @@
*
* @param user child identity
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user) throws IdentityException;
@@ -403,7 +403,7 @@
* @param group parent group
* @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<User> findAssociatedUsers(Group group,
boolean cascade) throws IdentityException;
@@ -414,7 +414,7 @@
* @param group parent group
* @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<User> findAssociatedUsers(Group group,
boolean cascade,
@@ -426,7 +426,7 @@
* @param groupId parent group id
* @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<User> findAssociatedUsers(String groupId,
boolean cascade,
@@ -439,7 +439,7 @@
* @param user child identity
* @param groupType can be null
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findRelatedGroups(User user,
String groupType,
@@ -451,7 +451,7 @@
* @param userId
* @param groupType can be null
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<Group> findRelatedGroups(String userId,
String groupType,
@@ -462,7 +462,7 @@
*
* @param group parent group
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria criteria) throws IdentityException;
@@ -471,7 +471,7 @@
*
* @param groupId parent group id
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria criteria) throws IdentityException;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,8 +22,7 @@
package org.jboss.identity.idm.api;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.api.query.RoleQuery;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Collection;
import java.util.Map;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,7 +23,7 @@
package org.jboss.identity.idm.api.cfg;
import org.jboss.identity.idm.api.*;
-import org.jboss.identity.idm.exception.IdentityConfigurationException;
+import org.jboss.identity.idm.common.exception.IdentityConfigurationException;
import java.io.File;
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.api.cfg;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -35,7 +35,7 @@
* Retister object in context
* @param object representing object
* @param name to map object
- * @throws org.jboss.identity.idm.exception.IdentityException thrown if such object is already registered or operation fail.
+ * @throws org.jboss.identity.idm.common.exception.IdentityException thrown if such object is already registered or operation fail.
*/
public void register(Object object, String name) throws IdentityException;
@@ -49,7 +49,7 @@
* Retrieve registered object
* @param name
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException thrown if no such object exists in context
+ * @throws org.jboss.identity.idm.common.exception.IdentityException thrown if no such object exists in context
*/
public Object getObject(String name) throws IdentityException;
Modified: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-auth/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
@@ -1,4 +1,4 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.jboss.identity</groupId>
<artifactId>idm-parent</artifactId>
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
<groupId>org.jboss.identity</groupId>
- <artifactId>idm-common</artifactId>
+ <artifactId>idm-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -38,14 +38,28 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>jboss.jbossas.core-libs</groupId>
- <artifactId>jbosssx</artifactId>
- <version>4.0.4.GA</version>
+ <groupId>javax.security</groupId>
+ <artifactId>jacc</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>2.0.2.GA</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
- <groupId>apache-tomcat</groupId>
- <artifactId>catalina</artifactId>
- <version>5.5.12</version>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
Modified: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -1,325 +1,367 @@
-///*
-//* JBoss, a division of Red Hat
-//* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-//* by the @authors tag. See the copyright.txt in the distribution for a
-//* full listing of individual contributors.
-//*
-//* 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.jboss.identity.idm.auth;
-//
-//import org.jboss.security.SimpleGroup;
-//import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
-//
-//import javax.security.auth.Subject;
-//import javax.security.auth.login.LoginException;
-//import javax.security.auth.callback.CallbackHandler;
-//import javax.naming.NamingException;
-//import javax.naming.InitialContext;
-//import java.util.Map;
-//import java.util.Set;
-//import java.util.Iterator;
-//import java.security.acl.Group;
-//import java.security.Principal;
-//
-///**
-// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
-// * @version : 0.1 $
-// */
-//public class JBossIdentityIDMLoginModule extends UsernamePasswordLoginModule
-//{
-//
-// protected String userModuleJNDIName;
-//
-// protected String roleModuleJNDIName;
-//
-// protected String userProfileModuleJNDIName;
-//
-// protected String membershipModuleJNDIName;
-//
-// protected String additionalRole;
-//
-// protected String havingRole;
-//
-// protected String validateUserNameCase;
-//
-// protected String userNameToLowerCase;
-//
-// public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
-// {
-// super.initialize(subject, callbackHandler, sharedState, options);
-//
-// // Get data
-// userModuleJNDIName = (String) options.get("userModuleJNDIName");
-// roleModuleJNDIName = (String) options.get("roleModuleJNDIName");
-// userProfileModuleJNDIName = (String) options
-// .get("userProfileModuleJNDIName");
-// membershipModuleJNDIName = (String) options
-// .get("membershipModuleJNDIName");
-// additionalRole = (String) options.get("additionalRole");
-// havingRole = (String) options.get("havingRole");
-// validateUserNameCase = (String) options.get("validateUserNameCase");
-// userNameToLowerCase = (String) options.get("userNameToLowerCase");
-//
-//// // Some info
-//// log.trace("userModuleJNDIName = " + userModuleJNDIName);
-//// log.trace("roleModuleJNDIName = " + roleModuleJNDIName);
-//// log.trace("userProfileModuleJNDIName = " + userProfileModuleJNDIName);
-//// log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
-//// log.trace("additionalRole = " + additionalRole);
-//// log.trace("havingRole = " + havingRole);
-//// log.trace("validateUserNameCase = " + validateUserNameCase);
-//// log.trace("userNameToLowerCase = " + userNameToLowerCase);
-// }
-//
-// protected String getUsersPassword() throws LoginException
-// {
-// return "";
-// }
-//
-// protected boolean validatePassword(final String inputPassword, String expectedPassword)
-// {
-//
-// HttpServletRequest request = null;
-// try
-// {
-// request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
-// }
-// catch(Exception e)
-// {
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.auth;
+
+import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+import org.jboss.security.SimpleGroup;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.common.transaction.Transactions;
+import org.jboss.identity.idm.common.transaction.TransactionManagerProvider;
+import org.jboss.identity.idm.common.exception.NoSuchUserException;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.jacc.PolicyContext;
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.transaction.TransactionManager;
+import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.security.acl.Group;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class JBossIdentityIDMLoginModule extends UsernamePasswordLoginModule
+{
+
+ private static Logger log = Logger.getLogger(JBossIdentityIDMLoginModule.class.getName());
+
+
+ protected String identitySessionFactoryJNDIName;
+
+ protected String realmName;
+
+ protected String roleGroupTypeName;
+
+ protected String userEnabledAttributeName;
+
+ protected String additionalRole;
+
+ protected String associatedGroupType;
+
+ protected String associatedGroupName;
+
+ protected String validateUserNameCase;
+
+ protected String userNameToLowerCase;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
+ {
+ super.initialize(subject, callbackHandler, sharedState, options);
+
+ // Get data
+ identitySessionFactoryJNDIName = (String) options.get("identitySessionFactoryJNDIName");
+ realmName = (String) options.get("realmName");
+ roleGroupTypeName = (String) options.get("roleGroupTypeName");
+ userEnabledAttributeName = (String) options.get("userEnabledAttributeName");
+ additionalRole = (String) options.get("additionalRole");
+ associatedGroupType = (String) options.get("associatedGroupType");
+ associatedGroupName = (String) options.get("associatedGroupName");
+ validateUserNameCase = (String) options.get("validateUserNameCase");
+ userNameToLowerCase = (String) options.get("userNameToLowerCase");
+
+ // Some info
+ if (log.isLoggable(Level.FINEST))
+ log.finest("identitySessionFactoryJNDIName = " + identitySessionFactoryJNDIName);
+ log.finest("realmName = " + realmName);
+ log.finest("groupTypeName = " + roleGroupTypeName);
+ log.finest("userEnabledAttributeName = " + userEnabledAttributeName);
+ log.finest("additionalRole = " + additionalRole);
+ log.finest("havingRole = " + associatedGroupName);
+ log.finest("validateUserNameCase = " + validateUserNameCase);
+ log.finest("userNameToLowerCase = " + userNameToLowerCase);
+ }
+
+ protected String getUsersPassword() throws LoginException
+ {
+ return "";
+ }
+
+ protected boolean validatePassword(final String inputPassword, String expectedPassword)
+ {
+
+ HttpServletRequest request = null;
+ try
+ {
+ request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
+ }
+ catch(Exception e)
+ {
// log.error(this,e);
-// throw new RuntimeException(e);
-// }
-//
-// Object ssoSuccess = request.getAttribute("ssoSuccess");
-// if(ssoSuccess != null)
-// {
-// return true;
-// }
-//
-// if (inputPassword != null)
-// {
-// try
-// {
-// try
-// {
-//
-// UserStatus userStatus = getUserStatus(inputPassword);
-//
-// // Set the user Status in the request so that the login page can show an error message accordingly
-// request.setAttribute("org.jboss.portal.userStatus", userStatus);
-//
-// if (userStatus == UserStatus.DISABLE)
-// {
-// request.setAttribute("org.jboss.portal.loginError", "Your account is disabled");
-// return false;
-// }
-// else if (userStatus == UserStatus.NOTASSIGNEDTOROLE)
-// {
-// request.setAttribute("org.jboss.portal.loginError", "The user doesn't have the correct role");
-// return false;
-// }
-// else if ((userStatus == UserStatus.UNEXISTING) || userStatus == UserStatus.WRONGPASSWORD)
-// {
-// request.setAttribute("org.jboss.portal.loginError", "The user doesn't exist or the password is incorrect");
-// return false;
-// }
-// else if (userStatus == UserStatus.OK)
-// {
-// return true;
-// }
-// else
-// {
-// log.error("Unexpected error while logging in");
-// return false;
-// } }
-// catch (Exception e)
-// {
-// log.error("Error when validating password", e);
-// }
-// }
-// catch (Exception e)
-// {
-// log.debug("Failed to validate password", e);
-// }
-// }
-// return false;
-// }
-//
-// protected UserStatus getUserStatus(final String inputPassword)
-// {
-// UserStatus result = UserStatus.OK;
-//
-//// try {
-//// TransactionManager tm = (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
-//// UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
-//// {
-//// public Object run() throws Exception
-//// {
-//// try
-//// {
-//// User user = getUserModule().findUserByUserName(getUsername());
-//// // in case module implementation doesn't throw proper
-//// // exception...
-//// if (user == null)
-//// {
-//// throw new NoSuchUserException("UserModule returned null user object");
-//// }
-////
-//// //This is because LDAP binds can be non case sensitive
-//// if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
-//// && !getUsername().equals(user.getUserName()))
-//// {
-//// return UserStatus.UNEXISTING;
-//// }
-////
-//// boolean enabled = false;
-//// try {
-//// Object enabledS;
-//// enabledS = getUserProfileModule().getProperty(user,
-//// User.INFO_USER_ENABLED);
-//// if (enabledS != null) {
-//// enabled = new Boolean(enabledS.toString());
-//// }
-//// } catch (Exception e) {
-//// e.printStackTrace();
-//// }
-//// if (!enabled) {
-//// return UserStatus.DISABLE;
-//// }
-//// if (havingRole != null)
-//// {
-//// boolean hasTheRole = false;
-//// Set roles = getMembershipModule().getRoles(user);
-//// for (Iterator i = roles.iterator(); i.hasNext();)
-//// {
-//// Role role = (Role)i.next();
-//// if (havingRole.equals(role.getName()))
-//// {
-//// hasTheRole = true;
-//// break;
-//// }
-//// }
-//// if (!hasTheRole)
-//// {
-//// return UserStatus.NOTASSIGNEDTOROLE;
-//// }
-//// }
-//// if (!user.validatePassword(inputPassword))
-//// {
-//// return UserStatus.WRONGPASSWORD;
-//// }
-//// }
-//// catch (NoSuchUserException e1)
-//// {
-//// return UserStatus.UNEXISTING;
-//// }
-//// catch (Exception e)
-//// {
-//// throw new LoginException(e.toString());
-//// }
-//// return null;
-//// }
-//// });
-//// if (tmp != null)
-//// {
-//// result = tmp;
-//// }
-//// } catch (NamingException e1) {
-//// // TODO Auto-generated catch block
-//// e1.printStackTrace();
-//// }
-//// return result;
-// }
-//
-// protected Group[] getRoleSets() throws LoginException
-// {
-//// try {
-//// TransactionManager tm = (TransactionManager) new InitialContext()
-//// .lookup("java:/TransactionManager");
-//// return (Group[]) Transactions.required(tm, new Transactions.Runnable()
-//// {
-//// public Object run() throws Exception
-//// {
-//// Group rolesGroup = new SimpleGroup("Roles");
-////
-//// //
-//// if (additionalRole != null) {
-//// rolesGroup.addMember(createIdentity(additionalRole));
-//// }
-////
-//// try {
-//// User user = getUserModule().findUserByUserName(getUsername());
-//// Set roles = getMembershipModule().getRoles(user);
-////
-//// //
-////
-//// for (Iterator iterator = roles.iterator(); iterator.hasNext();) {
-//// Role role = (Role) iterator.next();
-//// String roleName = role.getName();
-//// try {
-//// Principal p = createIdentity(roleName);
-//// rolesGroup.addMember(p);
-//// } catch (Exception e) {
-//// log.debug("Failed to create principal " + roleName, e);
-//// }
-//// }
-////
-////
-//// } catch (Exception e) {
-//// throw new LoginException(e.toString());
-//// }
-//// //
-//// return new Group[] { rolesGroup };
-//// }
-//// });
-//// } catch (Exception e) {
-//// Throwable cause = e.getCause();
-//// throw new LoginException(cause.toString());
-//// }
-// }
-//
-// /** Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal. */
-// protected Principal createIdentity(String username) throws Exception
-// {
-// return new UserPrincipal(username);
-// }
-//
-// protected String getUsername()
-// {
-// if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
-// {
-// return super.getUsername().toLowerCase();
-// }
-// return super.getUsername();
-// }
-//
-// protected String[] getUsernameAndPassword() throws LoginException
-// {
-// String[] names = super.getUsernameAndPassword();
-//
-// if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
-// {
-// if (names[0] != null)
-// {
-// names[0] = names[0].toLowerCase();
-// }
-// }
-// return names;
-//
-// }
-//}
+ throw new RuntimeException(e);
+ }
+
+
+ // If attribute ssoSuccess is set just let user in
+ Object ssoSuccess = request.getAttribute("ssoSuccess");
+ if(ssoSuccess != null)
+ {
+ return true;
+ }
+
+ if (inputPassword != null)
+ {
+ try
+ {
+ try
+ {
+
+ UserStatus userStatus = getUserStatus(inputPassword);
+
+ // Set the user Status in the request so that the login page can show an error message accordingly
+ request.setAttribute("org.jboss.identity.idm.userStatus", userStatus);
+
+ if (userStatus == UserStatus.DISABLE)
+ {
+ //request.setAttribute("org.jboss.identity.idm.loginError", "Your account is disabled");
+ return false;
+ }
+ else if (userStatus == UserStatus.NOTASSIGNEDTOROLE)
+ {
+ //request.setAttribute("org.jboss.identity.idm.loginError", "The user doesn't have the correct role");
+ return false;
+ }
+ else if ((userStatus == UserStatus.UNEXISTING) || userStatus == UserStatus.WRONGPASSWORD)
+ {
+ //request.setAttribute("org.jboss.identity.idm.loginError", "The user doesn't exist or the password is incorrect");
+ return false;
+ }
+ else if (userStatus == UserStatus.OK)
+ {
+ return true;
+ }
+ else
+ {
+ log.fine("Unexpected error while logging in");
+ return false;
+ } }
+ catch (Exception e)
+ {
+ log.fine("Error when validating password: " + e);
+ }
+ }
+ catch (Exception e)
+ {
+ log.finer("Failed to validate password: " + e);
+ }
+ }
+ return false;
+ }
+
+ protected UserStatus getUserStatus(final String inputPassword)
+ {
+ UserStatus result = UserStatus.OK;
+
+ try {
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ UserStatus tmp = (UserStatus)Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ try
+ {
+ IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ User user = ids.getPersistenceManager().findUser(getUsername());
+
+ // in case module implementation doesn't throw proper
+ // exception...
+ if (user == null)
+ {
+ throw new NoSuchUserException("UserModule returned null user object");
+ }
+
+ //This is because LDAP binds can be non case sensitive
+ if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
+ && !getUsername().equals(user.getId()))
+ {
+ return UserStatus.UNEXISTING;
+ }
+
+ //Enabled
+ if (userEnabledAttributeName != null)
+ {
+
+ boolean enabled = false;
+ try {
+ Object enabledS;
+ enabledS = ids.getAttributesManager().getAttribute(user, userEnabledAttributeName);
+ if (enabledS != null) {
+ enabled = new Boolean(enabledS.toString());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (!enabled) {
+ return UserStatus.DISABLE;
+ }
+ }
+
+ if (associatedGroupName != null && associatedGroupType != null)
+ {
+ boolean hasTheGroup = false;
+
+ org.jboss.identity.idm.api.Group associatedGroup =
+ ids.getPersistenceManager().findGroup(associatedGroupName, associatedGroupType);
+
+ if (associatedGroup != null)
+ {
+ hasTheGroup = ids.getRelationshipManager().isAssociated(associatedGroup, user);
+ }
+
+ if (!hasTheGroup)
+ {
+ return UserStatus.NOTASSIGNEDTOROLE;
+ }
+ }
+
+ if (!ids.getAttributesManager().validatePassword(user, inputPassword))
+ {
+ return UserStatus.WRONGPASSWORD;
+ }
+
+ }
+ catch (NoSuchUserException e1)
+ {
+ return UserStatus.UNEXISTING;
+ }
+ catch (Exception e)
+ {
+ throw new LoginException(e.toString());
+ }
+ return null;
+ }
+ });
+ if (tmp != null)
+ {
+ result = tmp;
+ }
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ return result;
+ }
+
+ protected Group[] getRoleSets() throws LoginException
+ {
+ try {
+ TransactionManager tm = TransactionManagerProvider.JBOSS_PROVIDER.getTransactionManager();
+ return (Group[]) Transactions.required(tm, new Transactions.Runnable()
+ {
+ public Object run() throws Exception
+ {
+ Group rolesGroup = new SimpleGroup("Roles");
+
+ //
+ if (additionalRole != null) {
+ rolesGroup.addMember(createIdentity(additionalRole));
+ }
+
+ try {
+
+ IdentitySession ids = getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ User user = ids.getPersistenceManager().findUser(getUsername());
+ Collection<org.jboss.identity.idm.api.Group> userGroups =
+ ids.getRelationshipManager().findAssociatedGroups(user, roleGroupTypeName);
+
+ //
+ for (org.jboss.identity.idm.api.Group userGroup : userGroups)
+ {
+ String roleName = userGroup.getName();
+
+ try {
+ Principal p = createIdentity(roleName);
+ rolesGroup.addMember(p);
+ } catch (Exception e) {
+ log.finer("Failed to create principal " + roleName + " " + e);
+ }
+
+ }
+
+ } catch (Exception e) {
+ throw new LoginException(e.toString());
+ }
+ //
+ return new Group[] { rolesGroup };
+ }
+ });
+ } catch (Exception e) {
+ Throwable cause = e.getCause();
+ throw new LoginException(cause.toString());
+ }
+ }
+
+ /** Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal. */
+ protected Principal createIdentity(String username) throws Exception
+ {
+ return new UserPrincipal(username);
+ }
+
+ protected String getUsername()
+ {
+ if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ return super.getUsername().toLowerCase();
+ }
+ return super.getUsername();
+ }
+
+ protected String[] getUsernameAndPassword() throws LoginException
+ {
+ String[] names = super.getUsernameAndPassword();
+
+ if (userNameToLowerCase != null && userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ if (names[0] != null)
+ {
+ names[0] = names[0].toLowerCase();
+ }
+ }
+ return names;
+
+ }
+
+ protected IdentitySessionFactory getIdentitySessionFactory() throws NamingException
+ {
+ if (identitySessionFactory == null)
+ {
+ identitySessionFactory = (IdentitySessionFactory)new InitialContext().lookup(identitySessionFactoryJNDIName);
+ }
+ return identitySessionFactory;
+ }
+}
Modified: idm/trunk/idm-common/pom.xml
===================================================================
--- idm/trunk/idm-common/pom.xml 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-common/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
@@ -33,6 +33,17 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
</dependencies>
<reporting>
Copied: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception (from rev 485, idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception)
Modified: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/FeatureNotSupportedException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/FeatureNotSupportedException.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/FeatureNotSupportedException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -20,7 +20,7 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.identity.idm.exception;
+package org.jboss.identity.idm.common.exception;
/**
* Exception indicating that the feature is not implemented
Modified: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityConfigurationException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityConfigurationException.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityConfigurationException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -20,9 +20,9 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.identity.idm.exception;
+package org.jboss.identity.idm.common.exception;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Exception indicating some issue in configuration
Modified: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityException.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/IdentityException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.identity.idm.exception;
+package org.jboss.identity.idm.common.exception;
import java.security.GeneralSecurityException;
Added: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/NoSuchUserException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/NoSuchUserException.java (rev 0)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/NoSuchUserException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -0,0 +1,46 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.common.exception;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class NoSuchUserException extends IdentityException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7328419579811469592L;
+ private String userId;
+
+ public NoSuchUserException(String userId)
+ {
+ super("No such user " + userId);
+ this.userId = this.userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+}
Modified: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/PolicyValidationException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/PolicyValidationException.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/exception/PolicyValidationException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.identity.idm.exception;
+package org.jboss.identity.idm.common.exception;
import java.security.GeneralSecurityException;
Copied: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/p3p (from rev 485, idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/p3p)
Modified: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/p3p/P3PConstants.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/p3p/P3PConstants.java 2009-05-09 11:10:49 UTC (rev 485)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/p3p/P3PConstants.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -20,7 +20,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
-package org.jboss.identity.idm.p3p;
+package org.jboss.identity.idm.common.p3p;
/**
* Class taken from JBoss Portal common module.
Added: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/NestedException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/NestedException.java (rev 0)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/NestedException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -0,0 +1,38 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.common.transaction;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5451 $
+ */
+public class NestedException extends RuntimeException
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8546585764241990455L;
+
+ public NestedException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionException.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionException.java (rev 0)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -0,0 +1,48 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.common.transaction;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5451 $
+ */
+public class TransactionException extends RuntimeException
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8968893103336776336L;
+ public TransactionException()
+ {
+ }
+ public TransactionException(Throwable cause)
+ {
+ super(cause);
+ }
+ public TransactionException(String message)
+ {
+ super(message);
+ }
+ public TransactionException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionManagerProvider.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionManagerProvider.java (rev 0)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/TransactionManagerProvider.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -0,0 +1,54 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.common.transaction;
+
+import javax.transaction.TransactionManager;
+import javax.naming.InitialContext;
+
+/**
+ * Implementations provides access to a transaction manager.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5451 $
+ */
+public interface TransactionManagerProvider
+{
+ /**
+ * Provide access to the transaction manager.
+ *
+ * @return return the transaction manager.
+ * @throws Exception any exception that prevent to get the transaction manager
+ */
+ TransactionManager getTransactionManager() throws Exception;
+
+ /**
+ * JBoss transaction manager provider implementation.
+ */
+ TransactionManagerProvider JBOSS_PROVIDER = new TransactionManagerProvider()
+ {
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return (TransactionManager)new InitialContext().lookup("java:/TransactionManager");
+ }
+ };
+}
\ No newline at end of file
Added: idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/Transactions.java
===================================================================
--- idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/Transactions.java (rev 0)
+++ idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/common/transaction/Transactions.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -0,0 +1,704 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.common.transaction;
+
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.NotSupportedException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.RollbackException;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Utility class for managing transactions.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5451 $
+ */
+public class Transactions
+{
+
+ /** . */
+ private static Logger log = Logger.getLogger(Transactions.class);
+
+ /** . */
+ private static final String[] STATUS_NAMES = {
+ "STATUS_ACTIVE",
+ "STATUS_MARKED_ROLLBACK",
+ "STATUS_PREPARED",
+ "STATUS_COMMITTED",
+ "STATUS_ROLLEDBACK",
+ "STATUS_UNKNOWN",
+ "STATUS_NO_TRANSACTION",
+ "STATUS_PREPARING",
+ "STATUS_COMMITTING",
+ "STATUS_ROLLING_BACK"};
+
+ /**
+ * Decode the status name.
+ *
+ * @param status the status value
+ * @return the translated status name or null if it is not valid
+ */
+ public static String decodeStatus(int status)
+ {
+ if (status >= 0 && status <= STATUS_NAMES.length)
+ {
+ return STATUS_NAMES[status];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Apply the transaction type before the unit of work.
+ *
+ * @param type the transaction type
+ * @param tm the transaction manager
+ * @return the new transaction if one has been started.
+ * @throws TransactionException
+ * @throws IllegalArgumentException if the type or the transaction manager is null
+ */
+ public static Transaction applyBefore(Type type, TransactionManager tm) throws TransactionException, IllegalArgumentException
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager provided");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No type");
+ }
+
+ // Suspend the incoming transaction
+ Transaction oldTx = suspend(tm);
+
+ if (oldTx != null)
+ {
+ type.txBefore(tm, oldTx);
+ }
+ else
+ {
+ type.noTxBefore(tm);
+ }
+
+ return oldTx;
+ }
+
+ /**
+ * Apply the transaction type after the unit of work has been done.
+ *
+ * @param type the transaction type
+ * @param tm the transaction manager
+ * @param oldTx the old transaction if it is not null
+ * @throws TransactionException
+ * @throws IllegalArgumentException if the type of the transaction manager is null
+ */
+ public static void applyAfter(Type type, TransactionManager tm, Transaction oldTx) throws TransactionException, IllegalArgumentException
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager provided");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No type");
+ }
+
+ try
+ {
+ if (oldTx != null)
+ {
+ type.txAfter(tm, oldTx);
+ }
+ else
+ {
+ type.noTxAfter(tm);
+ }
+ }
+ finally
+ {
+ if (oldTx != null)
+ {
+ try
+ {
+ resume(tm, oldTx);
+ }
+ catch (TransactionException ignore)
+ {
+ log.error("Was not capable to resume the incoming transaction", ignore);
+ }
+ }
+ }
+ }
+
+ /**
+ * Apply the transaction type around the unit of work.
+ *
+ * @param type the transaction type
+ * @param tm the transaction manager
+ * @param runnable the unit of work
+ * @return the object returned by the runnable object
+ * @throws NestedException wraps any exception throws by the runnable object
+ * @throws TransactionException
+ * @throws IllegalArgumentException if any method argument is null
+ */
+ public static Object apply(Type type, TransactionManager tm, final Runnable runnable) throws NestedException, TransactionException, IllegalArgumentException
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager provided");
+ }
+ if (runnable == null)
+ {
+ throw new IllegalArgumentException("No code to execute");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("No type");
+ }
+
+ // Any throwable thrown by the wrapped code
+ Throwable throwable = null;
+
+ // Any object returned by the wrapped code
+ Object ret = null;
+
+ // Suspend the incoming transaction
+ Transaction oldTx = suspend(tm);
+
+ try
+ {
+ if (oldTx != null)
+ {
+ type.txBefore(tm, oldTx);
+ try
+ {
+ ret = runnable.run();
+ }
+ catch (Throwable t)
+ {
+ throwable = t;
+ }
+ finally
+ {
+ type.txAfter(tm, oldTx);
+ }
+ }
+ else
+ {
+ type.noTxBefore(tm);
+ try
+ {
+ ret = runnable.run();
+ }
+ catch (Throwable t)
+ {
+ throwable = t;
+ }
+ finally
+ {
+ type.noTxAfter(tm);
+ }
+ }
+ }
+ finally
+ {
+ if (oldTx != null)
+ {
+ try
+ {
+ resume(tm, oldTx);
+ }
+ catch (TransactionException ignore)
+ {
+ log.error("Was not capable to resume the incoming transaction", ignore);
+ }
+ }
+ }
+ if (throwable != null)
+ {
+ if (throwable instanceof Error)
+ {
+ throw (Error)throwable;
+ }
+ else
+ {
+ throw new NestedException(throwable);
+ }
+ }
+ else
+ {
+ return ret;
+ }
+ }
+
+ public static Object notSupported(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_NOT_SUPPORTED, tm, runnable);
+ }
+
+ public static Object never(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_NEVER, tm, runnable);
+ }
+
+ public static Object mandatory(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_MANDATORY, tm, runnable);
+ }
+
+ public static Object supports(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_SUPPORTS, tm, runnable);
+ }
+
+ public static Object required(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_REQUIRED, tm, runnable);
+ }
+
+ public static Object requiresNew(TransactionManager tm, Runnable runnable)
+ throws NestedException, TransactionException
+ {
+ return apply(TYPE_REQUIRES_NEW, tm, runnable);
+ }
+
+ /**
+ * Begin a new transaction.
+ *
+ * @param tm the transaction manager
+ * @throws IllegalArgumentException if the tm is null
+ */
+ public static void begin(TransactionManager tm) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager");
+ }
+ tm.begin();
+ }
+ catch (SystemException e)
+ {
+ log.error("Problem when beginning transaction", e);
+ throw new TransactionException(e);
+ }
+ catch (NotSupportedException e)
+ {
+ log.error("Problem when beginning transaction", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ /**
+ * Mark the transaction as rollback only.
+ *
+ * @param tx the transaction to mark as rollback only
+ * @throws IllegalArgumentException if the transaction is null
+ * @throws TransactionException
+ */
+ private static void setRollbackOnly(Transaction tx) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tx == null)
+ {
+ throw new IllegalArgumentException("No transaction to set rollback only");
+ }
+ tx.setRollbackOnly();
+ }
+ catch (SystemException e)
+ {
+ log.error("Problem when setting transaction as rollback only", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ /**
+ * Mark the active transaction for this thread as rollback only
+ *
+ * @see #setRollbackOnly(javax.transaction.Transaction)
+ * @param tm the transaction manager
+ * @throws IllegalArgumentException if the tm is null
+ */
+ public static void setRollbackOnly(TransactionManager tm) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager");
+ }
+ Transaction tx = tm.getTransaction();
+ if (tx == null)
+ {
+ throw new TransactionException("No active transaction to set rollback only");
+ }
+ setRollbackOnly(tx);
+ }
+ catch (SystemException e)
+ {
+ log.error("Problem when setting transaction as rollback only", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ public void safeSetRollbackOnly(TransactionManager tm)
+ {
+ try
+ {
+ setRollbackOnly(tm);
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.error("", e);
+ }
+ catch (TransactionException e)
+ {
+ log.error("", e);
+ }
+ }
+
+ public static void safeEnd(TransactionManager tm)
+ {
+ try
+ {
+ end(tm);
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.error("", e);
+ }
+ catch (TransactionException e)
+ {
+ log.error("", e);
+ }
+ }
+
+ /**
+ * Terminate the active transaction for this thread. If the transaction is marked for rollback
+ * then it is rollbacked otherwise it is commited.
+ *
+ * @param tm the transaction manager
+ * @return true if commit happened, false otherwise
+ * @throws IllegalArgumentException if the tm is null
+ */
+ public static boolean end(TransactionManager tm) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager");
+ }
+ int status = tm.getStatus();
+ switch (status)
+ {
+ case Status.STATUS_MARKED_ROLLBACK:
+ tm.rollback();
+ return false;
+ case Status.STATUS_ACTIVE:
+ tm.commit();
+ return true;
+ default:
+ throw new TransactionException("Abnormal status for ending a tx " + STATUS_NAMES[status]);
+ }
+ }
+ catch (SystemException e)
+ {
+ log.error("Problem when ending transaction", e);
+ throw new TransactionException(e);
+ }
+ catch (HeuristicMixedException e)
+ {
+ log.error("Problem when ending transaction", e);
+ throw new TransactionException(e);
+ }
+ catch (HeuristicRollbackException e)
+ {
+ log.error("Problem when ending transaction", e);
+ throw new TransactionException(e);
+ }
+ catch (RollbackException e)
+ {
+ log.error("Problem when ending transaction", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ /**
+ * Associate the thread with a transaction
+ *
+ * @param tm the transaction manager
+ * @param tx the transaction to associate with the this thread
+ * @throws IllegalArgumentException if any argument is null
+ * @throws TransactionException
+ */
+ public static void resume(TransactionManager tm, Transaction tx) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager");
+ }
+ if (tx == null)
+ {
+ throw new IllegalArgumentException("No transaction to resume");
+ }
+ tm.resume(tx);
+ }
+ catch (Exception e)
+ {
+ log.error("Problem when resuming transaction", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ /**
+ * Disassociate the current thread with the active transaction.
+ *
+ * @param tm the transaction manager
+ * @return the transaction previously associated with this thread
+ * @throws IllegalArgumentException if the transaction manager is null
+ * @throws TransactionException
+ */
+ public static Transaction suspend(TransactionManager tm) throws IllegalArgumentException, TransactionException
+ {
+ try
+ {
+ if (tm == null)
+ {
+ throw new IllegalArgumentException("No transaction manager");
+ }
+ return tm.suspend();
+ }
+ catch (SystemException e)
+ {
+ log.error("Problem when suspending transaction", e);
+ throw new TransactionException(e);
+ }
+ }
+
+ public interface Runnable
+ {
+ Object run() throws Exception;
+ }
+
+ public abstract static class Type
+ {
+ private final String name;
+
+ private Type(String name)
+ {
+ this.name = name;
+ }
+
+ public Transaction before(TransactionManager tm)
+ {
+ return applyBefore(this, tm);
+ }
+
+ public void after(TransactionManager tm, Transaction oldTx)
+ {
+ applyAfter(this, tm, oldTx);
+ }
+
+ abstract void txBefore(TransactionManager tm, Transaction oldTx) throws TransactionException;
+
+ abstract void txAfter(TransactionManager tm, Transaction oldTx);
+
+ abstract void noTxBefore(TransactionManager tm) throws TransactionException;
+
+ abstract void noTxAfter(TransactionManager tm);
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String toString()
+ {
+ return name;
+ }
+ }
+
+ public static final Type TYPE_NOT_SUPPORTED = new Type("NOT_SUPPORTED")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx)
+ {
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ }
+ void noTxBefore(TransactionManager tm)
+ {
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ }
+ };
+
+ public static final Type TYPE_SUPPORTS = new Type("SUPPORTS")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx) throws TransactionException
+ {
+ resume(tm, oldTx);
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ try
+ {
+ suspend(tm);
+ }
+ catch (IllegalStateException ignore)
+ {
+ log.error("Problem when suspending transaction", ignore);
+ }
+ }
+ void noTxBefore(TransactionManager tm)
+ {
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ }
+ };
+
+ public static final Type TYPE_REQUIRED = new Type("REQUIRED")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx)
+ {
+ resume(tm, oldTx);
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ try
+ {
+ suspend(tm);
+ }
+ catch (TransactionException ignore)
+ {
+ log.error("Problem when suspending transaction", ignore);
+ }
+ }
+ void noTxBefore(TransactionManager tm) throws TransactionException
+ {
+ begin(tm);
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ try
+ {
+ end(tm);
+ }
+ catch (IllegalStateException ignore)
+ {
+ log.error("Problem when ending transaction", ignore);
+ }
+ }
+ };
+
+ public static final Type TYPE_REQUIRES_NEW = new Type("REQUIRES_NEW")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx) throws TransactionException
+ {
+ begin(tm);
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ try
+ {
+ end(tm);
+ }
+ catch (IllegalStateException ignore)
+ {
+ log.error("Problem when ending transaction", ignore);
+ }
+ }
+ void noTxBefore(TransactionManager tm) throws TransactionException
+ {
+ begin(tm);
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ try
+ {
+ end(tm);
+ }
+ catch (IllegalStateException ignore)
+ {
+ log.error("Problem when ending transaction", ignore);
+ }
+ }
+ };
+
+ public static final Type TYPE_MANDATORY = new Type("MANDATORY")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx) throws TransactionException
+ {
+ resume(tm, oldTx);
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ }
+ void noTxBefore(TransactionManager tm) throws TransactionException
+ {
+ throw new TransactionException("No incoming transaction");
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ throw new UnsupportedOperationException("Should never ne called");
+ }
+ };
+
+ public static final Type TYPE_NEVER = new Type("NEVER")
+ {
+ void txBefore(TransactionManager tm, Transaction oldTx) throws TransactionException
+ {
+ throw new TransactionException("Need no incoming transaction");
+ }
+ void txAfter(TransactionManager tm, Transaction oldTx)
+ {
+ throw new UnsupportedOperationException("Should never ne called");
+ }
+ void noTxBefore(TransactionManager tm)
+ {
+ }
+ void noTxAfter(TransactionManager tm)
+ {
+ }
+ };
+}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -28,7 +28,7 @@
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.configuration.IdentitySessionConfigurationContext;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,25 +23,12 @@
package org.jboss.identity.idm.impl.api.query;
import org.jboss.identity.idm.api.query.GroupQuery;
-import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
-import org.jboss.identity.idm.api.query.QueryException;
-import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
-import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.model.GroupId;
-import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
-import org.jboss.identity.idm.exception.IdentityException;
-import java.util.Collection;
-import java.util.List;
import java.util.Set;
-import java.util.HashSet;
-import java.util.LinkedList;
import java.util.Collections;
/**
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,30 +23,11 @@
package org.jboss.identity.idm.impl.api.query;
import org.jboss.identity.idm.api.query.RoleQuery;
-import org.jboss.identity.idm.api.query.GroupQuery;
-import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
-import org.jboss.identity.idm.api.query.QueryException;
-import org.jboss.identity.idm.api.SortOrder;
-import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.IdentityType;
-import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
-import org.jboss.identity.idm.impl.api.model.SimpleUser;
-import org.jboss.identity.idm.impl.api.model.GroupId;
-import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
-import org.jboss.identity.idm.impl.api.model.SimpleRole;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.exception.FeatureNotSupportedException;
-import java.util.Collection;
-import java.util.List;
-import java.util.LinkedList;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,21 +23,10 @@
package org.jboss.identity.idm.impl.api.query;
import org.jboss.identity.idm.api.query.UserQuery;
-import org.jboss.identity.idm.api.query.QueryException;
-import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
-import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.SortOrder;
-import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
-import org.jboss.identity.idm.exception.IdentityException;
-import java.util.Collection;
-import java.util.List;
import java.util.Set;
-import java.util.HashSet;
-import java.util.LinkedList;
import java.util.Collections;
/**
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/IdentitySessionImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -42,8 +42,8 @@
import org.jboss.identity.idm.api.query.GroupQueryBuilder;
import org.jboss.identity.idm.api.query.RoleQueryBuilder;
import org.jboss.identity.idm.api.query.QueryException;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.exception.FeatureNotSupportedException;
+import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.FeatureNotSupportedException;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
@@ -66,7 +66,6 @@
import org.jboss.identity.idm.impl.api.query.UserQueryBuilderImpl;
import org.jboss.identity.idm.impl.api.query.GroupQueryBuilderImpl;
import org.jboss.identity.idm.impl.api.query.RoleQueryBuilderImpl;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -30,7 +30,7 @@
import org.jboss.identity.idm.api.CredentialType;
import org.jboss.identity.idm.api.Credential;
import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -29,7 +29,7 @@
import org.jboss.identity.idm.api.PersistenceManagerFeaturesDescription;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySearchCriteriumType;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -30,13 +30,12 @@
import org.jboss.identity.idm.api.RelationshipManagerFeaturesDescription;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySearchCriteriumType;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -32,7 +32,7 @@
import org.jboss.identity.idm.api.RoleManagerFeaturesDescription;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySearchCriteriumType;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAttributeStoreWrapper.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -30,7 +30,7 @@
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.logging.Logger;
import java.util.Set;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -34,7 +34,7 @@
import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Map;
import java.util.Collection;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -31,8 +31,8 @@
import org.jboss.identity.idm.impl.api.session.mapper.DirectIdentityObjectTypeMapperImpl;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapperImpl;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.exception.IdentityConfigurationException;
+import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityConfigurationException;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -37,7 +37,7 @@
import org.jboss.identity.idm.spi.configuration.metadata.RelationshipMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
-import org.jboss.identity.idm.exception.IdentityConfigurationException;
+import org.jboss.identity.idm.common.exception.IdentityConfigurationException;
import org.jboss.identity.idm.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
import org.jboss.identity.idm.impl.configuration.jaxb2.generated.JbossIdentityType;
import org.jboss.identity.idm.impl.configuration.jaxb2.generated.IdentityStoreType;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -32,7 +32,7 @@
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreMappingMetaData;
import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.helper.SecurityActions;
import org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreWrapper;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -41,7 +41,7 @@
import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.store.SimpleIdentityStoreInvocationContext;
import org.jboss.identity.idm.impl.api.session.managers.RoleManagerImpl;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/RepositoryIdentityStoreSessionImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/RepositoryIdentityStoreSessionImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/RepositoryIdentityStoreSessionImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,7 +23,7 @@
package org.jboss.identity.idm.impl.repository;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Map;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -38,7 +38,7 @@
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.store.SimpleIdentityStoreInvocationContext;
import java.util.Map;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -29,7 +29,7 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.RelationshipMetaData;
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -21,7 +21,7 @@
*/
package org.jboss.identity.idm.impl.types;
-import org.jboss.identity.idm.exception.PolicyValidationException;
+import org.jboss.identity.idm.common.exception.PolicyValidationException;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
Modified: idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/opends/OpenDSService.java
===================================================================
--- idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/opends/OpenDSService.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/opends/OpenDSService.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,15 +23,12 @@
package org.jboss.identity.idm.opends;
import java.io.File;
-import java.io.InputStream;
import java.net.URL;
import java.net.URISyntaxException;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.InitializationException;
-import org.jboss.identity.idm.impl.helper.SecurityActions;
-import org.jboss.identity.idm.exception.IdentityException;
/**
* Simple service class that enables to bootstrap OpenDS LDAP server and to manage its lifecycle
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-hibernate/pom.xml 2009-05-10 19:15:26 UTC (rev 489)
@@ -65,11 +65,11 @@
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
</dependency>
- <!--<dependency>-->
- <!--<groupId>log4j</groupId>-->
- <!--<artifactId>log4j</artifactId>-->
- <!--<version>1.2.14</version>-->
- <!--</dependency>-->
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
<dependency>
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObject.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -40,11 +40,9 @@
import javax.persistence.FetchType;
import javax.persistence.UniqueConstraint;
import javax.persistence.JoinColumn;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
import javax.persistence.JoinTable;
-import org.jboss.identity.idm.exception.PolicyValidationException;
+import org.jboss.identity.idm.common.exception.PolicyValidationException;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
import org.hibernate.annotations.Cascade;
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -41,7 +41,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.criterion.Restrictions;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute;
import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute;
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,7 +23,7 @@
package org.jboss.identity.idm.impl.store.hibernate;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.hibernate.SessionFactory;
/**
Modified: idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap/LDAPIdentityObjectImpl.java
===================================================================
--- idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap/LDAPIdentityObjectImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/model/ldap/LDAPIdentityObjectImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -24,7 +24,7 @@
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
-import org.jboss.identity.idm.exception.PolicyValidationException;
+import org.jboss.identity.idm.common.exception.PolicyValidationException;
import java.util.Set;
import java.util.Map;
Modified: idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -56,7 +56,7 @@
import javax.naming.ldap.LdapName;
import javax.naming.ldap.SortControl;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.helper.Tools;
Modified: idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
===================================================================
--- idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-ldap/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -23,7 +23,7 @@
package org.jboss.identity.idm.impl.store.ldap;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.InitialLdapContext;
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.spi.configuration;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -35,7 +35,7 @@
* Retister object in context
* @param object representing object
* @param name to map object
- * @throws org.jboss.identity.idm.exception.IdentityException thrown if such object is already registered or operation fail.
+ * @throws org.jboss.identity.idm.common.exception.IdentityException thrown if such object is already registered or operation fail.
*/
public void register(Object object, String name) throws IdentityException;
@@ -49,7 +49,7 @@
* Retrieve registered object
* @param name
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException thrown if no such object exists in context
+ * @throws org.jboss.identity.idm.common.exception.IdentityException thrown if no such object exists in context
*/
public Object getObject(String name) throws IdentityException;
}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityTypeNotSupportedException.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityTypeNotSupportedException.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityTypeNotSupportedException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -21,7 +21,7 @@
*/
package org.jboss.identity.idm.spi.exception;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* <p>Represents an exception that
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/OperationNotSupportedException.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.spi.exception;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Identity operation not supported exception
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/model/IdentityObject.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/model/IdentityObject.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/model/IdentityObject.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.spi.model;
-import org.jboss.identity.idm.exception.PolicyValidationException;
+import org.jboss.identity.idm.common.exception.PolicyValidationException;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -52,7 +52,7 @@
/**
* Validate configured Policies
- * @throws org.jboss.identity.idm.exception.PolicyValidationException
+ * @throws org.jboss.identity.idm.common.exception.PolicyValidationException
*/
void validatePolicy() throws PolicyValidationException;
}
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -27,9 +27,8 @@
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.store.IdentityStore;
import org.jboss.identity.idm.spi.store.AttributeStore;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* IdentityStoreRepository exposes identity object management
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/AttributeStore.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/AttributeStore.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/AttributeStore.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -26,7 +26,7 @@
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Set;
import java.util.Map;
@@ -50,7 +50,7 @@
* @param invocationContext
* @param identityType @return names of supported attributes
* @return
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType)
throws IdentityException;
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/FeaturesMetaData.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -26,7 +26,7 @@
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Describe the features supported by an Identity Store
@@ -84,7 +84,7 @@
* @param toType
* @param relationshipType
* @return true is given relationship can be persisted or retrieved
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType,
IdentityObjectRelationshipType relationshipType)
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -34,7 +34,7 @@
import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Represents an Identity Store. Implementation of this interface perform operations on real identity storage like DB or LDAP
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSession.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSession.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSession.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.spi.store;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* Session related to the identity persistence store. Created by IdentityStoreSessionFactory
@@ -41,19 +41,19 @@
/**
* Close this session
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void close() throws IdentityException;
/**
* Save all pending changes
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void save() throws IdentityException;
/**
* Clear this session
- * @throws org.jboss.identity.idm.exception.IdentityException
+ * @throws org.jboss.identity.idm.common.exception.IdentityException
*/
void clear() throws IdentityException;
Modified: idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java
===================================================================
--- idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStoreSessionFactory.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -22,7 +22,7 @@
package org.jboss.identity.idm.spi.store;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -30,7 +30,7 @@
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.AttributeDescription;
import org.jboss.identity.idm.api.Credential;
-import org.jboss.identity.idm.p3p.P3PConstants;
+import org.jboss.identity.idm.common.p3p.P3PConstants;
import java.util.Collection;
import java.util.Map;
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -40,7 +40,7 @@
import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Test;
import org.hibernate.Session;
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-09 21:28:54 UTC (rev 488)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-10 19:15:26 UTC (rev 489)
@@ -39,7 +39,7 @@
import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Test;
15 years, 8 months
JBoss Identity SVN: r488 - in idm/trunk: idm-core/src/main/java/org/jboss/identity/idm/impl/api/query and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 17:28:54 -0400 (Sat, 09 May 2009)
New Revision: 488
Modified:
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/jboss5/src/main/resources/assembly.xml
Log:
cascade search impl for findAssociatedUsers and findAssociatedGroups
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -25,10 +25,24 @@
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.api.UnsupportedCriterium;
+import org.jboss.identity.idm.api.IdentityType;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+import org.jboss.identity.idm.impl.helper.Tools;
import java.util.Map;
import java.util.HashMap;
+import java.util.List;
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -239,4 +253,247 @@
result = 31 * result + (filter != null ? filter.hashCode() : 0);
return result;
}
+
+
+ // Static helper methods:
+
+
+
+ public static <T extends IdentityType> List<T> applyCriteria(IdentitySession identitySession,
+ IdentityObjectSearchCriteria criteria,
+ List<T> types) throws Exception
+ {
+
+
+ // First pass - filters
+
+ if(criteria.isFiltered())
+ {
+ if (criteria.getFilter() != null)
+ {
+ filterByIdFilter(types, criteria.getFilter());
+ }
+
+ if (criteria.getValues() != null && criteria.getValues().size() > 0)
+ {
+ filterByAttributesValues(identitySession, types, criteria.getValues());
+ }
+
+ }
+
+ // Second pass - sort
+
+ if (criteria.isSorted())
+ {
+ if (criteria.getSortAttributeName() != null)
+ {
+ sortByAttributeName(identitySession, types, criteria.getSortAttributeName(), criteria.isAscending());
+ }
+ else
+ {
+ sortByName(types, criteria.isAscending());
+ }
+ }
+
+ List<T> results = types;
+
+ // Third pass - cut the page
+
+ if (criteria.isPaged())
+ {
+ results = cutPageFromResults(results, criteria);
+ }
+
+ return results;
+ }
+
+ //TODO: quick impl. should be reviewed
+ private static void filterByAttributesValues(IdentitySession identitySession,
+ Collection<? extends IdentityType> types,
+ Map<String, String[]> attrs) throws Exception
+ {
+ Set<IdentityType> toRemove = new HashSet<IdentityType>();
+
+ for (IdentityType type : types)
+ {
+ //TODO: AttributeManager should have .getAttributes(type, names) to improve and not obtain everything
+ Map<String, Attribute> presentAttrs = identitySession.getAttributesManager().getAttributes(type);
+
+ for (Map.Entry<String, String[]> entry : attrs.entrySet())
+ {
+ if (presentAttrs.containsKey(entry.getKey()))
+ {
+ Set<String> given = new HashSet<String>(Arrays.asList(entry.getValue()));
+ Attribute attr = presentAttrs.get(entry.getKey());
+
+ Collection present = null;
+
+ if (attr != null)
+ {
+ present = attr.getValues();
+ }
+ else
+ {
+ present = Collections.emptySet();
+ }
+
+ for (String s : given)
+ {
+ if (!present.contains(s))
+ {
+ toRemove.add(type);
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ toRemove.add(type);
+ break;
+
+ }
+ }
+ }
+
+ for (IdentityType type : toRemove)
+ {
+ types.remove(type);
+ }
+
+ }
+
+ //TODO: quick impl. should be reviewed
+ private static void filterByIdFilter(List<? extends IdentityType> types, String filter) throws Exception
+ {
+ Set<IdentityType> toRemove = new HashSet<IdentityType>();
+
+ String regex = Tools.wildcardToRegex(filter);
+
+
+ for (IdentityType type : types)
+ {
+ String id = null;
+
+ if (type instanceof User)
+ {
+ id = type.getId();
+ }
+ else if (type instanceof Group)
+ {
+ id = ((Group)type).getName();
+ }
+ else
+ {
+ // shouldn't happen
+ throw new IllegalStateException();
+ }
+
+ if (!id.matches(regex))
+ {
+ toRemove.add(type);
+ }
+ }
+
+ for (IdentityType type : toRemove)
+ {
+ types.remove(type);
+ }
+
+ }
+
+ private static <T extends IdentityType> void sortByName(List<T> objects, final boolean ascending)
+ {
+ Collections.sort(objects, new Comparator<T>(){
+ public int compare(T o1, T o2)
+ {
+ if (o1 instanceof User && o2 instanceof User)
+ {
+ if (ascending)
+ {
+ return o1.getId().compareTo(o2.getId());
+ }
+ else
+ {
+ return o2.getId().compareTo(o1.getId());
+ }
+ }
+ else
+ {
+ Group g1 = (Group)o1;
+ Group g2 = (Group)o2;
+
+ if (ascending)
+ {
+ return g1.getName().compareTo(g2.getName());
+ }
+ else
+ {
+ return g2.getName().compareTo(g1.getName());
+ }
+
+ }
+ }
+ });
+ }
+
+ private static <T extends IdentityType> void sortByAttributeName(IdentitySession identitySession,
+ List<T> objects,
+ String attributeName, final boolean ascending)
+ throws Exception
+ {
+
+ //TODO: Check if attribute has "text" type and delegate to name sort if not
+
+ // Pre fetch attributes
+ final Map<T, String> attributes = new HashMap<T, String>();
+
+ for (T object : objects)
+ {
+ Attribute attr = identitySession.getAttributesManager().getAttribute(object, attributeName);
+
+ if (attr != null && attr.getValue() != null)
+ {
+ attributes.put(object, attr.getValue().toString());
+ }
+ else
+ {
+ attributes.put(object, "");
+ }
+ }
+
+
+
+ Collections.sort(objects, new Comparator<T>(){
+ public int compare(T o1, T o2)
+ {
+ String a1 = attributes.get(o1);
+ String a2 = attributes.get(o2);
+
+ if (ascending)
+ {
+ return a1.compareTo(a2);
+ }
+ else
+ {
+ return a2.compareTo(a1);
+ }
+ }
+ });
+ }
+
+ //TODO: dummy and inefficient...
+ private static <T extends IdentityType> List<T> cutPageFromResults(List<T> objects,
+ IdentityObjectSearchCriteria criteria)
+ {
+ List<T> results = new LinkedList<T>();
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() + criteria.getMaxResults(); i++)
+ {
+ if (i < objects.size())
+ {
+ results.add(objects.get(i));
+ }
+ }
+ return results;
+ }
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryExecutor.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -84,51 +84,8 @@
}
- protected <T extends IdentityType> List<T> applyCriteria(IdentityObjectSearchCriteria criteria, List<T> types) throws Exception
- {
- // First pass - filters
- if(criteria.isFiltered())
- {
- if (criteria.getFilter() != null)
- {
- filterByIdFilter(types, criteria.getFilter());
- }
-
- if (criteria.getValues() != null && criteria.getValues().size() > 0)
- {
- filterByAttributesValues(types, criteria.getValues());
- }
-
- }
-
- // Second pass - sort
-
- if (criteria.isSorted())
- {
- if (criteria.getSortAttributeName() != null)
- {
- sortByAttributeName(types, criteria.getSortAttributeName(), criteria.isAscending());
- }
- else
- {
- sortByName(types, criteria.isAscending());
- }
- }
-
- List<T> results = types;
-
- // Third pass - cut the page
-
- if (criteria.isPaged())
- {
- results = cutPageFromResults(results, criteria);
- }
-
- return results;
- }
-
protected List<Role> applyCriteriaRoles(IdentityObjectSearchCriteria criteria, List<Role> roles)
{
//TODO: No criteria in RoleQueryBuilder for now...
@@ -136,188 +93,5 @@
return roles;
}
- //TODO: quick impl. should be reviewed
- private void filterByAttributesValues(Collection<? extends IdentityType> types, Map<String, String[]> attrs) throws Exception
- {
- Set<IdentityType> toRemove = new HashSet<IdentityType>();
-
- for (IdentityType type : types)
- {
- //TODO: AttributeManager should have .getAttributes(type, names) to improve and not obtain everything
- Map<String, Attribute> presentAttrs = identitySession.getAttributesManager().getAttributes(type);
-
- for (Map.Entry<String, String[]> entry : attrs.entrySet())
- {
- if (presentAttrs.containsKey(entry.getKey()))
- {
- Set<String> given = new HashSet<String>(Arrays.asList(entry.getValue()));
- Attribute attr = presentAttrs.get(entry.getKey());
-
- Collection present = null;
-
- if (attr != null)
- {
- present = attr.getValues();
- }
- else
- {
- present = Collections.emptySet();
- }
-
- for (String s : given)
- {
- if (!present.contains(s))
- {
- toRemove.add(type);
- break;
- }
- }
-
- }
- else
- {
- toRemove.add(type);
- break;
-
- }
- }
- }
-
- for (IdentityType type : toRemove)
- {
- types.remove(type);
- }
-
- }
-
- //TODO: quick impl. should be reviewed
- private void filterByIdFilter(List<? extends IdentityType> types, String filter) throws Exception
- {
- Set<IdentityType> toRemove = new HashSet<IdentityType>();
-
- String regex = Tools.wildcardToRegex(filter);
-
-
- for (IdentityType type : types)
- {
- String id = null;
-
- if (type instanceof User)
- {
- id = type.getId();
- }
- else if (type instanceof Group)
- {
- id = ((Group)type).getName();
- }
- else
- {
- // shouldn't happen
- throw new IllegalStateException();
- }
-
- if (!id.matches(regex))
- {
- toRemove.add(type);
- }
- }
-
- for (IdentityType type : toRemove)
- {
- types.remove(type);
- }
-
- }
-
- private <T extends IdentityType> void sortByName(List<T> objects, final boolean ascending)
- {
- Collections.sort(objects, new Comparator<T>(){
- public int compare(T o1, T o2)
- {
- if (o1 instanceof User && o2 instanceof User)
- {
- if (ascending)
- {
- return o1.getId().compareTo(o2.getId());
- }
- else
- {
- return o2.getId().compareTo(o1.getId());
- }
- }
- else
- {
- Group g1 = (Group)o1;
- Group g2 = (Group)o2;
-
- if (ascending)
- {
- return g1.getName().compareTo(g2.getName());
- }
- else
- {
- return g2.getName().compareTo(g1.getName());
- }
-
- }
- }
- });
- }
-
- private <T extends IdentityType> void sortByAttributeName(List<T> objects, String attributeName, final boolean ascending)
- throws Exception
- {
-
- //TODO: Check if attribute has "text" type and delegate to name sort if not
-
- // Pre fetch attributes
- final Map<T, String> attributes = new HashMap<T, String>();
-
- for (T object : objects)
- {
- Attribute attr = identitySession.getAttributesManager().getAttribute(object, attributeName);
-
- if (attr != null && attr.getValue() != null)
- {
- attributes.put(object, attr.getValue().toString());
- }
- else
- {
- attributes.put(object, "");
- }
- }
-
-
-
- Collections.sort(objects, new Comparator<T>(){
- public int compare(T o1, T o2)
- {
- String a1 = attributes.get(o1);
- String a2 = attributes.get(o2);
-
- if (ascending)
- {
- return a1.compareTo(a2);
- }
- else
- {
- return a2.compareTo(a1);
- }
- }
- });
- }
-
- //TODO: dummy and inefficient...
- private <T extends IdentityType> List<T> cutPageFromResults(List<T> objects, IdentityObjectSearchCriteria criteria)
- {
- List<T> results = new LinkedList<T>();
- for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() + criteria.getMaxResults(); i++)
- {
- if (i < objects.size())
- {
- results.add(objects.get(i));
- }
- }
- return results;
- }
+
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -27,6 +27,7 @@
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.query.QueryException;
import org.jboss.identity.idm.impl.NotYetImplementedException;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import java.util.Collection;
import java.util.List;
@@ -163,7 +164,7 @@
{
mainResults.add(uniqueResult);
- applyCriteria(q.searchCriteria, mainResults);
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, q.searchCriteria, mainResults);
return mainResults;
}
else if (q.groupId == null &&
@@ -318,7 +319,7 @@
}
}
- applyCriteria(q.searchCriteria, mainResults);
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, q.searchCriteria, mainResults);
}
catch (Exception e)
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryExecutorImpl.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -27,6 +27,7 @@
import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.query.QueryException;
import org.jboss.identity.idm.impl.NotYetImplementedException;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import java.util.Collection;
import java.util.List;
@@ -111,7 +112,7 @@
resultsRelatedGroups.size() == 0)
{
resultsMain.add(uniqueUser);
- resultsMain = applyCriteria(q.searchCriteria, resultsMain);
+ resultsMain = IdentitySearchCriteriaImpl.applyCriteria(identitySession, q.searchCriteria, resultsMain);
return resultsMain;
}
else if (q.userId == null &&
@@ -203,7 +204,7 @@
// As results were merged criteria need to be applied separately
if (resultsMain.size() > 0)
{
- resultsMain = applyCriteria(q.searchCriteria, resultsMain);
+ resultsMain = IdentitySearchCriteriaImpl.applyCriteria(identitySession, q.searchCriteria, resultsMain);
}
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -38,6 +38,7 @@
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
+import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import java.util.Collection;
import java.util.Iterator;
@@ -467,6 +468,28 @@
return true;
}
+ private Collection<Group> findAssociatedGroupsCascaded(Collection<Group> previous, Group group, String groupType, boolean parent, IdentitySearchCriteria criteria) throws IdentityException
+ {
+ Collection<Group> results = findAssociatedGroups(group, groupType, parent, false, criteria);
+
+ List<Group> newResults = new LinkedList<Group>();
+
+
+ // For each result make recursive call unless it is already in previous results
+ for (Group result : results)
+ {
+ if (!previous.contains(result))
+ {
+ newResults.add(result);
+ previous.add(result);
+ newResults.addAll(findAssociatedGroupsCascaded(previous, result, groupType, parent, criteria));
+ }
+ }
+
+ return newResults;
+
+ }
+
public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
@@ -477,17 +500,36 @@
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
- //TODO Handle cascade
+
+
if (cascade)
{
- throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
+ Set<Group> prev = new HashSet<Group>();
+ prev.add(group);
+ identities = (List<Group>)findAssociatedGroupsCascaded(prev, group, groupType, parent, criteria);
+
+ try
+ {
+ //TODO: don't perform when only one repository call was made
+ if (criteria != null)
+ {
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to apply criteria", e);
+ }
+
+ return identities;
}
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
- if (iot == null || io.getIdentityType().getName().equals(iot.getName()))
+ if ((iot == null && !io.getIdentityType().getName().equals(getUserObjectType().getName())) ||
+ (iot != null && io.getIdentityType().getName().equals(iot.getName())))
{
identities.add(createGroup(io));
}
@@ -599,10 +641,37 @@
List<User> identities = new LinkedList<User>();
- //TODO Handle cascade
if (cascade)
{
- throw new NotYetImplementedException("Support for 'cascade' argument is not yet implemented. Please use 'false' value for now");
+ // Do non cascaded call
+
+ identities.addAll(findAssociatedUsers(group, false, criteria));
+
+ // Find all associated groups (cascaded)
+ Collection<Group> groups = findAssociatedGroups(group, null, true, true, criteria);
+
+
+ for (Group asociatedGroup : groups)
+ {
+ identities.addAll(findAssociatedUsers(asociatedGroup, false, criteria));
+ }
+
+ try
+ {
+
+ //TODO: don't perform when only one repository call was made
+ if (criteria != null)
+ {
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to apply criteria", e);
+ }
+
+ return identities;
+
}
Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -109,6 +109,12 @@
}
@Test
+ public void testRelationshipManagerCascade() throws Exception
+ {
+ relationshipManagerTest.testCascade(getRealmName());
+ }
+
+ @Test
public void testRelationshipManagerMergedRoleAssociations() throws Exception
{
relationshipManagerTest.testMergedRoleAssociations(getRealmName());
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -106,6 +106,12 @@
}
@Test
+ public void testRelationshipManagerCascade() throws Exception
+ {
+ relationshipManagerTest.testCascade(getRealmName());
+ }
+
+ @Test
public void testRelationshipManagerMergedRoleAssociations() throws Exception
{
relationshipManagerTest.testMergedRoleAssociations(getRealmName());
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-09 21:28:54 UTC (rev 488)
@@ -29,6 +29,7 @@
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import java.util.Arrays;
+import java.util.Collection;
import junit.framework.Assert;
@@ -312,6 +313,73 @@
}
+ public void testCascade(String realmName) throws Exception
+ {
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+ User user5 = session.getPersistenceManager().createUser("user5");
+ User user6 = session.getPersistenceManager().createUser("user6");
+ User user7 = session.getPersistenceManager().createUser("user7");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION);
+ Group group4 = session.getPersistenceManager().createGroup("group4", ORGANIZATION);
+ Group group5 = session.getPersistenceManager().createGroup("group5", ORGANIZATION);
+
+
+ // Create looped associations
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+ session.getRelationshipManager().associateGroups(group2, group4);
+ session.getRelationshipManager().associateGroups(group2, group5);
+ session.getRelationshipManager().associateGroups(group3, group1);
+
+ // Assign users
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group2, user2);
+ session.getRelationshipManager().associateUser(group3, user3);
+ session.getRelationshipManager().associateUser(group5, user4);
+ session.getRelationshipManager().associateUser(group5, user5);
+
+
+ // Make sure that algorithm doesn't go in a loop
+ Collection<Group> results = session.getRelationshipManager().
+ findAssociatedGroups(group1, ORGANIZATION, true, true);
+
+ assertEquals(4, results.size());
+ assertFalse(results.contains(group1));
+ assertTrue(results.contains(group2));
+ assertTrue(results.contains(group3));
+ assertTrue(results.contains(group4));
+ assertTrue(results.contains(group5));
+
+
+ // And get all users associated in a tree
+ Collection<User> results2 = session.getRelationshipManager().
+ findAssociatedUsers(group1, true);
+
+ assertEquals(5, results2.size());
+ assertFalse(results2.contains(user6));
+ assertFalse(results2.contains(user7));
+ assertTrue(results2.contains(user1));
+ assertTrue(results2.contains(user2));
+ assertTrue(results2.contains(user3));
+ assertTrue(results2.contains(user4));
+ assertTrue(results2.contains(user5));
+
+ }
+
public void testMergedRoleAssociations(String realmName) throws Exception
{
IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/integration/jboss5/pom.xml 2009-05-09 21:28:54 UTC (rev 488)
@@ -24,10 +24,25 @@
<dependency>
<groupId>org.jboss.identity</groupId>
- <artifactId>idm</artifactId>
+ <artifactId>idm-core</artifactId>
<version>${version}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-cache</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>${jboss.version}</version>
Modified: idm/trunk/integration/jboss5/src/main/resources/assembly.xml
===================================================================
--- idm/trunk/integration/jboss5/src/main/resources/assembly.xml 2009-05-09 15:10:05 UTC (rev 487)
+++ idm/trunk/integration/jboss5/src/main/resources/assembly.xml 2009-05-09 21:28:54 UTC (rev 488)
@@ -22,7 +22,10 @@
<outputDirectory>/</outputDirectory>
<includes>
<include>org.jboss.identity.integration:idm-jboss5</include>
- <include>org.jboss.identity:idm</include>
+ <include>org.jboss.identity:idm-cache</include>
+ <include>org.jboss.identity:idm-ldap</include>
+ <include>org.jboss.identity:idm-hibernate</include>
+ <include>org.jboss.identity:idm-core</include>
<include>org.jboss.identity:idm-api</include>
<include>org.jboss.identity:idm-common</include>
<include>org.jboss.identity:idm-spi</include>
15 years, 8 months
JBoss Identity SVN: r487 - idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-05-09 11:10:05 -0400 (Sat, 09 May 2009)
New Revision: 487
Added:
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java
Log:
oups... missing commit
Added: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java (rev 0)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheProviderImpl.java 2009-05-09 15:10:05 UTC (rev 487)
@@ -0,0 +1,933 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.jboss.identity.idm.impl.cache;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Node;
+import org.jboss.identity.idm.spi.model.IdentityObject;
+import org.jboss.identity.idm.spi.model.IdentityObjectType;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.idm.spi.search.IdentityObjectSearchCriteria;
+import org.jboss.identity.idm.spi.cache.IdentityStoreCacheProvider;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.util.Set;
+import java.util.Map;
+import java.util.Collection;
+import java.io.InputStream;
+
+/**
+ * Helper class providing caching support for IdentityStore. Stores search methods results using hash from a set of used
+ * IdentityObjectSearchControl objects as a key. *
+ *
+ * TODO: update cache tree structure documentation to all used nodes/keys...
+ * Cache structure:
+ *
+ * CACHE_ROOT (real)
+ * |
+ * |-JBID_ROOT_NODE
+ * |
+ * |-OBJECT_TYPES_NODE
+ * | |
+ * | |-OBJECT_TYPES_IDS_NODE
+ * | | |
+ * | | |- (IdentityObjectType names)
+ * | | | key[NODE_OBJECT_KEY] -> IdentityObject
+ * | | |- ...
+ * | |
+ * | |-OBJECT_TYPES_NAMES_NODE
+ * | | |
+ * | | |- (IdentityObjectType names)
+ * | | | key[NODE_OBJECT_KEY] -> IdentityObject
+ * | | | key[NODE_ATTRIBUTES_KEY] -> Map<String, IdentityObjectAttribute>
+ * | | |- ...
+ * | |
+ * | |-OBJECT_TYPES_SEARCH_NODE
+ * | |
+ * | |
+ * | |- ...
+ * |
+ * |-RELATIONSHIPS_NODE
+ * |
+
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityStoreCacheProviderImpl implements IdentityStoreCacheProvider
+{
+ private static Logger log = Logger.getLogger(IdentityStoreCacheProvider.class.getName());
+
+ //Structure
+ public static final String JBID_ROOT_NODE = "/jboss_id_idm";
+
+ public static final String OBJECT_TYPES_NODE = JBID_ROOT_NODE + "/object_types";
+
+ public static final String OBJECT_TYPES_IDS_NODE = OBJECT_TYPES_NODE + "/by_ids";
+
+ public static final String OBJECT_TYPES_NAMES_NODE = OBJECT_TYPES_NODE + "/by_names";
+
+ public static final String OBJECT_TYPES_SEARCH_BY_TYPE_NODE = OBJECT_TYPES_NODE + "/search_by_type";
+
+ public static final String OBJECT_TYPES_SEARCH_NODE = OBJECT_TYPES_NODE + "/search";
+
+ // Don't populate children as resident nodes!
+ public static final String OBJECT_TYPES_COUNT_NODE = OBJECT_TYPES_NODE + "/count";
+
+ public static final String RELATIONSHIPS_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_types_names";
+
+ public static final String RELATIONSHIPS_SEARCH_SIMPLE_NODE = RELATIONSHIPS_SEARCH_NODE + "/simple";
+
+ public static final String RELATIONSHIPS_SEARCH_COMPLEX_NODE = RELATIONSHIPS_SEARCH_NODE + "/complex";
+
+ public static final String RELATIONSHIP_NAMES_SEARCH_NODE = JBID_ROOT_NODE + "/relationship_names_search";
+
+ public static final String RELATIONSHIP_NAMES_SEARCH_IO_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/identity_object";
+
+ public static final String RELATIONSHIP_NAMES_SEARCH_ALL_NODE = RELATIONSHIP_NAMES_SEARCH_NODE + "/all";
+
+ // Node keys
+
+ public static final String NODE_OBJECT_KEY = "object";
+
+ public static final String NODE_ATTRIBUTES_KEY = "attributes";
+
+ public static final String NODE_REL_NAME_KEY = "relationship_name";
+
+ public static final String NODE_REL_TYPE_KEY = "relationship_type";
+
+ public static final String NODE_REL_FROM_KEY = "relationship_from";
+
+ public static final String NODE_REL_TO_KEY = "relationship_to";
+
+ public static final String NODE_SEARCH_RESULTS_KEY = "search_results";
+
+
+ // FQNs
+
+ public static final Fqn FQN_OBJECT_TYPES = Fqn.fromString(OBJECT_TYPES_NODE);
+
+ public static final Fqn FQN_OBJECT_TYPES_NAMES = Fqn.fromString(OBJECT_TYPES_NAMES_NODE);
+
+ public static final Fqn FQN_OBJECT_TYPES_IDS = Fqn.fromString(OBJECT_TYPES_IDS_NODE);
+
+ public static final Fqn FQN_OBJECT_TYPES_SEARCH_BY_TYPE = Fqn.fromString(OBJECT_TYPES_SEARCH_BY_TYPE_NODE);
+
+ public static final Fqn FQN_OBJECT_TYPES_SEARCH = Fqn.fromString(OBJECT_TYPES_SEARCH_NODE);
+
+ public static final Fqn FQN_OBJECT_TYPES_COUNT = Fqn.fromString(OBJECT_TYPES_COUNT_NODE);
+
+ public static final Fqn FQN_RELATIONSHIPS = Fqn.fromString(RELATIONSHIPS_SEARCH_NODE);
+
+ public static final Fqn FQN_RELATIONSHIPS_COMPLEX = Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE);
+
+ public static final Fqn FQN_RELATIONSHIPS_SIMPLE = Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
+
+ protected final Cache cache;
+
+ public IdentityStoreCacheProviderImpl(InputStream cacheConfigInputStream)
+ {
+ CacheFactory factory = new DefaultCacheFactory();
+
+ this.cache = factory.createCache(cacheConfigInputStream);
+
+ this.cache.start();
+
+ }
+
+ private Fqn createIONameNodeFQN(String ioTypeName, String ioName)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, ioTypeName, ioName);
+ }
+
+ private Fqn createIONameNodeFQN(IdentityObject io)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_NAMES_NODE, io.getIdentityType().getName(), io.getName());
+ }
+
+ private Fqn createIOIdNodeFQN(IdentityObject io)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_IDS_NODE, io.getIdentityType().getName(), io.getId());
+ }
+
+ private Fqn createIOTypeCountNodeFQN(IdentityObjectType iot)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_COUNT_NODE, iot.getName());
+ }
+
+ private Fqn createIOTypeSearchNodeFQN(IdentityObjectType iot, Object searchId)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, iot.getName(), searchId);
+ }
+
+ private Fqn createIOSearchNodeFQN(IdentityObject io, IdentityObjectRelationshipType relationshipType, boolean parent, Object searchId)
+ {
+ return Fqn.fromElements(OBJECT_TYPES_SEARCH_NODE, io.getIdentityType().getName(), relationshipType == null ? "null" : relationshipType.getName(),
+ io.getName() + "_" + parent, searchId);
+ }
+
+ private Fqn createRelationshipNamesIdentityObjectSearchFqn(IdentityObject identityObject, Object searchId)
+ {
+ return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_IO_NODE, identityObject.getIdentityType() + "_" + identityObject.getName(),
+ searchId);
+ }
+
+ private Fqn createRelationshipNamesAllSearchFqn(Object searchId)
+ {
+ return Fqn.fromElements(RELATIONSHIP_NAMES_SEARCH_ALL_NODE, searchId);
+ }
+
+ private Fqn createRelationshipsSimpleSearchFqn(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType)
+ {
+ //TODO: fixme - null relationshipType
+ return Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromIdentity.getIdentityType().getName() + "_" + toIdentity.getName(),
+ toIdentity.getIdentityType().getName() + "_" + toIdentity.getName(), relationshipType == null ? "null" : relationshipType );
+ }
+
+ private Fqn createRelationshipsComplexSearchFqn(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ boolean named,
+ String name)
+ {
+ return Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, identity.getIdentityType().getName() + "_" + identity.getName(),
+ parent, relationshipType, named + "_" + name);
+ }
+
+ public static boolean isSchemaFqn(Fqn fqn)
+ {
+ if (fqn.equals(JBID_ROOT_NODE) ||
+ fqn.equals(OBJECT_TYPES_NODE) ||
+ fqn.equals(OBJECT_TYPES_IDS_NODE) ||
+ fqn.equals(OBJECT_TYPES_NAMES_NODE) ||
+ fqn.equals(RELATIONSHIPS_SEARCH_NODE))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isFqnObjectTypeChild(Fqn fqn)
+ {
+ return fqn.isChildOf(FQN_OBJECT_TYPES);
+ }
+
+ public static boolean isFqnObjectTypeIdsChild(Fqn fqn)
+ {
+ return fqn.isChildOf(FQN_OBJECT_TYPES_IDS);
+ }
+
+ public static boolean isFqnObjectTypeNamesChild(Fqn fqn)
+ {
+ return fqn.isChildOf(FQN_OBJECT_TYPES_NAMES);
+ }
+
+ public static boolean isFqnObjectTypeSearchChild(Fqn fqn)
+ {
+ return fqn.isChildOf(FQN_OBJECT_TYPES_SEARCH_BY_TYPE);
+ }
+
+ public static boolean isFqnRelationshipsChild(Fqn fqn)
+ {
+ return fqn.isChildOf(FQN_RELATIONSHIPS);
+ }
+
+
+ private void removeNodeChildren(String path)
+ {
+ Fqn fqn = Fqn.fromString(path);
+ Node node = getCache().getRoot().getChild(fqn);
+
+ if (node != null)
+ {
+ Set<Object> names = node.getChildrenNames();
+ for (Object name : names)
+ {
+ node.removeChild(name);
+ }
+ }
+ }
+
+ protected Logger getLog()
+ {
+ return log;
+ }
+
+ protected Cache getCache()
+ {
+ return cache;
+ }
+
+ public void initResidentNodes(Set<String> supportedIdentityObjectTypes,
+ Set<String> supportedRelationshipTypes)
+ {
+ getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheProviderImpl.JBID_ROOT_NODE)).setResident(true);
+ getCache().getRoot().addChild(Fqn.fromString(IdentityStoreCacheProviderImpl.OBJECT_TYPES_NODE)).setResident(true);
+ getCache().getRoot().addChild(FQN_OBJECT_TYPES_IDS).setResident(true);
+ getCache().getRoot().addChild(FQN_OBJECT_TYPES_NAMES).setResident(true);
+ getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH).setResident(true);
+ getCache().getRoot().addChild(FQN_OBJECT_TYPES_SEARCH_BY_TYPE).setResident(true);
+ getCache().getRoot().addChild(FQN_OBJECT_TYPES_COUNT).setResident(true);
+ getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_ALL_NODE)).setResident(true);
+ getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIP_NAMES_SEARCH_IO_NODE)).setResident(true);
+ getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_COMPLEX_NODE)).setResident(true);
+ getCache().getRoot().addChild(Fqn.fromString(RELATIONSHIPS_SEARCH_SIMPLE_NODE)).setResident(true);
+
+ for (String objectTypeName : supportedIdentityObjectTypes)
+ {
+ Fqn nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_NAMES, "/" + objectTypeName);
+ getCache().getRoot().addChild(nodeFqn).setResident(true);
+
+ nodeFqn = Fqn.fromRelativeElements(FQN_OBJECT_TYPES_IDS, "/" + objectTypeName);
+ getCache().getRoot().addChild(nodeFqn).setResident(true);
+ }
+ }
+
+ public void putIntoCache(IdentityObject io)
+ {
+ Fqn nodeFqn = createIONameNodeFQN(io);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ // in case this node was already present in cache
+ if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
+ {
+ ioNode.put(NODE_OBJECT_KEY, io);
+ }
+
+ nodeFqn = createIOIdNodeFQN(io);
+
+ ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ // in case this node was already present in cache
+ if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
+ {
+ ioNode.put(NODE_OBJECT_KEY, io);
+ }
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject stored in cache: " + io.getName() + "; " + io.getId());
+ }
+ }
+
+ public void putIntoCache(IdentityObject io, Map<String, IdentityObjectAttribute> attributesMap)
+ {
+ Fqn nodeFqn = createIONameNodeFQN(io);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ // in case this node was already present in cache
+ if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
+ {
+ ioNode.put(NODE_OBJECT_KEY, io);
+ }
+
+ if (!ioNode.getKeys().contains(NODE_ATTRIBUTES_KEY))
+ {
+ ioNode.put(NODE_ATTRIBUTES_KEY, attributesMap);
+ }
+
+ nodeFqn = createIOIdNodeFQN(io);
+
+ ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ // in case this node was already present in cache
+ if (!ioNode.getKeys().contains(NODE_OBJECT_KEY))
+ {
+ ioNode.put(NODE_OBJECT_KEY, io);
+ }
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject stored in cache with attributes map: " + io.getName() + "; " + io.getId()
+ + "; type=" + io.getIdentityType().getName() );
+ }
+ }
+
+ public void removeFromCache(IdentityObject io)
+ {
+ Fqn nodeFqn = createIONameNodeFQN(io);
+
+ getCache().getRoot().removeChild(nodeFqn);
+
+ nodeFqn = createIOIdNodeFQN(io);
+
+ getCache().getRoot().removeChild(nodeFqn);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject removed from cache: " + io.getName() + "; " + io.getId()
+ + "; type=" + io.getIdentityType().getName() );
+ }
+ }
+
+ public void removeAttributesFromCache(IdentityObject io)
+ {
+ Fqn nodeFqn = createIONameNodeFQN(io);
+
+ Node ioNode = getCache().getRoot().addChild(nodeFqn);
+
+ ioNode.remove(NODE_ATTRIBUTES_KEY);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject attributes removed from cache: name=" + io.getName() + "; id=" + io.getId()
+ + "; type=" + io.getIdentityType().getName() );
+ }
+ }
+
+ public IdentityObject getFromCache(String name, IdentityObjectType identityObjectType)
+ {
+ Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
+
+ Node ioNode = getCache().getRoot().getChild(nodeFqn);
+
+ if (ioNode != null)
+ {
+ IdentityObject io = (IdentityObject)ioNode.get(NODE_OBJECT_KEY);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject found in cache: name=" + io.getName() + "; id=" + io.getId());
+ }
+
+ return io;
+ }
+
+ return null;
+
+ }
+
+ public Map<String, IdentityObjectAttribute> getAttributesFromCache(String name, IdentityObjectType identityObjectType)
+ {
+ Fqn nodeFqn = Fqn.fromElements(OBJECT_TYPES_NODE, identityObjectType.getName(), name);
+
+ Node ioNode = getCache().getRoot().getChild(nodeFqn);
+
+ if (ioNode != null)
+ {
+ Map<String, IdentityObjectAttribute> attrs = (Map<String, IdentityObjectAttribute>)ioNode.get(NODE_ATTRIBUTES_KEY);
+
+ if (attrs != null)
+ {
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject attributes found in cache: name=" + name + "; type=" + identityObjectType.getName());
+ }
+ }
+ return attrs;
+ }
+
+ return null;
+
+ }
+
+ public IdentityObject getFromCache(String id)
+ {
+ Node idsNode = getCache().getRoot().getChild(OBJECT_TYPES_IDS_NODE);
+
+ for (Node typeNode : (Set<Node>)idsNode.getChildren())
+ {
+ for (Object name : typeNode.getChildrenNames())
+ {
+ if (name.toString().equals(id))
+ {
+ IdentityObject io = (IdentityObject)typeNode.getChild(name).get(NODE_OBJECT_KEY);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject found in cache: name" + io.getName() + "; type" + io.getIdentityType().getName());
+ }
+
+ return io;
+ }
+ }
+ }
+
+ return null;
+
+ }
+
+ public void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
+ IdentityObjectSearchCriteria criteria,
+ Collection<IdentityObject> results)
+ {
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
+
+ Node searchNode = getCache().getRoot().addChild(nodeFqn);
+
+ searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject search results stored in cache: type" + identityType.getName());
+ }
+ }
+
+ public Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObjectType identityType,
+ IdentityObjectSearchCriteria criteria)
+ {
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
+
+ Node searchNode = getCache().getRoot().getChild(nodeFqn);
+
+ Collection<IdentityObject> results = null;
+
+ if (searchNode != null)
+ {
+
+
+ results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject search results found in cache: type" + identityType.getName());
+ }
+ }
+
+ return results;
+
+ }
+
+ public void putIdentityObjectSearchToCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ IdentityObjectSearchCriteria criteria,
+ Collection<IdentityObject> results)
+ {
+
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
+
+ Node searchNode = getCache().getRoot().addChild(nodeFqn);
+
+ searchNode.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject search results stored in cache: IdentityObject name= " + identity.getName()
+ + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
+ "; parent= " + parent);
+ }
+
+ }
+
+ public Collection<IdentityObject> getIdentityObjectSearchFromCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ IdentityObjectSearchCriteria criteria)
+ {
+
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent, getControlsHash(criteria));
+
+ Node searchNode = getCache().getRoot().getChild(nodeFqn);
+
+ Collection<IdentityObject> results = null;
+
+ if (searchNode != null)
+ {
+ results = (Collection<IdentityObject>)searchNode.get(NODE_SEARCH_RESULTS_KEY);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject search results found in cache: IdentityObject name= " + identity.getName()
+ + "; IdentityObject type= " + identity.getIdentityType().getName() + "; IdentityObjectRelationshipType= " + relationshipType +
+ "; parent= " + parent);
+ }
+ }
+
+ return results;
+
+ }
+
+ public void putRelationshipsSearchIntoCache(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ Set<IdentityObjectRelationship> results)
+ {
+
+ Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: fromIdentity" +
+ fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
+ "; relationshipType=" + relationshipType.getName() ) ;
+ }
+
+ }
+
+
+
+ public Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType)
+ {
+ Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
+ Node node = getCache().getRoot().getChild(fqn);
+
+ if (node != null)
+ {
+ if (node.getKeys().contains(NODE_SEARCH_RESULTS_KEY) && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: fromIdentity" +
+ fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
+ "; relationshipType=" + relationshipType.getName() ) ;
+ }
+
+ return (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
+ }
+ return null;
+ }
+
+ public void putRelationshipSearchIntoCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ boolean named,
+ String name,
+ Set<IdentityObjectRelationship> results)
+ {
+ Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search stored in cache: " +
+ "identity" + identity.toString() +
+ "; relationshipType=" + relationshipType.getName() +
+ "; parent=" + parent +
+ "; named=" + named +
+ "; name=" + name) ;
+ }
+
+ }
+
+
+
+ public Set<IdentityObjectRelationship> getRelationshipsSearchFromCache(IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ boolean named,
+ String name)
+ {
+ Fqn fqn = createRelationshipsComplexSearchFqn(identity, relationshipType, parent, named, name);
+ Node node = getCache().getRoot().getChild(fqn);
+
+ Set<IdentityObjectRelationship> results = null;
+
+ if (node != null)
+ {
+ results = (Set<IdentityObjectRelationship>)node.get(NODE_SEARCH_RESULTS_KEY);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search found in cache: " +
+ "identity" + identity.toString() +
+ "; relationshipType=" + relationshipType.getName() +
+ "; parent=" + parent +
+ "; named=" + named +
+ "; name=" + name) ;
+ }
+ }
+ return results;
+
+ }
+
+ public void invalidateCachedIdentityObjectSearches(IdentityObject io)
+ {
+
+ Fqn fqn = Fqn.fromElements(OBJECT_TYPES_SEARCH_BY_TYPE_NODE, io.getIdentityType().getName());
+ getCache().getRoot().removeChild(fqn);
+
+ // It can be in any result in the type searches
+ removeNodeChildren(OBJECT_TYPES_SEARCH_NODE);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObject searches invalidated in cache: identityObject=" + io.toString());
+ }
+ }
+
+ public void putIdentityObjectCountIntoCache(IdentityObjectType identityType, int count)
+ {
+ Fqn fqn = createIOTypeCountNodeFQN(identityType);
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.put(NODE_OBJECT_KEY, count);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectType count search strored in cache: " +
+ "identityObjectType=" + identityType.getName() +
+ "; count=" + count);
+ }
+
+ }
+
+ public int getIdentityObjectCountFromCache(IdentityObjectType identityType)
+ {
+ Fqn fqn = createIOTypeCountNodeFQN(identityType);
+ Node node = getCache().getRoot().getChild(fqn);
+
+
+ if (node != null && node.getKeys().contains(NODE_OBJECT_KEY))
+ {
+ int count = (Integer)(node.get(NODE_OBJECT_KEY));
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectType count search result found in cache: " +
+ "identityObjectType=" + identityType.getName() +
+ "; count=" + count);
+ }
+
+ return count;
+
+ }
+ // -1 means nothing in cache
+ return -1;
+ }
+
+
+ public void invalidateCachedIdentityObjectCount(IdentityObjectType identityType)
+ {
+ Fqn fqn = createIOTypeCountNodeFQN(identityType);
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.remove(NODE_OBJECT_KEY);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectType count search result invalidated in cache: " +
+ "identityObjectType=" + identityType.getName());
+ }
+ }
+
+ public void invalidateCachedRelationshipSearches(IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ String relationshipName)
+ {
+ String fromName = fromIdentity.getIdentityType().getName() + "_" + fromIdentity.getName();
+ String toName = toIdentity.getIdentityType().getName() + "_" + toIdentity.getName();
+
+ // Simple
+
+// Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, fromName, toName, relationshipType.getName());
+// getCache().getRoot().removeChild(fqn);
+
+ Fqn fqn = createRelationshipsSimpleSearchFqn(fromIdentity, toIdentity, relationshipType);
+ getCache().getRoot().removeChild(fqn);
+
+ // Complex
+
+ String relNameElement;
+ if (relationshipName != null)
+ {
+ relNameElement = true + relationshipName;
+ }
+ else
+ {
+ relNameElement = false + relationshipName;
+ }
+
+
+ fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, fromName, true, relationshipType.getName(), relNameElement);
+ getCache().getRoot().removeChild(fqn);
+ fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, toName, false, relationshipType.getName(), relNameElement);
+ getCache().getRoot().removeChild(fqn);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache: fromIdentity" +
+ fromIdentity.toString() + "; toIdentity=" + toIdentity.toString() +
+ "; relationshipType=" + relationshipType.getName() ) ;
+ }
+
+ }
+
+ public void invalidateCachedRelationshipSearches(IdentityObject identity1, IdentityObject identity2, boolean named)
+ {
+
+ String name1 = identity1.getIdentityType().getName() + "_" + identity1.getName();
+ String name2 = identity2.getIdentityType().getName() + "_" + identity2.getName();
+
+
+ // Complex search
+
+ Fqn fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name1);
+ getCache().getRoot().removeChild(fqn);
+ fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_COMPLEX_NODE, name2);
+ getCache().getRoot().removeChild(fqn);
+
+ // Simple search
+
+ getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name1));
+ getCache().getRoot().removeChild(Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE, name2));
+
+ fqn = Fqn.fromElements(RELATIONSHIPS_SEARCH_SIMPLE_NODE);
+ Set<String> names = getCache().getRoot().getChildrenNames();
+
+ for (String childName : names)
+ {
+ //
+ getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name1));
+ getCache().getRoot().removeChild(Fqn.fromElements(fqn, childName, name2));
+ }
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationship search result invalidated in cache for: identity1" +
+ identity1.toString() + "; identity2=" + identity2.toString() +
+ "; named=" + named ) ;
+ }
+
+ }
+
+ public void invalidateRelationshipNameSearches(String name)
+ {
+ //TODO: at the moment it just trash up all relationships searches
+
+ removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_ALL_NODE);
+ removeNodeChildren(RELATIONSHIP_NAMES_SEARCH_IO_NODE);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: name" +
+ name ) ;
+ }
+ }
+
+
+
+ public void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria criteria, Set<String> results)
+ {
+
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
+
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search results invalidated in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
+ }
+
+ }
+
+ public Set<String> getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria)
+ {
+
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
+
+ Node node = getCache().getRoot().getChild(fqn);
+
+ if (node != null)
+ {
+ Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
+ }
+
+ return results;
+ }
+
+
+ return null;
+ }
+
+ public void putRelationshipNamesSearchIntoCache(IdentityObject identity,
+ IdentityObjectSearchCriteria criteria,
+ Set<String> results)
+ {
+
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
+
+ Node node = getCache().getRoot().addChild(fqn);
+
+ node.put(NODE_SEARCH_RESULTS_KEY, results);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search result stored in cache: " +
+ "criteria hash=" + getControlsHash(criteria) +
+ "identity=" + identity.toString()) ;
+ }
+
+ }
+
+ public Set<String> getRelationshipNamesSearchFromCache(IdentityObject identity, IdentityObjectSearchCriteria criteria)
+ {
+
+
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity, getControlsHash(criteria));
+
+ Node node = getCache().getRoot().getChild(fqn);
+
+ if (node != null)
+ {
+ Set<String> results = (Set<String>)node.get(NODE_SEARCH_RESULTS_KEY);
+
+ if (results != null && getLog().isLoggable(Level.FINER))
+ {
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search result found in cache: " +
+ "criteria hash=" + getControlsHash(criteria) +
+ "identity=" + identity.toString()) ;
+ }
+
+ return results;
+ }
+ return null;
+ }
+
+ private int getControlsHash(IdentityObjectSearchCriteria criteria)
+ {
+ // Convert criteria to Set to have the same hashcode regardles order of criteria
+ int hashcode = 0;
+
+ if (criteria != null)
+ {
+ hashcode = criteria.hashCode();
+ }
+
+ return hashcode;
+ }
+}
15 years, 8 months