gatein SVN: r783 - in components/mop/trunk: core/src/main/java/org/gatein/mop/core/api/workspace and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-24 07:44:44 -0500 (Tue, 24 Nov 2009)
New Revision: 783
Modified:
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java
components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java
Log:
- make API avoid to return Collection type with extends (<? extends Foo>) as it makes API not flexible (like child reordering)
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2009-11-24 11:49:59 UTC (rev 782)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Navigation.java 2009-11-24 12:44:44 UTC (rev 783)
@@ -67,7 +67,7 @@
*
* @return the child navigations
*/
- List<? extends Navigation> getChildren();
+ List<Navigation> getChildren();
/**
* Returns a specified navigation.
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java 2009-11-24 11:49:59 UTC (rev 782)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Page.java 2009-11-24 12:44:44 UTC (rev 783)
@@ -75,7 +75,7 @@
*
* @return the children
*/
- Collection<? extends Page> getChildren();
+ Collection<Page> getChildren();
/**
* Returns a named child or null if it does not exist.
Modified: components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java
===================================================================
--- components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java 2009-11-24 11:49:59 UTC (rev 782)
+++ components/mop/trunk/api/src/main/java/org/gatein/mop/api/workspace/Site.java 2009-11-24 12:44:44 UTC (rev 783)
@@ -62,7 +62,9 @@
*/
Workspace getWorkspace();
- /** Destroy the site. */
+ /**
+ * Destroy the site.
+ */
void destroy();
}
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2009-11-24 11:49:59 UTC (rev 782)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/NavigationImpl.java 2009-11-24 12:44:44 UTC (rev 783)
@@ -106,10 +106,13 @@
}
}
- public List<? extends Navigation> getChildren()
+ public List<Navigation> getChildren()
{
NavigationContainer childrenContainer = getChildrenContainer();
- return childrenContainer.getNavigationList();
+
+ // Yeah a bit ugly but navigation list should support type safety itself
+ // (i.e only accept object of type NavigationImpl
+ return (List)childrenContainer.getNavigationList();
}
public Navigation getChild(String name)
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java 2009-11-24 11:49:59 UTC (rev 782)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageImpl.java 2009-11-24 12:44:44 UTC (rev 783)
@@ -219,10 +219,10 @@
return childrenContainer.addPage(name);
}
- public Collection<? extends Page> getChildren()
+ public Collection<Page> getChildren()
{
PageContainer childrenContainer = getChildrenContainer();
- return childrenContainer.getPages().values();
+ return (Collection)childrenContainer.getPages().values();
}
public PageImpl getChild(String name)
15 years, 1 month
gatein SVN: r782 - in portal/branches/wsrp-integration/component/wsrp: src/main/java/org/gatein/portal/wsrp/state/producer/configuration and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-11-24 06:49:59 -0500 (Tue, 24 Nov 2009)
New Revision: 782
Modified:
portal/branches/wsrp-integration/component/wsrp/pom.xml
portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/JCRProducerConfigurationService.java
Log:
- Add the APT module of Chromattic so that annotations are processed.
- Initialize persister in JCRProducerConfigurationService (NPE otherwise!).
Modified: portal/branches/wsrp-integration/component/wsrp/pom.xml
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/pom.xml 2009-11-24 11:22:31 UTC (rev 781)
+++ portal/branches/wsrp-integration/component/wsrp/pom.xml 2009-11-24 11:49:59 UTC (rev 782)
@@ -104,6 +104,14 @@
<scope>provided</scope>
</dependency>
+ <!-- Required to process Chromattic annotations -->
+ <dependency>
+ <groupId>org.chromattic</groupId>
+ <artifactId>chromattic.apt</artifactId>
+ <version>${version.chromattic}</version>
+ <scope>provided</scope>
+ </dependency>
+
<!-- tests -->
<dependency>
<groupId>org.chromattic</groupId>
Modified: portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/JCRProducerConfigurationService.java
===================================================================
--- portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/JCRProducerConfigurationService.java 2009-11-24 11:22:31 UTC (rev 781)
+++ portal/branches/wsrp-integration/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/producer/configuration/JCRProducerConfigurationService.java 2009-11-24 11:49:59 UTC (rev 782)
@@ -42,7 +42,7 @@
*/
public class JCRProducerConfigurationService extends AbstractProducerConfigurationService
{
- private JCRPersister persister;
+ private JCRPersister persister = new JCRPersister();
private static String PRODUCER_CONFIGURATION_PATH = JCRPersister.WSRP_SERVICES_PATH + "producerconfiguration";
private InputStream defaultConfigurationIS;
15 years, 1 month
gatein SVN: r781 - components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 06:22:31 -0500 (Tue, 24 Nov 2009)
New Revision: 781
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
Log:
prepare for next development iteration
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-24 09:40:56 UTC (rev 780)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2009-11-24 11:22:31 UTC (rev 781)
@@ -36,7 +36,7 @@
*/
public interface PortalContext
{
- public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 0, new Version.Qualifier(Version.Qualifier.Prefix.CR, Version.Qualifier.Suffix.SUFFIX_1), "Community");
+ public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 0, new Version.Qualifier(Version.Qualifier.Prefix.CR, Version.Qualifier.Suffix.SUFFIX_2), "Community");
/**
* Return info about the portal. Must conform to javax.portlet.PortalContext.getPortalInfo().
15 years, 1 month
gatein SVN: r780 - in components/pc/trunk: api and 12 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 04:40:56 -0500 (Tue, 24 Nov 2009)
New Revision: 780
Modified:
components/pc/trunk/api/pom.xml
components/pc/trunk/bridge/pom.xml
components/pc/trunk/controller/pom.xml
components/pc/trunk/docs/pom.xml
components/pc/trunk/docs/user-guide/pom.xml
components/pc/trunk/federation/pom.xml
components/pc/trunk/jsr168api/pom.xml
components/pc/trunk/management/pom.xml
components/pc/trunk/mc/pom.xml
components/pc/trunk/pom.xml
components/pc/trunk/portal/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/samples/pom.xml
components/pc/trunk/test/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: components/pc/trunk/api/pom.xml
===================================================================
--- components/pc/trunk/api/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/api/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.pc</groupId>
Modified: components/pc/trunk/bridge/pom.xml
===================================================================
--- components/pc/trunk/bridge/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/bridge/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-bridge</artifactId>
Modified: components/pc/trunk/controller/pom.xml
===================================================================
--- components/pc/trunk/controller/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/controller/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: components/pc/trunk/docs/pom.xml
===================================================================
--- components/pc/trunk/docs/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/docs/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: components/pc/trunk/docs/user-guide/pom.xml
===================================================================
--- components/pc/trunk/docs/user-guide/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/docs/user-guide/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -9,7 +9,7 @@
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
<packaging>jdocbook</packaging>
<name>GateIn - Portlet Container (User Guide ${translation})</name>
@@ -64,10 +64,4 @@
</releases>
</pluginRepository>
</pluginRepositories>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/tools/maven/doc-parent/tags...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/tools/maven/doc-parent/tags/2....</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/tools/maven/doc-parent/tags/2.1.0-...</url>
- </scm>
</project>
Modified: components/pc/trunk/federation/pom.xml
===================================================================
--- components/pc/trunk/federation/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/federation/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-federation</artifactId>
Modified: components/pc/trunk/jsr168api/pom.xml
===================================================================
--- components/pc/trunk/jsr168api/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/jsr168api/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-jsr168api</artifactId>
Modified: components/pc/trunk/management/pom.xml
===================================================================
--- components/pc/trunk/management/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/management/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-management</artifactId>
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/mc/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: components/pc/trunk/pom.xml
===================================================================
--- components/pc/trunk/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -6,7 +6,7 @@
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
@@ -16,9 +16,9 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/tags/2.1.0-CR01</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/tags/2.1.0-CR01</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/pc/tags/2.1.0-CR01</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/trunk/</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/pc/trunk/</url>
</scm>
<properties>
Modified: components/pc/trunk/portal/pom.xml
===================================================================
--- components/pc/trunk/portal/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/portal/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/portlet/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified: components/pc/trunk/samples/pom.xml
===================================================================
--- components/pc/trunk/samples/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/samples/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-samples</artifactId>
Modified: components/pc/trunk/test/pom.xml
===================================================================
--- components/pc/trunk/test/pom.xml 2009-11-24 09:40:27 UTC (rev 779)
+++ components/pc/trunk/test/pom.xml 2009-11-24 09:40:56 UTC (rev 780)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01</version>
+ <version>2.1.0-CR02-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test</artifactId>
15 years, 1 month
gatein SVN: r779 - components/pc/tags.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 04:40:27 -0500 (Tue, 24 Nov 2009)
New Revision: 779
Added:
components/pc/tags/2.1.0-CR01/
Log:
[maven-scm] copy for tag 2.1.0-CR01
Copied: components/pc/tags/2.1.0-CR01 (from rev 778, components/pc/trunk)
15 years, 1 month
gatein SVN: r778 - in components/pc/trunk: api and 12 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 04:40:00 -0500 (Tue, 24 Nov 2009)
New Revision: 778
Modified:
components/pc/trunk/api/pom.xml
components/pc/trunk/bridge/pom.xml
components/pc/trunk/controller/pom.xml
components/pc/trunk/docs/pom.xml
components/pc/trunk/docs/user-guide/pom.xml
components/pc/trunk/federation/pom.xml
components/pc/trunk/jsr168api/pom.xml
components/pc/trunk/management/pom.xml
components/pc/trunk/mc/pom.xml
components/pc/trunk/pom.xml
components/pc/trunk/portal/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/samples/pom.xml
components/pc/trunk/test/pom.xml
Log:
[maven-release-plugin] prepare release 2.1.0-CR01
Modified: components/pc/trunk/api/pom.xml
===================================================================
--- components/pc/trunk/api/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/api/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.gatein.pc</groupId>
Modified: components/pc/trunk/bridge/pom.xml
===================================================================
--- components/pc/trunk/bridge/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/bridge/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-bridge</artifactId>
Modified: components/pc/trunk/controller/pom.xml
===================================================================
--- components/pc/trunk/controller/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/controller/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-controller</artifactId>
Modified: components/pc/trunk/docs/pom.xml
===================================================================
--- components/pc/trunk/docs/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/docs/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<artifactId>docs-aggregator</artifactId>
<packaging>pom</packaging>
Modified: components/pc/trunk/docs/user-guide/pom.xml
===================================================================
--- components/pc/trunk/docs/user-guide/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/docs/user-guide/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -9,7 +9,7 @@
</parent>
<groupId>org.gatein.pc</groupId>
<artifactId>user-guide-${translation}</artifactId>
- <version>2.1.0-CR1-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
<packaging>jdocbook</packaging>
<name>GateIn - Portlet Container (User Guide ${translation})</name>
@@ -64,4 +64,10 @@
</releases>
</pluginRepository>
</pluginRepositories>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/tools/maven/doc-parent/tags...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/tools/maven/doc-parent/tags/2....</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/tools/maven/doc-parent/tags/2.1.0-...</url>
+ </scm>
</project>
Modified: components/pc/trunk/federation/pom.xml
===================================================================
--- components/pc/trunk/federation/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/federation/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-federation</artifactId>
Modified: components/pc/trunk/jsr168api/pom.xml
===================================================================
--- components/pc/trunk/jsr168api/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/jsr168api/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-jsr168api</artifactId>
Modified: components/pc/trunk/management/pom.xml
===================================================================
--- components/pc/trunk/management/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/management/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-management</artifactId>
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/mc/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-mc</artifactId>
Modified: components/pc/trunk/pom.xml
===================================================================
--- components/pc/trunk/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -6,7 +6,7 @@
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
<packaging>pom</packaging>
<parent>
@@ -16,9 +16,9 @@
</parent>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/trunk/</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/trunk/</developerConnection>
- <url>http://fisheye.jboss.org/browse/gatein/components/pc/trunk/</url>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/gatein/components/pc/tags/2.1.0-CR01</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/gatein/components/pc/tags/2.1.0-CR01</developerConnection>
+ <url>http://fisheye.jboss.org/browse/gatein/components/pc/tags/2.1.0-CR01</url>
</scm>
<properties>
Modified: components/pc/trunk/portal/pom.xml
===================================================================
--- components/pc/trunk/portal/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/portal/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portal</artifactId>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/portlet/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-portlet</artifactId>
Modified: components/pc/trunk/samples/pom.xml
===================================================================
--- components/pc/trunk/samples/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/samples/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-samples</artifactId>
Modified: components/pc/trunk/test/pom.xml
===================================================================
--- components/pc/trunk/test/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
+++ components/pc/trunk/test/pom.xml 2009-11-24 09:40:00 UTC (rev 778)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-parent</artifactId>
- <version>2.1.0-CR01-SNAPSHOT</version>
+ <version>2.1.0-CR01</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pc-test</artifactId>
15 years, 1 month
gatein SVN: r777 - in components/pc/trunk: bridge and 6 other directories.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 03:37:03 -0500 (Tue, 24 Nov 2009)
New Revision: 777
Modified:
components/pc/trunk/bridge/pom.xml
components/pc/trunk/controller/pom.xml
components/pc/trunk/federation/pom.xml
components/pc/trunk/mc/pom.xml
components/pc/trunk/pom.xml
components/pc/trunk/portlet/pom.xml
components/pc/trunk/test/pom.xml
components/pc/trunk/test/src/test/build.xml
Log:
Upgrade to Common 2.0.0-CR02 WCI 2.0.0-CR01 Dep 1.0.0-Beta03
Modified: components/pc/trunk/bridge/pom.xml
===================================================================
--- components/pc/trunk/bridge/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/bridge/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -18,6 +18,10 @@
<groupId>org.apache.portals.bridges</groupId>
<artifactId>portals-bridges-common</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-common</artifactId>
+ <version>${version.apache.portals.bridges}</version>
+ </dependency>
</dependencies>
-
</project>
Modified: components/pc/trunk/controller/pom.xml
===================================================================
--- components/pc/trunk/controller/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/controller/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -35,6 +35,12 @@
<!--TEST SCOPE-->
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>apache-xerces</groupId>
<artifactId>resolver</artifactId>
</dependency>
Modified: components/pc/trunk/federation/pom.xml
===================================================================
--- components/pc/trunk/federation/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/federation/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -15,7 +15,6 @@
<artifactId>pc-portlet</artifactId>
</dependency>
-
<!--TEST SCOPE-->
<dependency>
<groupId>org.jboss.unit</groupId>
@@ -28,6 +27,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
<plugins>
Modified: components/pc/trunk/mc/pom.xml
===================================================================
--- components/pc/trunk/mc/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/mc/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -23,6 +23,13 @@
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
Modified: components/pc/trunk/pom.xml
===================================================================
--- components/pc/trunk/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -22,9 +22,11 @@
</scm>
<properties>
- <version.gatein.common>2.0.0-Beta03</version.gatein.common>
- <version.gatein.wci>2.0.0-Beta02</version.gatein.wci>
-
+ <version.gatein.common>2.0.0-CR02</version.gatein.common>
+ <version.gatein.wci>2.0.0-CR01</version.gatein.wci>
+ <version.apache.portals.bridges>1.0.4</version.apache.portals.bridges>
+ <version.apache.taglibs>1.1.2</version.apache.taglibs>
+
<!-- used in test module by maven-antrun-extended-plugin -->
<version.jboss.unit>1.2.3</version.jboss.unit>
<version.cargo>1.0.1-alpha-1</version.cargo>
@@ -36,11 +38,11 @@
<dependency>
<groupId>org.gatein</groupId>
<artifactId>gatein-dep</artifactId>
- <version>1.0.0-Beta02</version>
+ <version>1.0.0-Beta03</version>
<type>pom</type>
<scope>import</scope>
</dependency>
-
+
<!-- Internal dependencies -->
<dependency>
<groupId>org.gatein.common</groupId>
@@ -50,10 +52,16 @@
<dependency>
<groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ <version>${version.gatein.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.common</groupId>
<artifactId>common-mc</artifactId>
<version>${version.gatein.common}</version>
</dependency>
-
+
<dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-portlet</artifactId>
@@ -99,6 +107,18 @@
<artifactId>wci-tomcat</artifactId>
<version>${version.gatein.wci}</version>
</dependency>
+
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>jstl</artifactId>
+ <version>${version.apache.taglibs}</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-taglibs</groupId>
+ <artifactId>standard</artifactId>
+ <version>${version.apache.taglibs}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Modified: components/pc/trunk/portlet/pom.xml
===================================================================
--- components/pc/trunk/portlet/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/portlet/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -42,6 +42,13 @@
<artifactId>jboss-unit-remote</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
Modified: components/pc/trunk/test/pom.xml
===================================================================
--- components/pc/trunk/test/pom.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/test/pom.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -16,7 +16,13 @@
<artifactId>common-mc</artifactId>
</dependency>
+
<dependency>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-logging</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.gatein.wci</groupId>
<artifactId>wci-wci</artifactId>
</dependency>
@@ -89,7 +95,13 @@
<artifactId>jboss-remoting</artifactId>
</dependency>
+
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>concurrent</groupId>
<artifactId>concurrent</artifactId>
<scope>test</scope>
@@ -343,6 +355,9 @@
<property name="dependency.portal-common-common.jar" value="${maven.dependency.org.gatein.common.common-common.jar.path}" />
<property name="dependency.portal-common-mc.jar" value="${maven.dependency.org.gatein.common.common-mc.jar.path}" />
+ <property name="dependency.portal-common-logging.jar" value="${maven.dependency.org.gatein.common.common-logging.jar.path}" />
+ <property name="dependency.slf4j-simple.jar" value="${maven.dependency.org.slf4j.slf4j-simple.jar.path}" />
+ <property name="dependency.slf4j-api.jar" value="${maven.dependency.org.slf4j.slf4j-api.jar.path}" />
<property name="dependency.portal-wci-wci.jar" value="${maven.dependency.org.gatein.wci.wci-wci.jar.path}" />
<property name="dependency.portal-wci-tomcat.jar" value="${maven.dependency.org.gatein.wci.wci-tomcat.jar.path}" />
Modified: components/pc/trunk/test/src/test/build.xml
===================================================================
--- components/pc/trunk/test/src/test/build.xml 2009-11-24 08:31:03 UTC (rev 776)
+++ components/pc/trunk/test/src/test/build.xml 2009-11-24 08:37:03 UTC (rev 777)
@@ -69,6 +69,9 @@
<path id="portal-common-shared">
<pathelement path="${dependency.portal-common-common.jar}"/>
+ <pathelement path="${dependency.portal-common-logging.jar}"/>
+ <pathelement path="${dependency.slf4j-simple.jar}"/>
+ <pathelement path="${dependency.slf4j-api.jar}"/>
</path>
<path id="portal-web">
15 years, 1 month
gatein SVN: r776 - components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2009-11-24 03:31:03 -0500 (Tue, 24 Nov 2009)
New Revision: 776
Added:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java
Removed:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java
Modified:
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java
components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java
Log:
Rename JBossServletContextProvider -> GateInServletContextProvider
Modified: components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java
===================================================================
--- components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java 2009-11-24 00:35:57 UTC (rev 775)
+++ components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeInterceptor.java 2009-11-24 08:31:03 UTC (rev 776)
@@ -38,12 +38,12 @@
public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException, PortletInvokerException
{
- JBossServletContextProvider.BridgeInfo previousInfo = JBossServletContextProvider.get();
+ GateInServletContextProvider.BridgeInfo previousInfo = GateInServletContextProvider.get();
try
{
// Set bridge
- JBossServletContextProvider.BridgeInfo bridgeInfo = new JBossServletContextProvider.BridgeInfo(invocation);
- JBossServletContextProvider.set(bridgeInfo);
+ GateInServletContextProvider.BridgeInfo bridgeInfo = new GateInServletContextProvider.BridgeInfo(invocation);
+ GateInServletContextProvider.set(bridgeInfo);
// Proceed to invocation
return super.invoke(invocation);
@@ -51,7 +51,7 @@
finally
{
// Remove bridge
- JBossServletContextProvider.set(previousInfo);
+ GateInServletContextProvider.set(previousInfo);
}
}
}
Modified: components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java
===================================================================
--- components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java 2009-11-24 00:35:57 UTC (rev 775)
+++ components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/BridgeResponse.java 2009-11-24 08:31:03 UTC (rev 776)
@@ -52,7 +52,7 @@
/** . */
protected ServletOutputStream sos;
- public BridgeResponse(JBossServletContextProvider.BridgeInfo info)
+ public BridgeResponse(GateInServletContextProvider.BridgeInfo info)
{
super(info.getInvocation().getDispatchedResponse());
invocation = info.getInvocation();
Copied: components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java (from rev 775, components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java)
===================================================================
--- components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java (rev 0)
+++ components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/GateInServletContextProvider.java 2009-11-24 08:31:03 UTC (rev 776)
@@ -0,0 +1,139 @@
+/******************************************************************************
+ * 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.gatein.pc.bridge;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.portals.bridges.common.ServletContextProvider;
+import org.gatein.pc.portlet.container.PortletContainer;
+import org.gatein.pc.portlet.container.ContainerPortletInvoker;
+import org.gatein.pc.api.invocation.PortletInvocation;
+
+/**
+ * The JBoss implementation of <code>org.apache.portals.bridges.common.ServletContextProvider</code> use thread local
+ * variables to keep the request associated with the current thread of execution.
+ *
+ * @author <a href="mailto:dr@vizuri.com">Swarn Dhaliwal</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7226 $
+ */
+public class GateInServletContextProvider implements ServletContextProvider
+{
+
+ /** . */
+ private static final ThreadLocal local = new ThreadLocal();
+
+ static void set(BridgeInfo info)
+ {
+ local.set(info);
+ }
+
+ public static BridgeInfo get()
+ {
+ return (BridgeInfo)local.get();
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public ServletContext getServletContext(GenericPortlet genericPortlet) throws IllegalStateException
+ {
+ BridgeInfo info = ((BridgeInfo)local.get());
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ return info.ctx;
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public HttpServletRequest getHttpServletRequest(GenericPortlet genericPortlet, PortletRequest portletRequest) throws IllegalStateException
+ {
+ BridgeInfo info = (BridgeInfo)GateInServletContextProvider.local.get();
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ if (info.breq == null)
+ {
+ init(info);
+ }
+ return info.breq;
+ }
+
+ /** @throws IllegalStateException if no bridge info is found */
+ public HttpServletResponse getHttpServletResponse(GenericPortlet genericPortlet, PortletResponse portletResponse) throws IllegalStateException
+ {
+ BridgeInfo info = (BridgeInfo)GateInServletContextProvider.local.get();
+ if (info == null)
+ {
+ throw new IllegalStateException("No bridge set");
+ }
+ if (info.breq == null)
+ {
+ init(info);
+ }
+ return info.bresp;
+ }
+
+ /** Lazy initialisation of the bridge info. */
+ private void init(BridgeInfo bridgeInfo)
+ {
+ bridgeInfo.breq = bridgeInfo.getInvocation().getDispatchedRequest();
+ bridgeInfo.bresp = new BridgeResponse(bridgeInfo);
+ }
+
+ public static class BridgeInfo
+ {
+ /** Servlet context of the dispatched application. */
+ private final PortletInvocation invocation;
+
+ /** Servlet context of the dispatched application. */
+ private final ServletContext ctx;
+
+ /** The bridge response. */
+ private HttpServletRequest breq;
+
+ /** The bridge response. */
+ private HttpServletResponse bresp;
+
+ public BridgeInfo(PortletInvocation invocation)
+ {
+ PortletContainer container = (PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
+
+ //
+ this.invocation = invocation;
+ this.ctx = container.getPortletApplication().getContext().getServletContext();
+ this.breq = null;
+ this.bresp = null;
+ }
+
+ public PortletInvocation getInvocation()
+ {
+ return invocation;
+ }
+ }
+}
Deleted: components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java
===================================================================
--- components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java 2009-11-24 00:35:57 UTC (rev 775)
+++ components/pc/trunk/bridge/src/main/java/org/gatein/pc/bridge/JBossServletContextProvider.java 2009-11-24 08:31:03 UTC (rev 776)
@@ -1,139 +0,0 @@
-/******************************************************************************
- * 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.gatein.pc.bridge;
-
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletResponse;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.portals.bridges.common.ServletContextProvider;
-import org.gatein.pc.portlet.container.PortletContainer;
-import org.gatein.pc.portlet.container.ContainerPortletInvoker;
-import org.gatein.pc.api.invocation.PortletInvocation;
-
-/**
- * The JBoss implementation of <code>org.apache.portals.bridges.common.ServletContextProvider</code> use thread local
- * variables to keep the request associated with the current thread of execution.
- *
- * @author <a href="mailto:dr@vizuri.com">Swarn Dhaliwal</a>
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 7226 $
- */
-public class JBossServletContextProvider implements ServletContextProvider
-{
-
- /** . */
- private static final ThreadLocal local = new ThreadLocal();
-
- static void set(BridgeInfo info)
- {
- local.set(info);
- }
-
- public static BridgeInfo get()
- {
- return (BridgeInfo)local.get();
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public ServletContext getServletContext(GenericPortlet genericPortlet) throws IllegalStateException
- {
- BridgeInfo info = ((BridgeInfo)local.get());
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- return info.ctx;
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public HttpServletRequest getHttpServletRequest(GenericPortlet genericPortlet, PortletRequest portletRequest) throws IllegalStateException
- {
- BridgeInfo info = (BridgeInfo)JBossServletContextProvider.local.get();
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- if (info.breq == null)
- {
- init(info);
- }
- return info.breq;
- }
-
- /** @throws IllegalStateException if no bridge info is found */
- public HttpServletResponse getHttpServletResponse(GenericPortlet genericPortlet, PortletResponse portletResponse) throws IllegalStateException
- {
- BridgeInfo info = (BridgeInfo)JBossServletContextProvider.local.get();
- if (info == null)
- {
- throw new IllegalStateException("No bridge set");
- }
- if (info.breq == null)
- {
- init(info);
- }
- return info.bresp;
- }
-
- /** Lazy initialisation of the bridge info. */
- private void init(BridgeInfo bridgeInfo)
- {
- bridgeInfo.breq = bridgeInfo.getInvocation().getDispatchedRequest();
- bridgeInfo.bresp = new BridgeResponse(bridgeInfo);
- }
-
- public static class BridgeInfo
- {
- /** Servlet context of the dispatched application. */
- private final PortletInvocation invocation;
-
- /** Servlet context of the dispatched application. */
- private final ServletContext ctx;
-
- /** The bridge response. */
- private HttpServletRequest breq;
-
- /** The bridge response. */
- private HttpServletResponse bresp;
-
- public BridgeInfo(PortletInvocation invocation)
- {
- PortletContainer container = (PortletContainer)invocation.getAttribute(ContainerPortletInvoker.PORTLET_CONTAINER);
-
- //
- this.invocation = invocation;
- this.ctx = container.getPortletApplication().getContext().getServletContext();
- this.breq = null;
- this.bresp = null;
- }
-
- public PortletInvocation getInvocation()
- {
- return invocation;
- }
- }
-}
15 years, 1 month
gatein SVN: r775 - in portal/trunk: component/application-registry/src/test/java/conf/portal and 13 other directories.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2009-11-23 19:35:57 -0500 (Mon, 23 Nov 2009)
New Revision: 775
Added:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java
Removed:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java
Modified:
portal/trunk/component/application-registry/src/test/java/conf/portal/idm-configuration.xml
portal/trunk/component/identity/pom.xml
portal/trunk/component/identity/src/main/java/conf/portal/hibernate-jbidm.cfg.xml
portal/trunk/component/identity/src/main/java/conf/portal/idm-config.xml
portal/trunk/component/identity/src/main/java/conf/portal/jboss-idm-configuration.xml
portal/trunk/component/identity/src/test/java/conf/portal/idm-configuration.xml
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
portal/trunk/component/portal/pom.xml
portal/trunk/component/portal/src/test/java/conf/portal/database-configuration.xml
portal/trunk/component/portal/src/test/java/conf/portal/idm-configuration.xml
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
portal/trunk/docs/user-guide/en/modules/configuration/IDM_Configuration.xml
portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js
portal/trunk/pom.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/database/database-configuration.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-config.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
Log:
Rollback revision 744
- upgrade to PicketLink IDM (former JBoss Identity) 1.0.0.CR1
- remove separate IDM hibernate config
Modified: portal/trunk/component/application-registry/src/test/java/conf/portal/idm-configuration.xml
===================================================================
--- portal/trunk/component/application-registry/src/test/java/conf/portal/idm-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/application-registry/src/test/java/conf/portal/idm-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -25,8 +25,8 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
@@ -34,18 +34,18 @@
</value-param>
<values-param>
<name>hibernate.annotations</name>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateRealm</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
</values-param>
<properties-param>
<name>hibernate.properties</name>
@@ -70,7 +70,7 @@
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
</configuration>
Modified: portal/trunk/component/identity/pom.xml
===================================================================
--- portal/trunk/component/identity/pom.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/pom.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -55,24 +55,24 @@
</dependency>
<dependency>
- <groupId>org.picketlink.idm</groupId>
- <artifactId>picketlink-idm-core</artifactId>
- <version>${org.picketlink.idm}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${org.jboss.identity.idm}</version>
</dependency>
<dependency>
- <groupId>org.picketlink.idm</groupId>
- <artifactId>picketlink-idm-hibernate</artifactId>
- <version>${org.picketlink.idm}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${org.jboss.identity.idm}</version>
</dependency>
<dependency>
- <groupId>org.picketlink.idm</groupId>
- <artifactId>picketlink-idm-ldap</artifactId>
- <version>${org.picketlink.idm}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-ldap</artifactId>
+ <version>${org.jboss.identity.idm}</version>
</dependency>
<dependency>
- <groupId>org.picketlink.idm</groupId>
- <artifactId>picketlink-idm-cache</artifactId>
- <version>${org.picketlink.idm}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-cache</artifactId>
+ <version>${org.jboss.identity.idm}</version>
</dependency>
<!--To use instead of outdated version from xdoclet-->
Modified: portal/trunk/component/identity/src/main/java/conf/portal/hibernate-jbidm.cfg.xml
===================================================================
--- portal/trunk/component/identity/src/main/java/conf/portal/hibernate-jbidm.cfg.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/src/main/java/conf/portal/hibernate-jbidm.cfg.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -41,5 +41,19 @@
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></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.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
Modified: portal/trunk/component/identity/src/main/java/conf/portal/idm-config.xml
===================================================================
--- portal/trunk/component/identity/src/main/java/conf/portal/idm-config.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/src/main/java/conf/portal/idm-config.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -20,9 +20,9 @@
-->
-<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_cr1"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_cr1 identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
<realms>
<realm>
<id>PortalRealm</id>
@@ -35,7 +35,7 @@
<repositories>
<repository>
<id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>HibernateStore</default-identity-store-id>
<default-attribute-store-id>HibernateStore</default-attribute-store-id>
@@ -46,7 +46,7 @@
<identity-stores>
<identity-store>
<id>HibernateStore</id>
- <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <class>org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
<external-config/>
<supported-relationship-types>
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
Modified: portal/trunk/component/identity/src/main/java/conf/portal/jboss-idm-configuration.xml
===================================================================
--- portal/trunk/component/identity/src/main/java/conf/portal/jboss-idm-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/src/main/java/conf/portal/jboss-idm-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -25,8 +25,8 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
@@ -41,7 +41,7 @@
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
<external-component-plugins>
@@ -52,18 +52,19 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<values-param>
- <name>hibernate.mapping</name>
- <value>mappings/HibernateRealm.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObject.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredential.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
</values-param>
</init-params>
</component-plugin>
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm)
Property changes on: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm
___________________________________________________________________
Name: svn:ignore
+ *.iml
.idea
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,459 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.GroupEventListener;
-import org.exoplatform.services.organization.GroupHandler;
-import org.exoplatform.services.organization.impl.GroupImpl;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.impl.api.SimpleAttribute;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class GroupDAOImpl implements GroupHandler
-{
-
- public static final String GROUP_LABEL = "label";
-
- public static final String GROUP_DESCRIPTION = "description";
-
- private JBossIDMService service_;
-
- private List<GroupEventListener> listeners_;
-
- private JBossIDMOrganizationServiceImpl orgService;
-
- public GroupDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
- {
- service_ = service;
- this.orgService = orgService;
- listeners_ = new ArrayList<GroupEventListener>();
- }
-
- public void addGroupEventListener(GroupEventListener listener)
- {
- listeners_.add(listener);
- }
-
- final public Group createGroupInstance()
- {
- return new GroupImpl();
- }
-
- public void createGroup(Group group, boolean broadcast) throws Exception
- {
- addChild(null, group, broadcast);
- }
-
- public void addChild(Group parent, Group child, boolean broadcast) throws Exception
- {
- org.jboss.identity.idm.api.Group parentGroup = null;
-
- if (parent != null)
- {
- parentGroup =
- getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(), orgService.getExoGroupType());
- ((GroupImpl)child).setId(parent.getId() + "/" + child.getGroupName());
-
- }
- else
- {
- ((GroupImpl)child).setId("/" + child.getGroupName());
- }
-
- if (broadcast)
- {
- preSave(child, true);
- }
-
- org.jboss.identity.idm.api.Group childGroup = persistGroup(child);
-
- if (parentGroup != null)
- {
- getIdentitySession().getRelationshipManager().associateGroups(parentGroup, childGroup);
- ((GroupImpl)child).setParentId(parent.getId());
-
- }
- else
- {
- getIdentitySession().getRelationshipManager().associateGroups(getRootGroup(), childGroup);
- }
-
- if (broadcast)
- {
- postSave(child, true);
- }
-
- }
-
- public void saveGroup(Group group, boolean broadcast) throws Exception
- {
- if (broadcast)
- {
- preSave(group, false);
- }
- persistGroup(group);
- if (broadcast)
- {
- postSave(group, false);
- }
- }
-
- public Group removeGroup(Group group, boolean broadcast) throws Exception
- {
- if (broadcast)
- {
- preDelete(group);
- }
-
- org.jboss.identity.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(group.getGroupName(), orgService.getExoGroupType());
-
- if (jbidGroup == null)
- {
- return group;
- }
-
- // MembershipDAOImpl.removeMembershipEntriesOfGroup(group, getIdentitySession());
-
- Collection<org.jboss.identity.idm.api.Group> oneLevelChilds =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
- true, false);
-
- Collection<org.jboss.identity.idm.api.Group> allChilds =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
- true, true);
-
- getIdentitySession().getRelationshipManager().disassociateGroups(jbidGroup, oneLevelChilds);
-
- for (org.jboss.identity.idm.api.Group child : allChilds)
- {
- //TODO: impl force in IDM
- getIdentitySession().getPersistenceManager().removeGroup(child, true);
- }
-
- getIdentitySession().getPersistenceManager().removeGroup(jbidGroup, true);
-
- if (broadcast)
- {
- postDelete(group);
- }
- return group;
- }
-
- public Collection findGroupByMembership(String userName, String membershipType) throws Exception
- {
- Collection<org.jboss.identity.idm.api.Role> allRoles =
- getIdentitySession().getRoleManager().findRoles(userName, membershipType);
-
- Set<Group> exoGroups = new HashSet<Group>();
-
- for (org.jboss.identity.idm.api.Role role : allRoles)
- {
- exoGroups.add(convertGroup(role.getGroup()));
-
- }
-
- return exoGroups;
- }
-
- //
- public Group findGroupById(String groupId) throws Exception
- {
-
- org.jboss.identity.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
-
- if (jbidGroup == null)
- {
- return null;
- }
-
- return convertGroup(jbidGroup);
- }
-
- public Collection findGroups(Group parent) throws Exception
- {
- org.jboss.identity.idm.api.Group jbidGroup = null;
-
- if (parent == null)
- {
- jbidGroup = getRootGroup();
- }
- else
- {
- jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(), orgService.getExoGroupType());
- }
-
- if (jbidGroup == null)
- {
- return Collections.emptyList();
- }
-
- Collection<org.jboss.identity.idm.api.Group> allGroups =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
- true, false);
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.jboss.identity.idm.api.Group group : allGroups)
- {
- exoGroups.add(convertGroup(group));
-
- }
-
- return exoGroups;
-
- }
-
- public Collection findGroupsOfUser(String user) throws Exception
- {
-
- if (user == null)
- {
- // julien : integration bug
- // need to look at that later
- //
- // Caused by: java.lang.IllegalArgumentException: User name cannot be null
- // at org.jboss.identity.idm.impl.api.session.managers.AbstractManager.checkNotNullArgument(AbstractManager.java:267)
- // at org.jboss.identity.idm.impl.api.session.managers.RelationshipManagerImpl.findRelatedGroups(RelationshipManagerImpl.java:753)
- // at org.exoplatform.services.organization.jbidm.GroupDAOImpl.findGroupsOfUser(GroupDAOImpl.java:225)
- // at org.exoplatform.organization.webui.component.GroupManagement.isMemberOfGroup(GroupManagement.java:72)
- // at org.exoplatform.organization.webui.component.GroupManagement.isAdministrator(GroupManagement.java:125)
- // at org.exoplatform.organization.webui.component.UIGroupExplorer.<init>(UIGroupExplorer.java:57)
- return Collections.emptyList();
- }
-
- Collection<org.jboss.identity.idm.api.Group> allGroups =
- getIdentitySession().getRelationshipManager().findRelatedGroups(user, orgService.getExoGroupType(), null);
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.jboss.identity.idm.api.Group group : allGroups)
- {
- exoGroups.add(convertGroup(group));
-
- }
-
- return exoGroups;
- }
-
- public Collection getAllGroups() throws Exception
- {
- Collection<org.jboss.identity.idm.api.Group> allGroups =
- getIdentitySession().getPersistenceManager().findGroup(orgService.getExoGroupType());
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.jboss.identity.idm.api.Group group : allGroups)
- {
- if (!orgService.getExoGroupType().equals(orgService.getExoRootGroupType())
- || !group.getName().equals(orgService.getExoRootGroupName()))
- {
- exoGroups.add(convertGroup(group));
- }
-
- }
-
- return exoGroups;
- }
-
- private void preSave(Group group, boolean isNew) throws Exception
- {
- for (GroupEventListener listener : listeners_)
- {
- listener.preSave(group, isNew);
- }
- }
-
- private void postSave(Group group, boolean isNew) throws Exception
- {
- for (GroupEventListener listener : listeners_)
- {
- listener.postSave(group, isNew);
- }
- }
-
- private void preDelete(Group group) throws Exception
- {
- for (GroupEventListener listener : listeners_)
- {
- listener.preDelete(group);
- }
- }
-
- private void postDelete(Group group) throws Exception
- {
- for (GroupEventListener listener : listeners_)
- {
- listener.postDelete(group);
- }
- }
-
- public Group getGroup(String groupName) throws Exception
- {
- org.jboss.identity.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(groupName, orgService.getExoGroupType());
-
- if (jbidGroup == null)
- {
- return null;
- }
-
- return convertGroup(jbidGroup);
-
- }
-
- private Group convertGroup(org.jboss.identity.idm.api.Group jbidGroup) throws Exception
- {
- Map<String, Attribute> attrs = getIdentitySession().getAttributesManager().getAttributes(jbidGroup);
-
- GroupImpl exoGroup = new GroupImpl(jbidGroup.getName());
-
- if (attrs.containsKey(GROUP_DESCRIPTION))
- {
- exoGroup.setDescription(attrs.get(GROUP_DESCRIPTION).getValue().toString());
- }
- if (attrs.containsKey(GROUP_LABEL))
- {
- exoGroup.setLabel(attrs.get(GROUP_LABEL).getValue().toString());
- }
-
- // Resolve full ID
- String id = getGroupId(jbidGroup.getName());
-
- exoGroup.setId(id);
-
- if (id.length() == jbidGroup.getName().length() + 1)
- {
- exoGroup.setParentId(null);
- }
- else
- {
- exoGroup.setParentId(id.substring(0, id.length() - jbidGroup.getName().length() - 1));
- }
-
- return exoGroup;
- }
-
- private String getGroupId(String groupName) throws Exception
- {
- if (groupName.equals(orgService.getExoRootGroupName()))
- {
- return "";
- }
-
- org.jboss.identity.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(groupName, orgService.getExoGroupType());
-
- Collection<org.jboss.identity.idm.api.Group> parents =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
- false, false);
-
- if (parents.size() > 1)
- {
- throw new IllegalStateException("Group has more than one parent: " + groupName);
- }
-
- if (parents.size() == 0)
- {
- //As there is special root group this shouldn't happen:
- throw new IllegalStateException("Group present that is not connected to the root: " + groupName);
-
- // This group is at the root
- //return "/" + groupName;
- }
-
- String parentGroupId = getGroupId(((org.jboss.identity.idm.api.Group)parents.iterator().next()).getName());
-
- return parentGroupId + "/" + groupName;
-
- }
-
- private org.jboss.identity.idm.api.Group persistGroup(Group exoGroup) throws Exception
- {
-
- org.jboss.identity.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(exoGroup.getGroupName(), orgService.getExoGroupType());
-
- if (jbidGroup == null)
- {
- jbidGroup =
- getIdentitySession().getPersistenceManager().createGroup(exoGroup.getGroupName(),
- orgService.getExoGroupType());
- }
-
- String description = exoGroup.getDescription();
- String label = exoGroup.getLabel();
-
- List<Attribute> attrsList = new ArrayList<Attribute>();
- if (description != null)
- {
- attrsList.add(new SimpleAttribute(GROUP_DESCRIPTION, description));
- }
-
- if (label != null)
- {
- attrsList.add(new SimpleAttribute(GROUP_LABEL, label));
- }
-
- if (attrsList.size() > 0)
- {
- Attribute[] attrs = new Attribute[attrsList.size()];
-
- attrs = attrsList.toArray(attrs);
-
- getIdentitySession().getAttributesManager().addAttributes(jbidGroup, attrs);
-
- }
-
- return jbidGroup;
- }
-
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-
- private org.jboss.identity.idm.api.Group getRootGroup() throws Exception
- {
- org.jboss.identity.idm.api.Group rootGroup =
- getIdentitySession().getPersistenceManager().findGroup(orgService.getExoRootGroupName(),
- orgService.getExoRootGroupType());
-
- if (rootGroup == null)
- {
- rootGroup =
- getIdentitySession().getPersistenceManager().createGroup(orgService.getExoRootGroupName(),
- orgService.getExoRootGroupType());
- }
-
- return rootGroup;
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/GroupDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,459 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.services.organization.Group;
+import org.exoplatform.services.organization.GroupEventListener;
+import org.exoplatform.services.organization.GroupHandler;
+import org.exoplatform.services.organization.impl.GroupImpl;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class GroupDAOImpl implements GroupHandler
+{
+
+ public static final String GROUP_LABEL = "label";
+
+ public static final String GROUP_DESCRIPTION = "description";
+
+ private JBossIDMService service_;
+
+ private List<GroupEventListener> listeners_;
+
+ private JBossIDMOrganizationServiceImpl orgService;
+
+ public GroupDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
+ {
+ service_ = service;
+ this.orgService = orgService;
+ listeners_ = new ArrayList<GroupEventListener>();
+ }
+
+ public void addGroupEventListener(GroupEventListener listener)
+ {
+ listeners_.add(listener);
+ }
+
+ final public Group createGroupInstance()
+ {
+ return new GroupImpl();
+ }
+
+ public void createGroup(Group group, boolean broadcast) throws Exception
+ {
+ addChild(null, group, broadcast);
+ }
+
+ public void addChild(Group parent, Group child, boolean broadcast) throws Exception
+ {
+ org.jboss.identity.idm.api.Group parentGroup = null;
+
+ if (parent != null)
+ {
+ parentGroup =
+ getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(), orgService.getExoGroupType());
+ ((GroupImpl)child).setId(parent.getId() + "/" + child.getGroupName());
+
+ }
+ else
+ {
+ ((GroupImpl)child).setId("/" + child.getGroupName());
+ }
+
+ if (broadcast)
+ {
+ preSave(child, true);
+ }
+
+ org.jboss.identity.idm.api.Group childGroup = persistGroup(child);
+
+ if (parentGroup != null)
+ {
+ getIdentitySession().getRelationshipManager().associateGroups(parentGroup, childGroup);
+ ((GroupImpl)child).setParentId(parent.getId());
+
+ }
+ else
+ {
+ getIdentitySession().getRelationshipManager().associateGroups(getRootGroup(), childGroup);
+ }
+
+ if (broadcast)
+ {
+ postSave(child, true);
+ }
+
+ }
+
+ public void saveGroup(Group group, boolean broadcast) throws Exception
+ {
+ if (broadcast)
+ {
+ preSave(group, false);
+ }
+ persistGroup(group);
+ if (broadcast)
+ {
+ postSave(group, false);
+ }
+ }
+
+ public Group removeGroup(Group group, boolean broadcast) throws Exception
+ {
+ if (broadcast)
+ {
+ preDelete(group);
+ }
+
+ org.jboss.identity.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(group.getGroupName(), orgService.getExoGroupType());
+
+ if (jbidGroup == null)
+ {
+ return group;
+ }
+
+ // MembershipDAOImpl.removeMembershipEntriesOfGroup(group, getIdentitySession());
+
+ Collection<org.jboss.identity.idm.api.Group> oneLevelChilds =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
+ true, false);
+
+ Collection<org.jboss.identity.idm.api.Group> allChilds =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
+ true, true);
+
+ getIdentitySession().getRelationshipManager().disassociateGroups(jbidGroup, oneLevelChilds);
+
+ for (org.jboss.identity.idm.api.Group child : allChilds)
+ {
+ //TODO: impl force in IDM
+ getIdentitySession().getPersistenceManager().removeGroup(child, true);
+ }
+
+ getIdentitySession().getPersistenceManager().removeGroup(jbidGroup, true);
+
+ if (broadcast)
+ {
+ postDelete(group);
+ }
+ return group;
+ }
+
+ public Collection findGroupByMembership(String userName, String membershipType) throws Exception
+ {
+ Collection<org.jboss.identity.idm.api.Role> allRoles =
+ getIdentitySession().getRoleManager().findRoles(userName, membershipType);
+
+ Set<Group> exoGroups = new HashSet<Group>();
+
+ for (org.jboss.identity.idm.api.Role role : allRoles)
+ {
+ exoGroups.add(convertGroup(role.getGroup()));
+
+ }
+
+ return exoGroups;
+ }
+
+ //
+ public Group findGroupById(String groupId) throws Exception
+ {
+
+ org.jboss.identity.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
+
+ if (jbidGroup == null)
+ {
+ return null;
+ }
+
+ return convertGroup(jbidGroup);
+ }
+
+ public Collection findGroups(Group parent) throws Exception
+ {
+ org.jboss.identity.idm.api.Group jbidGroup = null;
+
+ if (parent == null)
+ {
+ jbidGroup = getRootGroup();
+ }
+ else
+ {
+ jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(), orgService.getExoGroupType());
+ }
+
+ if (jbidGroup == null)
+ {
+ return Collections.emptyList();
+ }
+
+ Collection<org.jboss.identity.idm.api.Group> allGroups =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
+ true, false);
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.jboss.identity.idm.api.Group group : allGroups)
+ {
+ exoGroups.add(convertGroup(group));
+
+ }
+
+ return exoGroups;
+
+ }
+
+ public Collection findGroupsOfUser(String user) throws Exception
+ {
+
+ if (user == null)
+ {
+ // julien : integration bug
+ // need to look at that later
+ //
+ // Caused by: java.lang.IllegalArgumentException: User name cannot be null
+ // at org.jboss.identity.idm.impl.api.session.managers.AbstractManager.checkNotNullArgument(AbstractManager.java:267)
+ // at org.jboss.identity.idm.impl.api.session.managers.RelationshipManagerImpl.findRelatedGroups(RelationshipManagerImpl.java:753)
+ // at org.exoplatform.services.organization.jbidm.GroupDAOImpl.findGroupsOfUser(GroupDAOImpl.java:225)
+ // at org.exoplatform.organization.webui.component.GroupManagement.isMemberOfGroup(GroupManagement.java:72)
+ // at org.exoplatform.organization.webui.component.GroupManagement.isAdministrator(GroupManagement.java:125)
+ // at org.exoplatform.organization.webui.component.UIGroupExplorer.<init>(UIGroupExplorer.java:57)
+ return Collections.emptyList();
+ }
+
+ Collection<org.jboss.identity.idm.api.Group> allGroups =
+ getIdentitySession().getRelationshipManager().findRelatedGroups(user, orgService.getExoGroupType(), null);
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.jboss.identity.idm.api.Group group : allGroups)
+ {
+ exoGroups.add(convertGroup(group));
+
+ }
+
+ return exoGroups;
+ }
+
+ public Collection getAllGroups() throws Exception
+ {
+ Collection<org.jboss.identity.idm.api.Group> allGroups =
+ getIdentitySession().getPersistenceManager().findGroup(orgService.getExoGroupType());
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.jboss.identity.idm.api.Group group : allGroups)
+ {
+ if (!orgService.getExoGroupType().equals(orgService.getExoRootGroupType())
+ || !group.getName().equals(orgService.getExoRootGroupName()))
+ {
+ exoGroups.add(convertGroup(group));
+ }
+
+ }
+
+ return exoGroups;
+ }
+
+ private void preSave(Group group, boolean isNew) throws Exception
+ {
+ for (GroupEventListener listener : listeners_)
+ {
+ listener.preSave(group, isNew);
+ }
+ }
+
+ private void postSave(Group group, boolean isNew) throws Exception
+ {
+ for (GroupEventListener listener : listeners_)
+ {
+ listener.postSave(group, isNew);
+ }
+ }
+
+ private void preDelete(Group group) throws Exception
+ {
+ for (GroupEventListener listener : listeners_)
+ {
+ listener.preDelete(group);
+ }
+ }
+
+ private void postDelete(Group group) throws Exception
+ {
+ for (GroupEventListener listener : listeners_)
+ {
+ listener.postDelete(group);
+ }
+ }
+
+ public Group getGroup(String groupName) throws Exception
+ {
+ org.jboss.identity.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(groupName, orgService.getExoGroupType());
+
+ if (jbidGroup == null)
+ {
+ return null;
+ }
+
+ return convertGroup(jbidGroup);
+
+ }
+
+ private Group convertGroup(org.jboss.identity.idm.api.Group jbidGroup) throws Exception
+ {
+ Map<String, Attribute> attrs = getIdentitySession().getAttributesManager().getAttributes(jbidGroup);
+
+ GroupImpl exoGroup = new GroupImpl(jbidGroup.getName());
+
+ if (attrs.containsKey(GROUP_DESCRIPTION))
+ {
+ exoGroup.setDescription(attrs.get(GROUP_DESCRIPTION).getValue().toString());
+ }
+ if (attrs.containsKey(GROUP_LABEL))
+ {
+ exoGroup.setLabel(attrs.get(GROUP_LABEL).getValue().toString());
+ }
+
+ // Resolve full ID
+ String id = getGroupId(jbidGroup.getName());
+
+ exoGroup.setId(id);
+
+ if (id.length() == jbidGroup.getName().length() + 1)
+ {
+ exoGroup.setParentId(null);
+ }
+ else
+ {
+ exoGroup.setParentId(id.substring(0, id.length() - jbidGroup.getName().length() - 1));
+ }
+
+ return exoGroup;
+ }
+
+ private String getGroupId(String groupName) throws Exception
+ {
+ if (groupName.equals(orgService.getExoRootGroupName()))
+ {
+ return "";
+ }
+
+ org.jboss.identity.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(groupName, orgService.getExoGroupType());
+
+ Collection<org.jboss.identity.idm.api.Group> parents =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup, orgService.getExoGroupType(),
+ false, false);
+
+ if (parents.size() > 1)
+ {
+ throw new IllegalStateException("Group has more than one parent: " + groupName);
+ }
+
+ if (parents.size() == 0)
+ {
+ //As there is special root group this shouldn't happen:
+ throw new IllegalStateException("Group present that is not connected to the root: " + groupName);
+
+ // This group is at the root
+ //return "/" + groupName;
+ }
+
+ String parentGroupId = getGroupId(((org.jboss.identity.idm.api.Group)parents.iterator().next()).getName());
+
+ return parentGroupId + "/" + groupName;
+
+ }
+
+ private org.jboss.identity.idm.api.Group persistGroup(Group exoGroup) throws Exception
+ {
+
+ org.jboss.identity.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(exoGroup.getGroupName(), orgService.getExoGroupType());
+
+ if (jbidGroup == null)
+ {
+ jbidGroup =
+ getIdentitySession().getPersistenceManager().createGroup(exoGroup.getGroupName(),
+ orgService.getExoGroupType());
+ }
+
+ String description = exoGroup.getDescription();
+ String label = exoGroup.getLabel();
+
+ List<Attribute> attrsList = new ArrayList<Attribute>();
+ if (description != null)
+ {
+ attrsList.add(new SimpleAttribute(GROUP_DESCRIPTION, description));
+ }
+
+ if (label != null)
+ {
+ attrsList.add(new SimpleAttribute(GROUP_LABEL, label));
+ }
+
+ if (attrsList.size() > 0)
+ {
+ Attribute[] attrs = new Attribute[attrsList.size()];
+
+ attrs = attrsList.toArray(attrs);
+
+ getIdentitySession().getAttributesManager().addAttributes(jbidGroup, attrs);
+
+ }
+
+ return jbidGroup;
+ }
+
+ private IdentitySession getIdentitySession() throws Exception
+ {
+ return service_.getIdentitySession();
+ }
+
+ private org.jboss.identity.idm.api.Group getRootGroup() throws Exception
+ {
+ org.jboss.identity.idm.api.Group rootGroup =
+ getIdentitySession().getPersistenceManager().findGroup(orgService.getExoRootGroupName(),
+ orgService.getExoRootGroupType());
+
+ if (rootGroup == null)
+ {
+ rootGroup =
+ getIdentitySession().getPersistenceManager().createGroup(orgService.getExoRootGroupName(),
+ orgService.getExoRootGroupType());
+ }
+
+ return rootGroup;
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,83 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.commons.utils.ListAccess;
-import org.exoplatform.services.organization.User;
-import org.jboss.identity.idm.api.query.UserQuery;
-import org.jboss.identity.idm.api.query.UserQueryBuilder;
-
-import java.util.List;
-
-public class IDMUserListAccess implements ListAccess<User>
-{
- private final UserDAOImpl userDAO;
-
- private final JBossIDMService idmService;
-
- private final UserQueryBuilder userQueryBuilder;
-
- private final int pageSize;
-
- private final boolean countAll;
-
- public IDMUserListAccess(UserDAOImpl userDAO, JBossIDMService idmService, UserQueryBuilder userQueryBuilder,
- int pageSize, boolean countAll)
- {
- this.userDAO = userDAO;
- this.idmService = idmService;
- this.userQueryBuilder = userQueryBuilder;
- this.pageSize = pageSize;
- this.countAll = countAll;
- }
-
- public User[] load(int index, int length) throws Exception, IllegalArgumentException
- {
- userQueryBuilder.page(index, length);
- UserQuery query = userQueryBuilder.createQuery();
- List<org.jboss.identity.idm.api.User> users = idmService.getIdentitySession().list(query);
-
- User[] exoUsers = new User[users.size()];
-
- for (int i = 0; i < users.size(); i++)
- {
- org.jboss.identity.idm.api.User user = users.get(i);
-
- exoUsers[i] = UserDAOImpl.getPopulatedUser(user.getId(), idmService.getIdentitySession());
- }
-
- return exoUsers;
- }
-
- public int getSize() throws Exception
- {
- if (countAll)
- {
- return idmService.getIdentitySession().getPersistenceManager().getUserCount();
- }
- else
- {
- userQueryBuilder.page(0, 0);
- UserQuery query = userQueryBuilder.createQuery();
- return idmService.getIdentitySession().execute(query).size();
- }
-
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/IDMUserListAccess.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,83 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.services.organization.User;
+import org.jboss.identity.idm.api.query.UserQuery;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+
+import java.util.List;
+
+public class IDMUserListAccess implements ListAccess<User>
+{
+ private final UserDAOImpl userDAO;
+
+ private final JBossIDMService idmService;
+
+ private final UserQueryBuilder userQueryBuilder;
+
+ private final int pageSize;
+
+ private final boolean countAll;
+
+ public IDMUserListAccess(UserDAOImpl userDAO, JBossIDMService idmService, UserQueryBuilder userQueryBuilder,
+ int pageSize, boolean countAll)
+ {
+ this.userDAO = userDAO;
+ this.idmService = idmService;
+ this.userQueryBuilder = userQueryBuilder;
+ this.pageSize = pageSize;
+ this.countAll = countAll;
+ }
+
+ public User[] load(int index, int length) throws Exception, IllegalArgumentException
+ {
+ userQueryBuilder.page(index, length);
+ UserQuery query = userQueryBuilder.createQuery();
+ List<org.jboss.identity.idm.api.User> users = idmService.getIdentitySession().list(query);
+
+ User[] exoUsers = new User[users.size()];
+
+ for (int i = 0; i < users.size(); i++)
+ {
+ org.jboss.identity.idm.api.User user = users.get(i);
+
+ exoUsers[i] = UserDAOImpl.getPopulatedUser(user.getId(), idmService.getIdentitySession());
+ }
+
+ return exoUsers;
+ }
+
+ public int getSize() throws Exception
+ {
+ if (countAll)
+ {
+ return idmService.getIdentitySession().getPersistenceManager().getUserCount();
+ }
+ else
+ {
+ userQueryBuilder.page(0, 0);
+ UserQuery query = userQueryBuilder.createQuery();
+ return idmService.getIdentitySession().execute(query).size();
+ }
+
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,175 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.component.ComponentRequestLifecycle;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.organization.BaseOrganizationService;
-import org.picocontainer.Startable;
-
-public class JBossIDMOrganizationServiceImpl extends BaseOrganizationService implements Startable,
- ComponentRequestLifecycle
-{
-
- // We may have several portal containers thus we need one JBossIDMService per portal container
- // private static JBossIDMService jbidmService_;
- private JBossIDMService jbidmService_;
-
- public static final String EXO_GROUP_TYPE_OPTION = "exoGroupTypeName";
-
- public static final String EXO_ROOT_GROUP_NAME_OPTION = "exoRootGroupName";
-
- public static final String EXO_ROOT_GROUP_TYPE_NAME_OPTION = "exoRootGroupTypeName";
-
- public static final String PASSWORD_AS_ATTRIBUTE_OPTION = "passwordAsAttribute";
-
- private String exoGroupType = "EXO_GROUP_TYPE";
-
- private String exoRootGroupName = "EXO_ROOT_GROUP";
-
- private String exoRootGroupType = exoGroupType;
-
- private boolean passwordAsAttribute = false;
-
- public JBossIDMOrganizationServiceImpl(InitParams params, CacheService cservice, JBossIDMService jbidmService)
- throws Exception
- {
- groupDAO_ = new GroupDAOImpl(this, jbidmService);
- userDAO_ = new UserDAOImpl(this, jbidmService, cservice);
- userProfileDAO_ = new UserProfileDAOImpl(this, jbidmService, cservice);
- membershipDAO_ = new MembershipDAOImpl(this, jbidmService);
- membershipTypeDAO_ = new MembershipTypeDAOImpl(this, jbidmService);
-
- jbidmService_ = jbidmService;
-
- if (params != null)
- {
- //Options
- ValueParam exoGroupTypeNameParam = params.getValueParam(EXO_GROUP_TYPE_OPTION);
- ValueParam exoRootGroupTypeNameParam = params.getValueParam(EXO_ROOT_GROUP_TYPE_NAME_OPTION);
- ValueParam exoRootGroupNameParam = params.getValueParam(EXO_ROOT_GROUP_NAME_OPTION);
- ValueParam passwordAsAttributeParam = params.getValueParam(PASSWORD_AS_ATTRIBUTE_OPTION);
-
- if (exoGroupTypeNameParam != null)
- {
- this.exoGroupType = exoGroupTypeNameParam.getValue();
- }
-
- if (exoRootGroupNameParam != null)
- {
- this.exoRootGroupName = exoRootGroupNameParam.getValue();
- }
-
- if (exoRootGroupTypeNameParam != null)
- {
- this.exoRootGroupType = exoRootGroupTypeNameParam.getValue();
- }
- else if (exoRootGroupTypeNameParam != null)
- {
- this.exoRootGroupType = this.exoGroupType;
- }
-
- if (passwordAsAttributeParam != null && passwordAsAttributeParam.getValue().equalsIgnoreCase("true"))
- {
- this.passwordAsAttribute = true;
- }
- }
-
- }
-
- public final org.jboss.identity.idm.api.Group getJBIDMGroup(String groupId) throws Exception
- {
- String[] ids = groupId.split("/");
- String name = ids[ids.length - 1];
- return jbidmService_.getIdentitySession().getPersistenceManager().findGroup(name, getExoGroupType());
- }
-
- @Override
- public void start()
- {
-
- try
- {
- // Wrap within transaction so all initializers can work
- jbidmService_.getIdentitySession().beginTransaction();
- super.start();
- jbidmService_.getIdentitySession().getTransaction().commit();
-
- }
- catch (Exception e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
-
- }
-
- @Override
- public void stop()
- {
- //toto
- }
-
- public void startRequest(ExoContainer container)
- {
- try
- {
- jbidmService_.getIdentitySession().beginTransaction();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void endRequest(ExoContainer container)
- {
- try
- {
- jbidmService_.getIdentitySession().getTransaction().commit();
- }
- catch (Exception e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
- public String getExoGroupType()
- {
- return exoGroupType;
- }
-
- public String getExoRootGroupName()
- {
- return exoRootGroupName;
- }
-
- public String getExoRootGroupType()
- {
- return exoRootGroupType;
- }
-
- public boolean isPasswordAsAttribute()
- {
- return passwordAsAttribute;
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMOrganizationServiceImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,175 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.organization.BaseOrganizationService;
+import org.picocontainer.Startable;
+
+public class JBossIDMOrganizationServiceImpl extends BaseOrganizationService implements Startable,
+ ComponentRequestLifecycle
+{
+
+ // We may have several portal containers thus we need one JBossIDMService per portal container
+ // private static JBossIDMService jbidmService_;
+ private JBossIDMService jbidmService_;
+
+ public static final String EXO_GROUP_TYPE_OPTION = "exoGroupTypeName";
+
+ public static final String EXO_ROOT_GROUP_NAME_OPTION = "exoRootGroupName";
+
+ public static final String EXO_ROOT_GROUP_TYPE_NAME_OPTION = "exoRootGroupTypeName";
+
+ public static final String PASSWORD_AS_ATTRIBUTE_OPTION = "passwordAsAttribute";
+
+ private String exoGroupType = "EXO_GROUP_TYPE";
+
+ private String exoRootGroupName = "EXO_ROOT_GROUP";
+
+ private String exoRootGroupType = exoGroupType;
+
+ private boolean passwordAsAttribute = false;
+
+ public JBossIDMOrganizationServiceImpl(InitParams params, CacheService cservice, JBossIDMService jbidmService)
+ throws Exception
+ {
+ groupDAO_ = new GroupDAOImpl(this, jbidmService);
+ userDAO_ = new UserDAOImpl(this, jbidmService, cservice);
+ userProfileDAO_ = new UserProfileDAOImpl(this, jbidmService, cservice);
+ membershipDAO_ = new MembershipDAOImpl(this, jbidmService);
+ membershipTypeDAO_ = new MembershipTypeDAOImpl(this, jbidmService);
+
+ jbidmService_ = jbidmService;
+
+ if (params != null)
+ {
+ //Options
+ ValueParam exoGroupTypeNameParam = params.getValueParam(EXO_GROUP_TYPE_OPTION);
+ ValueParam exoRootGroupTypeNameParam = params.getValueParam(EXO_ROOT_GROUP_TYPE_NAME_OPTION);
+ ValueParam exoRootGroupNameParam = params.getValueParam(EXO_ROOT_GROUP_NAME_OPTION);
+ ValueParam passwordAsAttributeParam = params.getValueParam(PASSWORD_AS_ATTRIBUTE_OPTION);
+
+ if (exoGroupTypeNameParam != null)
+ {
+ this.exoGroupType = exoGroupTypeNameParam.getValue();
+ }
+
+ if (exoRootGroupNameParam != null)
+ {
+ this.exoRootGroupName = exoRootGroupNameParam.getValue();
+ }
+
+ if (exoRootGroupTypeNameParam != null)
+ {
+ this.exoRootGroupType = exoRootGroupTypeNameParam.getValue();
+ }
+ else if (exoRootGroupTypeNameParam != null)
+ {
+ this.exoRootGroupType = this.exoGroupType;
+ }
+
+ if (passwordAsAttributeParam != null && passwordAsAttributeParam.getValue().equalsIgnoreCase("true"))
+ {
+ this.passwordAsAttribute = true;
+ }
+ }
+
+ }
+
+ public final org.jboss.identity.idm.api.Group getJBIDMGroup(String groupId) throws Exception
+ {
+ String[] ids = groupId.split("/");
+ String name = ids[ids.length - 1];
+ return jbidmService_.getIdentitySession().getPersistenceManager().findGroup(name, getExoGroupType());
+ }
+
+ @Override
+ public void start()
+ {
+
+ try
+ {
+ // Wrap within transaction so all initializers can work
+ jbidmService_.getIdentitySession().beginTransaction();
+ super.start();
+ jbidmService_.getIdentitySession().getTransaction().commit();
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+
+ }
+
+ @Override
+ public void stop()
+ {
+ //toto
+ }
+
+ public void startRequest(ExoContainer container)
+ {
+ try
+ {
+ jbidmService_.getIdentitySession().beginTransaction();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void endRequest(ExoContainer container)
+ {
+ try
+ {
+ jbidmService_.getIdentitySession().getTransaction().commit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public String getExoGroupType()
+ {
+ return exoGroupType;
+ }
+
+ public String getExoRootGroupName()
+ {
+ return exoRootGroupName;
+ }
+
+ public String getExoRootGroupType()
+ {
+ return exoRootGroupType;
+ }
+
+ public boolean isPasswordAsAttribute()
+ {
+ return passwordAsAttribute;
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,34 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-
-public interface JBossIDMService
-{
-
- IdentitySessionFactory getIdentitySessionFactory();
-
- IdentitySession getIdentitySession() throws Exception;
-
- IdentitySession getIdentitySession(String realm) throws Exception;
-
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMService.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+
+public interface JBossIDMService
+{
+
+ IdentitySessionFactory getIdentitySessionFactory();
+
+ IdentitySession getIdentitySession() throws Exception;
+
+ IdentitySession getIdentitySession(String realm) throws Exception;
+
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,222 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.PropertiesParam;
-import org.exoplatform.container.xml.Property;
-import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.container.xml.ValuesParam;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.dialect.Dialect;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
-import org.jboss.identity.idm.common.exception.IdentityConfigurationException;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
-import org.picocontainer.Startable;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.naming.InitialContext;
-
-public class JBossIDMServiceImpl implements JBossIDMService, Startable
-{
-
- private static Log log_ = ExoLogger.getLogger(JBossIDMServiceImpl.class);
-
- public static final String PARAM_CONFIG_OPTION = "config";
-
- public static final String PARAM_HIBERNATE_PROPS = "hibernate.properties";
-
- public static final String PARAM_HIBERNATE_MAPPINGS = "hibernate.mappings";
-
- public static final String PARAM_HIBERNATE_ANNOTATIONS = "hibernate.annotations";
-
- public static final String PARAM_JNDI_NAME_OPTION = "jndiName";
-
- public static final String DEFAULT_REALM_NAME_OPTION = "PortalRealm";
-
- // We may have several portal containers thus we need one indentitySessionFactory per portal container
- // private static IdentitySessionFactory identitySessionFactory;
- private IdentitySessionFactory identitySessionFactory;
-
- private String config;
-
- private String defaultRealmName = "PortalRealm";
-
- private IdentityConfiguration identityConfiguration;
-
- private JBossIDMServiceImpl()
- {
- }
-
- public JBossIDMServiceImpl(InitParams initParams, ConfigurationManager confManager) throws Exception
- {
- ValueParam config = initParams.getValueParam(PARAM_CONFIG_OPTION);
- ValueParam jndiName = initParams.getValueParam(PARAM_JNDI_NAME_OPTION);
- ValueParam realmName = initParams.getValueParam(DEFAULT_REALM_NAME_OPTION);
-
- if (config == null && jndiName == null)
- {
- throw new IllegalStateException("Either '" + PARAM_CONFIG_OPTION + "' or '" + PARAM_JNDI_NAME_OPTION
- + "' parameter must " + "be specified");
- }
- if (realmName != null)
- {
- this.defaultRealmName = realmName.getValue();
- }
-
- SessionFactory sf = null;
-
- if (initParams.containsKey(PARAM_HIBERNATE_PROPS))
- {
- PropertiesParam param = initParams.getPropertiesParam(PARAM_HIBERNATE_PROPS);
- AnnotationConfiguration conf_ = new AnnotationConfiguration();
- Iterator properties = param.getPropertyIterator();
- while (properties.hasNext())
- {
- Property p = (Property)properties.next();
-
- //
- String name = p.getName();
- String value = p.getValue();
-
- // Julien: Don't remove that unless you know what you are doing
- if (name.equals("hibernate.dialect"))
- {
- Package pkg = Dialect.class.getPackage();
- String dialect = value.substring(22);
- value = pkg.getName() + "." + dialect; // 22 is the length of
- // "org.hibernate.dialect"
- log_.info("Using dialect " + dialect);
- }
-
- //
- conf_.setProperty(name, value);
- }
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- if (initParams.containsKey(PARAM_HIBERNATE_MAPPINGS))
- {
- ValuesParam mappings = initParams.getValuesParam(PARAM_HIBERNATE_MAPPINGS);
-
- List<String> paths = mappings.getValues();
-
- for (String path : paths)
- {
- URL url = cl.getResource(path);
- log_.info("Adding Hibernate Mapping: " + path);
- conf_.addURL(url);
- }
- }
-
- if (initParams.containsKey(PARAM_HIBERNATE_ANNOTATIONS))
- {
- ValuesParam annotations = initParams.getValuesParam(PARAM_HIBERNATE_ANNOTATIONS);
-
- List<String> classes = annotations.getValues();
-
- for (String name : classes)
- {
- Class clazz = cl.loadClass(name);
- conf_.addAnnotatedClass(clazz);
- }
-
- }
-
- sf = conf_.buildSessionFactory();
-
- }
-
- if (config != null)
- {
- this.config = config.getValue();
- URL configURL = confManager.getURL(this.config);
-
- if (configURL == null)
- {
- throw new IllegalStateException("Cannot fine resource: " + this.config);
- }
-
- IdentityConfigurationMetaData configMD =
- JAXB2IdentityConfiguration.createConfigurationMetaData(confManager.getInputStream(this.config));
-
- identityConfiguration = new IdentityConfigurationImpl().configure(configMD);
-
- if (sf != null)
- {
- identityConfiguration.getIdentityConfigurationRegistry().register(sf, "hibernateSessionFactory");
- }
- }
- else
- {
- identitySessionFactory = (IdentitySessionFactory)new InitialContext().lookup(jndiName.getValue());
- }
-
- }
-
- public void start()
- {
- if (identitySessionFactory == null)
- {
- try
- {
- identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
- }
- catch (IdentityConfigurationException e)
- {
- throw new RuntimeException(e);
- }
- }
- }
-
- public void stop()
- {
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public IdentitySession getIdentitySession() throws Exception
- {
- return getIdentitySessionFactory().getCurrentIdentitySession(defaultRealmName);
- }
-
- public IdentitySession getIdentitySession(String realm) throws Exception
- {
- if (realm == null)
- {
- throw new IllegalArgumentException("Realm name cannot be null");
- }
- return getIdentitySessionFactory().getCurrentIdentitySession(realm);
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/JBossIDMServiceImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,222 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.PropertiesParam;
+import org.exoplatform.container.xml.Property;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.container.xml.ValuesParam;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.dialect.Dialect;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
+import org.jboss.identity.idm.common.exception.IdentityConfigurationException;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.picocontainer.Startable;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.InitialContext;
+
+public class JBossIDMServiceImpl implements JBossIDMService, Startable
+{
+
+ private static Log log_ = ExoLogger.getLogger(JBossIDMServiceImpl.class);
+
+ public static final String PARAM_CONFIG_OPTION = "config";
+
+ public static final String PARAM_HIBERNATE_PROPS = "hibernate.properties";
+
+ public static final String PARAM_HIBERNATE_MAPPINGS = "hibernate.mappings";
+
+ public static final String PARAM_HIBERNATE_ANNOTATIONS = "hibernate.annotations";
+
+ public static final String PARAM_JNDI_NAME_OPTION = "jndiName";
+
+ public static final String DEFAULT_REALM_NAME_OPTION = "PortalRealm";
+
+ // We may have several portal containers thus we need one indentitySessionFactory per portal container
+ // private static IdentitySessionFactory identitySessionFactory;
+ private IdentitySessionFactory identitySessionFactory;
+
+ private String config;
+
+ private String defaultRealmName = "PortalRealm";
+
+ private IdentityConfiguration identityConfiguration;
+
+ private JBossIDMServiceImpl()
+ {
+ }
+
+ public JBossIDMServiceImpl(InitParams initParams, ConfigurationManager confManager) throws Exception
+ {
+ ValueParam config = initParams.getValueParam(PARAM_CONFIG_OPTION);
+ ValueParam jndiName = initParams.getValueParam(PARAM_JNDI_NAME_OPTION);
+ ValueParam realmName = initParams.getValueParam(DEFAULT_REALM_NAME_OPTION);
+
+ if (config == null && jndiName == null)
+ {
+ throw new IllegalStateException("Either '" + PARAM_CONFIG_OPTION + "' or '" + PARAM_JNDI_NAME_OPTION
+ + "' parameter must " + "be specified");
+ }
+ if (realmName != null)
+ {
+ this.defaultRealmName = realmName.getValue();
+ }
+
+ SessionFactory sf = null;
+
+ if (initParams.containsKey(PARAM_HIBERNATE_PROPS))
+ {
+ PropertiesParam param = initParams.getPropertiesParam(PARAM_HIBERNATE_PROPS);
+ AnnotationConfiguration conf_ = new AnnotationConfiguration();
+ Iterator properties = param.getPropertyIterator();
+ while (properties.hasNext())
+ {
+ Property p = (Property)properties.next();
+
+ //
+ String name = p.getName();
+ String value = p.getValue();
+
+ // Julien: Don't remove that unless you know what you are doing
+ if (name.equals("hibernate.dialect"))
+ {
+ Package pkg = Dialect.class.getPackage();
+ String dialect = value.substring(22);
+ value = pkg.getName() + "." + dialect; // 22 is the length of
+ // "org.hibernate.dialect"
+ log_.info("Using dialect " + dialect);
+ }
+
+ //
+ conf_.setProperty(name, value);
+ }
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+ if (initParams.containsKey(PARAM_HIBERNATE_MAPPINGS))
+ {
+ ValuesParam mappings = initParams.getValuesParam(PARAM_HIBERNATE_MAPPINGS);
+
+ List<String> paths = mappings.getValues();
+
+ for (String path : paths)
+ {
+ URL url = cl.getResource(path);
+ log_.info("Adding Hibernate Mapping: " + path);
+ conf_.addURL(url);
+ }
+ }
+
+ if (initParams.containsKey(PARAM_HIBERNATE_ANNOTATIONS))
+ {
+ ValuesParam annotations = initParams.getValuesParam(PARAM_HIBERNATE_ANNOTATIONS);
+
+ List<String> classes = annotations.getValues();
+
+ for (String name : classes)
+ {
+ Class clazz = cl.loadClass(name);
+ conf_.addAnnotatedClass(clazz);
+ }
+
+ }
+
+ sf = conf_.buildSessionFactory();
+
+ }
+
+ if (config != null)
+ {
+ this.config = config.getValue();
+ URL configURL = confManager.getURL(this.config);
+
+ if (configURL == null)
+ {
+ throw new IllegalStateException("Cannot fine resource: " + this.config);
+ }
+
+ IdentityConfigurationMetaData configMD =
+ JAXB2IdentityConfiguration.createConfigurationMetaData(confManager.getInputStream(this.config));
+
+ identityConfiguration = new IdentityConfigurationImpl().configure(configMD);
+
+ if (sf != null)
+ {
+ identityConfiguration.getIdentityConfigurationRegistry().register(sf, "hibernateSessionFactory");
+ }
+ }
+ else
+ {
+ identitySessionFactory = (IdentitySessionFactory)new InitialContext().lookup(jndiName.getValue());
+ }
+
+ }
+
+ public void start()
+ {
+ if (identitySessionFactory == null)
+ {
+ try
+ {
+ identitySessionFactory = identityConfiguration.buildIdentitySessionFactory();
+ }
+ catch (IdentityConfigurationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public void stop()
+ {
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public IdentitySession getIdentitySession() throws Exception
+ {
+ return getIdentitySessionFactory().getCurrentIdentitySession(defaultRealmName);
+ }
+
+ public IdentitySession getIdentitySession(String realm) throws Exception
+ {
+ if (realm == null)
+ {
+ throw new IllegalArgumentException("Realm name cannot be null");
+ }
+ return getIdentitySessionFactory().getCurrentIdentitySession(realm);
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,394 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.commons.utils.ListenerStack;
-import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.Membership;
-import org.exoplatform.services.organization.MembershipEventListener;
-import org.exoplatform.services.organization.MembershipHandler;
-import org.exoplatform.services.organization.MembershipType;
-import org.exoplatform.services.organization.User;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.RoleType;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.naming.InvalidNameException;
-
-/**
- */
-public class MembershipDAOImpl implements MembershipHandler
-{
-
- private JBossIDMService service_;
-
- private List listeners_;
-
- private JBossIDMOrganizationServiceImpl orgService;
-
- public MembershipDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
- {
- service_ = service;
- listeners_ = new ListenerStack(5);
- this.orgService = orgService;
- }
-
- public void addMembershipEventListener(MembershipEventListener listener)
- {
- listeners_.add(listener);
- }
-
- final public Membership createMembershipInstance()
- {
- return new MembershipImpl();
- }
-
- public void createMembership(Membership m, boolean broadcast) throws Exception
- {
-
- if (broadcast)
- {
- preSave(m, true);
- }
-
- saveMembership(m, false);
-
- if (broadcast)
- {
- postSave(m, true);
- }
-
- }
-
- public void linkMembership(User user, Group g, MembershipType mt, boolean broadcast) throws Exception
- {
- if (g == null)
- {
- throw new InvalidNameException("Can not create membership record for " + user.getUserName()
- + " because group is null");
- }
-
- if (mt == null)
- {
- throw new InvalidNameException("Can not create membership record for " + user.getUserName()
- + " because membership type is null");
- }
-
- if (getIdentitySession().getRoleManager().getRoleType(mt.getName()) == null)
- {
- getIdentitySession().getRoleManager().createRoleType(mt.getName());
- }
-
- String groupId =
- getIdentitySession().getPersistenceManager().createGroupId(g.getGroupName(), orgService.getExoGroupType());
-
- if (getIdentitySession().getRoleManager().hasRole(user.getUserName(), groupId, mt.getName()))
- {
- return;
- }
-
- MembershipImpl membership = new MembershipImpl();
- membership.setMembershipType(mt.getName());
- membership.setUserName(user.getUserName());
- membership.setGroupId(g.getId());
-
- if (broadcast)
- {
- preSave(membership, true);
- }
-
- getIdentitySession().getRoleManager().createRole(mt.getName(), user.getUserName(), groupId);
-
- if (broadcast)
- {
- postSave(membership, true);
- }
-
- }
-
- public void saveMembership(Membership m, boolean broadcast) throws Exception
- {
- String groupId =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
- orgService.getExoGroupType());
-
- if (getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
- {
- return;
- }
-
- if (broadcast)
- {
- preSave(m, false);
- }
-
- getIdentitySession().getRoleManager().createRole(m.getMembershipType(), m.getUserName(), groupId);
-
- if (broadcast)
- {
- postSave(m, false);
- }
- }
-
- public Membership removeMembership(String id, boolean broadcast) throws Exception
- {
-
- Membership m = new MembershipImpl(id);
-
- String groupId =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
- orgService.getExoGroupType());
-
- if (!getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
- {
- return m;
- }
-
- if (broadcast)
- {
- preDelete(m);
- }
-
- getIdentitySession().getRoleManager().removeRole(m.getMembershipType(), m.getUserName(), groupId);
-
- if (broadcast)
- {
- postDelete(m);
- }
- return m;
- }
-
- public Collection removeMembershipByUser(String userName, boolean broadcast) throws Exception
- {
-
- Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(userName, null);
-
- //TODO: Exo UI has hardcoded casts to List
- List<Membership> memberships = new LinkedList<Membership>();
-
- for (Role role : roles)
- {
- MembershipImpl m = new MembershipImpl();
- Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
- m.setGroupId(g.getId());
- m.setUserName(role.getUser().getId());
- m.setMembershipType(role.getRoleType().getName());
- memberships.add(m);
-
- if (broadcast)
- {
- preDelete(m);
- }
-
- getIdentitySession().getRoleManager().removeRole(role);
-
- if (broadcast)
- {
- postDelete(m);
- }
-
- }
-
- return memberships;
-
- }
-
- public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
- {
- String gid =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
- orgService.getExoGroupType());
-
- Role role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
-
- if (role == null)
- {
- return null;
- }
-
- MembershipImpl m = new MembershipImpl();
- m.setGroupId(groupId);
- m.setUserName(userName);
- m.setMembershipType(type);
-
- return m;
- }
-
- public Collection findMembershipsByUserAndGroup(String userName, String groupId) throws Exception
- {
- if (userName == null)
- {
- // julien fix : if user name is null, need to check if we do need to return a special group
- return Collections.emptyList();
- }
-
- String gid =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
- orgService.getExoGroupType());
-
- Collection<RoleType> roleTypes = getIdentitySession().getRoleManager().findRoleTypes(userName, gid, null);
-
- //TODO: Exo UI has hardcoded casts to List
- List<Membership> memberships = new LinkedList<Membership>();
-
- for (RoleType roleType : roleTypes)
- {
- MembershipImpl m = new MembershipImpl();
- m.setGroupId(groupId);
- m.setUserName(userName);
- m.setMembershipType(roleType.getName());
- memberships.add(m);
- }
-
- return memberships;
- }
-
- public Collection findMembershipsByUser(String userName) throws Exception
- {
- Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(userName, null);
-
- //TODO: Exo UI has hardcoded casts to List
- List<Membership> memberships = new LinkedList<Membership>();
-
- for (Role role : roles)
- {
- MembershipImpl m = new MembershipImpl();
- Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
- m.setGroupId(g.getId());
- m.setUserName(role.getUser().getId());
- m.setMembershipType(role.getRoleType().getName());
- memberships.add(m);
- }
-
- return memberships;
- }
-
- static void removeMembershipEntriesOfGroup(JBossIDMOrganizationServiceImpl orgService, Group group,
- IdentitySession session) throws Exception
- {
- String gid = session.getPersistenceManager().createGroupId(group.getGroupName(), orgService.getExoGroupType());
-
- Collection<Role> roles = session.getRoleManager().findRoles(gid, null);
-
- for (Role role : roles)
- {
- session.getRoleManager().removeRole(role);
- }
- }
-
- public Collection findMembershipsByGroup(Group group) throws Exception
- {
- return findMembershipsByGroupId(group.getId());
- }
-
- public Collection findMembershipsByGroupId(String groupId) throws Exception
- {
- String gid =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
- orgService.getExoGroupType());
-
- Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(gid, null);
-
- //TODO: Exo UI has hardcoded casts to List
- List<Membership> memberships = new LinkedList<Membership>();
-
- for (Role role : roles)
- {
- MembershipImpl m = new MembershipImpl();
- Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
- m.setGroupId(g.getId());
- m.setUserName(role.getUser().getId());
- m.setMembershipType(role.getRoleType().getName());
- memberships.add(m);
- }
-
- return memberships;
-
- }
-
- public Membership findMembership(String id) throws Exception
- {
- Membership m = new MembershipImpl(id);
-
- String groupId =
- getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
- orgService.getExoGroupType());
-
- if (getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
- {
- return m;
- }
-
- return null;
- }
-
- private void preSave(Membership membership, boolean isNew) throws Exception
- {
- for (int i = 0; i < listeners_.size(); i++)
- {
- MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
- listener.preSave(membership, isNew);
- }
- }
-
- private void postSave(Membership membership, boolean isNew) throws Exception
- {
- for (int i = 0; i < listeners_.size(); i++)
- {
- MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
- listener.postSave(membership, isNew);
- }
- }
-
- private void preDelete(Membership membership) throws Exception
- {
- for (int i = 0; i < listeners_.size(); i++)
- {
- MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
- listener.preDelete(membership);
- }
- }
-
- private void postDelete(Membership membership) throws Exception
- {
- for (int i = 0; i < listeners_.size(); i++)
- {
- MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
- listener.postDelete(membership);
- }
- }
-
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-
- private String getGroupNameFromId(String groupId)
- {
- String[] ids = groupId.split("/");
-
- return ids[ids.length - 1];
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,394 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.commons.utils.ListenerStack;
+import org.exoplatform.services.organization.Group;
+import org.exoplatform.services.organization.Membership;
+import org.exoplatform.services.organization.MembershipEventListener;
+import org.exoplatform.services.organization.MembershipHandler;
+import org.exoplatform.services.organization.MembershipType;
+import org.exoplatform.services.organization.User;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.RoleType;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.naming.InvalidNameException;
+
+/**
+ */
+public class MembershipDAOImpl implements MembershipHandler
+{
+
+ private JBossIDMService service_;
+
+ private List listeners_;
+
+ private JBossIDMOrganizationServiceImpl orgService;
+
+ public MembershipDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
+ {
+ service_ = service;
+ listeners_ = new ListenerStack(5);
+ this.orgService = orgService;
+ }
+
+ public void addMembershipEventListener(MembershipEventListener listener)
+ {
+ listeners_.add(listener);
+ }
+
+ final public Membership createMembershipInstance()
+ {
+ return new MembershipImpl();
+ }
+
+ public void createMembership(Membership m, boolean broadcast) throws Exception
+ {
+
+ if (broadcast)
+ {
+ preSave(m, true);
+ }
+
+ saveMembership(m, false);
+
+ if (broadcast)
+ {
+ postSave(m, true);
+ }
+
+ }
+
+ public void linkMembership(User user, Group g, MembershipType mt, boolean broadcast) throws Exception
+ {
+ if (g == null)
+ {
+ throw new InvalidNameException("Can not create membership record for " + user.getUserName()
+ + " because group is null");
+ }
+
+ if (mt == null)
+ {
+ throw new InvalidNameException("Can not create membership record for " + user.getUserName()
+ + " because membership type is null");
+ }
+
+ if (getIdentitySession().getRoleManager().getRoleType(mt.getName()) == null)
+ {
+ getIdentitySession().getRoleManager().createRoleType(mt.getName());
+ }
+
+ String groupId =
+ getIdentitySession().getPersistenceManager().createGroupId(g.getGroupName(), orgService.getExoGroupType());
+
+ if (getIdentitySession().getRoleManager().hasRole(user.getUserName(), groupId, mt.getName()))
+ {
+ return;
+ }
+
+ MembershipImpl membership = new MembershipImpl();
+ membership.setMembershipType(mt.getName());
+ membership.setUserName(user.getUserName());
+ membership.setGroupId(g.getId());
+
+ if (broadcast)
+ {
+ preSave(membership, true);
+ }
+
+ getIdentitySession().getRoleManager().createRole(mt.getName(), user.getUserName(), groupId);
+
+ if (broadcast)
+ {
+ postSave(membership, true);
+ }
+
+ }
+
+ public void saveMembership(Membership m, boolean broadcast) throws Exception
+ {
+ String groupId =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
+ orgService.getExoGroupType());
+
+ if (getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
+ {
+ return;
+ }
+
+ if (broadcast)
+ {
+ preSave(m, false);
+ }
+
+ getIdentitySession().getRoleManager().createRole(m.getMembershipType(), m.getUserName(), groupId);
+
+ if (broadcast)
+ {
+ postSave(m, false);
+ }
+ }
+
+ public Membership removeMembership(String id, boolean broadcast) throws Exception
+ {
+
+ Membership m = new MembershipImpl(id);
+
+ String groupId =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
+ orgService.getExoGroupType());
+
+ if (!getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
+ {
+ return m;
+ }
+
+ if (broadcast)
+ {
+ preDelete(m);
+ }
+
+ getIdentitySession().getRoleManager().removeRole(m.getMembershipType(), m.getUserName(), groupId);
+
+ if (broadcast)
+ {
+ postDelete(m);
+ }
+ return m;
+ }
+
+ public Collection removeMembershipByUser(String userName, boolean broadcast) throws Exception
+ {
+
+ Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(userName, null);
+
+ //TODO: Exo UI has hardcoded casts to List
+ List<Membership> memberships = new LinkedList<Membership>();
+
+ for (Role role : roles)
+ {
+ MembershipImpl m = new MembershipImpl();
+ Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
+ m.setGroupId(g.getId());
+ m.setUserName(role.getUser().getId());
+ m.setMembershipType(role.getRoleType().getName());
+ memberships.add(m);
+
+ if (broadcast)
+ {
+ preDelete(m);
+ }
+
+ getIdentitySession().getRoleManager().removeRole(role);
+
+ if (broadcast)
+ {
+ postDelete(m);
+ }
+
+ }
+
+ return memberships;
+
+ }
+
+ public Membership findMembershipByUserGroupAndType(String userName, String groupId, String type) throws Exception
+ {
+ String gid =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
+ orgService.getExoGroupType());
+
+ Role role = getIdentitySession().getRoleManager().getRole(type, userName, gid);
+
+ if (role == null)
+ {
+ return null;
+ }
+
+ MembershipImpl m = new MembershipImpl();
+ m.setGroupId(groupId);
+ m.setUserName(userName);
+ m.setMembershipType(type);
+
+ return m;
+ }
+
+ public Collection findMembershipsByUserAndGroup(String userName, String groupId) throws Exception
+ {
+ if (userName == null)
+ {
+ // julien fix : if user name is null, need to check if we do need to return a special group
+ return Collections.emptyList();
+ }
+
+ String gid =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
+ orgService.getExoGroupType());
+
+ Collection<RoleType> roleTypes = getIdentitySession().getRoleManager().findRoleTypes(userName, gid, null);
+
+ //TODO: Exo UI has hardcoded casts to List
+ List<Membership> memberships = new LinkedList<Membership>();
+
+ for (RoleType roleType : roleTypes)
+ {
+ MembershipImpl m = new MembershipImpl();
+ m.setGroupId(groupId);
+ m.setUserName(userName);
+ m.setMembershipType(roleType.getName());
+ memberships.add(m);
+ }
+
+ return memberships;
+ }
+
+ public Collection findMembershipsByUser(String userName) throws Exception
+ {
+ Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(userName, null);
+
+ //TODO: Exo UI has hardcoded casts to List
+ List<Membership> memberships = new LinkedList<Membership>();
+
+ for (Role role : roles)
+ {
+ MembershipImpl m = new MembershipImpl();
+ Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
+ m.setGroupId(g.getId());
+ m.setUserName(role.getUser().getId());
+ m.setMembershipType(role.getRoleType().getName());
+ memberships.add(m);
+ }
+
+ return memberships;
+ }
+
+ static void removeMembershipEntriesOfGroup(JBossIDMOrganizationServiceImpl orgService, Group group,
+ IdentitySession session) throws Exception
+ {
+ String gid = session.getPersistenceManager().createGroupId(group.getGroupName(), orgService.getExoGroupType());
+
+ Collection<Role> roles = session.getRoleManager().findRoles(gid, null);
+
+ for (Role role : roles)
+ {
+ session.getRoleManager().removeRole(role);
+ }
+ }
+
+ public Collection findMembershipsByGroup(Group group) throws Exception
+ {
+ return findMembershipsByGroupId(group.getId());
+ }
+
+ public Collection findMembershipsByGroupId(String groupId) throws Exception
+ {
+ String gid =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(groupId),
+ orgService.getExoGroupType());
+
+ Collection<Role> roles = getIdentitySession().getRoleManager().findRoles(gid, null);
+
+ //TODO: Exo UI has hardcoded casts to List
+ List<Membership> memberships = new LinkedList<Membership>();
+
+ for (Role role : roles)
+ {
+ MembershipImpl m = new MembershipImpl();
+ Group g = ((GroupDAOImpl)orgService.getGroupHandler()).getGroup(role.getGroup().getName());
+ m.setGroupId(g.getId());
+ m.setUserName(role.getUser().getId());
+ m.setMembershipType(role.getRoleType().getName());
+ memberships.add(m);
+ }
+
+ return memberships;
+
+ }
+
+ public Membership findMembership(String id) throws Exception
+ {
+ Membership m = new MembershipImpl(id);
+
+ String groupId =
+ getIdentitySession().getPersistenceManager().createGroupId(getGroupNameFromId(m.getGroupId()),
+ orgService.getExoGroupType());
+
+ if (getIdentitySession().getRoleManager().hasRole(m.getUserName(), groupId, m.getMembershipType()))
+ {
+ return m;
+ }
+
+ return null;
+ }
+
+ private void preSave(Membership membership, boolean isNew) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
+ listener.preSave(membership, isNew);
+ }
+ }
+
+ private void postSave(Membership membership, boolean isNew) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
+ listener.postSave(membership, isNew);
+ }
+ }
+
+ private void preDelete(Membership membership) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
+ listener.preDelete(membership);
+ }
+ }
+
+ private void postDelete(Membership membership) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipEventListener listener = (MembershipEventListener)listeners_.get(i);
+ listener.postDelete(membership);
+ }
+ }
+
+ private IdentitySession getIdentitySession() throws Exception
+ {
+ return service_.getIdentitySession();
+ }
+
+ private String getGroupNameFromId(String groupId)
+ {
+ String[] ids = groupId.split("/");
+
+ return ids[ids.length - 1];
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,106 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.services.organization.Membership;
-
-public class MembershipImpl implements Membership
-{
- private String membershipType = "member";
-
- private String userName = null;
-
- private String groupId = null;
-
- public MembershipImpl()
- {
- }
-
- public MembershipImpl(String id)
- {
- String[] fields = id.split(":");
-
- // Id can be pure "//" in some cases
- if (fields[0] != null)
- {
- membershipType = fields[0];
- }
- if (fields[1] != null)
- {
- userName = fields[1];
- }
- if (fields[2] != null)
- {
- groupId = fields[2];
- }
- }
-
- public String getId()
- {
- StringBuffer id = new StringBuffer();
-
- if (membershipType != null)
- {
- id.append(membershipType);
- }
- id.append(":");
- if (userName != null)
- {
- id.append(userName);
- }
- id.append(":");
- if (groupId != null)
- {
- id.append(groupId);
- }
-
- return id.toString();
- }
-
- public String getMembershipType()
- {
- return membershipType;
- }
-
- public void setMembershipType(String membershipType)
- {
- this.membershipType = membershipType;
- }
-
- public String getUserName()
- {
- return userName;
- }
-
- public void setUserName(String userName)
- {
- this.userName = userName;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public void setGroupId(String groupId)
- {
- this.groupId = groupId;
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,106 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.services.organization.Membership;
+
+public class MembershipImpl implements Membership
+{
+ private String membershipType = "member";
+
+ private String userName = null;
+
+ private String groupId = null;
+
+ public MembershipImpl()
+ {
+ }
+
+ public MembershipImpl(String id)
+ {
+ String[] fields = id.split(":");
+
+ // Id can be pure "//" in some cases
+ if (fields[0] != null)
+ {
+ membershipType = fields[0];
+ }
+ if (fields[1] != null)
+ {
+ userName = fields[1];
+ }
+ if (fields[2] != null)
+ {
+ groupId = fields[2];
+ }
+ }
+
+ public String getId()
+ {
+ StringBuffer id = new StringBuffer();
+
+ if (membershipType != null)
+ {
+ id.append(membershipType);
+ }
+ id.append(":");
+ if (userName != null)
+ {
+ id.append(userName);
+ }
+ id.append(":");
+ if (groupId != null)
+ {
+ id.append(groupId);
+ }
+
+ return id.toString();
+ }
+
+ public String getMembershipType()
+ {
+ return membershipType;
+ }
+
+ public void setMembershipType(String membershipType)
+ {
+ this.membershipType = membershipType;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public void setUserName(String userName)
+ {
+ this.userName = userName;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId)
+ {
+ this.groupId = groupId;
+ }
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,178 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.services.organization.MembershipType;
-import org.exoplatform.services.organization.MembershipTypeHandler;
-import org.exoplatform.services.organization.impl.MembershipTypeImpl;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.RoleType;
-
-import java.text.DateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public class MembershipTypeDAOImpl implements MembershipTypeHandler
-{
-
- public static final String MEMBERSHIP_DESCRIPTION = "description";
-
- public static final String MEMBERSHIP_OWNER = "owner";
-
- public static final String MEMBERSHIP_CREATE_DATE = "create_date";
-
- public static final String MEMBERSHIP_MODIFIED_DATE = "modified_date";
-
- public static final DateFormat dateFormat = DateFormat.getInstance();
-
- private JBossIDMService service_;
-
- private JBossIDMOrganizationServiceImpl orgService;
-
- public MembershipTypeDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
- {
- service_ = service;
- this.orgService = orgService;
- }
-
- final public MembershipType createMembershipTypeInstance()
- {
- return new MembershipTypeImpl();
- }
-
- public MembershipType createMembershipType(MembershipType mt, boolean broadcast) throws Exception
- {
- Date now = new Date();
- mt.setCreatedDate(now);
- mt.setModifiedDate(now);
-
- getIdentitySession().getRoleManager().createRoleType(mt.getName());
- updateMembershipType(mt);
-
- return mt;
- }
-
- public MembershipType saveMembershipType(MembershipType mt, boolean broadcast) throws Exception
- {
- Date now = new Date();
- mt.setModifiedDate(now);
- updateMembershipType(mt);
- return mt;
- }
-
- public MembershipType findMembershipType(String name) throws Exception
- {
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(name);
-
- MembershipType mt = null;
-
- if (rt != null)
- {
- mt = new MembershipTypeImpl(name, null, null);
- populateMembershipType(mt);
- }
-
- return mt;
- }
-
- public MembershipType removeMembershipType(String name, boolean broadcast) throws Exception
- {
- MembershipType mt = findMembershipType(name);
-
- if (mt != null)
- {
- getIdentitySession().getRoleManager().removeRoleType(mt.getName());
- }
-
- return mt;
-
- }
-
- public Collection findMembershipTypes() throws Exception
- {
-
- Collection<RoleType> rts = getIdentitySession().getRoleManager().findRoleTypes();
-
- List<MembershipType> mts = new LinkedList<MembershipType>();
-
- for (RoleType rt : rts)
- {
- MembershipType mt = new MembershipTypeImpl(rt.getName(), null, null);
- populateMembershipType(mt);
- mts.add(mt);
- }
-
- return mts;
- }
-
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-
- private void updateMembershipType(MembershipType mt) throws Exception
- {
-
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
-
- Map<String, String> props = new HashMap<String, String>();
-
- props.put(MEMBERSHIP_DESCRIPTION, mt.getDescription());
- props.put(MEMBERSHIP_CREATE_DATE, mt.getCreatedDate() == null ? null : dateFormat.format(mt.getCreatedDate()));
- props
- .put(MEMBERSHIP_MODIFIED_DATE, mt.getModifiedDate() == null ? null : dateFormat.format(mt.getModifiedDate()));
- props.put(MEMBERSHIP_OWNER, mt.getOwner());
-
- getIdentitySession().getRoleManager().setProperties(rt, props);
-
- return;
-
- }
-
- private void populateMembershipType(MembershipType mt) throws Exception
- {
- RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
-
- Map<String, String> props = getIdentitySession().getRoleManager().getProperties(rt);
-
- mt.setDescription(props.get(MEMBERSHIP_DESCRIPTION));
- mt.setOwner(props.get(MEMBERSHIP_OWNER));
-
- String cd = props.get(MEMBERSHIP_CREATE_DATE);
- String md = props.get(MEMBERSHIP_MODIFIED_DATE);
-
- if (cd != null)
- {
- mt.setCreatedDate(dateFormat.parse(cd));
- }
-
- if (md != null)
- {
- mt.setModifiedDate(dateFormat.parse(md));
- }
-
- return;
- }
-
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/MembershipTypeDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,178 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.services.organization.MembershipType;
+import org.exoplatform.services.organization.MembershipTypeHandler;
+import org.exoplatform.services.organization.impl.MembershipTypeImpl;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.RoleType;
+
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class MembershipTypeDAOImpl implements MembershipTypeHandler
+{
+
+ public static final String MEMBERSHIP_DESCRIPTION = "description";
+
+ public static final String MEMBERSHIP_OWNER = "owner";
+
+ public static final String MEMBERSHIP_CREATE_DATE = "create_date";
+
+ public static final String MEMBERSHIP_MODIFIED_DATE = "modified_date";
+
+ public static final DateFormat dateFormat = DateFormat.getInstance();
+
+ private JBossIDMService service_;
+
+ private JBossIDMOrganizationServiceImpl orgService;
+
+ public MembershipTypeDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service)
+ {
+ service_ = service;
+ this.orgService = orgService;
+ }
+
+ final public MembershipType createMembershipTypeInstance()
+ {
+ return new MembershipTypeImpl();
+ }
+
+ public MembershipType createMembershipType(MembershipType mt, boolean broadcast) throws Exception
+ {
+ Date now = new Date();
+ mt.setCreatedDate(now);
+ mt.setModifiedDate(now);
+
+ getIdentitySession().getRoleManager().createRoleType(mt.getName());
+ updateMembershipType(mt);
+
+ return mt;
+ }
+
+ public MembershipType saveMembershipType(MembershipType mt, boolean broadcast) throws Exception
+ {
+ Date now = new Date();
+ mt.setModifiedDate(now);
+ updateMembershipType(mt);
+ return mt;
+ }
+
+ public MembershipType findMembershipType(String name) throws Exception
+ {
+ RoleType rt = getIdentitySession().getRoleManager().getRoleType(name);
+
+ MembershipType mt = null;
+
+ if (rt != null)
+ {
+ mt = new MembershipTypeImpl(name, null, null);
+ populateMembershipType(mt);
+ }
+
+ return mt;
+ }
+
+ public MembershipType removeMembershipType(String name, boolean broadcast) throws Exception
+ {
+ MembershipType mt = findMembershipType(name);
+
+ if (mt != null)
+ {
+ getIdentitySession().getRoleManager().removeRoleType(mt.getName());
+ }
+
+ return mt;
+
+ }
+
+ public Collection findMembershipTypes() throws Exception
+ {
+
+ Collection<RoleType> rts = getIdentitySession().getRoleManager().findRoleTypes();
+
+ List<MembershipType> mts = new LinkedList<MembershipType>();
+
+ for (RoleType rt : rts)
+ {
+ MembershipType mt = new MembershipTypeImpl(rt.getName(), null, null);
+ populateMembershipType(mt);
+ mts.add(mt);
+ }
+
+ return mts;
+ }
+
+ private IdentitySession getIdentitySession() throws Exception
+ {
+ return service_.getIdentitySession();
+ }
+
+ private void updateMembershipType(MembershipType mt) throws Exception
+ {
+
+ RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
+
+ Map<String, String> props = new HashMap<String, String>();
+
+ props.put(MEMBERSHIP_DESCRIPTION, mt.getDescription());
+ props.put(MEMBERSHIP_CREATE_DATE, mt.getCreatedDate() == null ? null : dateFormat.format(mt.getCreatedDate()));
+ props
+ .put(MEMBERSHIP_MODIFIED_DATE, mt.getModifiedDate() == null ? null : dateFormat.format(mt.getModifiedDate()));
+ props.put(MEMBERSHIP_OWNER, mt.getOwner());
+
+ getIdentitySession().getRoleManager().setProperties(rt, props);
+
+ return;
+
+ }
+
+ private void populateMembershipType(MembershipType mt) throws Exception
+ {
+ RoleType rt = getIdentitySession().getRoleManager().getRoleType(mt.getName());
+
+ Map<String, String> props = getIdentitySession().getRoleManager().getProperties(rt);
+
+ mt.setDescription(props.get(MEMBERSHIP_DESCRIPTION));
+ mt.setOwner(props.get(MEMBERSHIP_OWNER));
+
+ String cd = props.get(MEMBERSHIP_CREATE_DATE);
+ String md = props.get(MEMBERSHIP_MODIFIED_DATE);
+
+ if (cd != null)
+ {
+ mt.setCreatedDate(dateFormat.parse(cd));
+ }
+
+ if (md != null)
+ {
+ mt.setModifiedDate(dateFormat.parse(md));
+ }
+
+ return;
+ }
+
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,416 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.organization.Query;
-import org.exoplatform.services.organization.User;
-import org.exoplatform.services.organization.UserEventListener;
-import org.exoplatform.services.organization.UserHandler;
-import org.exoplatform.services.organization.impl.UserImpl;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.AttributesManager;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.query.UserQueryBuilder;
-import org.jboss.identity.idm.impl.api.SimpleAttribute;
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- */
-public class UserDAOImpl implements UserHandler
-{
-
- private final JBossIDMService service_;
-
- private ExoCache cache_;
-
- private List<UserEventListener> listeners_ = new ArrayList<UserEventListener>(3);
-
- public static final String USER_PASSWORD = "password";
-
- public static final String USER_FIRST_NAME = "firstName";
-
- public static final String USER_LAST_NAME = "lastName";
-
- public static final String USER_EMAIL = "email";
-
- public static final String USER_CREATED_DATE = "createdDate";
-
- public static final String USER_LAST_LOGIN_TIME = "lastLoginTime";
-
- public static final String USER_ORGANIZATION_ID = "organizationId";
-
- public static final Set<String> USER_NON_PROFILE_KEYS;
-
- public static final DateFormat dateFormat = DateFormat.getInstance();
-
- private JBossIDMOrganizationServiceImpl orgService;
-
- static
- {
- Set<String> keys = new HashSet<String>();
- keys.add(USER_PASSWORD);
- keys.add(USER_FIRST_NAME);
- keys.add(USER_LAST_NAME);
- keys.add(USER_EMAIL);
- keys.add(USER_CREATED_DATE);
- keys.add(USER_LAST_LOGIN_TIME);
- keys.add(USER_ORGANIZATION_ID);
-
- USER_NON_PROFILE_KEYS = Collections.unmodifiableSet(keys);
- }
-
- public UserDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService idmService, CacheService cservice)
- throws Exception
- {
- service_ = idmService;
- cache_ = cservice.getCacheInstance(UserImpl.class.getName());
- this.orgService = orgService;
- }
-
- final public List getUserEventListeners()
- {
- return listeners_;
- }
-
- public void addUserEventListener(UserEventListener listener)
- {
- listeners_.add(listener);
- }
-
- public User createUserInstance()
- {
- return new UserImpl();
- }
-
- public User createUserInstance(String username)
- {
- return new UserImpl(username);
- }
-
- public void createUser(User user, boolean broadcast) throws Exception
- {
- IdentitySession session = service_.getIdentitySession();
- if (broadcast)
- {
- preSave(user, true);
- }
-
- session.getPersistenceManager().createUser(user.getUserName());
-
- persistUserInfo(user, session);
-
- if (broadcast)
- {
- postSave(user, true);
- }
-
- }
-
- public void saveUser(User user, boolean broadcast) throws Exception
- {
- IdentitySession session = service_.getIdentitySession();
- if (broadcast)
- {
- preSave(user, false);
- }
-
- persistUserInfo(user, session);
-
- if (broadcast)
- {
- postSave(user, false);
- }
- cache_.put(user.getUserName(), user);
- }
-
- public User removeUser(String userName, boolean broadcast) throws Exception
- {
- IdentitySession session = service_.getIdentitySession();
-
- org.jboss.identity.idm.api.User foundUser = session.getPersistenceManager().findUser(userName);
-
- if (foundUser == null)
- {
- cache_.remove(userName);
- return null;
- }
-
- User exoUser = getPopulatedUser(userName, session);
-
- if (broadcast)
- {
- preDelete(exoUser);
- }
-
- session.getPersistenceManager().removeUser(foundUser, true);
- if (broadcast)
- {
- postDelete(exoUser);
- }
- cache_.remove(userName);
- return exoUser;
- }
-
- //
- public User findUserByName(String userName) throws Exception
- {
- IdentitySession session = service_.getIdentitySession();
-
- User user = (User)cache_.get(userName);
- if (user != null)
- {
- return user;
- }
- user = getPopulatedUser(userName, session);
- if (user != null)
- {
- cache_.put(userName, user);
- }
- return user;
- }
-
- public LazyPageList getUserPageList(int pageSize) throws Exception
- {
- UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
-
- return new LazyPageList(new IDMUserListAccess(this, service_, qb, pageSize, true), pageSize);
- }
-
- //
- public boolean authenticate(String username, String password) throws Exception
- {
- User user = findUserByName(username);
- if (user == null)
- {
- return false;
- }
-
- boolean authenticated = false;
-
- if (orgService.isPasswordAsAttribute())
- {
- authenticated = user.getPassword().equals(password);
- }
- else
- {
- IdentitySession session = service_.getIdentitySession();
- org.jboss.identity.idm.api.User idmUser = session.getPersistenceManager().findUser(user.getUserName());
-
- authenticated = session.getAttributesManager().validatePassword(idmUser, password);
- }
-
- if (authenticated)
- {
- UserImpl userImpl = (UserImpl)user;
- userImpl.setLastLoginTime(Calendar.getInstance().getTime());
- saveUser(userImpl, false);
- }
- return authenticated;
- }
-
- public LazyPageList findUsers(Query q) throws Exception
- {
-
- UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
-
- if (q.getUserName() != null)
- {
- qb.idFilter(q.getUserName());
- }
- if (q.getEmail() != null)
- {
- qb.attributeValuesFilter(UserDAOImpl.USER_EMAIL, new String[]{q.getEmail()});
- }
- if (q.getFirstName() != null)
- {
- qb.attributeValuesFilter(UserDAOImpl.USER_FIRST_NAME, new String[]{q.getFirstName()});
- }
-
- //TODO: from/to login date
-
- if (q.getLastName() != null)
- {
- qb.attributeValuesFilter(UserDAOImpl.USER_LAST_NAME, new String[]{q.getLastName()});
- }
-
- return new LazyPageList(new IDMUserListAccess(this, service_, qb, 20, false), 20);
- }
-
- //
- public LazyPageList findUsersByGroup(String groupId) throws Exception
- {
- UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
-
- org.jboss.identity.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
-
- qb.addRelatedGroup(jbidGroup);
-
- return new LazyPageList(new IDMUserListAccess(this, service_, qb, 20, false), 20);
- }
-
- //
-
- private void preSave(User user, boolean isNew) throws Exception
- {
- for (UserEventListener listener : listeners_)
- {
- listener.preSave(user, isNew);
- }
- }
-
- private void postSave(User user, boolean isNew) throws Exception
- {
- for (UserEventListener listener : listeners_)
- {
- listener.postSave(user, isNew);
- }
- }
-
- private void preDelete(User user) throws Exception
- {
- for (UserEventListener listener : listeners_)
- {
- listener.preDelete(user);
- }
- }
-
- private void postDelete(User user) throws Exception
- {
- for (UserEventListener listener : listeners_)
- {
- listener.postDelete(user);
- }
- }
-
- public void persistUserInfo(User user, IdentitySession session) throws Exception
- {
-
- AttributesManager am = session.getAttributesManager();
-
- ArrayList attributes = new ArrayList();
-
- if (user.getCreatedDate() != null)
- {
- attributes.add(new SimpleAttribute(USER_CREATED_DATE, dateFormat.format(user.getCreatedDate())));
- }
- if (user.getLastLoginTime() != null)
- {
- attributes.add(new SimpleAttribute(USER_LAST_LOGIN_TIME, dateFormat.format(user.getLastLoginTime())));
- }
- if (user.getEmail() != null)
- {
- attributes.add(new SimpleAttribute(USER_EMAIL, user.getEmail()));
- }
- if (user.getFirstName() != null)
- {
- attributes.add(new SimpleAttribute(USER_FIRST_NAME, user.getFirstName()));
- }
- if (user.getLastName() != null)
- {
- attributes.add(new SimpleAttribute(USER_LAST_NAME, user.getLastName()));
- }
- if (user.getOrganizationId() != null)
- {
- attributes.add(new SimpleAttribute(USER_ORGANIZATION_ID, user.getOrganizationId()));
- }
- if (user.getPassword() != null)
- {
- if (orgService.isPasswordAsAttribute())
- {
- attributes.add(new SimpleAttribute(USER_PASSWORD, user.getPassword()));
- }
- else
- {
- am.updatePassword(session.getPersistenceManager().findUser(user.getUserName()), user.getPassword());
- }
- }
-
- Attribute[] attrs = new Attribute[attributes.size()];
- attrs = (Attribute[])attributes.toArray(attrs);
- am.addAttributes(user.getUserName(), attrs);
- }
-
- public static User getPopulatedUser(String userName, IdentitySession session) throws Exception
- {
-
- if (session.getPersistenceManager().findUser(userName) == null)
- {
- return null;
- }
-
- AttributesManager am = session.getAttributesManager();
-
- Map<String, Attribute> attrs = am.getAttributes(userName);
-
- User user = new UserImpl(userName);
-
- if (attrs == null)
- {
-
- return user;
- }
- else
- {
- if (attrs.containsKey(USER_CREATED_DATE))
- {
- user.setCreatedDate(dateFormat.parse(attrs.get(USER_CREATED_DATE).getValue().toString()));
- }
- if (attrs.containsKey(USER_EMAIL))
- {
- user.setEmail(attrs.get(USER_EMAIL).getValue().toString());
- }
- if (attrs.containsKey(USER_FIRST_NAME))
- {
- user.setFirstName(attrs.get(USER_FIRST_NAME).getValue().toString());
- }
- if (attrs.containsKey(USER_LAST_LOGIN_TIME))
- {
- user.setLastLoginTime(dateFormat.parse(attrs.get(USER_LAST_LOGIN_TIME).getValue().toString()));
- }
- if (attrs.containsKey(USER_LAST_NAME))
- {
- user.setLastName(attrs.get(USER_LAST_NAME).getValue().toString());
- }
- if (attrs.containsKey(USER_ORGANIZATION_ID))
- {
- user.setOrganizationId(attrs.get(USER_ORGANIZATION_ID).getValue().toString());
- }
- if (attrs.containsKey(USER_PASSWORD))
- {
- user.setPassword(attrs.get(USER_PASSWORD).getValue().toString());
- }
- }
-
- return user;
-
- }
-
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,416 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.organization.Query;
+import org.exoplatform.services.organization.User;
+import org.exoplatform.services.organization.UserEventListener;
+import org.exoplatform.services.organization.UserHandler;
+import org.exoplatform.services.organization.impl.UserImpl;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.AttributesManager;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.query.UserQueryBuilder;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ */
+public class UserDAOImpl implements UserHandler
+{
+
+ private final JBossIDMService service_;
+
+ private ExoCache cache_;
+
+ private List<UserEventListener> listeners_ = new ArrayList<UserEventListener>(3);
+
+ public static final String USER_PASSWORD = "password";
+
+ public static final String USER_FIRST_NAME = "firstName";
+
+ public static final String USER_LAST_NAME = "lastName";
+
+ public static final String USER_EMAIL = "email";
+
+ public static final String USER_CREATED_DATE = "createdDate";
+
+ public static final String USER_LAST_LOGIN_TIME = "lastLoginTime";
+
+ public static final String USER_ORGANIZATION_ID = "organizationId";
+
+ public static final Set<String> USER_NON_PROFILE_KEYS;
+
+ public static final DateFormat dateFormat = DateFormat.getInstance();
+
+ private JBossIDMOrganizationServiceImpl orgService;
+
+ static
+ {
+ Set<String> keys = new HashSet<String>();
+ keys.add(USER_PASSWORD);
+ keys.add(USER_FIRST_NAME);
+ keys.add(USER_LAST_NAME);
+ keys.add(USER_EMAIL);
+ keys.add(USER_CREATED_DATE);
+ keys.add(USER_LAST_LOGIN_TIME);
+ keys.add(USER_ORGANIZATION_ID);
+
+ USER_NON_PROFILE_KEYS = Collections.unmodifiableSet(keys);
+ }
+
+ public UserDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService idmService, CacheService cservice)
+ throws Exception
+ {
+ service_ = idmService;
+ cache_ = cservice.getCacheInstance(UserImpl.class.getName());
+ this.orgService = orgService;
+ }
+
+ final public List getUserEventListeners()
+ {
+ return listeners_;
+ }
+
+ public void addUserEventListener(UserEventListener listener)
+ {
+ listeners_.add(listener);
+ }
+
+ public User createUserInstance()
+ {
+ return new UserImpl();
+ }
+
+ public User createUserInstance(String username)
+ {
+ return new UserImpl(username);
+ }
+
+ public void createUser(User user, boolean broadcast) throws Exception
+ {
+ IdentitySession session = service_.getIdentitySession();
+ if (broadcast)
+ {
+ preSave(user, true);
+ }
+
+ session.getPersistenceManager().createUser(user.getUserName());
+
+ persistUserInfo(user, session);
+
+ if (broadcast)
+ {
+ postSave(user, true);
+ }
+
+ }
+
+ public void saveUser(User user, boolean broadcast) throws Exception
+ {
+ IdentitySession session = service_.getIdentitySession();
+ if (broadcast)
+ {
+ preSave(user, false);
+ }
+
+ persistUserInfo(user, session);
+
+ if (broadcast)
+ {
+ postSave(user, false);
+ }
+ cache_.put(user.getUserName(), user);
+ }
+
+ public User removeUser(String userName, boolean broadcast) throws Exception
+ {
+ IdentitySession session = service_.getIdentitySession();
+
+ org.jboss.identity.idm.api.User foundUser = session.getPersistenceManager().findUser(userName);
+
+ if (foundUser == null)
+ {
+ cache_.remove(userName);
+ return null;
+ }
+
+ User exoUser = getPopulatedUser(userName, session);
+
+ if (broadcast)
+ {
+ preDelete(exoUser);
+ }
+
+ session.getPersistenceManager().removeUser(foundUser, true);
+ if (broadcast)
+ {
+ postDelete(exoUser);
+ }
+ cache_.remove(userName);
+ return exoUser;
+ }
+
+ //
+ public User findUserByName(String userName) throws Exception
+ {
+ IdentitySession session = service_.getIdentitySession();
+
+ User user = (User)cache_.get(userName);
+ if (user != null)
+ {
+ return user;
+ }
+ user = getPopulatedUser(userName, session);
+ if (user != null)
+ {
+ cache_.put(userName, user);
+ }
+ return user;
+ }
+
+ public LazyPageList getUserPageList(int pageSize) throws Exception
+ {
+ UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
+
+ return new LazyPageList(new IDMUserListAccess(this, service_, qb, pageSize, true), pageSize);
+ }
+
+ //
+ public boolean authenticate(String username, String password) throws Exception
+ {
+ User user = findUserByName(username);
+ if (user == null)
+ {
+ return false;
+ }
+
+ boolean authenticated = false;
+
+ if (orgService.isPasswordAsAttribute())
+ {
+ authenticated = user.getPassword().equals(password);
+ }
+ else
+ {
+ IdentitySession session = service_.getIdentitySession();
+ org.jboss.identity.idm.api.User idmUser = session.getPersistenceManager().findUser(user.getUserName());
+
+ authenticated = session.getAttributesManager().validatePassword(idmUser, password);
+ }
+
+ if (authenticated)
+ {
+ UserImpl userImpl = (UserImpl)user;
+ userImpl.setLastLoginTime(Calendar.getInstance().getTime());
+ saveUser(userImpl, false);
+ }
+ return authenticated;
+ }
+
+ public LazyPageList findUsers(Query q) throws Exception
+ {
+
+ UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
+
+ if (q.getUserName() != null)
+ {
+ qb.idFilter(q.getUserName());
+ }
+ if (q.getEmail() != null)
+ {
+ qb.attributeValuesFilter(UserDAOImpl.USER_EMAIL, new String[]{q.getEmail()});
+ }
+ if (q.getFirstName() != null)
+ {
+ qb.attributeValuesFilter(UserDAOImpl.USER_FIRST_NAME, new String[]{q.getFirstName()});
+ }
+
+ //TODO: from/to login date
+
+ if (q.getLastName() != null)
+ {
+ qb.attributeValuesFilter(UserDAOImpl.USER_LAST_NAME, new String[]{q.getLastName()});
+ }
+
+ return new LazyPageList(new IDMUserListAccess(this, service_, qb, 20, false), 20);
+ }
+
+ //
+ public LazyPageList findUsersByGroup(String groupId) throws Exception
+ {
+ UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
+
+ org.jboss.identity.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
+
+ qb.addRelatedGroup(jbidGroup);
+
+ return new LazyPageList(new IDMUserListAccess(this, service_, qb, 20, false), 20);
+ }
+
+ //
+
+ private void preSave(User user, boolean isNew) throws Exception
+ {
+ for (UserEventListener listener : listeners_)
+ {
+ listener.preSave(user, isNew);
+ }
+ }
+
+ private void postSave(User user, boolean isNew) throws Exception
+ {
+ for (UserEventListener listener : listeners_)
+ {
+ listener.postSave(user, isNew);
+ }
+ }
+
+ private void preDelete(User user) throws Exception
+ {
+ for (UserEventListener listener : listeners_)
+ {
+ listener.preDelete(user);
+ }
+ }
+
+ private void postDelete(User user) throws Exception
+ {
+ for (UserEventListener listener : listeners_)
+ {
+ listener.postDelete(user);
+ }
+ }
+
+ public void persistUserInfo(User user, IdentitySession session) throws Exception
+ {
+
+ AttributesManager am = session.getAttributesManager();
+
+ ArrayList attributes = new ArrayList();
+
+ if (user.getCreatedDate() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_CREATED_DATE, dateFormat.format(user.getCreatedDate())));
+ }
+ if (user.getLastLoginTime() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_LAST_LOGIN_TIME, dateFormat.format(user.getLastLoginTime())));
+ }
+ if (user.getEmail() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_EMAIL, user.getEmail()));
+ }
+ if (user.getFirstName() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_FIRST_NAME, user.getFirstName()));
+ }
+ if (user.getLastName() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_LAST_NAME, user.getLastName()));
+ }
+ if (user.getOrganizationId() != null)
+ {
+ attributes.add(new SimpleAttribute(USER_ORGANIZATION_ID, user.getOrganizationId()));
+ }
+ if (user.getPassword() != null)
+ {
+ if (orgService.isPasswordAsAttribute())
+ {
+ attributes.add(new SimpleAttribute(USER_PASSWORD, user.getPassword()));
+ }
+ else
+ {
+ am.updatePassword(session.getPersistenceManager().findUser(user.getUserName()), user.getPassword());
+ }
+ }
+
+ Attribute[] attrs = new Attribute[attributes.size()];
+ attrs = (Attribute[])attributes.toArray(attrs);
+ am.addAttributes(user.getUserName(), attrs);
+ }
+
+ public static User getPopulatedUser(String userName, IdentitySession session) throws Exception
+ {
+
+ if (session.getPersistenceManager().findUser(userName) == null)
+ {
+ return null;
+ }
+
+ AttributesManager am = session.getAttributesManager();
+
+ Map<String, Attribute> attrs = am.getAttributes(userName);
+
+ User user = new UserImpl(userName);
+
+ if (attrs == null)
+ {
+
+ return user;
+ }
+ else
+ {
+ if (attrs.containsKey(USER_CREATED_DATE))
+ {
+ user.setCreatedDate(dateFormat.parse(attrs.get(USER_CREATED_DATE).getValue().toString()));
+ }
+ if (attrs.containsKey(USER_EMAIL))
+ {
+ user.setEmail(attrs.get(USER_EMAIL).getValue().toString());
+ }
+ if (attrs.containsKey(USER_FIRST_NAME))
+ {
+ user.setFirstName(attrs.get(USER_FIRST_NAME).getValue().toString());
+ }
+ if (attrs.containsKey(USER_LAST_LOGIN_TIME))
+ {
+ user.setLastLoginTime(dateFormat.parse(attrs.get(USER_LAST_LOGIN_TIME).getValue().toString()));
+ }
+ if (attrs.containsKey(USER_LAST_NAME))
+ {
+ user.setLastName(attrs.get(USER_LAST_NAME).getValue().toString());
+ }
+ if (attrs.containsKey(USER_ORGANIZATION_ID))
+ {
+ user.setOrganizationId(attrs.get(USER_ORGANIZATION_ID).getValue().toString());
+ }
+ if (attrs.containsKey(USER_PASSWORD))
+ {
+ user.setPassword(attrs.get(USER_PASSWORD).getValue().toString());
+ }
+ }
+
+ return user;
+
+ }
+
+}
Deleted: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java 2009-11-20 16:25:22 UTC (rev 743)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -1,286 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.organization.jbidm;
-
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.organization.UserProfile;
-import org.exoplatform.services.organization.UserProfileEventListener;
-import org.exoplatform.services.organization.UserProfileHandler;
-import org.exoplatform.services.organization.impl.UserProfileImpl;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.impl.api.SimpleAttribute;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class UserProfileDAOImpl implements UserProfileHandler
-{
-
- static private UserProfile NOT_FOUND = new UserProfileImpl();
-
- private JBossIDMService service_;
-
- private ExoCache cache_;
-
- private List<UserProfileEventListener> listeners_;
-
- private JBossIDMOrganizationServiceImpl orgService;
-
- public UserProfileDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service, CacheService cservice)
- throws Exception
- {
- service_ = service;
- cache_ = cservice.getCacheInstance(getClass().getName());
- listeners_ = new ArrayList<UserProfileEventListener>(3);
- this.orgService = orgService;
- }
-
- public void addUserProfileEventListener(UserProfileEventListener listener)
- {
- listeners_.add(listener);
- }
-
- final public UserProfile createUserProfileInstance()
- {
- return new UserProfileImpl();
- }
-
- public UserProfile createUserProfileInstance(String userName)
- {
- return new UserProfileImpl(userName);
- }
-
- // void createUserProfileEntry(UserProfile up, IdentitySession session) throws Exception
- // {
- // UserProfileData upd = new UserProfileData();
- // upd.setUserProfile(up);
- // session.save(upd);
- // session.flush();
- // cache_.remove(up.getUserName());
- // }
-
- public void saveUserProfile(UserProfile profile, boolean broadcast) throws Exception
- {
-
- if (broadcast)
- {
- preSave(profile, true);
- }
-
- setProfile(profile.getUserName(), profile);
-
- if (broadcast)
- {
- postSave(profile, true);
- }
-
- cache_.put(profile.getUserName(), profile);
-
- }
-
- public UserProfile removeUserProfile(String userName, boolean broadcast) throws Exception
- {
- UserProfile profile = getProfile(userName);
-
- if (profile != null)
- {
- try
- {
- if (broadcast)
- {
- preDelete(profile);
- }
-
- removeProfile(userName, profile);
-
- if (broadcast)
- {
- postDelete(profile);
- }
- cache_.remove(userName);
- return profile;
- }
- catch (Exception exp)
- {
- return null;
- }
- }
- cache_.remove(userName);
- return null;
- }
-
- public UserProfile findUserProfileByName(String userName) throws Exception
- {
-
- org.jboss.identity.idm.api.User foundUser = getIdentitySession().getPersistenceManager().findUser(userName);
-
- if (foundUser == null)
- {
- return null;
- }
-
- UserProfile up = (UserProfile)cache_.get(userName);
- if (up == null)
- {
- up = getProfile(userName);
- }
-
- //
- if (up == null)
- {
- up = NOT_FOUND;
- }
-
- //
- cache_.put(userName, up);
-
- // Just to avoid to return a shared object between many threads
- // that would not be thread safe nor corrct
- if (up == NOT_FOUND)
- {
- // julien : integration bug fix
- // Return an empty profile to avoid NPE in portal
- // Should clarify what do do (maybe portal should care about returned value)
- UserProfileImpl profile = new UserProfileImpl();
- profile.setUserName(userName);
- return profile;
- }
- else
- {
- return up;
- }
- }
-
- public Collection findUserProfiles() throws Exception
- {
- return null;
- }
-
- private void preSave(UserProfile profile, boolean isNew) throws Exception
- {
- for (UserProfileEventListener listener : listeners_)
- {
- listener.preSave(profile, isNew);
- }
- }
-
- private void postSave(UserProfile profile, boolean isNew) throws Exception
- {
- for (UserProfileEventListener listener : listeners_)
- {
- listener.postSave(profile, isNew);
- }
- }
-
- private void preDelete(UserProfile profile) throws Exception
- {
- for (UserProfileEventListener listener : listeners_)
- {
- listener.preDelete(profile);
- }
- }
-
- private void postDelete(UserProfile profile) throws Exception
- {
- for (UserProfileEventListener listener : listeners_)
- {
- listener.postDelete(profile);
- }
- }
-
- public UserProfile getProfile(String userName) throws Exception
- {
- if (getIdentitySession().getPersistenceManager().findUser(userName) == null)
- {
- return null;
- }
-
- Map<String, Attribute> attrs = getIdentitySession().getAttributesManager().getAttributes(userName);
-
- if (attrs == null || attrs.isEmpty())
- {
- return null;
- }
-
- Map<String, String> filteredAttrs = new HashMap<String, String>();
-
- for (String key : attrs.keySet())
- {
- // Check if attribute is part of User interface data
- if (!UserDAOImpl.USER_NON_PROFILE_KEYS.contains(key))
- {
- filteredAttrs.put(key, attrs.get(key).getValue().toString());
- }
-
- }
-
- if (filteredAttrs.isEmpty())
- {
- return null;
- }
-
- UserProfile profile = new UserProfileImpl(userName, filteredAttrs);
-
- return profile;
-
- }
-
- public void setProfile(String userName, UserProfile profile) throws Exception
- {
-
- Map<String, String> profileAttrs = profile.getUserInfoMap();
-
- Set<Attribute> attrs = new HashSet<Attribute>();
-
- for (Map.Entry<String, String> entry : profileAttrs.entrySet())
- {
- attrs.add(new SimpleAttribute(entry.getKey(), entry.getValue()));
- }
-
- Attribute[] attrArray = new Attribute[attrs.size()];
- attrArray = attrs.toArray(attrArray);
-
- getIdentitySession().getAttributesManager().updateAttributes(userName, attrArray);
-
- }
-
- public void removeProfile(String userName, UserProfile profile) throws Exception
- {
- Map<String, String> profileAttrs = profile.getUserInfoMap();
-
- String[] attrKeys = new String[profileAttrs.keySet().size()];
-
- attrKeys = profileAttrs.keySet().toArray(attrKeys);
-
- getIdentitySession().getAttributesManager().removeAttributes(userName, attrKeys);
- }
-
- private IdentitySession getIdentitySession() throws Exception
- {
- return service_.getIdentitySession();
- }
-}
Copied: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java (from rev 743, portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java)
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java (rev 0)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/UserProfileDAOImpl.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -0,0 +1,286 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.organization.jbidm;
+
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.organization.UserProfile;
+import org.exoplatform.services.organization.UserProfileEventListener;
+import org.exoplatform.services.organization.UserProfileHandler;
+import org.exoplatform.services.organization.impl.UserProfileImpl;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class UserProfileDAOImpl implements UserProfileHandler
+{
+
+ static private UserProfile NOT_FOUND = new UserProfileImpl();
+
+ private JBossIDMService service_;
+
+ private ExoCache cache_;
+
+ private List<UserProfileEventListener> listeners_;
+
+ private JBossIDMOrganizationServiceImpl orgService;
+
+ public UserProfileDAOImpl(JBossIDMOrganizationServiceImpl orgService, JBossIDMService service, CacheService cservice)
+ throws Exception
+ {
+ service_ = service;
+ cache_ = cservice.getCacheInstance(getClass().getName());
+ listeners_ = new ArrayList<UserProfileEventListener>(3);
+ this.orgService = orgService;
+ }
+
+ public void addUserProfileEventListener(UserProfileEventListener listener)
+ {
+ listeners_.add(listener);
+ }
+
+ final public UserProfile createUserProfileInstance()
+ {
+ return new UserProfileImpl();
+ }
+
+ public UserProfile createUserProfileInstance(String userName)
+ {
+ return new UserProfileImpl(userName);
+ }
+
+ // void createUserProfileEntry(UserProfile up, IdentitySession session) throws Exception
+ // {
+ // UserProfileData upd = new UserProfileData();
+ // upd.setUserProfile(up);
+ // session.save(upd);
+ // session.flush();
+ // cache_.remove(up.getUserName());
+ // }
+
+ public void saveUserProfile(UserProfile profile, boolean broadcast) throws Exception
+ {
+
+ if (broadcast)
+ {
+ preSave(profile, true);
+ }
+
+ setProfile(profile.getUserName(), profile);
+
+ if (broadcast)
+ {
+ postSave(profile, true);
+ }
+
+ cache_.put(profile.getUserName(), profile);
+
+ }
+
+ public UserProfile removeUserProfile(String userName, boolean broadcast) throws Exception
+ {
+ UserProfile profile = getProfile(userName);
+
+ if (profile != null)
+ {
+ try
+ {
+ if (broadcast)
+ {
+ preDelete(profile);
+ }
+
+ removeProfile(userName, profile);
+
+ if (broadcast)
+ {
+ postDelete(profile);
+ }
+ cache_.remove(userName);
+ return profile;
+ }
+ catch (Exception exp)
+ {
+ return null;
+ }
+ }
+ cache_.remove(userName);
+ return null;
+ }
+
+ public UserProfile findUserProfileByName(String userName) throws Exception
+ {
+
+ org.jboss.identity.idm.api.User foundUser = getIdentitySession().getPersistenceManager().findUser(userName);
+
+ if (foundUser == null)
+ {
+ return null;
+ }
+
+ UserProfile up = (UserProfile)cache_.get(userName);
+ if (up == null)
+ {
+ up = getProfile(userName);
+ }
+
+ //
+ if (up == null)
+ {
+ up = NOT_FOUND;
+ }
+
+ //
+ cache_.put(userName, up);
+
+ // Just to avoid to return a shared object between many threads
+ // that would not be thread safe nor corrct
+ if (up == NOT_FOUND)
+ {
+ // julien : integration bug fix
+ // Return an empty profile to avoid NPE in portal
+ // Should clarify what do do (maybe portal should care about returned value)
+ UserProfileImpl profile = new UserProfileImpl();
+ profile.setUserName(userName);
+ return profile;
+ }
+ else
+ {
+ return up;
+ }
+ }
+
+ public Collection findUserProfiles() throws Exception
+ {
+ return null;
+ }
+
+ private void preSave(UserProfile profile, boolean isNew) throws Exception
+ {
+ for (UserProfileEventListener listener : listeners_)
+ {
+ listener.preSave(profile, isNew);
+ }
+ }
+
+ private void postSave(UserProfile profile, boolean isNew) throws Exception
+ {
+ for (UserProfileEventListener listener : listeners_)
+ {
+ listener.postSave(profile, isNew);
+ }
+ }
+
+ private void preDelete(UserProfile profile) throws Exception
+ {
+ for (UserProfileEventListener listener : listeners_)
+ {
+ listener.preDelete(profile);
+ }
+ }
+
+ private void postDelete(UserProfile profile) throws Exception
+ {
+ for (UserProfileEventListener listener : listeners_)
+ {
+ listener.postDelete(profile);
+ }
+ }
+
+ public UserProfile getProfile(String userName) throws Exception
+ {
+ if (getIdentitySession().getPersistenceManager().findUser(userName) == null)
+ {
+ return null;
+ }
+
+ Map<String, Attribute> attrs = getIdentitySession().getAttributesManager().getAttributes(userName);
+
+ if (attrs == null || attrs.isEmpty())
+ {
+ return null;
+ }
+
+ Map<String, String> filteredAttrs = new HashMap<String, String>();
+
+ for (String key : attrs.keySet())
+ {
+ // Check if attribute is part of User interface data
+ if (!UserDAOImpl.USER_NON_PROFILE_KEYS.contains(key))
+ {
+ filteredAttrs.put(key, attrs.get(key).getValue().toString());
+ }
+
+ }
+
+ if (filteredAttrs.isEmpty())
+ {
+ return null;
+ }
+
+ UserProfile profile = new UserProfileImpl(userName, filteredAttrs);
+
+ return profile;
+
+ }
+
+ public void setProfile(String userName, UserProfile profile) throws Exception
+ {
+
+ Map<String, String> profileAttrs = profile.getUserInfoMap();
+
+ Set<Attribute> attrs = new HashSet<Attribute>();
+
+ for (Map.Entry<String, String> entry : profileAttrs.entrySet())
+ {
+ attrs.add(new SimpleAttribute(entry.getKey(), entry.getValue()));
+ }
+
+ Attribute[] attrArray = new Attribute[attrs.size()];
+ attrArray = attrs.toArray(attrArray);
+
+ getIdentitySession().getAttributesManager().updateAttributes(userName, attrArray);
+
+ }
+
+ public void removeProfile(String userName, UserProfile profile) throws Exception
+ {
+ Map<String, String> profileAttrs = profile.getUserInfoMap();
+
+ String[] attrKeys = new String[profileAttrs.keySet().size()];
+
+ attrKeys = profileAttrs.keySet().toArray(attrKeys);
+
+ getIdentitySession().getAttributesManager().removeAttributes(userName, attrKeys);
+ }
+
+ private IdentitySession getIdentitySession() throws Exception
+ {
+ return service_.getIdentitySession();
+ }
+}
Modified: portal/trunk/component/identity/src/test/java/conf/portal/idm-configuration.xml
===================================================================
--- portal/trunk/component/identity/src/test/java/conf/portal/idm-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/src/test/java/conf/portal/idm-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -25,54 +25,54 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
<value>jar:/conf/portal/idm-config.xml</value>
</value-param>
+ <values-param>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
+ </values-param>
+ <properties-param>
+ <name>hibernate.properties</name>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.current_session_context_class" value="thread"/>
+ <property name="hibernate.show_sql" value="false"/>
+ <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:file:target/temp/data/exodb"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.connection.autocommit" value="true"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.c3p0.min_size" value="5"/>
+ <property name="hibernate.c3p0.max_size" value="20"/>
+ <property name="hibernate.c3p0.timeout" value="1800"/>
+ <property name="hibernate.c3p0.max_statements" value="50"/>
+ </properties-param>
+
</init-params>
</component>
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
- <component>
- <key>org.exoplatform.services.database.HibernateService</key>
- <jmx-name>database:type=HibernateService</jmx-name>
- <type>org.exoplatform.services.database.impl.HibernateServiceImpl</type>
- <init-params>
- <properties-param>
- <name>hibernate.properties</name>
- <description>Default Hibernate Service</description>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- <!--<property name="hibernate.show_sql" value="true"/>-->
- <!--<property name="hibernate.use_sql_comments" value="true"/>-->
- <!--<property name="hibernate.format_sql" value="true"/>-->
- <property name="hibernate.current_session_context_class" value="thread"/>
- <property name="hibernate.jdbc.batch_size" value="100"/>
- <property name="hibernate.cache.use_second_level_cache" value="true"/>
- <property name="hibernate.cache.use_query_cache" value="true"/>
- <!--CHANGEME HashtableCacheProvider shold not be used in production env-->
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
- <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
- <property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
- <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
- <property name="hibernate.connection.autocommit" value="true"/>
- <property name="hibernate.connection.username" value="sa"/>
- <property name="hibernate.connection.password" value=""/>
- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
- <property name="hibernate.c3p0.min_size" value="5"/>
- <property name="hibernate.c3p0.max_size" value="20"/>
- <property name="hibernate.c3p0.timeout" value="1800"/>
- <property name="hibernate.c3p0.max_statements" value="50"/>
- </properties-param>
- </init-params>
- </component>
-
<external-component-plugins>
<target-component>org.exoplatform.services.database.HibernateService</target-component>
<component-plugin>
@@ -81,18 +81,19 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<values-param>
- <name>hibernate.mapping</name>
- <value>mappings/HibernateRealm.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObject.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredential.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
</values-param>
</init-params>
</component-plugin>
Modified: portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
--- portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -173,7 +173,6 @@
// newly created 'test' and 'demo'
assertEquals(2, piterator.currentPage().size());
-// membershipHandler_.removeMembershipByUser(USER,false);
userHandler_.removeUser(USER, true);
piterator = userHandler_.getUserPageList(10);
// one 'demo'
@@ -437,20 +436,19 @@
groupHandler_.removeGroup(group3, true);
}
-// public void testUserProfileListener() throws Exception
-// {
-// UserProfileListener l = new UserProfileListener();
-// profileHandler_.addUserProfileEventListener(l);
-// User user = createUser(USER);
-// assertNotNull(user);
-// UserProfile profile = profileHandler_.createUserProfileInstance(user.getUserName());
-// profile.setAttribute("blah", "blah");
-// profileHandler_.saveUserProfile(profile, true);
-// assertTrue(l.preSave && l.postSave);
-// profileHandler_.removeUserProfile(user.getUserName(), true);
-// assertFalse(l.preDelete && l.postDelete);
-// userHandler_.removeUser(user.getUserName(), false);
-// }
+ public void testUserProfileListener() throws Exception
+ {
+ UserProfileListener l = new UserProfileListener();
+ profileHandler_.addUserProfileEventListener(l);
+ User user = createUser(USER);
+ assertNotNull(user);
+ UserProfile profile = profileHandler_.createUserProfileInstance(user.getUserName());
+ profile.setAttribute("blah", "blah");
+ profileHandler_.saveUserProfile(profile, true);
+ assertTrue(l.preSave && l.postSave);
+ profileHandler_.removeUserProfile(user.getUserName(), true);
+ assertFalse(l.preDelete && l.postDelete);
+ }
public void testFindUsersByGroupId() throws Exception
{
Modified: portal/trunk/component/portal/pom.xml
===================================================================
--- portal/trunk/component/portal/pom.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/portal/pom.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -82,9 +82,9 @@
</dependency>
<dependency>
- <groupId>org.picketlink.idm</groupId>
- <artifactId>picketlink-idm-core</artifactId>
- <version>${org.picketlink.idm}</version>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${org.jboss.identity.idm}</version>
</dependency>
</dependencies>
Modified: portal/trunk/component/portal/src/test/java/conf/portal/database-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/database-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/portal/src/test/java/conf/portal/database-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -34,9 +34,6 @@
<description>Default Hibernate Service</description>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
- <property name="hibernate.cache.use_second_level_cache" value="true"/>
- <property name="hibernate.cache.use_query_cache" value="true"/>
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:file:target/temp/data/exodb"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.autocommit" value="true"/>
Modified: portal/trunk/component/portal/src/test/java/conf/portal/idm-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/portal/idm-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/portal/src/test/java/conf/portal/idm-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -25,21 +25,52 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
<value>war:/conf/organization/idm-config.xml</value>
</value-param>
-
+ <values-param>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
+ </values-param>
+ <properties-param>
+ <name>hibernate.properties</name>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.current_session_context_class" value="thread"/>
+ <property name="hibernate.show_sql" value="false"/>
+ <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:file:target/temp/data/exodb"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.connection.autocommit" value="true"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.c3p0.min_size" value="5"/>
+ <property name="hibernate.c3p0.max_size" value="20"/>
+ <property name="hibernate.c3p0.timeout" value="1800"/>
+ <property name="hibernate.c3p0.max_statements" value="50"/>
+ </properties-param>
</init-params>
</component>
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
<external-component-plugins>
@@ -50,18 +81,19 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<values-param>
- <name>hibernate.mapping</name>
- <value>mappings/HibernateRealm.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObject.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredential.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
</values-param>
</init-params>
</component-plugin>
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-24 00:35:57 UTC (rev 775)
@@ -43,12 +43,12 @@
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.organization.UserHandler;
-import org.exoplatform.services.organization.idm.PicketLinkIDMService;
+import org.exoplatform.services.organization.jbidm.JBossIDMService;
import org.exoplatform.services.security.Authenticator;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.test.BasicTestCase;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.common.exception.IdentityException;
import java.util.Arrays;
import java.util.Collections;
@@ -76,7 +76,7 @@
private DataStorage storage_;
/** . */
- private PicketLinkIDMService idmService;
+ private JBossIDMService idmService;
/** . */
private POMSessionManager mgr;
@@ -122,7 +122,7 @@
userPortalConfigSer_ =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
orgService_ = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
- idmService = (PicketLinkIDMService)container.getComponentInstanceOfType(PicketLinkIDMService.class);
+ idmService = (JBossIDMService)container.getComponentInstanceOfType(JBossIDMService.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
Modified: portal/trunk/docs/user-guide/en/modules/configuration/IDM_Configuration.xml
===================================================================
--- portal/trunk/docs/user-guide/en/modules/configuration/IDM_Configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/docs/user-guide/en/modules/configuration/IDM_Configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -17,15 +17,15 @@
<section>
<title>Configuration files</title>
<para>Main configuration file is <emphasis role="bold">idm-configuration</emphasis>:</para>
- <programlisting><![CDATA[<![CDATA[<![CDATA[
+ <programlisting>
<![CDATA[
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.orgaidmion.jbidm.PicketLinkIDMService</key>
- <type>org.exoplatform.servicidmganization.jbidm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
@@ -33,18 +33,18 @@
</value-param>
<values-param>
<name>hibernate.annotations</name>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObject</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
- <value>org.picketlink.idm.impl.model.hibernate.HibernateRealm</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
</values-param>
<properties-param>
<name>hibernate.properties</name>
@@ -70,18 +70,18 @@
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
-</configuration>
+</configuration>
]]>
- ]]>]]>]]></programlisting>
- <para><emphasis role="bold">org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</emphasis>
+ </programlisting>
+ <para><emphasis role="bold">org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</emphasis>
is a main entrypoint implementing
<emphasis role="bold">org.exoplatform.services.organization.OrganizationService</emphasis> and is dependant on
- <emphasis role="bold">org.exoplatform.services.organization.idm.PicketLinkIDMService</emphasis></para>
+ <emphasis role="bold">org.exoplatform.services.organization.jbidm.JBossIDMService</emphasis></para>
- <para><emphasis role="bold">org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</emphasis> service has following
+ <para><emphasis role="bold">org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</emphasis> service has following
options:</para>
<itemizedlist>
<listitem>
@@ -121,25 +121,25 @@
</listitem>
</itemizedlist>
- <para><emphasis role="bold">org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</emphasis> service has following
+ <para><emphasis role="bold">org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</emphasis> service has following
options:</para>
<itemizedlist>
<listitem>
<para>
- <emphasis role="bold">gtnGroupTypeName</emphasis> - (value-param) - Name of JBoss Identity IDM GroupType
- that will be used to store groups. Default is 'GTN_GROUP_TYPE'
+ <emphasis role="bold">exoGroupTypeName</emphasis> - (value-param) - Name of JBoss Identity IDM GroupType
+ that will be used to store groups. Default is 'EXO_GROUP_TYPE'
</para>
</listitem>
<listitem>
<para>
- <emphasis role="bold">gtnRootGroupName</emphasis> - (value-param) - Name of JBoss Identity IDM Group that will
- be used as a root parent. Default is 'GTN_ROOT_GROUP'
+ <emphasis role="bold">exoRootGroupName</emphasis> - (value-param) - Name of JBoss Identity IDM Group that will
+ be used as a root parent. Default is 'EXO_ROOT_GROUP'
</para>
</listitem>
<listitem>
<para>
- <emphasis role="bold">gtnRootGroupTypeName</emphasis> - (value-param) - Name of JBoss Identity IDM GroupType
- of a Group used as a parent root. Default is 'GTN_GROUP_TYPE'
+ <emphasis role="bold">exoRootGroupTypeName</emphasis> - (value-param) - Name of JBoss Identity IDM GroupType
+ of a Group used as a parent root. Default is 'EXO_GROUP_TYPE'
</para>
</listitem>
<listitem>
@@ -187,7 +187,7 @@
<repositories>
<repository>
<id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>HibernateStore</default-identity-store-id>
<default-attribute-store-id>HibernateStore</default-attribute-store-id>
@@ -198,7 +198,7 @@
<identity-stores>
<identity-store>
<id>HibernateStore</id>
- <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <class>org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
<external-config/>
<supported-relationship-types>
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
Modified: portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js
===================================================================
--- portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js 2009-11-24 00:35:57 UTC (rev 775)
@@ -37,7 +37,7 @@
var mopVersion = "${org.gatein.mop.version}";
var chromatticVersion = "${version.chromattic}";
var reflectVersion = "${version.reflect}";
- var idmVersion = "${org.picketlink.idm}";
+ var idmVersion = "${org.jboss.identity.idm}";
var pcVersion = "${org.gatein.pc.version}";
var wciVersion = "${org.gatein.wci.version}";
var commonVersion = "${org.gatein.common.version}";
@@ -115,12 +115,12 @@
module.component.identity =
new Project("org.exoplatform.portal", "exo.portal.component.identity", "jar", module.version).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-core", "jar", idmVersion)).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-common", "jar", idmVersion)).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-api", "jar", idmVersion)).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-spi", "jar", idmVersion)).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-hibernate", "jar", idmVersion)).
- addDependency(new Project("org.picketlink.idm", "picketlink-idm-ldap", "jar", idmVersion));
+ addDependency(new Project("org.jboss.identity.idm", "idm-core", "jar", idmVersion)).
+ addDependency(new Project("org.jboss.identity.idm", "idm-common", "jar", idmVersion)).
+ addDependency(new Project("org.jboss.identity.idm", "idm-api", "jar", idmVersion)).
+ addDependency(new Project("org.jboss.identity.idm", "idm-spi", "jar", idmVersion)).
+ addDependency(new Project("org.jboss.identity.idm", "idm-hibernate", "jar", idmVersion)).
+ addDependency(new Project("org.jboss.identity.idm", "idm-ldap", "jar", idmVersion));
module.component.applicationRegistry =
new Project("org.exoplatform.portal", "exo.portal.component.application-registry", "jar", module.version).
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/pom.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -46,7 +46,7 @@
<org.gatein.common.version>2.0.0-Beta03</org.gatein.common.version>
<org.gatein.wci.version>2.0.0-Beta02</org.gatein.wci.version>
<org.gatein.pc.version>2.1.0-Beta02</org.gatein.pc.version>
- <org.picketlink.idm>1.0.0.CR1</org.picketlink.idm>
+ <org.jboss.identity.idm>1.0.0.Beta3</org.jboss.identity.idm>
<org.gatein.wsrp.version>1.0.0-Beta01</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.0-Beta09</org.gatein.mop.version>
<version.chromattic>1.0.0-beta6</version.chromattic>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/database/database-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/database/database-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/database/database-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -33,11 +33,6 @@
<name>hibernate.properties</name>
<description>Default Hibernate Service</description>
<property name="hibernate.show_sql" value="false"/>
- <property name="hibernate.current_session_context_class" value="thread"/>
- <property name="hibernate.cache.use_second_level_cache" value="true"/>
- <property name="hibernate.cache.use_query_cache" value="true"/>
- <!--CHANGEME HashtableCacheProvider shold not be used in production env-->
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-config.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-config.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-config.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -20,9 +20,9 @@
-->
-<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_cr1"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_cr1 identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha identity-config.xsd">
<realms>
<realm>
<id>PortalRealm</id>
@@ -35,7 +35,7 @@
<repositories>
<repository>
<id>PortalRepository</id>
- <class>org.picketlink.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>HibernateStore</default-identity-store-id>
<default-attribute-store-id>HibernateStore</default-attribute-store-id>
@@ -46,7 +46,7 @@
<identity-stores>
<identity-store>
<id>HibernateStore</id>
- <class>org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <class>org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
<external-config/>
<supported-relationship-types>
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2009-11-23 20:13:58 UTC (rev 774)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2009-11-24 00:35:57 UTC (rev 775)
@@ -23,50 +23,54 @@
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
-
-
<component>
- <key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</type>
+ <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
<init-params>
<value-param>
<name>config</name>
<value>war:/conf/organization/idm-config.xml</value>
</value-param>
+ <values-param>
+ <name>hibernate.annotations</name>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttributeValue</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType</value>
+ <value>org.jboss.identity.idm.impl.model.hibernate.HibernateRealm</value>
+ </values-param>
+ <properties-param>
+ <name>hibernate.properties</name>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.current_session_context_class" value="thread"/>
+ <property name="hibernate.show_sql" value="false"/>
+ <property name="hibernate.cglib.use_reflection_optimizer" value="true"/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:file:../temp/data/exodb${container.name.suffix}"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.connection.autocommit" value="true"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.c3p0.min_size" value="5"/>
+ <property name="hibernate.c3p0.max_size" value="20"/>
+ <property name="hibernate.c3p0.timeout" value="1800"/>
+ <property name="hibernate.c3p0.max_statements" value="50"/>
+ </properties-param>
+
</init-params>
</component>
-
<component>
<key>org.exoplatform.services.organization.OrganizationService</key>
- <type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
+ <type>org.exoplatform.services.organization.jbidm.JBossIDMOrganizationServiceImpl</type>
</component>
- <external-component-plugins>
- <target-component>org.exoplatform.services.database.HibernateService</target-component>
- <component-plugin>
- <name>add.hibernate.mapping</name>
- <set-method>addPlugin</set-method>
- <type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
- <init-params>
- <values-param>
- <name>hibernate.mapping</name>
- <value>mappings/HibernateRealm.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttributeBinaryValue.hbm.xml</value>
- <value>mappings/HibernateIdentityObject.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredential.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectCredentialType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectAttribute.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationship.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipType.hbm.xml</value>
- <value>mappings/HibernateIdentityObjectRelationshipName.hbm.xml</value>
- </values-param>
- </init-params>
- </component-plugin>
- </external-component-plugins>
-
-
</configuration>
15 years, 1 month
gatein SVN: r774 - in components/mop/trunk/core/src: main/java/org/gatein/mop/core/api/workspace and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2009-11-23 15:13:58 -0500 (Mon, 23 Nov 2009)
New Revision: 774
Added:
components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java
Log:
- remove usage of global name encoder
- use the @FormattedBy Chromattic annotation to specify the name encoder for the various model objects
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/MOPService.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -69,7 +69,7 @@
{
ChromatticBuilder builder = ChromatticBuilder.create();
builder.setOption(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");
- builder.setOption(ChromatticBuilder.OBJECT_FORMATTER_CLASSNAME, MOPFormatter.class.getName());
+// builder.setOption(ChromatticBuilder.OBJECT_FORMATTER_CLASSNAME, MOPFormatter.class.getName());
//
this.builder = builder;
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSite.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -19,7 +19,6 @@
package org.gatein.mop.core.api.workspace;
import org.chromattic.api.annotations.NodeMapping;
-import org.gatein.mop.core.api.workspace.SiteImpl;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/GroupSiteContainer.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -20,8 +20,6 @@
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.RelatedMappedBy;
-import org.gatein.mop.core.api.workspace.SiteContainer;
-import org.gatein.mop.core.api.workspace.WorkspaceImpl;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/PageContainer.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,11 +18,13 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.Create;
import org.chromattic.api.annotations.RelatedMappedBy;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -31,6 +33,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:pagecontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class PageContainer
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteContainer.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.Create;
import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Collection;
import java.util.Map;
@@ -30,6 +32,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class SiteContainer<T extends Site>
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/SiteImpl.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,6 +18,7 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.ManyToOne;
import org.chromattic.api.annotations.OneToOne;
import org.chromattic.api.annotations.MappedBy;
@@ -29,12 +30,14 @@
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.ContentType;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.api.workspace.content.CustomizationContainer;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class SiteImpl extends WorkspaceObjectImpl implements Site, WorkspaceCustomizationContext
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/WorkspaceObjectImpl.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace;
+import org.chromattic.api.annotations.FormattedBy;
import org.gatein.mop.api.workspace.WorkspaceObject;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.CustomizationContext;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.util.AbstractAttributes;
import org.chromattic.api.annotations.Id;
import org.chromattic.api.annotations.Name;
@@ -37,6 +39,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class WorkspaceObjectImpl implements WorkspaceObject
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/AbstractCustomization.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.CustomizationContext;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
+import org.gatein.mop.core.api.MOPFormatter;
import org.gatein.mop.core.api.content.CustomizationContextComparator;
import org.gatein.mop.core.api.content.ContentManagerRegistry;
import org.gatein.mop.spi.content.ContentProvider;
@@ -44,6 +46,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
+(a)FormattedBy(MOPFormatter.class)
public abstract class AbstractCustomization implements Customization<Object>, StateContainer
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextType.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,10 +18,12 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.Name;
import org.chromattic.api.annotations.ManyToOne;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -30,6 +32,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:contexttype")
+(a)FormattedBy(MOPFormatter.class)
public abstract class ContextType
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/ContextTypeContainer.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,9 +18,11 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.chromattic.api.annotations.ManyToOne;
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -29,6 +31,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:contexttypecontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class ContextTypeContainer
{
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java
===================================================================
--- components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java 2009-11-23 19:33:52 UTC (rev 773)
+++ components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/workspace/content/CustomizationContainer.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -18,6 +18,7 @@
*/
package org.gatein.mop.core.api.workspace.content;
+import org.chromattic.api.annotations.FormattedBy;
import org.gatein.mop.api.content.Customization;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.workspace.WorkspaceCustomizationContext;
@@ -26,6 +27,7 @@
import org.chromattic.api.annotations.OneToMany;
import org.chromattic.api.annotations.NodeMapping;
import org.chromattic.api.annotations.RelatedMappedBy;
+import org.gatein.mop.core.api.MOPFormatter;
import java.util.Map;
@@ -34,6 +36,7 @@
* @version $Revision$
*/
@NodeMapping(name = "mop:customizationcontainer")
+(a)FormattedBy(MOPFormatter.class)
public abstract class CustomizationContainer
{
Added: components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java
===================================================================
--- components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java (rev 0)
+++ components/mop/trunk/core/src/test/java/org/gatein/mop/core/api/workspace/NameEncodingTestCase.java 2009-11-23 20:13:58 UTC (rev 774)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.gatein.mop.core.api.workspace;
+
+import org.chromattic.core.DomainSession;
+import org.gatein.mop.api.workspace.ObjectType;
+import org.gatein.mop.api.workspace.Site;
+import org.gatein.mop.api.workspace.Workspace;
+import org.gatein.mop.core.api.AbstractPOMTestCase;
+import org.gatein.mop.core.api.ModelImpl;
+
+import javax.jcr.Node;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class NameEncodingTestCase extends AbstractPOMTestCase
+{
+
+ public void testEncodeSite() throws Exception
+ {
+ ModelImpl model = pomService.getModel();
+ Workspace workspace = model.getWorkspace();
+ Site site = workspace.addSite(ObjectType.GROUP_SITE, ":");
+ DomainSession session = (DomainSession)model.getSession();
+ Node siteNode = session.getNode(site);
+ assertEquals("%04", siteNode.getName());
+ }
+}
15 years, 1 month