Author: bdaw
Date: 2009-11-25 15:49:26 -0500 (Wed, 25 Nov 2009)
New Revision: 803
Added:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
Removed:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/jbidm/
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/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:
PicketLink IDM 1.0.0.CR1
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/application-registry/src/test/java/conf/portal/idm-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -25,52 +25,44 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
-
<type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
+
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</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"/>
- <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.jbidm.JBossIDMOrganizationServiceImpl</type>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</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>
Modified: portal/trunk/component/identity/pom.xml
===================================================================
--- portal/trunk/component/identity/pom.xml 2009-11-25 19:11:07 UTC (rev 802)
+++ portal/trunk/component/identity/pom.xml 2009-11-25 20:49:26 UTC (rev 803)
@@ -55,24 +55,24 @@
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-core</artifactId>
- <version>${org.jboss.identity.idm}</version>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-core</artifactId>
+ <version>${org.picketlink.idm}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-hibernate</artifactId>
- <version>${org.jboss.identity.idm}</version>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-hibernate</artifactId>
+ <version>${org.picketlink.idm}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-ldap</artifactId>
- <version>${org.jboss.identity.idm}</version>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-ldap</artifactId>
+ <version>${org.picketlink.idm}</version>
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-cache</artifactId>
- <version>${org.jboss.identity.idm}</version>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-cache</artifactId>
+ <version>${org.picketlink.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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/identity/src/main/java/conf/portal/hibernate-jbidm.cfg.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -41,19 +41,5 @@
<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-25
19:11:07 UTC (rev 802)
+++ portal/trunk/component/identity/src/main/java/conf/portal/idm-config.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -20,9 +20,9 @@
-->
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha
identity-config.xsd">
+ xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_cr1
identity-config.xsd">
<realms>
<realm>
<id>PortalRealm</id>
@@ -35,7 +35,7 @@
<repositories>
<repository>
<id>PortalRepository</id>
-
<class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+
<class>org.picketlink.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.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+
<class>org.picketlink.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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/identity/src/main/java/conf/portal/jboss-idm-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -25,8 +25,8 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
-
<type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
+
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</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.jbidm.JBossIDMOrganizationServiceImpl</type>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
</component>
<external-component-plugins>
@@ -52,19 +52,18 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<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>
+ <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>
Copied:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm)
Property changes on:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm
___________________________________________________________________
Name: svn:ignore
+ *.iml
.idea
Deleted:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-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.picketlink.idm.api.Attribute;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.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 PicketLinkIDMService service_;
-
- private List<GroupEventListener> listeners_;
-
- private PicketLinkIDMOrganizationServiceImpl orgService;
-
- public GroupDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.idm.api.Group parentGroup = null;
-
- if (parent != null)
- {
- parentGroup =
- getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(),
orgService.getGtnGroupType());
- ((GroupImpl)child).setId(parent.getId() + "/" +
child.getGroupName());
-
- }
- else
- {
- ((GroupImpl)child).setId("/" + child.getGroupName());
- }
-
- if (broadcast)
- {
- preSave(child, true);
- }
-
- org.picketlink.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.picketlink.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(group.getGroupName(),
orgService.getGtnGroupType());
-
- if (jbidGroup == null)
- {
- return group;
- }
-
- // MembershipDAOImpl.removeMembershipEntriesOfGroup(group,
getIdentitySession());
-
- Collection<org.picketlink.idm.api.Group> oneLevelChilds =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
- true, false);
-
- Collection<org.picketlink.idm.api.Group> allChilds =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
- true, true);
-
- getIdentitySession().getRelationshipManager().disassociateGroups(jbidGroup,
oneLevelChilds);
-
- for (org.picketlink.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.picketlink.idm.api.Role> allRoles =
- getIdentitySession().getRoleManager().findRoles(userName, membershipType);
-
- Set<Group> exoGroups = new HashSet<Group>();
-
- for (org.picketlink.idm.api.Role role : allRoles)
- {
- exoGroups.add(convertGroup(role.getGroup()));
-
- }
-
- return exoGroups;
- }
-
- //
- public Group findGroupById(String groupId) throws Exception
- {
-
- org.picketlink.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
-
- if (jbidGroup == null)
- {
- return null;
- }
-
- return convertGroup(jbidGroup);
- }
-
- public Collection findGroups(Group parent) throws Exception
- {
- org.picketlink.idm.api.Group jbidGroup = null;
-
- if (parent == null)
- {
- jbidGroup = getRootGroup();
- }
- else
- {
- jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(),
orgService.getGtnGroupType());
- }
-
- if (jbidGroup == null)
- {
- return Collections.emptyList();
- }
-
- Collection<org.picketlink.idm.api.Group> allGroups =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
- true, false);
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.picketlink.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.picketlink.idm.impl.api.session.managers.AbstractManager.checkNotNullArgument(AbstractManager.java:267)
- // at
org.picketlink.idm.impl.api.session.managers.RelationshipManagerImpl.findRelatedGroups(RelationshipManagerImpl.java:753)
- // at
org.exoplatform.services.organization.idm.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.picketlink.idm.api.Group> allGroups =
- getIdentitySession().getRelationshipManager().findRelatedGroups(user,
orgService.getGtnGroupType(), null);
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.picketlink.idm.api.Group group : allGroups)
- {
- exoGroups.add(convertGroup(group));
-
- }
-
- return exoGroups;
- }
-
- public Collection getAllGroups() throws Exception
- {
- Collection<org.picketlink.idm.api.Group> allGroups =
-
getIdentitySession().getPersistenceManager().findGroup(orgService.getGtnGroupType());
-
- List<Group> exoGroups = new LinkedList<Group>();
-
- for (org.picketlink.idm.api.Group group : allGroups)
- {
- if (!orgService.getGtnGroupType().equals(orgService.getGtnRootGroupType())
- || !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.picketlink.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(groupName,
orgService.getGtnGroupType());
-
- if (jbidGroup == null)
- {
- return null;
- }
-
- return convertGroup(jbidGroup);
-
- }
-
- private Group convertGroup(org.picketlink.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.picketlink.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(groupName,
orgService.getGtnGroupType());
-
- Collection<org.picketlink.idm.api.Group> parents =
- getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
- 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.picketlink.idm.api.Group)parents.iterator().next()).getName());
-
- return parentGroupId + "/" + groupName;
-
- }
-
- private org.picketlink.idm.api.Group persistGroup(Group exoGroup) throws Exception
- {
-
- org.picketlink.idm.api.Group jbidGroup =
- getIdentitySession().getPersistenceManager().findGroup(exoGroup.getGroupName(),
orgService.getGtnGroupType());
-
- if (jbidGroup == null)
- {
- jbidGroup =
-
getIdentitySession().getPersistenceManager().createGroup(exoGroup.getGroupName(),
- orgService.getGtnGroupType());
- }
-
- 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.picketlink.idm.api.Group getRootGroup() throws Exception
- {
- org.picketlink.idm.api.Group rootGroup =
-
getIdentitySession().getPersistenceManager().findGroup(orgService.getExoRootGroupName(),
- orgService.getGtnRootGroupType());
-
- if (rootGroup == null)
- {
- rootGroup =
-
getIdentitySession().getPersistenceManager().createGroup(orgService.getExoRootGroupName(),
- orgService.getGtnRootGroupType());
- }
-
- return rootGroup;
- }
-}
Copied:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+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.picketlink.idm.api.Attribute;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.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 PicketLinkIDMService service_;
+
+ private List<GroupEventListener> listeners_;
+
+ private PicketLinkIDMOrganizationServiceImpl orgService;
+
+ public GroupDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.idm.api.Group parentGroup = null;
+
+ if (parent != null)
+ {
+ parentGroup =
+ getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(),
orgService.getGtnGroupType());
+ ((GroupImpl)child).setId(parent.getId() + "/" +
child.getGroupName());
+
+ }
+ else
+ {
+ ((GroupImpl)child).setId("/" + child.getGroupName());
+ }
+
+ if (broadcast)
+ {
+ preSave(child, true);
+ }
+
+ org.picketlink.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.picketlink.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(group.getGroupName(),
orgService.getGtnGroupType());
+
+ if (jbidGroup == null)
+ {
+ return group;
+ }
+
+ // MembershipDAOImpl.removeMembershipEntriesOfGroup(group,
getIdentitySession());
+
+ Collection<org.picketlink.idm.api.Group> oneLevelChilds =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
+ true, false);
+
+ Collection<org.picketlink.idm.api.Group> allChilds =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
+ true, true);
+
+ getIdentitySession().getRelationshipManager().disassociateGroups(jbidGroup,
oneLevelChilds);
+
+ for (org.picketlink.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.picketlink.idm.api.Role> allRoles =
+ getIdentitySession().getRoleManager().findRoles(userName, membershipType);
+
+ Set<Group> exoGroups = new HashSet<Group>();
+
+ for (org.picketlink.idm.api.Role role : allRoles)
+ {
+ exoGroups.add(convertGroup(role.getGroup()));
+
+ }
+
+ return exoGroups;
+ }
+
+ //
+ public Group findGroupById(String groupId) throws Exception
+ {
+
+ org.picketlink.idm.api.Group jbidGroup = orgService.getJBIDMGroup(groupId);
+
+ if (jbidGroup == null)
+ {
+ return null;
+ }
+
+ return convertGroup(jbidGroup);
+ }
+
+ public Collection findGroups(Group parent) throws Exception
+ {
+ org.picketlink.idm.api.Group jbidGroup = null;
+
+ if (parent == null)
+ {
+ jbidGroup = getRootGroup();
+ }
+ else
+ {
+ jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(parent.getGroupName(),
orgService.getGtnGroupType());
+ }
+
+ if (jbidGroup == null)
+ {
+ return Collections.emptyList();
+ }
+
+ Collection<org.picketlink.idm.api.Group> allGroups =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
+ true, false);
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.picketlink.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.picketlink.idm.impl.api.session.managers.AbstractManager.checkNotNullArgument(AbstractManager.java:267)
+ // at
org.picketlink.idm.impl.api.session.managers.RelationshipManagerImpl.findRelatedGroups(RelationshipManagerImpl.java:753)
+ // at
org.exoplatform.services.organization.idm.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.picketlink.idm.api.Group> allGroups =
+ getIdentitySession().getRelationshipManager().findRelatedGroups(user,
orgService.getGtnGroupType(), null);
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.picketlink.idm.api.Group group : allGroups)
+ {
+ exoGroups.add(convertGroup(group));
+
+ }
+
+ return exoGroups;
+ }
+
+ public Collection getAllGroups() throws Exception
+ {
+ Collection<org.picketlink.idm.api.Group> allGroups =
+
getIdentitySession().getPersistenceManager().findGroup(orgService.getGtnGroupType());
+
+ List<Group> exoGroups = new LinkedList<Group>();
+
+ for (org.picketlink.idm.api.Group group : allGroups)
+ {
+ if (!orgService.getGtnGroupType().equals(orgService.getGtnRootGroupType())
+ || !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.picketlink.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(groupName,
orgService.getGtnGroupType());
+
+ if (jbidGroup == null)
+ {
+ return null;
+ }
+
+ return convertGroup(jbidGroup);
+
+ }
+
+ private Group convertGroup(org.picketlink.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) &&
attrs.get(GROUP_DESCRIPTION).getValue() != null)
+ {
+ exoGroup.setDescription(attrs.get(GROUP_DESCRIPTION).getValue().toString());
+ }
+ if (attrs.containsKey(GROUP_LABEL) && attrs.get(GROUP_LABEL).getValue() !=
null)
+ {
+ 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.picketlink.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(groupName,
orgService.getGtnGroupType());
+
+ Collection<org.picketlink.idm.api.Group> parents =
+ getIdentitySession().getRelationshipManager().findAssociatedGroups(jbidGroup,
orgService.getGtnGroupType(),
+ 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.picketlink.idm.api.Group)parents.iterator().next()).getName());
+
+ return parentGroupId + "/" + groupName;
+
+ }
+
+ private org.picketlink.idm.api.Group persistGroup(Group exoGroup) throws Exception
+ {
+
+ org.picketlink.idm.api.Group jbidGroup =
+ getIdentitySession().getPersistenceManager().findGroup(exoGroup.getGroupName(),
orgService.getGtnGroupType());
+
+ if (jbidGroup == null)
+ {
+ jbidGroup =
+
getIdentitySession().getPersistenceManager().createGroup(exoGroup.getGroupName(),
+ orgService.getGtnGroupType());
+ }
+
+ 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.picketlink.idm.api.Group getRootGroup() throws Exception
+ {
+ org.picketlink.idm.api.Group rootGroup =
+
getIdentitySession().getPersistenceManager().findGroup(orgService.getExoRootGroupName(),
+ orgService.getGtnRootGroupType());
+
+ if (rootGroup == null)
+ {
+ rootGroup =
+
getIdentitySession().getPersistenceManager().createGroup(orgService.getExoRootGroupName(),
+ orgService.getGtnRootGroupType());
+ }
+
+ return rootGroup;
+ }
+}
Deleted:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-import org.exoplatform.commons.utils.ListAccess;
-import org.exoplatform.services.organization.User;
-import org.picketlink.idm.api.query.UserQuery;
-import org.picketlink.idm.api.query.UserQueryBuilder;
-
-import java.util.List;
-
-public class IDMUserListAccess implements ListAccess<User>
-{
- private final UserDAOImpl userDAO;
-
- private final PicketLinkIDMService idmService;
-
- private final UserQueryBuilder userQueryBuilder;
-
- private final int pageSize;
-
- private final boolean countAll;
-
- public IDMUserListAccess(UserDAOImpl userDAO, PicketLinkIDMService 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.picketlink.idm.api.User> users =
idmService.getIdentitySession().list(query);
-
- User[] exoUsers = new User[users.size()];
-
- for (int i = 0; i < users.size(); i++)
- {
- org.picketlink.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/idm/IDMUserListAccess.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMUserListAccess.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.services.organization.User;
+import org.picketlink.idm.api.query.UserQuery;
+import org.picketlink.idm.api.query.UserQueryBuilder;
+
+import java.util.List;
+
+public class IDMUserListAccess implements ListAccess<User>
+{
+ private final UserDAOImpl userDAO;
+
+ private final PicketLinkIDMService idmService;
+
+ private final UserQueryBuilder userQueryBuilder;
+
+ private final int pageSize;
+
+ private final boolean countAll;
+
+ public IDMUserListAccess(UserDAOImpl userDAO, PicketLinkIDMService 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.picketlink.idm.api.User> users =
idmService.getIdentitySession().list(query);
+
+ User[] exoUsers = new User[users.size()];
+
+ for (int i = 0; i < users.size(); i++)
+ {
+ org.picketlink.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/idm/MembershipDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-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.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.api.Role;
-import org.picketlink.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 PicketLinkIDMService service_;
-
- private List listeners_;
-
- private PicketLinkIDMOrganizationServiceImpl orgService;
-
- public MembershipDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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().createGroupKey(g.getGroupName(),
orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
- orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
- orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(groupId),
- orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(groupId),
- orgService.getGtnGroupType());
-
- 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(PicketLinkIDMOrganizationServiceImpl
orgService, Group group,
- IdentitySession session) throws Exception
- {
- String gid = session.getPersistenceManager().createGroupKey(group.getGroupName(),
orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(groupId),
- orgService.getGtnGroupType());
-
- 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
- orgService.getGtnGroupType());
-
- 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/idm/MembershipDAOImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+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.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.Role;
+import org.picketlink.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 PicketLinkIDMService service_;
+
+ private List listeners_;
+
+ private PicketLinkIDMOrganizationServiceImpl orgService;
+
+ public MembershipDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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().createGroupKey(g.getGroupName(),
orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
+ orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
+ orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(groupId),
+ orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(groupId),
+ orgService.getGtnGroupType());
+
+ 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(PicketLinkIDMOrganizationServiceImpl
orgService, Group group,
+ IdentitySession session) throws Exception
+ {
+ String gid = session.getPersistenceManager().createGroupKey(group.getGroupName(),
orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(groupId),
+ orgService.getGtnGroupType());
+
+ 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().createGroupKey(getGroupNameFromId(m.getGroupId()),
+ orgService.getGtnGroupType());
+
+ 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/idm/MembershipImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-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/idm/MembershipImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+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/idm/MembershipTypeDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-import org.exoplatform.services.organization.MembershipType;
-import org.exoplatform.services.organization.MembershipTypeHandler;
-import org.exoplatform.services.organization.impl.MembershipTypeImpl;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.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 PicketLinkIDMService service_;
-
- private PicketLinkIDMOrganizationServiceImpl orgService;
-
- public MembershipTypeDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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/idm/MembershipTypeDAOImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+import org.exoplatform.services.organization.MembershipType;
+import org.exoplatform.services.organization.MembershipTypeHandler;
+import org.exoplatform.services.organization.impl.MembershipTypeImpl;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.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 PicketLinkIDMService service_;
+
+ private PicketLinkIDMOrganizationServiceImpl orgService;
+
+ public MembershipTypeDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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/idm/PicketLinkIDMOrganizationServiceImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-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 PicketLinkIDMOrganizationServiceImpl extends BaseOrganizationService
implements Startable,
- ComponentRequestLifecycle
-{
-
- // We may have several portal containers thus we need one PicketLinkIDMService per
portal container
- // private static PicketLinkIDMService jbidmService_;
- private PicketLinkIDMService idmService_;
-
- public static final String GTN_GROUP_TYPE_OPTION = "gtnGroupTypeName";
-
- public static final String GTN_ROOT_GROUP_NAME_OPTION = "gtnRootGroupName";
-
- public static final String GTN_ROOT_GROUP_TYPE_NAME_OPTION =
"gtnRootGroupTypeName";
-
- public static final String PASSWORD_AS_ATTRIBUTE_OPTION =
"passwordAsAttribute";
-
- private String gtnGroupType = "GTN_GROUP_TYPE";
-
- private String gtnRootGroupName = "GTN_ROOT_GROUP";
-
- private String gtnRootGroupType = gtnGroupType;
-
- private boolean passwordAsAttribute = false;
-
- public PicketLinkIDMOrganizationServiceImpl(InitParams params, CacheService cservice,
PicketLinkIDMService idmService)
- throws Exception
- {
- groupDAO_ = new GroupDAOImpl(this, idmService);
- userDAO_ = new UserDAOImpl(this, idmService, cservice);
- userProfileDAO_ = new UserProfileDAOImpl(this, idmService, cservice);
- membershipDAO_ = new MembershipDAOImpl(this, idmService);
- membershipTypeDAO_ = new MembershipTypeDAOImpl(this, idmService);
-
- idmService_ = idmService;
-
- if (params != null)
- {
- //Options
- ValueParam gtnGroupTypeNameParam = params.getValueParam(GTN_GROUP_TYPE_OPTION);
- ValueParam gtnRootGroupTypeNameParam =
params.getValueParam(GTN_ROOT_GROUP_TYPE_NAME_OPTION);
- ValueParam gtnRootGroupNameParam =
params.getValueParam(GTN_ROOT_GROUP_NAME_OPTION);
- ValueParam passwordAsAttributeParam =
params.getValueParam(PASSWORD_AS_ATTRIBUTE_OPTION);
-
- if (gtnGroupTypeNameParam != null)
- {
- this.gtnGroupType = gtnGroupTypeNameParam.getValue();
- }
-
- if (gtnRootGroupNameParam != null)
- {
- this.gtnRootGroupName = gtnRootGroupNameParam.getValue();
- }
-
- if (gtnRootGroupTypeNameParam != null)
- {
- this.gtnRootGroupType = gtnRootGroupTypeNameParam.getValue();
- }
- else if (gtnRootGroupTypeNameParam != null)
- {
- this.gtnRootGroupType = this.gtnGroupType;
- }
-
- if (passwordAsAttributeParam != null &&
passwordAsAttributeParam.getValue().equalsIgnoreCase("true"))
- {
- this.passwordAsAttribute = true;
- }
- }
-
- }
-
- public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws
Exception
- {
- String[] ids = groupId.split("/");
- String name = ids[ids.length - 1];
- return idmService_.getIdentitySession().getPersistenceManager().findGroup(name,
getGtnGroupType());
- }
-
- @Override
- public void start()
- {
-
- try
- {
- // Wrap within transaction so all initializers can work
- idmService_.getIdentitySession().beginTransaction();
- super.start();
- idmService_.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
- {
- idmService_.getIdentitySession().beginTransaction();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void endRequest(ExoContainer container)
- {
- try
- {
- idmService_.getIdentitySession().getTransaction().commit();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public String getGtnGroupType()
- {
- return gtnGroupType;
- }
-
- public String getExoRootGroupName()
- {
- return gtnRootGroupName;
- }
-
- public String getGtnRootGroupType()
- {
- return gtnRootGroupType;
- }
-
- public boolean isPasswordAsAttribute()
- {
- return passwordAsAttribute;
- }
-}
Copied:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+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 PicketLinkIDMOrganizationServiceImpl extends BaseOrganizationService
implements Startable,
+ ComponentRequestLifecycle
+{
+
+ // We may have several portal containers thus we need one PicketLinkIDMService per
portal container
+ // private static PicketLinkIDMService jbidmService_;
+ private PicketLinkIDMService idmService_;
+
+ public static final String GTN_GROUP_TYPE_OPTION = "gtnGroupTypeName";
+
+ public static final String GTN_ROOT_GROUP_NAME_OPTION = "gtnRootGroupName";
+
+ public static final String GTN_ROOT_GROUP_TYPE_NAME_OPTION =
"gtnRootGroupTypeName";
+
+ public static final String PASSWORD_AS_ATTRIBUTE_OPTION =
"passwordAsAttribute";
+
+ private String gtnGroupType = "GTN_GROUP_TYPE";
+
+ private String gtnRootGroupName = "GTN_ROOT_GROUP";
+
+ private String gtnRootGroupType = gtnGroupType;
+
+ private boolean passwordAsAttribute = false;
+
+ public PicketLinkIDMOrganizationServiceImpl(InitParams params, CacheService cservice,
PicketLinkIDMService idmService)
+ throws Exception
+ {
+ groupDAO_ = new GroupDAOImpl(this, idmService);
+ userDAO_ = new UserDAOImpl(this, idmService, cservice);
+ userProfileDAO_ = new UserProfileDAOImpl(this, idmService, cservice);
+ membershipDAO_ = new MembershipDAOImpl(this, idmService);
+ membershipTypeDAO_ = new MembershipTypeDAOImpl(this, idmService);
+
+ idmService_ = idmService;
+
+ if (params != null)
+ {
+ //Options
+ ValueParam gtnGroupTypeNameParam = params.getValueParam(GTN_GROUP_TYPE_OPTION);
+ ValueParam gtnRootGroupTypeNameParam =
params.getValueParam(GTN_ROOT_GROUP_TYPE_NAME_OPTION);
+ ValueParam gtnRootGroupNameParam =
params.getValueParam(GTN_ROOT_GROUP_NAME_OPTION);
+ ValueParam passwordAsAttributeParam =
params.getValueParam(PASSWORD_AS_ATTRIBUTE_OPTION);
+
+ if (gtnGroupTypeNameParam != null)
+ {
+ this.gtnGroupType = gtnGroupTypeNameParam.getValue();
+ }
+
+ if (gtnRootGroupNameParam != null)
+ {
+ this.gtnRootGroupName = gtnRootGroupNameParam.getValue();
+ }
+
+ if (gtnRootGroupTypeNameParam != null)
+ {
+ this.gtnRootGroupType = gtnRootGroupTypeNameParam.getValue();
+ }
+ else if (gtnRootGroupTypeNameParam != null)
+ {
+ this.gtnRootGroupType = this.gtnGroupType;
+ }
+
+ if (passwordAsAttributeParam != null &&
passwordAsAttributeParam.getValue().equalsIgnoreCase("true"))
+ {
+ this.passwordAsAttribute = true;
+ }
+ }
+
+ }
+
+ public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws
Exception
+ {
+ String[] ids = groupId.split("/");
+ String name = ids[ids.length - 1];
+ return idmService_.getIdentitySession().getPersistenceManager().findGroup(name,
getGtnGroupType());
+ }
+
+ @Override
+ public void start()
+ {
+
+ try
+ {
+ // Wrap within transaction so all initializers can work
+ idmService_.getIdentitySession().beginTransaction();
+ super.start();
+ idmService_.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
+ {
+ idmService_.getIdentitySession().beginTransaction();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void endRequest(ExoContainer container)
+ {
+ try
+ {
+ idmService_.getIdentitySession().getTransaction().commit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public String getGtnGroupType()
+ {
+ return gtnGroupType;
+ }
+
+ public String getExoRootGroupName()
+ {
+ return gtnRootGroupName;
+ }
+
+ public String getGtnRootGroupType()
+ {
+ return gtnRootGroupType;
+ }
+
+ public boolean isPasswordAsAttribute()
+ {
+ return passwordAsAttribute;
+ }
+}
Deleted:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.api.IdentitySessionFactory;
-
-public interface PicketLinkIDMService
-{
-
- IdentitySessionFactory getIdentitySessionFactory();
-
- IdentitySession getIdentitySession() throws Exception;
-
- IdentitySession getIdentitySession(String realm) throws Exception;
-
-}
Copied:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMService.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+
+public interface PicketLinkIDMService
+{
+
+ IdentitySessionFactory getIdentitySessionFactory();
+
+ IdentitySession getIdentitySession() throws Exception;
+
+ IdentitySession getIdentitySession(String realm) throws Exception;
+
+}
Deleted:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -1,149 +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.idm;
-
-import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.database.HibernateService;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.api.IdentitySessionFactory;
-import org.picketlink.idm.api.cfg.IdentityConfiguration;
-import org.picketlink.idm.common.exception.IdentityConfigurationException;
-import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
-import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
-import org.picocontainer.Startable;
-
-import java.net.URL;
-
-import javax.naming.InitialContext;
-
-public class PicketLinkIDMServiceImpl implements PicketLinkIDMService, Startable
-{
-
- private static Log log_ = ExoLogger.getLogger(PicketLinkIDMServiceImpl.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 PicketLinkIDMServiceImpl()
- {
- }
-
- public PicketLinkIDMServiceImpl(InitParams initParams, HibernateService
hibernateService, 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();
- }
-
- 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);
-
-
identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(),
"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/idm/PicketLinkIDMServiceImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -0,0 +1,149 @@
+/**
+ * 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.idm;
+
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.database.HibernateService;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.cfg.IdentityConfiguration;
+import org.picketlink.idm.common.exception.IdentityConfigurationException;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.picocontainer.Startable;
+
+import java.net.URL;
+
+import javax.naming.InitialContext;
+
+public class PicketLinkIDMServiceImpl implements PicketLinkIDMService, Startable
+{
+
+ private static Log log_ = ExoLogger.getLogger(PicketLinkIDMServiceImpl.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 PicketLinkIDMServiceImpl()
+ {
+ }
+
+ public PicketLinkIDMServiceImpl(InitParams initParams, HibernateService
hibernateService, 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();
+ }
+
+ 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);
+
+
identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(),
"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/idm/UserDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -1,420 +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.idm;
-
-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.picketlink.idm.api.Attribute;
-import org.picketlink.idm.api.AttributesManager;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.idm.api.query.UserQueryBuilder;
-import org.picketlink.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 PicketLinkIDMService 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 PicketLinkIDMOrganizationServiceImpl 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(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.idm.api.User foundUser =
session.getPersistenceManager().findUser(userName);
-
- if (foundUser == null)
- {
- cache_.remove(userName);
- return null;
- }
-
- // Remove all memberships and profile first
- orgService.getMembershipHandler().removeMembershipByUser(userName, false);
- orgService.getUserProfileHandler().removeUserProfile(userName, false);
-
- 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.picketlink.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.picketlink.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/idm/UserDAOImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -0,0 +1,420 @@
+/**
+ * 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.idm;
+
+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.picketlink.idm.api.Attribute;
+import org.picketlink.idm.api.AttributesManager;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.query.UserQueryBuilder;
+import org.picketlink.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 PicketLinkIDMService 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 PicketLinkIDMOrganizationServiceImpl 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(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.idm.api.User foundUser =
session.getPersistenceManager().findUser(userName);
+
+ if (foundUser == null)
+ {
+ cache_.remove(userName);
+ return null;
+ }
+
+ // Remove all memberships and profile first
+ orgService.getMembershipHandler().removeMembershipByUser(userName, false);
+ orgService.getUserProfileHandler().removeUserProfile(userName, false);
+
+ 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.picketlink.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.picketlink.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/idm/UserProfileDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2009-11-20
17:18:44 UTC (rev 744)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
-
-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.picketlink.idm.api.Attribute;
-import org.picketlink.idm.api.IdentitySession;
-import org.picketlink.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 PicketLinkIDMService service_;
-
- private ExoCache cache_;
-
- private List<UserProfileEventListener> listeners_;
-
- private PicketLinkIDMOrganizationServiceImpl orgService;
-
- public UserProfileDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.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/idm/UserProfileDAOImpl.java
(from rev 744,
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java)
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
(rev 0)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.idm;
+
+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.picketlink.idm.api.Attribute;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.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 PicketLinkIDMService service_;
+
+ private ExoCache cache_;
+
+ private List<UserProfileEventListener> listeners_;
+
+ private PicketLinkIDMOrganizationServiceImpl orgService;
+
+ public UserProfileDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService 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.picketlink.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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/identity/src/test/java/conf/portal/idm-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -25,54 +25,54 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
-
<type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
+
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</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.jbidm.JBossIDMOrganizationServiceImpl</type>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</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="0"/>
+ <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,19 +81,18 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<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>
+ <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>
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -173,6 +173,7 @@
// newly created 'test' and 'demo'
assertEquals(2, piterator.currentPage().size());
+// membershipHandler_.removeMembershipByUser(USER,false);
userHandler_.removeUser(USER, true);
piterator = userHandler_.getUserPageList(10);
// one 'demo'
@@ -436,19 +437,20 @@
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);
- }
+// 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 testFindUsersByGroupId() throws Exception
{
Modified: portal/trunk/component/portal/pom.xml
===================================================================
--- portal/trunk/component/portal/pom.xml 2009-11-25 19:11:07 UTC (rev 802)
+++ portal/trunk/component/portal/pom.xml 2009-11-25 20:49:26 UTC (rev 803)
@@ -82,9 +82,9 @@
</dependency>
<dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-core</artifactId>
- <version>${org.jboss.identity.idm}</version>
+ <groupId>org.picketlink.idm</groupId>
+ <artifactId>picketlink-idm-core</artifactId>
+ <version>${org.picketlink.idm}</version>
</dependency>
<dependency>
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/portal/src/test/java/conf/portal/database-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -33,6 +33,11 @@
<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="false"/>
+ <property name="hibernate.cache.use_query_cache"
value="false"/>
+ <property name="hibernate.jdbc.batch_size" value="0"/>
+ <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:target/temp/data/exodb"/>
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/portal/src/test/java/conf/portal/idm-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -25,52 +25,19 @@
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
<component>
- <key>org.exoplatform.services.organization.jbidm.JBossIDMService</key>
-
<type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
+
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</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.jbidm.JBossIDMOrganizationServiceImpl</type>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</type>
</component>
<external-component-plugins>
@@ -81,19 +48,18 @@
<type>org.exoplatform.services.database.impl.AddHibernateMappingPlugin</type>
<init-params>
<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>
+ <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>
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2009-11-25
20:49:26 UTC (rev 803)
@@ -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.jbidm.JBossIDMService;
+import org.exoplatform.services.organization.idm.PicketLinkIDMService;
import org.exoplatform.services.security.Authenticator;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.test.BasicTestCase;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.common.exception.IdentityException;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.common.exception.IdentityException;
import java.util.Arrays;
import java.util.Collections;
@@ -76,7 +76,7 @@
private DataStorage storage_;
/** . */
- private JBossIDMService idmService;
+ private PicketLinkIDMService idmService;
/** . */
private POMSessionManager mgr;
@@ -122,7 +122,7 @@
userPortalConfigSer_ =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
orgService_ =
(OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
- idmService =
(JBossIDMService)container.getComponentInstanceOfType(JBossIDMService.class);
+ idmService =
(PicketLinkIDMService)container.getComponentInstanceOfType(PicketLinkIDMService.class);
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
authenticator =
(Authenticator)container.getComponentInstanceOfType(Authenticator.class);
listenerService =
(ListenerService)container.getComponentInstanceOfType(ListenerService.class);
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/packaging/module/src/main/javascript/portal.packaging.module.js 2009-11-25
20:49:26 UTC (rev 803)
@@ -37,7 +37,7 @@
var mopVersion = "${org.gatein.mop.version}";
var chromatticVersion = "${version.chromattic}";
var reflectVersion = "${version.reflect}";
- var idmVersion = "${org.jboss.identity.idm}";
+ var idmVersion = "${org.picketlink.idm}";
var pcVersion = "${org.gatein.pc.version}";
var wciVersion = "${org.gatein.wci.version}";
var commonVersion = "${org.gatein.common.version}";
@@ -120,12 +120,12 @@
module.component.identity =
new Project("org.exoplatform.portal",
"exo.portal.component.identity", "jar", module.version).
- 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));
+ 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));
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-25 19:11:07 UTC (rev 802)
+++ portal/trunk/pom.xml 2009-11-25 20:49:26 UTC (rev 803)
@@ -46,7 +46,7 @@
<org.gatein.common.version>2.0.0-CR02</org.gatein.common.version>
<org.gatein.wci.version>2.0.0-CR01</org.gatein.wci.version>
<org.gatein.pc.version>2.1.0-CR01</org.gatein.pc.version>
- <org.jboss.identity.idm>1.0.0.Beta3</org.jboss.identity.idm>
+ <org.picketlink.idm>1.0.0.CR1</org.picketlink.idm>
<org.gatein.wsrp.version>1.0.0-Beta01</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.0-Beta10</org.gatein.mop.version>
<org.slf4j.version>1.5.6</org.slf4j.version>
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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/database/database-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -33,6 +33,11 @@
<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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-config.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -20,9 +20,9 @@
-->
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha
identity-config.xsd">
+ xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_cr1
identity-config.xsd">
<realms>
<realm>
<id>PortalRealm</id>
@@ -35,7 +35,7 @@
<repositories>
<repository>
<id>PortalRepository</id>
-
<class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+
<class>org.picketlink.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.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+
<class>org.picketlink.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-25
19:11:07 UTC (rev 802)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2009-11-25
20:49:26 UTC (rev 803)
@@ -23,54 +23,50 @@
<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.jbidm.JBossIDMService</key>
-
<type>org.exoplatform.services.organization.jbidm.JBossIDMServiceImpl</type>
+
<key>org.exoplatform.services.organization.idm.PicketLinkIDMService</key>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl</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.jbidm.JBossIDMOrganizationServiceImpl</type>
+
<type>org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl</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>