[jboss-cvs] Picketlink SVN: r209 - in idm/trunk: assembly and 23 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 22 17:15:18 EDT 2010
Author: bdaw
Date: 2010-04-22 17:15:15 -0400 (Thu, 22 Apr 2010)
New Revision: 209
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/example/auth-simple/pom.xml
idm/trunk/example/auth/pom.xml
idm/trunk/example/simple/pom.xml
idm/trunk/integration/deployer/pom.xml
idm/trunk/integration/jboss5/pom.xml
idm/trunk/integration/pom.xml
idm/trunk/parent/pom.xml
idm/trunk/picketlink-idm-api/pom.xml
idm/trunk/picketlink-idm-auth/pom.xml
idm/trunk/picketlink-idm-cache/pom.xml
idm/trunk/picketlink-idm-common/pom.xml
idm/trunk/picketlink-idm-core/pom.xml
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/IdentitySessionImpl.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/AbstractIdentityStoreRepository.java
idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
idm/trunk/picketlink-idm-docs/pom.xml
idm/trunk/picketlink-idm-hibernate/pom.xml
idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/picketlink-idm-ldap/pom.xml
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
idm/trunk/picketlink-idm-spi/pom.xml
idm/trunk/picketlink-idm-testsuite/pom.xml
idm/trunk/pom.xml
Log:
- 1.1.2.GA-SNAPSHOT
- Add more debug logging points
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/assembly/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<packaging>pom</packaging>
<name>PicketLink IDM Assembly </name>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: idm/trunk/example/auth/pom.xml
===================================================================
--- idm/trunk/example/auth/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/example/auth/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: idm/trunk/example/auth-simple/pom.xml
===================================================================
--- idm/trunk/example/auth-simple/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/example/auth-simple/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<artifactId>example-auth-simple</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication (using deployer)</name>
Modified: idm/trunk/example/simple/pom.xml
===================================================================
--- idm/trunk/example/simple/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/example/simple/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple PicketLink IDM Maven2 project</name>
Modified: idm/trunk/integration/deployer/pom.xml
===================================================================
--- idm/trunk/integration/deployer/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/integration/deployer/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -8,12 +8,12 @@
<groupId>org.picketlink.idm.integration</groupId>
<artifactId>picketlink-idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-integration</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
</parent>
<properties>
Modified: idm/trunk/integration/jboss5/pom.xml
===================================================================
--- idm/trunk/integration/jboss5/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/integration/jboss5/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -8,12 +8,12 @@
<groupId>org.picketlink.idm.integration</groupId>
<artifactId>picketlink-idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-integration</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
</parent>
<dependencies>
Modified: idm/trunk/integration/pom.xml
===================================================================
--- idm/trunk/integration/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/integration/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: idm/trunk/parent/pom.xml
===================================================================
--- idm/trunk/parent/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/parent/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,13 +2,13 @@
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
- <version>3</version>
+ <version>5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<name>PicketLink IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>PicketLink is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: idm/trunk/picketlink-idm-api/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-api/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-api/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-auth/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-auth/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-auth/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-cache/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-cache/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-cache/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-common/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-common/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-common/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-core/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-core/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/IdentitySessionImpl.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/IdentitySessionImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/IdentitySessionImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -27,6 +27,8 @@
import java.util.List;
import java.util.LinkedList;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.picketlink.idm.api.IdentitySession;
import org.picketlink.idm.api.Transaction;
@@ -81,6 +83,8 @@
private static final long serialVersionUID = 7615238887627699243L;
+ private static Logger log = Logger.getLogger(IdentitySessionImpl.class.getName());
+
private final String realmName;
private final IdentitySessionContext sessionContext;
@@ -262,192 +266,291 @@
public Collection<User> execute(UserQuery userQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
- if (results != null)
+ if (apiCacheProvider != null)
{
- return results;
+ Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- Collection<User> results = userQueryExecutor.execute((UserQueryImpl)userQuery);
+ Collection<User> results = userQueryExecutor.execute((UserQueryImpl)userQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public User uniqueResult(UserQuery userQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- User result = apiCacheProvider.getUserQueryUnique(cacheNS, userQuery);
- if (result != null)
+ if (apiCacheProvider != null)
{
- return result;
+ User result = apiCacheProvider.getUserQueryUnique(cacheNS, userQuery);
+ if (result != null)
+ {
+ return result;
+ }
}
- }
- User result = userQueryExecutor.uniqueResult((UserQueryImpl)userQuery);
+ User result = userQueryExecutor.uniqueResult((UserQueryImpl)userQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQueryUnique(cacheNS, userQuery, result);
+ }
+
+ return result;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putUserQueryUnique(cacheNS, userQuery, result);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return result;
}
public List<User> list(UserQuery userQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
- if (results != null && results instanceof List)
+ if (apiCacheProvider != null)
{
- return (List<User>)results;
+ Collection<User> results = apiCacheProvider.getUserQuery(cacheNS, userQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<User>)results;
+ }
}
- }
- List<User> results = userQueryExecutor.list((UserQueryImpl)userQuery);
+ List<User> results = userQueryExecutor.list((UserQueryImpl)userQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putUserQuery(cacheNS, userQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public Collection<Group> execute(GroupQuery groupQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
- if (results != null)
+ if (apiCacheProvider != null)
{
- return results;
+ Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- Collection<Group> results = groupQueryExecutor.execute((GroupQueryImpl)groupQuery);
+ Collection<Group> results = groupQueryExecutor.execute((GroupQueryImpl)groupQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public Group uniqueResult(GroupQuery groupQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Group result = apiCacheProvider.getGroupQueryUnique(cacheNS, groupQuery);
- if (result != null)
+ if (apiCacheProvider != null)
{
- return result;
+ Group result = apiCacheProvider.getGroupQueryUnique(cacheNS, groupQuery);
+ if (result != null)
+ {
+ return result;
+ }
}
- }
- Group group = groupQueryExecutor.uniqueResult((GroupQueryImpl)groupQuery);
+ Group group = groupQueryExecutor.uniqueResult((GroupQueryImpl)groupQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQueryUnique(cacheNS, groupQuery, group);
+ }
+
+ return group;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putGroupQueryUnique(cacheNS, groupQuery, group);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return group;
}
public List<Group> list(GroupQuery groupQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
- if (results != null && results instanceof List)
+ if (apiCacheProvider != null)
{
- return (List<Group>)results;
+ Collection<Group> results = apiCacheProvider.getGroupQuery(cacheNS, groupQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<Group>)results;
+ }
}
- }
- List<Group> results = groupQueryExecutor.list((GroupQueryImpl)groupQuery);
+ List<Group> results = groupQueryExecutor.list((GroupQueryImpl)groupQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putGroupQuery(cacheNS, groupQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public Collection<Role> execute(RoleQuery roleQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
- if (results != null)
+ if (apiCacheProvider != null)
{
- return results;
+ Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- Collection<Role> results = roleQueryExecutor.execute((RoleQueryImpl)roleQuery);
+ Collection<Role> results = roleQueryExecutor.execute((RoleQueryImpl)roleQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public Role uniqueResult(RoleQuery roleQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Role result = apiCacheProvider.getRoleQueryUnique(cacheNS, roleQuery);
- if (result != null)
+ if (apiCacheProvider != null)
{
- return result;
+ Role result = apiCacheProvider.getRoleQueryUnique(cacheNS, roleQuery);
+ if (result != null)
+ {
+ return result;
+ }
}
- }
- Role result = roleQueryExecutor.uniqueResult((RoleQueryImpl)roleQuery);
+ Role result = roleQueryExecutor.uniqueResult((RoleQueryImpl)roleQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQueryUnique(cacheNS, roleQuery, result);
+ }
+
+ return result;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putRoleQueryUnique(cacheNS, roleQuery, result);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return result;
}
public List<Role> list(RoleQuery roleQuery) throws QueryException
{
- if (apiCacheProvider != null)
+ try
{
- Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
- if (results != null && results instanceof List)
+ if (apiCacheProvider != null)
{
- return (List<Role>)results;
+ Collection<Role> results = apiCacheProvider.getRoleQuery(cacheNS, roleQuery);
+ if (results != null && results instanceof List)
+ {
+ return (List<Role>)results;
+ }
}
- }
- List<Role> results = roleQueryExecutor.list((RoleQueryImpl)roleQuery);
+ List<Role> results = roleQueryExecutor.list((RoleQueryImpl)roleQuery);
- if (apiCacheProvider != null)
+ if (apiCacheProvider != null)
+ {
+ apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ }
+
+ return results;
+ }
+ catch (QueryException e)
{
- apiCacheProvider.putRoleQuery(cacheNS, roleQuery, results);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return results;
}
public void registerListener(EventListener listener)
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AttributesManagerImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AttributesManagerImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -45,6 +45,8 @@
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -52,6 +54,9 @@
*/
public class AttributesManagerImpl extends AbstractManager implements AttributesManager, Serializable
{
+
+ private static Logger log = Logger.getLogger(AttributesManagerImpl.class.getName());
+
private static final long serialVersionUID = 1285532201632609092L;
public AttributesManagerImpl(IdentitySessionImpl session)
@@ -135,219 +140,390 @@
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
- return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
+ return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Set<String> getSupportedAttributeNames(String id) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- return getSupportedAttributeNames(identityType);
+ return getSupportedAttributeNames(identityType);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Map<String, Attribute> getAttributes(IdentityType identityType) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
- if (cache != null)
- {
- Map<String, Attribute> attributes = cache.getAttributes(cacheNS, identityType.getKey());
- if (attributes != null)
+ if (cache != null)
{
- return attributes;
+ Map<String, Attribute> attributes = cache.getAttributes(cacheNS, identityType.getKey());
+ if (attributes != null)
+ {
+ return attributes;
+ }
}
- }
- Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identityType));
+ Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identityType));
- Map<String, Attribute> newMap = new HashMap<String, Attribute>();
+ Map<String, Attribute> newMap = new HashMap<String, Attribute>();
- for (Map.Entry<String, IdentityObjectAttribute> entry : map.entrySet())
- {
- newMap.put(entry.getKey(), convertAttribute(entry.getValue()));
+ for (Map.Entry<String, IdentityObjectAttribute> entry : map.entrySet())
+ {
+ newMap.put(entry.getKey(), convertAttribute(entry.getValue()));
+ }
+
+ if (cache != null)
+ {
+ cache.putAttributes(cacheNS, identityType.getKey(), newMap);
+ }
+ return newMap;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- cache.putAttributes(cacheNS, identityType.getKey(), newMap);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- return newMap;
}
public Map<String, Attribute> getAttributes(String id) throws IdentityException
{
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(id, "Id (Group) or name (User)");
+ IdentityType identityType = createIdentityTypeFromId(id);
- IdentityType identityType = createIdentityTypeFromId(id);
-
- return getAttributes(identityType);
+ return getAttributes(identityType);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void updateAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
- checkNotNullArgument(attributes, "Attributes");
+ try
+ {
+ checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(attributes, "Attributes");
- preAttributesUpdate(identity, attributes);
+ preAttributesUpdate(identity, attributes);
- getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
+ getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
- if (cache != null)
+ if (cache != null)
+ {
+ // Grab the new profile and persist in cache
+ cache.invalidateAttributes(cacheNS, identity.getKey());
+ this.getAttributes(identity);
+ }
+
+ postAttributesUpdate(identity, attributes);
+ }
+ catch (IdentityException e)
{
- // Grab the new profile and persist in cache
- cache.invalidateAttributes(cacheNS, identity.getKey());
- this.getAttributes(identity);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- postAttributesUpdate(identity, attributes);
-
}
public void updateAttributes(String id, Attribute[] attributes) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributes, "Attributes");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributes, "Attributes");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- updateAttributes(identityType, attributes);
+ updateAttributes(identityType, attributes);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Attribute getAttribute(IdentityType identityType, String attributeName) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(attributeName, "Attribute name");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
- return getAttributes(identityType).get(attributeName);
+ return getAttributes(identityType).get(attributeName);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Attribute getAttribute(String id, String attributeName) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributeName, "Attribute name");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- return getAttribute(identityType, attributeName);
+ return getAttribute(identityType, attributeName);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttribute(IdentityType identityType, String attributeName, Object[] values) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(values, "Attribute values");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(values, "Attribute values");
- Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
+ Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
- addAttributes(identityType, attrs);
+ addAttributes(identityType, attrs);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttributes(String id, Attribute[] attributes) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributes, "Attributes");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributes, "Attributes");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- addAttributes(identityType, attributes);
+ addAttributes(identityType, attributes);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttribute(IdentityType identityType, String attributeName, Object value) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(value, "Attribute value");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
- Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
+ Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
- addAttributes(identityType, attrs);
+ addAttributes(identityType, attrs);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttribute(String id, String attributeName, Object[] values) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(values, "Attribute values");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(values, "Attribute values");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- addAttribute(identityType, attributeName, values);
+ addAttribute(identityType, attributeName, values);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttribute(String id, String attributeName, Object value) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(value, "Attribute value");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- addAttribute(identityType, attributeName, value);
+ addAttribute(identityType, attributeName, value);
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
}
public void addAttributes(IdentityType identityType, Attribute[] attributes) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(attributes, "Attributes");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(attributes, "Attributes");
- preAttributesAdd(identityType, attributes);
+ preAttributesAdd(identityType, attributes);
- getRepository().addAttributes(getInvocationContext(), createIdentityObject(identityType), convertAttributes(attributes));
+ getRepository().addAttributes(getInvocationContext(), createIdentityObject(identityType), convertAttributes(attributes));
- if (cache != null)
+ if (cache != null)
+ {
+ // Grab the new profile and persist in cache
+ cache.invalidateAttributes(cacheNS, identityType.getKey());
+ this.getAttributes(identityType);
+ }
+
+ postAttributesAdd(identityType, attributes);
+ }
+ catch (IdentityException e)
{
- // Grab the new profile and persist in cache
- cache.invalidateAttributes(cacheNS, identityType.getKey());
- this.getAttributes(identityType);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postAttributesAdd(identityType, attributes);
}
public void removeAttributes(IdentityType identityType, String[] attributeNames) throws IdentityException
{
- checkNotNullArgument(identityType, "IdentityType");
- checkNotNullArgument(attributeNames, "Attribute names");
+ try
+ {
+ checkNotNullArgument(identityType, "IdentityType");
+ checkNotNullArgument(attributeNames, "Attribute names");
- preAttributesRemove(identityType, attributeNames);
+ preAttributesRemove(identityType, attributeNames);
- getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identityType), attributeNames);
+ getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identityType), attributeNames);
- if (cache != null)
+ if (cache != null)
+ {
+ // Grab the new profile and persist in cache
+ cache.invalidateAttributes(cacheNS, identityType.getKey());
+ this.getAttributes(identityType);
+ }
+
+ postAttributesRemove(identityType, attributeNames);
+ }
+ catch (IdentityException e)
{
- // Grab the new profile and persist in cache
- cache.invalidateAttributes(cacheNS, identityType.getKey());
- this.getAttributes(identityType);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postAttributesRemove(identityType, attributeNames);
}
public void removeAttributes(String id, String[] attributeNames) throws IdentityException
{
- checkNotNullArgument(id, "Id (Group) or name (User)");
- checkNotNullArgument(attributeNames, "Attribute names");
+ try
+ {
+ checkNotNullArgument(id, "Id (Group) or name (User)");
+ checkNotNullArgument(attributeNames, "Attribute names");
- IdentityType identityType = createIdentityTypeFromId(id);
+ IdentityType identityType = createIdentityTypeFromId(id);
- removeAttributes(identityType, attributeNames);
+ removeAttributes(identityType, attributeNames);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
@@ -359,21 +535,43 @@
public boolean validatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(user, "User");
- checkNotNullArgument(password, "Password");
- return getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
+ try
+ {
+ checkNotNullArgument(user, "User");
+ checkNotNullArgument(password, "Password");
+ return getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void updatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(user, "User");
- checkNotNullArgument(password, "Password");
+ try
+ {
+ checkNotNullArgument(user, "User");
+ checkNotNullArgument(password, "Password");
- preCredentialUpdate(user, new PasswordCredential(password));
+ preCredentialUpdate(user, new PasswordCredential(password));
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), new PasswordCredential(password));
- postCredentialUpdate(user, new PasswordCredential(password));
+ postCredentialUpdate(user, new PasswordCredential(password));
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
@@ -386,86 +584,130 @@
public boolean validateCredentials(User user, Credential[] credentials) throws IdentityException
{
- checkNotNullArgument(user, "User");
- checkNotNullArgument(credentials, "Credentials");
-
- for (Credential credential : credentials)
+ try
{
- IdentityObjectCredential ioc = null;
+ checkNotNullArgument(user, "User");
+ checkNotNullArgument(credentials, "Credentials");
- //Handle only those credentials that implement SPI
-
- if (!(credential instanceof IdentityObjectCredential))
+ for (Credential credential : credentials)
{
- throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
- }
+ IdentityObjectCredential ioc = null;
- ioc = (IdentityObjectCredential)credential;
+ //Handle only those credentials that implement SPI
- // All credentials must pass
+ if (!(credential instanceof IdentityObjectCredential))
+ {
+ throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
+ }
- if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), ioc))
+ ioc = (IdentityObjectCredential)credential;
+
+ // All credentials must pass
+
+ if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(user), ioc))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
{
- return false;
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
-
- return true;
}
public void updateCredential(User user, Credential credential) throws IdentityException
{
- checkNotNullArgument(user, "User");
- checkNotNullArgument(credential, "Credential");
-
- if (credential instanceof IdentityObjectCredential)
+ try
{
- preCredentialUpdate(user, credential);
+ checkNotNullArgument(user, "User");
+ checkNotNullArgument(credential, "Credential");
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), (IdentityObjectCredential)credential);
+ if (credential instanceof IdentityObjectCredential)
+ {
+ preCredentialUpdate(user, credential);
- postCredentialUpdate(user, credential);
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(user), (IdentityObjectCredential)credential);
+
+ postCredentialUpdate(user, credential);
+ }
+ else
+ {
+ throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
+ }
}
- else
+ catch (IdentityException e)
{
- throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
}
public User findUserByUniqueAttribute(String attributeName, Object value) throws IdentityException
{
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(value, "Attribute value");
+ try
+ {
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
- //TODO: cache
+ //TODO: cache
- IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(), getUserObjectType(), new SimpleAttribute(attributeName, value));
+ IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(), getUserObjectType(), new SimpleAttribute(attributeName, value));
- if (io == null)
+ if (io == null)
+ {
+ return null;
+ }
+
+ return createUser(io);
+ }
+ catch (IdentityException e)
{
- return null;
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return createUser(io);
}
public Group findGroupByUniqueAttribute(String groupType, String attributeName, Object value) throws IdentityException
{
- checkNotNullArgument(groupType, "GroupType");
- checkNotNullArgument(attributeName, "Attribute name");
- checkNotNullArgument(value, "Attribute value");
+ try
+ {
+ checkNotNullArgument(groupType, "GroupType");
+ checkNotNullArgument(attributeName, "Attribute name");
+ checkNotNullArgument(value, "Attribute value");
- //TODO: cache
+ //TODO: cache
- IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(),
- getIdentityObjectType(groupType),
- new SimpleAttribute(attributeName, value));
+ IdentityObject io = getRepository().findIdentityObjectByUniqueAttribute(getInvocationContext(),
+ getIdentityObjectType(groupType),
+ new SimpleAttribute(attributeName, value));
- if (io == null)
+ if (io == null)
+ {
+ return null;
+ }
+
+ return createGroup(io);
+ }
+ catch (IdentityException e)
{
- return null;
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return createGroup(io);
}
}
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/PersistenceManagerImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/PersistenceManagerImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -39,6 +39,8 @@
import java.util.LinkedList;
import java.util.Iterator;
import java.io.Serializable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -47,6 +49,8 @@
public class PersistenceManagerImpl extends AbstractManager implements PersistenceManager, Serializable
{
+ private static Logger log = Logger.getLogger(PersistenceManagerImpl.class.getName());
+
private final PersistenceManagerFeaturesDescription featuresDescription;
private static final long serialVersionUID = -4691446225503953920L;
@@ -116,67 +120,89 @@
public User createUser(String identityName) throws IdentityException
{
- checkNotNullArgument(identityName, "Identity name");
- checkObjectName(identityName);
+ try
+ {
+ checkNotNullArgument(identityName, "Identity name");
+ checkObjectName(identityName);
- IdentityObjectType iot = getUserObjectType();
+ IdentityObjectType iot = getUserObjectType();
- preCreate(new SimpleUser(identityName));
+ preCreate(new SimpleUser(identityName));
- IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), identityName, iot);
+ IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), identityName, iot);
- User user = null;
+ User user = null;
- if (identityObject != null)
- {
- user = new SimpleUser(identityName);
- }
+ if (identityObject != null)
+ {
+ user = new SimpleUser(identityName);
+ }
- //Cache
- if (cache != null)
- {
- //TODO: maybe invalidate only part
- cache.invalidate(cacheNS);
- cache.putUser(cacheNS, user);
- }
+ //Cache
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ cache.putUser(cacheNS, user);
+ }
- postCreate(user);
+ postCreate(user);
- return user;
+ return user;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Group createGroup(String groupName, String groupType) throws IdentityException
{
- checkNotNullArgument(groupName, "Group name");
- checkNotNullArgument(groupType, "Group type");
- checkObjectName(groupName);
- checkObjectName(groupType);
+ try
+ {
+ checkNotNullArgument(groupName, "Group name");
+ checkNotNullArgument(groupType, "Group type");
+ checkObjectName(groupName);
+ checkObjectName(groupType);
- IdentityObjectType iot = getIdentityObjectType(groupType);
+ IdentityObjectType iot = getIdentityObjectType(groupType);
- preCreate(new SimpleGroup(groupName, groupType));
+ preCreate(new SimpleGroup(groupName, groupType));
- IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), groupName, iot);
+ IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), groupName, iot);
- Group group = null;
+ Group group = null;
- if (identityObject != null)
- {
- group = new SimpleGroup(groupName, groupType);
+ if (identityObject != null)
+ {
+ group = new SimpleGroup(groupName, groupType);
+ }
+
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ cache.putGroup(cacheNS, group);
+ }
+
+ postCreate(new SimpleGroup(groupName, groupType));
+
+ return group;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- //TODO: maybe invalidate only part
- cache.invalidate(cacheNS);
- cache.putGroup(cacheNS, group);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postCreate(new SimpleGroup(groupName, groupType));
-
- return group;
}
public String createGroupKey(String groupName, String groupType)
@@ -196,214 +222,312 @@
public void removeUser(User user, boolean force) throws IdentityException
{
- checkNotNullArgument(user, "User");
+ try
+ {
+ checkNotNullArgument(user, "User");
- preRemove(user);
+ preRemove(user);
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(user));
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(user));
- if (cache != null)
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ }
+
+ postRemove(user);
+ }
+ catch (IdentityException e)
{
- //TODO: maybe invalidate only part
- cache.invalidate(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- postRemove(user);
-
}
public void removeUser(String userName, boolean force) throws IdentityException
{
- checkNotNullArgument(userName, "User name");
+ try
+ {
+ checkNotNullArgument(userName, "User name");
- preRemove(new SimpleUser(userName));
+ preRemove(new SimpleUser(userName));
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForUserName(userName));
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForUserName(userName));
- if (cache != null)
+ if (cache != null)
+ {
+ //TODO: maybe invalidate only part
+ cache.invalidate(cacheNS);
+ }
+
+ postRemove(new SimpleUser(userName));
+ }
+ catch (IdentityException e)
{
- //TODO: maybe invalidate only part
- cache.invalidate(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- postRemove(new SimpleUser(userName));
-
}
public void removeGroup(Group group, boolean force) throws IdentityException
{
- checkNotNullArgument(group, "Group");
+ try
+ {
+ checkNotNullArgument(group, "Group");
- //TODO: force
+ //TODO: force
- preRemove(group);
+ preRemove(group);
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(group));
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(group));
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidate(cacheNS);
+ }
+
+ postRemove(group);
+ }
+ catch (IdentityException e)
{
- cache.invalidate(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postRemove(group);
}
public void removeGroup(String groupId, boolean force) throws IdentityException
{
- checkNotNullArgument(groupId, "Group Id");
+ try
+ {
+ checkNotNullArgument(groupId, "Group Id");
- //TODO: force
+ //TODO: force
- preRemove(new SimpleGroup(new GroupKey(groupId)));
+ preRemove(new SimpleGroup(new GroupKey(groupId)));
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForGroupId(groupId));
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForGroupId(groupId));
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidate(cacheNS);
+ }
+
+ postRemove(new SimpleGroup(new GroupKey(groupId)));
+ }
+ catch (IdentityException e)
{
- cache.invalidate(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- postRemove(new SimpleGroup(new GroupKey(groupId)));
-
}
public int getUserCount() throws IdentityException
{
- if (cache != null)
+ try
{
- int count = cache.getUserCount(cacheNS);
- if (count != -1)
+ if (cache != null)
{
- return count;
+ int count = cache.getUserCount(cacheNS);
+ if (count != -1)
+ {
+ return count;
+ }
}
- }
- IdentityObjectType iot = getUserObjectType();
+ IdentityObjectType iot = getUserObjectType();
- int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.putUserCount(cacheNS, count);
+ }
+
+ return count;
+ }
+ catch (IdentityException e)
{
- cache.putUserCount(cacheNS, count);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return count;
}
public int getGroupTypeCount(String groupType) throws IdentityException
{
- checkNotNullArgument(groupType, "Group type");
+ try
+ {
+ checkNotNullArgument(groupType, "Group type");
- if (cache != null)
- {
- int count = cache.getGroupCount(cacheNS, groupType);
- if (count != -1)
+ if (cache != null)
{
- return count;
+ int count = cache.getGroupCount(cacheNS, groupType);
+ if (count != -1)
+ {
+ return count;
+ }
}
- }
- IdentityObjectType iot = getIdentityObjectType(groupType);
+ IdentityObjectType iot = getIdentityObjectType(groupType);
- int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ int count = getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.putGroupCount(cacheNS, groupType, count);
+ }
+
+ return count;
+ }
+ catch (IdentityException e)
{
- cache.putGroupCount(cacheNS, groupType, count);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return count;
}
public User findUser(String name) throws IdentityException
{
- checkNotNullArgument(name, "User name");
+ try
+ {
+ checkNotNullArgument(name, "User name");
- if (cache != null)
- {
- User user = cache.getUser(cacheNS, name);
- if (user != null)
+ if (cache != null)
{
+ User user = cache.getUser(cacheNS, name);
+ if (user != null)
+ {
+ return user;
+ }
+ }
+
+ IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType());
+
+ if (io != null)
+ {
+ User user = createUser(io);
+
+ if (cache != null)
+ {
+ cache.putUser(cacheNS, user);
+ }
+
return user;
}
+ return null;
}
-
- IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getUserObjectType());
-
- if (io != null)
+ catch (IdentityException e)
{
- User user = createUser(io);
-
- if (cache != null)
+ if (log.isLoggable(Level.FINER))
{
- cache.putUser(cacheNS, user);
+ log.log(Level.FINER, "Exception occurred: ", e);
}
-
- return user;
+ throw e;
}
- return null;
}
public Collection<User> findUser(IdentitySearchCriteria criteria) throws IdentityException
{
-
- if (cache != null)
+ try
{
- Collection<User> users = cache.getUsers(cacheNS, criteria);
- if (users != null)
+ if (cache != null)
{
- return users;
+ Collection<User> users = cache.getUsers(cacheNS, criteria);
+ if (users != null)
+ {
+ return users;
+ }
}
- }
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(), convertSearchControls(criteria));
- List<User> identities = new LinkedList<User>();
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(), convertSearchControls(criteria));
+ List<User> identities = new LinkedList<User>();
- for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- identities.add(createUser(identityObject));
- }
+ for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
+ {
+ IdentityObject identityObject = iterator.next();
+ identities.add(createUser(identityObject));
+ }
- if (cache != null)
+ if (cache != null)
+ {
+ cache.putUsers(cacheNS, criteria, identities);
+ }
+
+ return identities;
+ }
+ catch (IdentityException e)
{
- cache.putUsers(cacheNS, criteria, identities);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return identities;
}
public Group findGroup(String name, String groupType) throws IdentityException
{
- checkNotNullArgument(name, "Group name");
- checkNotNullArgument(groupType, "Group type");
+ try
+ {
+ checkNotNullArgument(name, "Group name");
+ checkNotNullArgument(groupType, "Group type");
- if (cache != null)
- {
- Group group = cache.getGroup(cacheNS, groupType, name);
- if (group != null)
+ if (cache != null)
{
+ Group group = cache.getGroup(cacheNS, groupType, name);
+ if (group != null)
+ {
+ return group;
+ }
+ }
+
+ IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType));
+
+ if (io != null)
+ {
+ Group group = createGroup(io);
+
+ if (cache != null)
+ {
+ cache.putGroup(cacheNS, group);
+ }
+
return group;
}
+ return null;
}
-
- IdentityObject io = getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType));
-
- if (io != null)
+ catch (IdentityException e)
{
- Group group = createGroup(io);
-
- if (cache != null)
+ if (log.isLoggable(Level.FINER))
{
- cache.putGroup(cacheNS, group);
+ log.log(Level.FINER, "Exception occurred: ", e);
}
-
- return group;
+ throw e;
}
- return null;
}
public Group findGroupByKey(String id) throws IdentityException
@@ -424,41 +548,52 @@
public Collection<Group> findGroup(String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(groupType, "Group type");
-
- if (cache != null)
+ try
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(groupType, "Group type");
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(criteria));
- List<Group> groups = new LinkedList<Group>();
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(criteria));
+ List<Group> groups = new LinkedList<Group>();
- for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- groups.add(createGroup(identityObject));
- }
+ for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
+ {
+ IdentityObject identityObject = iterator.next();
+ groups.add(createGroup(identityObject));
+ }
- if (cache != null)
- {
- GroupSearchImpl search = new GroupSearchImpl();
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
- cache.putGroupSearch(cacheNS, search, groups);
+ cache.putGroupSearch(cacheNS, search, groups);
+ }
+
+ return groups;
}
-
- return groups;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Collection<Group> findGroup(String groupType) throws IdentityException
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RelationshipManagerImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RelationshipManagerImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -53,6 +53,8 @@
import java.util.HashSet;
import java.util.Arrays;
import java.io.Serializable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -60,6 +62,10 @@
*/
public class RelationshipManagerImpl extends AbstractManager implements RelationshipManager, Serializable
{
+
+ private static Logger log = Logger.getLogger(RelationshipManagerImpl.class.getName());
+
+
RelationshipManagerFeaturesDescription featuresDescription;
public static final IdentityObjectRelationshipType MEMBER = new IdentityObjectRelationshipType()
@@ -204,46 +210,68 @@
public void associateGroups(Group parent, Group member) throws IdentityException
{
- checkNotNullArgument(parent, "Parent group");
- checkNotNullArgument(member, "Member group");
+ try
+ {
+ checkNotNullArgument(parent, "Parent group");
+ checkNotNullArgument(member, "Member group");
- preGroupAssociationCreate(parent, member);
+ preGroupAssociationCreate(parent, member);
- getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+ postGroupAssociationCreate(parent, member);
+ }
+ catch (IdentityException e)
{
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- postGroupAssociationCreate(parent, member);
-
}
public void associateGroupsByKeys(String parentId, String memberId) throws IdentityException
{
- checkNotNullArgument(parentId, "Parent Id");
- checkNotNullArgument(memberId, "Member Id");
+ try
+ {
+ checkNotNullArgument(parentId, "Parent Id");
+ checkNotNullArgument(memberId, "Member Id");
- Group parent = new SimpleGroup(new GroupKey(parentId));
- Group member = new SimpleGroup(new GroupKey(memberId));
+ Group parent = new SimpleGroup(new GroupKey(parentId));
+ Group member = new SimpleGroup(new GroupKey(memberId));
- preGroupAssociationCreate(parent, member);
+ preGroupAssociationCreate(parent, member);
- getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForGroupId(memberId), MEMBER, null, true);
+ getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForGroupId(memberId), MEMBER, null, true);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
+ postGroupAssociationCreate(parent, member);
+ }
+ catch (IdentityException e)
{
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postGroupAssociationCreate(parent, member);
-
}
public void associateUsers(Collection<Group> parents, Collection<User> members) throws IdentityException
@@ -302,46 +330,68 @@
public void associateUser(Group parent, User member) throws IdentityException
{
- checkNotNullArgument(parent, "Parent group");
- checkNotNullArgument(member, "Member user");
+ try
+ {
+ checkNotNullArgument(parent, "Parent group");
+ checkNotNullArgument(member, "Member user");
- preUserAssociationCreate(parent, member);
+ preUserAssociationCreate(parent, member);
- getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
+ postUserAssociationCreate(parent, member);
+ }
+ catch (IdentityException e)
{
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postUserAssociationCreate(parent, member);
-
}
public void associateUserByKeys(String parentId, String memberId) throws IdentityException
{
- checkNotNullArgument(parentId, "Parent group Id");
- checkNotNullArgument(memberId, "Member user Id");
+ try
+ {
+ checkNotNullArgument(parentId, "Parent group Id");
+ checkNotNullArgument(memberId, "Member user Id");
- Group parent = new SimpleGroup(new GroupKey(parentId));
- User member = new SimpleUser(memberId);
+ Group parent = new SimpleGroup(new GroupKey(parentId));
+ User member = new SimpleUser(memberId);
- preUserAssociationCreate(parent, member);
+ preUserAssociationCreate(parent, member);
- getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForUserName(memberId), MEMBER, null, true);
+ getRepository().createRelationship(getInvocationContext(), createIdentityObjectForGroupId(parentId), createIdentityObjectForUserName(memberId), MEMBER, null, true);
- if (cache != null)
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
+
+
+ postUserAssociationCreate(parent, member);
+ }
+ catch (IdentityException e)
{
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- postUserAssociationCreate(parent, member);
-
}
public void disassociateGroups(User user) throws IdentityException
@@ -365,33 +415,43 @@
public void disassociateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
{
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
+ try
+ {
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ Group parent = parentsIterator.next();
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- Group parent = parentsIterator.next();
+ for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ Group member = membersIterator.next();
- for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- Group member = membersIterator.next();
+ preGroupAssociationRemove(parent, member);
- preGroupAssociationRemove(parent, member);
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
- if (cache != null)
- {
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
+ postGroupAssociationRemove(parent, member);
+
}
-
- postGroupAssociationRemove(parent, member);
-
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
@@ -405,35 +465,46 @@
public void disassociateGroupsByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
-
- for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ try
{
- String parent = parentsIterator.next();
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
- for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
- String member = membersIterator.next();
+ String parent = parentsIterator.next();
- Group parentGroup = new SimpleGroup(new GroupKey(parent));
- Group memberGroup = new SimpleGroup(new GroupKey(member));
+ for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ String member = membersIterator.next();
- preGroupAssociationRemove(parentGroup, memberGroup);
+ Group parentGroup = new SimpleGroup(new GroupKey(parent));
+ Group memberGroup = new SimpleGroup(new GroupKey(member));
- getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForGroupId(member), MEMBER, null);
+ preGroupAssociationRemove(parentGroup, memberGroup);
- if (cache != null)
- {
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
- }
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForGroupId(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
- postGroupAssociationRemove(parentGroup, memberGroup);
+ postGroupAssociationRemove(parentGroup, memberGroup);
+
+ }
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void disassociateGroupsByKeys(String parent, Collection<String> members) throws IdentityException
@@ -445,31 +516,42 @@
public void disassociateUsers(Collection<Group> parents, Collection<User> members) throws IdentityException
{
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
-
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ try
{
- Group parent = parentsIterator.next();
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
- for (Iterator<User> membersIterator = members.iterator(); membersIterator.hasNext();)
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
- User member = membersIterator.next();
+ Group parent = parentsIterator.next();
- preUserAssociationRemove(parent, member);
+ for (Iterator<User> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ User member = membersIterator.next();
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ preUserAssociationRemove(parent, member);
- if (cache != null)
- {
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
- }
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
- postUserAssociationRemove(parent, member);
+
+ postUserAssociationRemove(parent, member);
+ }
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
@@ -482,36 +564,47 @@
public void disassociateUsersByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
+ try
+ {
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
- for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- String parent = parentsIterator.next();
-
- for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
- String member = membersIterator.next();
+ String parent = parentsIterator.next();
- Group parentGroup = new SimpleGroup(new GroupKey(parent));
- User memberUser = new SimpleUser(member);
+ for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ String member = membersIterator.next();
- preUserAssociationRemove(parentGroup, memberUser);
+ Group parentGroup = new SimpleGroup(new GroupKey(parent));
+ User memberUser = new SimpleUser(member);
- getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForUserName(member), MEMBER, null);
+ preUserAssociationRemove(parentGroup, memberUser);
- if (cache != null)
- {
- cache.invalidateAllQueries(cacheNS);
- cache.invalidateAllSearches(cacheNS);
- }
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObjectForGroupId(parent), createIdentityObjectForUserName(member), MEMBER, null);
+ if (cache != null)
+ {
+ cache.invalidateAllQueries(cacheNS);
+ cache.invalidateAllSearches(cacheNS);
+ }
- postUserAssociationRemove(parentGroup, memberUser);
+ postUserAssociationRemove(parentGroup, memberUser);
+
+ }
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void disassociateUsersByKeys(String parent, Collection<String> members) throws IdentityException
@@ -524,155 +617,177 @@
public <G extends IdentityType, I extends IdentityType> boolean isAssociated(Collection<G> parents, Collection<I> members) throws IdentityException
{
- //TODO: maybe IdentityStore should have isRelationshipPresent method to improve this?
+ try
+ {
+//TODO: maybe IdentityStore should have isRelationshipPresent method to improve this?
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
- if (cache != null)
- {
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (G parent : parents)
+ if (cache != null)
{
- search.addParent(parent);
- }
- for (I member : members)
- {
- search.addMember(member);
- }
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G parent : parents)
+ {
+ search.addParent(parent);
+ }
+ for (I member : members)
+ {
+ search.addMember(member);
+ }
- Boolean result = cache.getRelationshipSearch(cacheNS, search);
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
- if (result != null)
- {
- return result;
+ if (result != null)
+ {
+ return result;
+ }
}
- }
- for (Iterator<G> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- IdentityType parent = parentsIterator.next();
-
- for (Iterator<I> membersIterator = members.iterator(); membersIterator.hasNext();)
+ for (Iterator<G> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
- IdentityType member = membersIterator.next();
+ IdentityType parent = parentsIterator.next();
- Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+ for (Iterator<I> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ IdentityType member = membersIterator.next();
- if (relationships.size() == 0)
- {
- if (cache != null)
+ Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+
+ if (relationships.size() == 0)
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (G p : parents)
+ if (cache != null)
{
- search.addParent(p);
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G p : parents)
+ {
+ search.addParent(p);
+ }
+ for (I m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, false);
+
}
- for (I m : members)
- {
- search.addMember(m);
- }
- cache.putRelationshipSearch(cacheNS, search, false);
+ return false;
}
+ }
+ }
- return false;
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (G p : parents)
+ {
+ search.addParent(p);
}
+ for (I m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, true);
+
}
+
+ return true;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (G p : parents)
+ if (log.isLoggable(Level.FINER))
{
- search.addParent(p);
+ log.log(Level.FINER, "Exception occurred: ", e);
}
- for (I m : members)
- {
- search.addMember(m);
- }
- cache.putRelationshipSearch(cacheNS, search, true);
-
+ throw e;
}
-
- return true;
}
public boolean isAssociatedByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
- checkNotNullArgument(parents, "parents");
- checkNotNullArgument(members, "members");
+ try
+ {
+ checkNotNullArgument(parents, "parents");
+ checkNotNullArgument(members, "members");
- if (cache != null)
- {
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (String parent : parents)
+ if (cache != null)
{
- search.addParent(parent);
- }
- for (String member : members)
- {
- search.addMember(member);
- }
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String parent : parents)
+ {
+ search.addParent(parent);
+ }
+ for (String member : members)
+ {
+ search.addMember(member);
+ }
- Boolean result = cache.getRelationshipSearch(cacheNS, search);
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
- if (result != null)
- {
- return result;
+ if (result != null)
+ {
+ return result;
+ }
}
- }
- for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- String parent = parentsIterator.next();
-
- for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ for (Iterator<String> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
{
- String member = membersIterator.next();
+ String parent = parentsIterator.next();
- Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+ for (Iterator<String> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ String member = membersIterator.next();
- if (relationships.size() == 0)
- {
- if (cache != null)
+ Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+
+ if (relationships.size() == 0)
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (String p : parents)
+ if (cache != null)
{
- search.addParent(p);
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String p : parents)
+ {
+ search.addParent(p);
+ }
+ for (String m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, false);
+
}
- for (String m : members)
- {
- search.addMember(m);
- }
- cache.putRelationshipSearch(cacheNS, search, false);
+ return false;
}
+ }
+ }
- return false;
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ for (String p : parents)
+ {
+ search.addParent(p);
}
+ for (String m : members)
+ {
+ search.addMember(m);
+ }
+ cache.putRelationshipSearch(cacheNS, search, true);
+
}
+
+ return true;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- for (String p : parents)
+ if (log.isLoggable(Level.FINER))
{
- search.addParent(p);
+ log.log(Level.FINER, "Exception occurred: ", e);
}
- for (String m : members)
- {
- search.addMember(m);
- }
- cache.putRelationshipSearch(cacheNS, search, true);
-
+ throw e;
}
-
- return true;
}
public <G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member) throws IdentityException
@@ -691,41 +806,52 @@
public boolean isAssociatedByKeys(String parent, String member) throws IdentityException
{
- checkNotNullArgument(parent, "Parent Id");
- checkNotNullArgument(member, "Member Id");
-
- if (cache != null)
+ try
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- search.addParent(parent);
- search.addMember(member);
+ checkNotNullArgument(parent, "Parent Id");
+ checkNotNullArgument(member, "Member Id");
- Boolean result = cache.getRelationshipSearch(cacheNS, search);
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ search.addParent(parent);
+ search.addMember(member);
- if (result != null)
+ Boolean result = cache.getRelationshipSearch(cacheNS, search);
+
+ if (result != null)
+ {
+ return result;
+ }
+ }
+
+ Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+
+ boolean result = true;
+
+ if (relationships.size() == 0)
{
- return result;
+ result = false;
}
- }
- Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+ if (cache != null)
+ {
+ RelationshipSearchImpl search = new RelationshipSearchImpl();
+ search.addParent(parent);
+ search.addMember(member);
+ cache.putRelationshipSearch(cacheNS, search, result);
+ }
- boolean result = true;
-
- if (relationships.size() == 0)
- {
- result = false;
+ return result;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- RelationshipSearchImpl search = new RelationshipSearchImpl();
- search.addParent(parent);
- search.addMember(member);
- cache.putRelationshipSearch(cacheNS, search, result);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return result;
}
private Collection<Group> findAssociatedGroupsCascaded(Collection<Group> previous, Group group, String groupType, boolean parent, IdentitySearchCriteria criteria) throws IdentityException
@@ -753,81 +879,91 @@
public Collection<Group> findAssociatedGroups(Group group, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(group, "Group");
-
- if (cache != null)
+ try
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedGroupId(group.getKey());
- search.setGroupType(groupType);
- search.setParent(parent);
- search.setCascade(cascade);
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(group, "Group");
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedGroupId(group.getKey());
+ search.setGroupType(groupType);
+ search.setParent(parent);
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- List<Group> identities = new LinkedList<Group>();
+ List<Group> identities = new LinkedList<Group>();
- IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
+ IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
+ if (cascade)
+ {
+ Set<Group> prev = new HashSet<Group>();
+ prev.add(group);
+ identities = (List<Group>)findAssociatedGroupsCascaded(prev, group, groupType, parent, criteria);
- if (cascade)
- {
- Set<Group> prev = new HashSet<Group>();
- prev.add(group);
- identities = (List<Group>)findAssociatedGroupsCascaded(prev, group, groupType, parent, criteria);
+ try
+ {
+ //TODO: don't perform when only one repository call was made
+ if (criteria != null)
+ {
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to apply criteria", e);
+ }
- try
+
+ }
+ else
{
- //TODO: don't perform when only one repository call was made
- if (criteria != null)
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
+
+ for (IdentityObject io : ios)
{
- IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ if ((iot == null && !io.getIdentityType().getName().equals(getUserObjectType().getName())) ||
+ (iot != null && io.getIdentityType().getName().equals(iot.getName())))
+ {
+ identities.add(createGroup(io));
+ }
}
}
- catch (Exception e)
+
+ if (cache != null)
{
- throw new IdentityException("Failed to apply criteria", e);
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedGroupId(group.getKey());
+ search.setGroupType(groupType);
+ search.setParent(parent);
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ cache.putGroupSearch(cacheNS, search, identities);
+
}
-
+ return identities;
}
- else
+ catch (IdentityException e)
{
-
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(criteria));
-
- for (IdentityObject io : ios)
+ if (log.isLoggable(Level.FINER))
{
- if ((iot == null && !io.getIdentityType().getName().equals(getUserObjectType().getName())) ||
- (iot != null && io.getIdentityType().getName().equals(iot.getName())))
- {
- identities.add(createGroup(io));
- }
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
- if (cache != null)
- {
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedGroupId(group.getKey());
- search.setGroupType(groupType);
- search.setParent(parent);
- search.setCascade(cascade);
- search.setSearchCriteria(criteria);
-
- cache.putGroupSearch(cacheNS, search, identities);
-
- }
-
- return identities;
-
}
public Collection<Group> findAssociatedGroups(String groupId, String groupType, boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
@@ -850,51 +986,61 @@
public Collection<Group> findAssociatedGroups(User user, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(user, "User");
- //checkNotNullArgument(groupType, "Group type");
-
- if (cache != null)
+ try
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getKey());
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(user, "User");
+ //checkNotNullArgument(groupType, "Group type");
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
- {
- return results;
- }
- }
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getKey());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
- List<Group> identities = new LinkedList<Group>();
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
- IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
+ List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
+ IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) : null;
- for (IdentityObject io : ios)
- {
- if (iot == null || io.getIdentityType().getName().equals(iot.getName()))
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
+
+ for (IdentityObject io : ios)
{
- identities.add(createGroup(io));
+ if (iot == null || io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
}
- }
- if (cache != null)
- {
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getKey());
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getKey());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
- cache.putGroupSearch(cacheNS, search, identities);
+ cache.putGroupSearch(cacheNS, search, identities);
- }
+ }
-
- return identities;
+ return identities;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Collection<Group> findAssociatedGroups(String userName, String groupType, IdentitySearchCriteria criteria) throws IdentityException
@@ -917,46 +1063,57 @@
public Collection<Group> findAssociatedGroups(User user, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(user, "User");
-
- if (cache != null)
+ try
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getKey());
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(user, "User");
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getKey());
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- List<Group> identities = new LinkedList<Group>();
+ List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria));
- String userTypeName = getUserObjectType().getName();
+ String userTypeName = getUserObjectType().getName();
- for (IdentityObject io : ios)
- {
+ for (IdentityObject io : ios)
+ {
- // Filter out users
- if (!io.getIdentityType().getName().equals(userTypeName))
- identities.add(createGroup(io));
- }
+ // Filter out users
+ if (!io.getIdentityType().getName().equals(userTypeName))
+ identities.add(createGroup(io));
+ }
- if (cache != null)
- {
- GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getKey());
- search.setSearchCriteria(criteria);
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addAssociatedUserId(user.getKey());
+ search.setSearchCriteria(criteria);
- cache.putGroupSearch(cacheNS, search, identities);
+ cache.putGroupSearch(cacheNS, search, identities);
+ }
+
+ return identities;
}
-
- return identities;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Collection<Group> findAssociatedGroups(String userName, IdentitySearchCriteria criteria) throws IdentityException
@@ -977,82 +1134,93 @@
public Collection<User> findAssociatedUsers(Group group, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(group, "Group");
-
- if (cache != null)
+ try
{
- UserSearchImpl search = new UserSearchImpl();
- search.addAssociatedGroupId(group.getKey());
- search.setCascade(cascade);
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(group, "Group");
- Collection<User> results = cache.getUserSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ UserSearchImpl search = new UserSearchImpl();
+ search.addAssociatedGroupId(group.getKey());
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
+
+ Collection<User> results = cache.getUserSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- List<User> identities = new LinkedList<User>();
+ List<User> identities = new LinkedList<User>();
- if (cascade)
- {
- // Do non cascaded call
+ if (cascade)
+ {
+ // Do non cascaded call
- identities.addAll(findAssociatedUsers(group, false, criteria));
+ identities.addAll(findAssociatedUsers(group, false, criteria));
- // Find all associated groups (cascaded)
- Collection<Group> groups = findAssociatedGroups(group, null, true, true, criteria);
+ // Find all associated groups (cascaded)
+ Collection<Group> groups = findAssociatedGroups(group, null, true, true, criteria);
- for (Group asociatedGroup : groups)
- {
- identities.addAll(findAssociatedUsers(asociatedGroup, false, criteria));
- }
+ for (Group asociatedGroup : groups)
+ {
+ identities.addAll(findAssociatedUsers(asociatedGroup, false, criteria));
+ }
- try
- {
+ try
+ {
- //TODO: don't perform when only one repository call was made
- if (criteria != null)
+ //TODO: don't perform when only one repository call was made
+ if (criteria != null)
+ {
+ IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ }
+ }
+ catch (Exception e)
{
- IdentitySearchCriteriaImpl.applyCriteria(identitySession, convertSearchControls(criteria), identities);
+ throw new IdentityException("Failed to apply criteria", e);
}
+
}
- catch (Exception e)
+ else
{
- throw new IdentityException("Failed to apply criteria", e);
- }
- }
- else
- {
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(criteria));
+ String userTypeName = getUserObjectType().getName();
- String userTypeName = getUserObjectType().getName();
-
- for (IdentityObject io : ios)
- {
- //Filter out groups
- if (io.getIdentityType().getName().equals(userTypeName))
+ for (IdentityObject io : ios)
{
- identities.add(createUser(io));
+ //Filter out groups
+ if (io.getIdentityType().getName().equals(userTypeName))
+ {
+ identities.add(createUser(io));
+ }
}
}
- }
- if (cache != null)
- {
- UserSearchImpl search = new UserSearchImpl();
- search.addAssociatedGroupId(group.getKey());
- search.setCascade(cascade);
- search.setSearchCriteria(criteria);
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addAssociatedGroupId(group.getKey());
+ search.setCascade(cascade);
+ search.setSearchCriteria(criteria);
- cache.putUserSearch(cacheNS, search, identities);
+ cache.putUserSearch(cacheNS, search, identities);
+ }
+
+ return identities;
}
-
- return identities;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Collection<User> findAssociatedUsers(String groupId, boolean cascade, IdentitySearchCriteria criteria) throws IdentityException
@@ -1073,51 +1241,62 @@
public Collection<Group> findRelatedGroups(User user, String groupType, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(user, "User");
-
- if (cache != null)
+ try
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getKey());
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(user, "User");
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getKey());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- List<Group> identities = new LinkedList<Group>();
+ List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), null, false, convertSearchControls(criteria));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), null, false, convertSearchControls(criteria));
- String userTypeName = getUserObjectType().getName();
+ String userTypeName = getUserObjectType().getName();
- for (IdentityObject io : ios)
- {
- // Filter out users
- if (!io.getIdentityType().getName().equals(userTypeName))
- identities.add(createGroup(io));
+ for (IdentityObject io : ios)
+ {
+ // Filter out users
+ if (!io.getIdentityType().getName().equals(userTypeName))
+ identities.add(createGroup(io));
+ }
+
+ if (cache != null)
+ {
+ GroupSearchImpl search = new GroupSearchImpl();
+ search.addRelatedUserId(user.getKey());
+ search.setGroupType(groupType);
+ search.setSearchCriteria(criteria);
+
+ Collection<Group> results = cache.getGroupSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
+ }
+
+ return identities;
}
-
- if (cache != null)
+ catch (IdentityException e)
{
- GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getKey());
- search.setGroupType(groupType);
- search.setSearchCriteria(criteria);
-
- Collection<Group> results = cache.getGroupSearch(cacheNS, search);
- if (results != null)
+ if (log.isLoggable(Level.FINER))
{
- return results;
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
-
- return identities;
}
public Collection<Group> findRelatedGroups(String userName, String groupType, IdentitySearchCriteria criteria) throws IdentityException
@@ -1131,51 +1310,62 @@
public Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(group, "Group");
-
- if (cache != null)
+ try
{
- UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getKey());
- search.setSearchCriteria(criteria);
+ checkNotNullArgument(group, "Group");
- Collection<User> results = cache.getUserSearch(cacheNS, search);
- if (results != null)
+ if (cache != null)
{
- return results;
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getKey());
+ search.setSearchCriteria(criteria);
+
+ Collection<User> results = cache.getUserSearch(cacheNS, search);
+ if (results != null)
+ {
+ return results;
+ }
}
- }
- List<User> identities = new LinkedList<User>();
+ List<User> identities = new LinkedList<User>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), null, true, convertSearchControls(criteria));
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), null, true, convertSearchControls(criteria));
- String userTypeName = getUserObjectType().getName();
+ String userTypeName = getUserObjectType().getName();
- for (IdentityObject io : ios)
- {
- if (io.getIdentityType().getName().equals(userTypeName))
+ for (IdentityObject io : ios)
{
- User user = createUser(io);
+ if (io.getIdentityType().getName().equals(userTypeName))
+ {
+ User user = createUser(io);
- if (!identities.contains(user))
- {
- identities.add(createUser(io));
+ if (!identities.contains(user))
+ {
+ identities.add(createUser(io));
+ }
}
}
- }
- if (cache != null)
- {
- UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getKey());
- search.setSearchCriteria(criteria);
+ if (cache != null)
+ {
+ UserSearchImpl search = new UserSearchImpl();
+ search.addRelatedGroupId(group.getKey());
+ search.setSearchCriteria(criteria);
- cache.putUserSearch(cacheNS, search, identities);
+ cache.putUserSearch(cacheNS, search, identities);
+ }
+
+ return identities;
}
-
- return identities;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria criteria) throws IdentityException
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RoleManagerImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/RoleManagerImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -56,6 +56,7 @@
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -63,6 +64,9 @@
*/
public class RoleManagerImpl extends AbstractManager implements RoleManager, Serializable
{
+
+ private static Logger log = Logger.getLogger(RoleManagerImpl.class.getName());
+
public static final IdentityObjectRelationshipType ROLE = new IdentityObjectRelationshipType()
{
public String getName()
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/AbstractIdentityStoreRepository.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/AbstractIdentityStoreRepository.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -44,6 +44,8 @@
import java.io.InputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -52,6 +54,8 @@
public abstract class AbstractIdentityStoreRepository implements IdentityStoreRepository, Serializable
{
+ private static Logger log = Logger.getLogger(AbstractIdentityStoreRepository.class.getName());
+
protected Map<String, IdentityStore> identityStoreMappings = new HashMap<String, IdentityStore>();
protected Map<String, AttributeStore> attributeStoreMappings = new HashMap<String, AttributeStore>();
@@ -143,6 +147,12 @@
}
catch (IdentityException e)
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityStoreCacheProvider cache provider instance" +
"with provided name:" + cacheRegistryName, e);
}
@@ -163,6 +173,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
}
}
@@ -220,6 +235,12 @@
}
catch (IdentityException e)
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityStoreCacheProvider cache provider instance" +
"with provided name:" + cacheRegistryName, e);
}
@@ -240,6 +261,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
}
}
Modified: idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/FallbackIdentityStoreRepository.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/repository/FallbackIdentityStoreRepository.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -330,6 +330,11 @@
return defaultIdentityStore;
}
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IllegalStateException("Used IdentityObjectType not mapped. Consider using " + ALLOW_NOT_DEFINED_IDENTITY_OBJECT_TYPES_OPTION +
" repository option switch: " + iot );
}
@@ -355,6 +360,11 @@
return defaultAttributeStore;
}
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IllegalStateException("Used IdentityObjectType not mapped. Consider using " + ALLOW_NOT_DEFINED_IDENTITY_OBJECT_TYPES_OPTION +
" repository option switch: " + iot );
}
@@ -417,7 +427,7 @@
{
if (log.isLoggable(Level.INFO))
{
- log.info("Failed to create IdentityObject: " + e);
+ log.log(Level.INFO, "Failed to create IdentityObject: ", e);
}
}
@@ -455,7 +465,7 @@
{
if (log.isLoggable(Level.INFO))
{
- log.info("Failed to create IdentityObject: " + e);
+ log.log(Level.INFO, "Failed to create IdentityObject: ", e);
}
}
@@ -482,7 +492,7 @@
{
if (log.isLoggable(Level.INFO))
{
- log.info("Failed to remove IdentityObject: " + e);
+ log.log(Level.INFO, "Failed to remove IdentityObject: ", e);
}
}
}
@@ -504,7 +514,7 @@
{
if (log.isLoggable(Level.FINER))
{
- log.finer("Failed to obtain IdentityObject count: " + e);
+ log.log(Level.INFO, "Failed to obtain IdentityObject count: ", e);
}
}
@@ -527,7 +537,7 @@
{
if (log.isLoggable(Level.INFO))
{
- log.info("Failed to create IdentityObject: " + e);
+ log.log(Level.INFO, "Failed to create IdentityObject: ", e);
}
}
@@ -549,7 +559,7 @@
{
if (log.isLoggable(Level.INFO))
{
- log.info("Failed to create IdentityObject: " + e);
+ log.log(Level.INFO, "Failed to create IdentityObject: ", e);
}
}
@@ -584,7 +594,21 @@
if (targetStore == defaultIdentityStore)
{
- return targetStore.findIdentityObject(targetCtx, identityType, criteria);
+ Collection<IdentityObject> resx = new LinkedList<IdentityObject>();
+
+ try
+ {
+ resx = targetStore.findIdentityObject(targetCtx, identityType, criteria);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ }
+
+ return resx;
}
else
{
@@ -603,12 +627,36 @@
// as result need to be merged
if (defaultIOs.size() == 0)
{
- return targetStore.findIdentityObject(targetCtx, identityType, criteria);
+ Collection<IdentityObject> resx = new LinkedList<IdentityObject>();
+
+ try
+ {
+ resx = targetStore.findIdentityObject(targetCtx, identityType, criteria);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ }
+
+ return resx;
}
else
{
- results = targetStore.findIdentityObject(targetCtx, identityType, c);
+ try
+ {
+ results = targetStore.findIdentityObject(targetCtx, identityType, c);
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ }
}
}
@@ -658,193 +706,239 @@
{
// Check in the mapped store and merge with default
- IdentityStore mappedStore = resolveIdentityStore(identity);
+ try
+ {
+ IdentityStore mappedStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext mappedCtx = resolveInvocationContext(mappedStore, invocationCxt);
+ IdentityStoreInvocationContext mappedCtx = resolveInvocationContext(mappedStore, invocationCxt);
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
- if (mappedStore == defaultIdentityStore)
- {
- return defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria);
- }
+ if (mappedStore == defaultIdentityStore)
+ {
+ return defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria);
+ }
- IdentitySearchCriteriaImpl c = null;
+ IdentitySearchCriteriaImpl c = null;
- if (criteria != null)
- {
- c = new IdentitySearchCriteriaImpl(criteria);
- c.setPaged(false);
- }
+ if (criteria != null)
+ {
+ c = new IdentitySearchCriteriaImpl(criteria);
+ c.setPaged(false);
+ }
- Collection<IdentityObject> results = new LinkedList<IdentityObject>();
+ Collection<IdentityObject> results = new LinkedList<IdentityObject>();
- if (hasIdentityObject(mappedCtx, mappedStore, identity)
- && (relationshipType == null
- || !RoleManagerImpl.ROLE.getName().equals(relationshipType.getName())
- || mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
- )
- {
- // If object present in identity store then don't apply page in criteria
- if (hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
+ if (hasIdentityObject(mappedCtx, mappedStore, identity)
+ && (relationshipType == null
+ || !RoleManagerImpl.ROLE.getName().equals(relationshipType.getName())
+ || mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ )
{
- results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, c);
+ // If object present in identity store then don't apply page in criteria
+ if (hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
+ {
+ results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, c);
+ }
+
+ // Otherwise simply return results
+ else
+ {
+ return mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, criteria);
+ }
}
- // Otherwise simply return results
- else
+
+ Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, c);
+
+ // If default store contain related relationships merge and sort/page once more
+ if (objects != null && objects.size() != 0)
{
- return mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, criteria);
- }
- }
+ // Filter out duplicates
+ HashSet<IdentityObject> merged = new HashSet<IdentityObject>();
+ merged.addAll(results);
+ merged.addAll(objects);
- Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, c);
- // If default store contain related relationships merge and sort/page once more
- if (objects != null && objects.size() != 0)
- {
+ if (criteria != null)
+ {
- // Filter out duplicates
- HashSet<IdentityObject> merged = new HashSet<IdentityObject>();
- merged.addAll(results);
- merged.addAll(objects);
+ LinkedList<IdentityObject> processed = new LinkedList<IdentityObject>(merged);
- if (criteria != null)
- {
- LinkedList<IdentityObject> processed = new LinkedList<IdentityObject>(merged);
+ //TODO: hardcoded - expects List
+ if (criteria.isSorted())
+ {
+ sortByName(processed, criteria.isAscending());
+ }
+ results = processed;
+ //TODO: hardcoded - expects List
+ if (criteria.isPaged())
+ {
+ results = cutPageFromResults(processed, criteria);
+ }
- //TODO: hardcoded - expects List
- if (criteria.isSorted())
- {
- sortByName(processed, criteria.isAscending());
+
}
-
- results = processed;
-
- //TODO: hardcoded - expects List
- if (criteria.isPaged())
+ else
{
- results = cutPageFromResults(processed, criteria);
+ results = merged;
}
+ }
-
- }
- else
+ return results;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
{
- results = merged;
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+
+ throw e;
}
- return results;
-
}
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException
{
- IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(fromIdentity);
- IdentityStore toStore = resolveIdentityStore(toIdentity);
+ IdentityStore toStore = resolveIdentityStore(toIdentity);
- IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
- IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
- if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
- && hasIdentityObject(toTargetCtx, fromStore, fromIdentity)
- && hasIdentityObject(toTargetCtx, fromStore, toIdentity))
+ if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
+ && hasIdentityObject(toTargetCtx, fromStore, fromIdentity)
+ && hasIdentityObject(toTargetCtx, fromStore, toIdentity))
+ {
+ // If relationship is named and target store doesn't support named relationships it need to be put in default store anyway
+ if (relationshipName == null ||
+ (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported()))
+ {
+ return fromStore.createRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+ }
+ }
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
{
- // If relationship is named and target store doesn't support named relationships it need to be put in default store anyway
- if (relationshipName == null ||
- (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported()))
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
+ }
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
{
- return fromStore.createRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
}
- }
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
- {
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
+ return defaultIdentityStore.createRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
}
-
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
+ catch (IdentityException e)
{
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return defaultIdentityStore.createRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
}
public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName) throws IdentityException
{
- IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(fromIdentity);
- IdentityStore toStore = resolveIdentityStore(toIdentity);
+ IdentityStore toStore = resolveIdentityStore(toIdentity);
- IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
- IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
- if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
- && hasIdentityObject(toTargetCtx, toStore, fromIdentity)
- && hasIdentityObject(toTargetCtx, toStore, toIdentity))
- {
- if (relationshipName == null ||
- (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported()))
+ if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
+ && hasIdentityObject(toTargetCtx, toStore, fromIdentity)
+ && hasIdentityObject(toTargetCtx, toStore, toIdentity))
{
- fromStore.removeRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
- return;
+ if (relationshipName == null ||
+ (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported()))
+ {
+ fromStore.removeRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
+ return;
+ }
}
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
+ }
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
+ }
+
+ defaultIdentityStore.removeRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
}
-
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
+ catch (IdentityException e)
{
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
- }
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
- {
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
+ throw e;
}
-
- defaultIdentityStore.removeRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
}
public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
{
- IdentityStore fromStore = resolveIdentityStore(identity1);
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(identity1);
- IdentityStore toStore = resolveIdentityStore(identity2);
+ IdentityStore toStore = resolveIdentityStore(identity2);
- IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCtx);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCtx);
- IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCtx);
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCtx);
- if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
- && hasIdentityObject(toTargetCtx, toStore, identity1)
- && hasIdentityObject(toTargetCtx, toStore, identity2))
- {
- fromStore.removeRelationships(toTargetCtx, identity1, identity2, named);
- return;
- }
+ if (fromStore == toStore && !isIdentityStoreReadOnly(fromStore)
+ && hasIdentityObject(toTargetCtx, toStore, identity1)
+ && hasIdentityObject(toTargetCtx, toStore, identity2))
+ {
+ fromStore.removeRelationships(toTargetCtx, identity1, identity2, named);
+ return;
+ }
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity1))
- {
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity1.getName(), identity1.getIdentityType());
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity1))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity1.getName(), identity1.getIdentityType());
+ }
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity2))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity2.getName(), identity2.getIdentityType());
+ }
+
+ defaultIdentityStore.removeRelationships(defaultTargetCtx, identity1, identity2, named);
}
-
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity2))
+ catch (IdentityException e)
{
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity2.getName(), identity2.getIdentityType());
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- defaultIdentityStore.removeRelationships(defaultTargetCtx, identity1, identity2, named);
}
public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt,
@@ -853,612 +947,854 @@
IdentityObjectRelationshipType relationshipType) throws IdentityException
{
- IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(fromIdentity);
- IdentityStore toStore = resolveIdentityStore(toIdentity);
+ IdentityStore toStore = resolveIdentityStore(toIdentity);
- IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
- IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
- if (fromStore == toStore &&
- (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
- fromStore.getSupportedFeatures().isNamedRelationshipsSupported())
- && hasIdentityObject(toTargetCtx, toStore, fromIdentity)
- && hasIdentityObject(toTargetCtx, toStore, toIdentity))
- {
- return fromStore.resolveRelationships(toTargetCtx, fromIdentity, toIdentity, relationshipType);
+ if (fromStore == toStore &&
+ (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
+ fromStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ && hasIdentityObject(toTargetCtx, toStore, fromIdentity)
+ && hasIdentityObject(toTargetCtx, toStore, toIdentity))
+ {
+ return fromStore.resolveRelationships(toTargetCtx, fromIdentity, toIdentity, relationshipType);
- }
+ }
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
- {
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
+ }
+
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
+ }
+
+ return defaultIdentityStore.resolveRelationships(defaultTargetCtx, fromIdentity, toIdentity, relationshipType);
}
-
- if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
+ catch (IdentityException e)
{
- defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return defaultIdentityStore.resolveRelationships(defaultTargetCtx, fromIdentity, toIdentity, relationshipType);
}
public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, boolean named, String name) throws IdentityException
- {
- Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
+ {
+ try
+ {
+ Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
- {
- if (relationshipType.getName() != null &&
- !identityStore.getSupportedFeatures().getSupportedRelationshipTypes().contains(relationshipType.getName()))
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- continue;
+ if (relationshipType.getName() != null &&
+ !identityStore.getSupportedFeatures().getSupportedRelationshipTypes().contains(relationshipType.getName()))
+ {
+ continue;
+ }
+
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+
+ if ((!named || (named && identityStore.getSupportedFeatures().isNamedRelationshipsSupported()))
+ && hasIdentityObject(storeCtx, identityStore, identity))
+ {
+ relationships.addAll(identityStore.resolveRelationships(storeCtx, identity, relationshipType, parent, named, name));
+ }
}
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
-
- if ((!named || (named && identityStore.getSupportedFeatures().isNamedRelationshipsSupported()))
- && hasIdentityObject(storeCtx, identityStore, identity))
+ return relationships;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
{
- relationships.addAll(identityStore.resolveRelationships(storeCtx, identity, relationshipType, parent, named, name));
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
-
- return relationships;
}
public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
// For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
+ try
{
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- identityStore.createRelationshipName(storeCtx, name);
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ identityStore.createRelationshipName(storeCtx, name);
+ }
}
+
+ return name;
}
-
- return name;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
+ try
{
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- identityStore.removeRelationshipName(storeCtx, name);
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ identityStore.removeRelationshipName(storeCtx, name);
+ }
}
+
+ return name;
}
-
- return name;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- Set<String> results = new HashSet<String>();
+ try
+ {
+ Set<String> results = new HashSet<String>();
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
- {
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- results.addAll(identityStore.getRelationshipNames(storeCtx, criteria));
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ results.addAll(identityStore.getRelationshipNames(storeCtx, criteria));
+ }
}
+
+ return results;
}
-
- return results;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
{
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
+ try
+ {
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- if (toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ if (toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ return toStore.getRelationshipNames(targetCtx, identity, criteria);
+ }
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, criteria);
+ }
+ catch (IdentityException e)
{
- return toStore.getRelationshipNames(targetCtx, identity, criteria);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
-
- return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, criteria);
}
public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
- Map<String, String> results = new HashMap<String, String>();
+ try
+ {
+ Map<String, String> results = new HashMap<String, String>();
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
- {
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- Map<String, String> props = identityStore.getRelationshipNameProperties(storeCtx, name);
- if (props != null && props.keySet().size() > 0)
- {
- results.putAll(props);
+ Map<String, String> props = identityStore.getRelationshipNameProperties(storeCtx, name);
+ if (props != null && props.keySet().size() > 0)
+ {
+ results.putAll(props);
+ }
+
}
+ }
+ return results;
+ }
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
-
- return results;
}
public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
{
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
+ try
{
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- identityStore.setRelationshipNameProperties(storeCtx, name, properties);
+ identityStore.setRelationshipNameProperties(storeCtx, name, properties);
+ }
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties) throws IdentityException, OperationNotSupportedException
{
- // For any IdentityStore that supports named relationships...
- for (IdentityStore identityStore : configuredIdentityStores)
+ try
{
- if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ // For any IdentityStore that supports named relationships...
+ for (IdentityStore identityStore : configuredIdentityStores)
{
- IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
+ if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(identityStore))
+ {
+ IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx);
- identityStore.removeRelationshipNameProperties(storeCtx, name, properties);
+ identityStore.removeRelationshipNameProperties(storeCtx, name, properties);
+ }
}
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
{
- IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
- IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
- if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported())
+ {
+ return fromStore.getRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship);
+ }
+
+ return defaultIdentityStore.getRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship);
+ }
+ catch (IdentityException e)
{
- return fromStore.getRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return defaultIdentityStore.getRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship);
}
public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Map<String, String> properties) throws IdentityException, OperationNotSupportedException
{
- IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
- IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
- if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(fromStore))
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(fromStore))
+ {
+ fromStore.setRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
+ return;
+ }
+
+ defaultIdentityStore.setRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
+ }
+ catch (IdentityException e)
{
- fromStore.setRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
- return;
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- defaultIdentityStore.setRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
}
public void removeRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException, OperationNotSupportedException
{
- IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
- IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
+ try
+ {
+ IdentityStore fromStore = resolveIdentityStore(relationship.getFromIdentityObject());
+ IdentityStore toStore = resolveIdentityStore(relationship.getToIdentityObject());
- if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(fromStore))
+ if (fromStore == toStore && toStore.getSupportedFeatures().isNamedRelationshipsSupported() && !isIdentityStoreReadOnly(fromStore))
+ {
+ fromStore.removeRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
+ return;
+ }
+
+ defaultIdentityStore.removeRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
+ }
+ catch (IdentityException e)
{
- fromStore.removeRelationshipProperties(resolveInvocationContext(fromStore, ctx), relationship, properties);
- return;
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- defaultIdentityStore.removeRelationshipProperties(resolveInvocationContext(defaultIdentityStore, ctx), relationship, properties);
}
public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
- IdentityStore toStore = resolveIdentityStore(identityObject);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
-
- if (hasIdentityObject(targetCtx, toStore, identityObject))
+ try
{
- return toStore.validateCredential(targetCtx, identityObject, credential);
- }
+ IdentityStore toStore = resolveIdentityStore(identityObject);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- targetCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+ if (hasIdentityObject(targetCtx, toStore, identityObject))
+ {
+ return toStore.validateCredential(targetCtx, identityObject, credential);
+ }
- if (toStore != defaultIdentityStore && hasIdentityObject(targetCtx, defaultIdentityStore, identityObject))
+ targetCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+ if (toStore != defaultIdentityStore && hasIdentityObject(targetCtx, defaultIdentityStore, identityObject))
+ {
+ return defaultIdentityStore.validateCredential(targetCtx, identityObject, credential);
+ }
+
+ return false;
+ }
+ catch (IdentityException e)
{
- return defaultIdentityStore.validateCredential(targetCtx, identityObject, credential);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
-
- return false;
}
public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
- IdentityStore toStore = resolveIdentityStore(identityObject);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
-
- if (hasIdentityObject(targetCtx, toStore, identityObject))
+ try
{
- toStore.updateCredential(targetCtx, identityObject, credential);
- return;
- }
+ IdentityStore toStore = resolveIdentityStore(identityObject);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- targetCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+ if (hasIdentityObject(targetCtx, toStore, identityObject))
+ {
+ toStore.updateCredential(targetCtx, identityObject, credential);
+ return;
+ }
- if (toStore != defaultIdentityStore && hasIdentityObject(targetCtx, defaultIdentityStore, identityObject))
+ targetCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+ if (toStore != defaultIdentityStore && hasIdentityObject(targetCtx, defaultIdentityStore, identityObject))
+ {
+ defaultIdentityStore.updateCredential(targetCtx, identityObject, credential);
+ }
+ }
+ catch (IdentityException e)
{
- defaultIdentityStore.updateCredential(targetCtx, identityObject, credential);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
}
}
public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType) throws IdentityException
{
- Set<String> results;
+ try
+ {
+ Set<String> results;
- IdentityStore toStore = resolveIdentityStore(identityType);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
+ IdentityStore toStore = resolveIdentityStore(identityType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
- results = toStore.getSupportedAttributeNames(targetCtx, identityType);
+ results = toStore.getSupportedAttributeNames(targetCtx, identityType);
- if (toStore != defaultAttributeStore)
- {
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+ if (toStore != defaultAttributeStore)
+ {
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
- results.addAll(defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityType));
+ results.addAll(defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityType));
+ }
+
+ return results;
}
-
- return results;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(IdentityStoreInvocationContext invocationContext,
IdentityObjectType identityObjectType)
{
- IdentityStore targetStore = resolveIdentityStore(identityObjectType);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationContext);
+ try
+ {
+ IdentityStore targetStore = resolveIdentityStore(identityObjectType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationContext);
- Map<String, IdentityObjectAttributeMetaData> mdMap = new HashMap<String, IdentityObjectAttributeMetaData>();
- mdMap.putAll(targetStore.getAttributesMetaData(targetCtx, identityObjectType));
+ Map<String, IdentityObjectAttributeMetaData> mdMap = new HashMap<String, IdentityObjectAttributeMetaData>();
+ mdMap.putAll(targetStore.getAttributesMetaData(targetCtx, identityObjectType));
- if (targetStore != defaultAttributeStore)
- {
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+ if (targetStore != defaultAttributeStore)
+ {
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
- Map<String, IdentityObjectAttributeMetaData> defaultMDMap = defaultAttributeStore.getAttributesMetaData(defaultCtx, identityObjectType);
+ Map<String, IdentityObjectAttributeMetaData> defaultMDMap = defaultAttributeStore.getAttributesMetaData(defaultCtx, identityObjectType);
- // put all missing attribute MD from default store
- if (defaultMDMap != null)
- {
- for (Map.Entry<String, IdentityObjectAttributeMetaData> entry : defaultMDMap.entrySet())
+ // put all missing attribute MD from default store
+ if (defaultMDMap != null)
{
- if (!mdMap.containsKey(entry.getKey()))
+ for (Map.Entry<String, IdentityObjectAttributeMetaData> entry : defaultMDMap.entrySet())
{
- mdMap.put(entry.getKey(), entry.getValue());
+ if (!mdMap.containsKey(entry.getKey()))
+ {
+ mdMap.put(entry.getKey(), entry.getValue());
+ }
}
}
}
+
+ return mdMap;
}
-
- return mdMap;
+ catch (Exception e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ }
+ return new HashMap<String, IdentityObjectAttributeMetaData>();
}
public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext invocationContext, IdentityObject identity, String name) throws IdentityException
{
- IdentityObjectAttribute result = null;
+ try
+ {
+ IdentityObjectAttribute result = null;
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
- if (hasIdentityObject(targetCtx, toStore, identity))
- {
- result = toStore.getAttribute(targetCtx, identity, name);
- }
+ if (hasIdentityObject(targetCtx, toStore, identity))
+ {
+ result = toStore.getAttribute(targetCtx, identity, name);
+ }
- if (result == null && toStore != defaultAttributeStore)
- {
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+ if (result == null && toStore != defaultAttributeStore)
+ {
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
- result = defaultAttributeStore.getAttribute(defaultCtx, identity, name);
+ result = defaultAttributeStore.getAttribute(defaultCtx, identity, name);
+ }
+
+ return result;
}
-
- return result;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
{
- Map<String, IdentityObjectAttribute> results = new HashMap<String, IdentityObjectAttribute>();
+ try
+ {
+ Map<String, IdentityObjectAttribute> results = new HashMap<String, IdentityObjectAttribute>();
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);
- if (hasIdentityObject(targetCtx, toStore, identity))
- {
- results = toStore.getAttributes(targetCtx, identity);
- }
-
- if (toStore != defaultAttributeStore)
- {
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+ if (hasIdentityObject(targetCtx, toStore, identity))
+ {
+ results = toStore.getAttributes(targetCtx, identity);
+ }
- Map<String, IdentityObjectAttribute> defaultAttrs = defaultAttributeStore.getAttributes(defaultCtx, identity);
+ if (toStore != defaultAttributeStore)
+ {
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
- // Add only those attributes which are missing - don't overwrite or merge existing values
- for (Map.Entry<String, IdentityObjectAttribute> entry : defaultAttrs.entrySet())
- {
- if (!results.keySet().contains(entry.getKey()))
+ Map<String, IdentityObjectAttribute> defaultAttrs = defaultAttributeStore.getAttributes(defaultCtx, identity);
+
+ // Add only those attributes which are missing - don't overwrite or merge existing values
+ for (Map.Entry<String, IdentityObjectAttribute> entry : defaultAttrs.entrySet())
{
- results.put(entry.getKey(), entry.getValue());
+ if (!results.keySet().contains(entry.getKey()))
+ {
+ results.put(entry.getKey(), entry.getValue());
+ }
}
}
+
+ return results;
}
-
- return results;
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, IdentityObjectAttribute[] attributes) throws IdentityException
{
- ArrayList<IdentityObjectAttribute> filteredAttrs = new ArrayList<IdentityObjectAttribute>();
- ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();
+ try
+ {
+ ArrayList<IdentityObjectAttribute> filteredAttrs = new ArrayList<IdentityObjectAttribute>();
+ ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();
- IdentityObjectAttribute[] attributesToAdd = null;
+ IdentityObjectAttribute[] attributesToAdd = null;
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
- // Put supported attrs to the main store
- if (toStore != defaultAttributeStore
- && !isIdentityStoreReadOnly(toStore)
- && hasIdentityObject(targetCtx, toStore, identity))
- {
- Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
+ // Put supported attrs to the main store
+ if (toStore != defaultAttributeStore
+ && !isIdentityStoreReadOnly(toStore)
+ && hasIdentityObject(targetCtx, toStore, identity))
+ {
+ Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
- // Filter out supported and not supported attributes
- for (IdentityObjectAttribute entry : attributes)
- {
- if (supportedAttrs.contains(entry.getName()))
+ // Filter out supported and not supported attributes
+ for (IdentityObjectAttribute entry : attributes)
{
- filteredAttrs.add(entry);
+ if (supportedAttrs.contains(entry.getName()))
+ {
+ filteredAttrs.add(entry);
+ }
+ else
+ {
+ leftAttrs.add(entry);
+ }
}
- else
- {
- leftAttrs.add(entry);
- }
- }
- toStore.updateAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));
+ toStore.updateAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));
- attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);
+ attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);
- }
- else
- {
- attributesToAdd = attributes;
- }
+ }
+ else
+ {
+ attributesToAdd = attributes;
+ }
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
- if (isAllowNotDefinedAttributes())
- {
- if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
- {
- defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
- }
- defaultAttributeStore.updateAttributes(defaultCtx, identity, attributesToAdd);
- }
- else
- {
- Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
- for (IdentityObjectAttribute entry : leftAttrs)
+ if (isAllowNotDefinedAttributes())
{
- if (!supportedAttrs.contains(entry.getName()))
+ if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
+ }
+ defaultAttributeStore.updateAttributes(defaultCtx, identity, attributesToAdd);
+ }
+ else
+ {
+ Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
+ for (IdentityObjectAttribute entry : leftAttrs)
{
- throw new IdentityException("Cannot update not defined attribute. Use '"
- + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
- "Attribute name: " + entry.getName());
+ if (!supportedAttrs.contains(entry.getName()))
+ {
+ throw new IdentityException("Cannot update not defined attribute. Use '"
+ + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
+ "Attribute name: " + entry.getName());
+ }
}
+ defaultAttributeStore.updateAttributes(defaultCtx, identity, attributesToAdd);
}
- defaultAttributeStore.updateAttributes(defaultCtx, identity, attributesToAdd);
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, IdentityObjectAttribute[] attributes) throws IdentityException
{
- ArrayList<IdentityObjectAttribute> filteredAttrs = new ArrayList<IdentityObjectAttribute>();
- ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();
- IdentityObjectAttribute[] attributesToAdd = null;
+ try
+ {
+ ArrayList<IdentityObjectAttribute> filteredAttrs = new ArrayList<IdentityObjectAttribute>();
+ ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();
+ IdentityObjectAttribute[] attributesToAdd = null;
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
- // Put supported attrs to the main store
- if (toStore != defaultAttributeStore
- && !isIdentityStoreReadOnly(toStore)
- && hasIdentityObject(targetCtx, toStore, identity))
- {
- Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
+ // Put supported attrs to the main store
+ if (toStore != defaultAttributeStore
+ && !isIdentityStoreReadOnly(toStore)
+ && hasIdentityObject(targetCtx, toStore, identity))
+ {
+ Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
- // Filter out supported and not supported attributes
- for (IdentityObjectAttribute entry : attributes)
- {
- if (supportedAttrs.contains(entry.getName()))
+ // Filter out supported and not supported attributes
+ for (IdentityObjectAttribute entry : attributes)
{
- filteredAttrs.add(entry);
+ if (supportedAttrs.contains(entry.getName()))
+ {
+ filteredAttrs.add(entry);
+ }
+ else
+ {
+ leftAttrs.add(entry);
+ }
}
- else
- {
- leftAttrs.add(entry);
- }
- }
- toStore.addAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));
+ toStore.addAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));
- attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);
+ attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);
- }
- else
- {
- attributesToAdd = attributes;
- }
+ }
+ else
+ {
+ attributesToAdd = attributes;
+ }
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
- if (isAllowNotDefinedAttributes())
- {
- if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
- {
- defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
- }
+ if (isAllowNotDefinedAttributes())
+ {
+ if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
+ }
- defaultAttributeStore.addAttributes(defaultCtx, identity, attributesToAdd);
- }
- else
- {
- Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
- for (IdentityObjectAttribute entry : attributesToAdd)
+ defaultAttributeStore.addAttributes(defaultCtx, identity, attributesToAdd);
+ }
+ else
{
- // if we hit some unsupported attribute at this stage that we cannot store...
- if (!supportedAttrs.contains(entry.getName()))
+ Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
+ for (IdentityObjectAttribute entry : attributesToAdd)
{
- throw new IdentityException("Cannot add not defined attribute. Use '"
- + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
- "Attribute name: " + entry.getName());
+ // if we hit some unsupported attribute at this stage that we cannot store...
+ if (!supportedAttrs.contains(entry.getName()))
+ {
+ throw new IdentityException("Cannot add not defined attribute. Use '"
+ + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
+ "Attribute name: " + entry.getName());
+ }
+
}
-
+ defaultAttributeStore.addAttributes(defaultCtx, identity, attributesToAdd);
}
- defaultAttributeStore.addAttributes(defaultCtx, identity, attributesToAdd);
}
-
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
+
}
public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, String[] attributes) throws IdentityException
{
- List<String> filteredAttrs = new LinkedList<String>();
- List<String> leftAttrs = new LinkedList<String>();
+ try
+ {
+ List<String> filteredAttrs = new LinkedList<String>();
+ List<String> leftAttrs = new LinkedList<String>();
- IdentityStore toStore = resolveIdentityStore(identity);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
+ IdentityStore toStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
- // Put supported attrs to the main store
- if (toStore != defaultAttributeStore
- && !isIdentityStoreReadOnly(toStore)
- && hasIdentityObject(targetCtx, toStore, identity))
- {
- Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
+ // Put supported attrs to the main store
+ if (toStore != defaultAttributeStore
+ && !isIdentityStoreReadOnly(toStore)
+ && hasIdentityObject(targetCtx, toStore, identity))
+ {
+ Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());
- // Filter out supported and not supported attributes
- for (String name : attributes)
- {
- if (supportedAttrs.contains(name))
+ // Filter out supported and not supported attributes
+ for (String name : attributes)
{
- filteredAttrs.add(name);
+ if (supportedAttrs.contains(name))
+ {
+ filteredAttrs.add(name);
+ }
+ else
+ {
+ leftAttrs.add(name);
+ }
}
- else
- {
- leftAttrs.add(name);
- }
- }
- toStore.removeAttributes(targetCtx, identity, filteredAttrs.toArray(new String[filteredAttrs.size()]));
+ toStore.removeAttributes(targetCtx, identity, filteredAttrs.toArray(new String[filteredAttrs.size()]));
- }
- else
- {
- leftAttrs = Arrays.asList(attributes);
- }
+ }
+ else
+ {
+ leftAttrs = Arrays.asList(attributes);
+ }
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
- if (isAllowNotDefinedAttributes())
- {
- if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
- {
- defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
- }
- defaultAttributeStore.removeAttributes(defaultCtx, identity, leftAttrs.toArray(new String[leftAttrs.size()]));
- }
- else
- {
- Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
- for (String name : leftAttrs)
+ if (isAllowNotDefinedAttributes())
{
- if (!supportedAttrs.contains(name))
+ if (!hasIdentityObject(defaultCtx, defaultIdentityStore, identity))
+ {
+ defaultIdentityStore.createIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
+ }
+ defaultAttributeStore.removeAttributes(defaultCtx, identity, leftAttrs.toArray(new String[leftAttrs.size()]));
+ }
+ else
+ {
+ Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identity.getIdentityType());
+ for (String name : leftAttrs)
{
- throw new IdentityException("Cannot remove not defined attribute. Use '"
- + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
- "Attribute name: " + name);
+ if (!supportedAttrs.contains(name))
+ {
+ throw new IdentityException("Cannot remove not defined attribute. Use '"
+ + ALLOW_NOT_DEFINED_ATTRIBUTES + "' option to pass such attributes to default IdentityStore anyway." +
+ "Attribute name: " + name);
+ }
}
+ defaultAttributeStore.removeAttributes(defaultCtx, identity, leftAttrs.toArray(new String[leftAttrs.size()]));
}
- defaultAttributeStore.removeAttributes(defaultCtx, identity, leftAttrs.toArray(new String[leftAttrs.size()]));
}
+ catch (IdentityException e)
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+ throw e;
+ }
}
public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException
{
- List<String> filteredAttrs = new LinkedList<String>();
- List<String> leftAttrs = new LinkedList<String>();
+ try
+ {
+ List<String> filteredAttrs = new LinkedList<String>();
+ List<String> leftAttrs = new LinkedList<String>();
- IdentityStore toStore = resolveIdentityStore(identityObjectType);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
+ IdentityStore toStore = resolveIdentityStore(identityObjectType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);
- IdentityObject result = null;
+ IdentityObject result = null;
- // Put supported attrs to the main store
- if (toStore != defaultAttributeStore)
- {
- Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identityObjectType);
+ // Put supported attrs to the main store
+ if (toStore != defaultAttributeStore)
+ {
+ Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identityObjectType);
- if (supportedAttrs.contains(attribute.getName()))
+ if (supportedAttrs.contains(attribute.getName()))
+ {
+ result = toStore.findIdentityObjectByUniqueAttribute(targetCtx, identityObjectType, attribute);
+ }
+ }
+
+ if (result != null)
{
- result = toStore.findIdentityObjectByUniqueAttribute(targetCtx, identityObjectType, attribute);
+ return result;
}
- }
- if (result != null)
- {
- return result;
- }
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
- IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+ if (isAllowNotDefinedAttributes())
+ {
+ return defaultAttributeStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute);
+ }
+ else
+ {
+ Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityObjectType);
+ if (supportedAttrs.contains(attribute.getName()))
+ {
+ return toStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute);
+ }
+ }
- if (isAllowNotDefinedAttributes())
- {
- return defaultAttributeStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute);
+ return null;
}
- else
+ catch (IdentityException e)
{
- Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityObjectType);
- if (supportedAttrs.contains(attribute.getName()))
+ if (log.isLoggable(Level.FINER))
{
- return toStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute);
+ log.log(Level.FINER, "Exception occurred: ", e);
}
+ throw e;
}
-
- return null;
}
private void sortByName(List<IdentityObject> objects, final boolean ascending)
Modified: idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../../parent</relativePath>
</parent>
Modified: idm/trunk/picketlink-idm-docs/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-docs/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-docs/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,10 +2,9 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.docs</groupId>
<artifactId>picketlink-idm-docs</artifactId>
Modified: idm/trunk/picketlink-idm-hibernate/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-hibernate/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-hibernate/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -57,6 +57,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -74,7 +76,7 @@
public class HibernateIdentityStoreImpl implements IdentityStore, Serializable
{
- //TODO: logging
+ private static Logger log = Logger.getLogger(HibernateIdentityStoreImpl.class.getName());
public static final String HIBERNATE_SESSION_FACTORY_REGISTRY_NAME = "hibernateSessionFactoryRegistryName";
@@ -224,6 +226,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to populate relationship types", e);
}
@@ -245,6 +252,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to populate identity object types", e);
}
@@ -258,6 +270,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to populated credential types");
}
}
@@ -365,6 +382,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot obtain hibernate SessionFactory from provided JNDI name: " + sfJNDIName, e);
}
}
@@ -419,6 +441,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot obtain hibernate SessionFactory using provided hibernate configuration: "+ hibernateConfiguration, e);
}
@@ -438,6 +465,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to obtain Hibernate SessionFactory",e);
}
}
@@ -515,6 +547,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot persist new IdentityObject" + io, e);
}
@@ -558,6 +595,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove IdentityObject" + identity, e);
}
}
@@ -582,6 +624,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot count stored IdentityObjects with type: " + identityType.getName(), e);
}
@@ -616,6 +663,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityObject with name '" + name + "' and type '" + type.getName() + "'", e);
}
@@ -637,6 +689,11 @@
}
catch(Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityObject with id: " + id, e);
}
@@ -707,6 +764,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityObjects with type '" + identityType.getName() + "'", e);
}
@@ -845,6 +907,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot find IdentityObjects", e);
}
@@ -931,6 +998,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot create relationship: ", e);
}
@@ -1013,6 +1085,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove relationship");
}
@@ -1059,6 +1136,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove relationship");
}
}
@@ -1171,6 +1253,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot create new relationship name: " + name, e);
}
@@ -1222,6 +1309,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove new relationship name: " + name, e);
}
@@ -1289,6 +1381,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot get relationship names. ", e);
}
@@ -1351,6 +1448,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot get relationship names. ", e);
}
@@ -1395,6 +1497,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot get relationship name properties: " + name, e);
}
}
@@ -1429,6 +1536,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot set relationship name properties: " + name, e);
}
}
@@ -1469,6 +1581,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove relationship name properties: " + name, e);
}
}
@@ -1514,6 +1631,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot obtain relationship properties: ", e);
}
}
@@ -1559,6 +1681,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot update relationship properties: ", e);
}
}
@@ -1607,6 +1734,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot update relationship properties: ", e);
}
}
@@ -2335,6 +2467,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot obtain Hibernate Session", e);
}
}
@@ -2413,6 +2550,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObjectType[" + type.getName() + "] not present in the store.", e);
}
@@ -2446,6 +2588,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObject[ " + io.getName() + " | " + io.getIdentityType().getName() + "] not present in the store.", e);
}
@@ -2470,6 +2617,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObjectRelationshipType[ " + iot.getName() + "] not present in the store.");
}
@@ -2492,6 +2644,11 @@
}
catch (HibernateException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObjectCredentialType[ " + credentialType.getName() + "] not present in the store.");
}
@@ -2576,6 +2733,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to create store realm", e);
}
}
Modified: idm/trunk/picketlink-idm-ldap/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-ldap/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-ldap/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -195,6 +195,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot create entries in LDAP during store initialization: " + e);
}
finally
@@ -205,6 +210,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot close LDAP connection: ", e);
}
}
@@ -326,6 +336,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to create identity object", e);
}
finally
@@ -336,6 +351,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -369,6 +389,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to remove identity: ", e);
}
finally
@@ -379,6 +404,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -431,6 +461,10 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
throw new IdentityException("User search failed.", e);
}
return 0;
@@ -508,6 +542,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObject search failed.", e);
}
finally
@@ -521,6 +560,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -614,6 +658,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Identity object search failed.", e);
}
finally
@@ -624,6 +673,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -765,6 +819,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObject search failed.", e);
}
finally
@@ -778,6 +837,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -949,6 +1013,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to resolve relationship", e);
}
finally
@@ -959,6 +1028,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1272,6 +1346,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to resolve relationship", e);
}
finally
@@ -1282,6 +1361,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1539,6 +1623,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to create relationship", e);
}
finally
@@ -1549,6 +1638,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1639,6 +1733,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to remove relationship", e);
}
finally
@@ -1649,6 +1748,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1761,6 +1865,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to resolve relationship", e);
}
finally
@@ -1771,6 +1880,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1833,6 +1947,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to create relationship name object", e);
}
finally
@@ -1843,6 +1962,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -1920,6 +2044,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("relationship name remove failed.", e);
}
finally
@@ -1933,6 +2062,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2017,6 +2151,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("relationship names search failed.", e);
}
finally
@@ -2030,6 +2169,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2161,6 +2305,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2226,6 +2375,11 @@
}
catch (UnsupportedEncodingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Error while encoding password with configured setting: " + typeConfig.getPasswordEncoding(),
e);
}
@@ -2278,6 +2432,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot set identity password value.", e);
}
finally
@@ -2288,6 +2447,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2383,6 +2547,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot get attributes value.", e);
}
finally
@@ -2393,6 +2562,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2491,6 +2665,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot add attribute", e);
}
}
@@ -2505,6 +2684,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2602,6 +2786,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot add attribute", e);
}
}
@@ -2616,6 +2805,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2681,6 +2875,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Cannot remove attribute", e);
}
@@ -2694,6 +2893,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2777,6 +2981,11 @@
}
catch (Exception e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("IdentityObject search failed.", e);
}
finally
@@ -2790,6 +2999,11 @@
}
catch (NamingException e)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Failed to close LDAP connection", e);
}
}
@@ -2828,6 +3042,12 @@
}
catch (Exception e)
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occurred: ", e);
+ }
+
throw new IdentityException("Couldn't create LDAPIdentityObjectImpl object from ldap entry (SearchResult)", e);
}
Modified: idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
===================================================================
--- idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2010-04-22 21:15:15 UTC (rev 209)
@@ -27,6 +27,8 @@
import java.util.Hashtable;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -41,6 +43,8 @@
*/
public class LDAPIdentityStoreSessionImpl implements IdentityStoreSession
{
+ private static Logger log = Logger.getLogger(LDAPIdentityStoreSessionImpl.class.getName());
+
private final LDAPIdentityStoreConfiguration storeConfig;
public LDAPIdentityStoreSessionImpl(LDAPIdentityStoreConfiguration storeConfig)
@@ -125,6 +129,12 @@
}
catch (Exception e)
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.log(Level.FINER, "Exception occured: ", e);
+ }
+
throw new IdentityException("Could not create LdapContext", e);
}
}
Modified: idm/trunk/picketlink-idm-spi/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-spi/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-spi/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/picketlink-idm-testsuite/pom.xml
===================================================================
--- idm/trunk/picketlink-idm-testsuite/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/picketlink-idm-testsuite/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2010-04-14 15:01:32 UTC (rev 208)
+++ idm/trunk/pom.xml 2010-04-22 21:15:15 UTC (rev 209)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.1.2.CR01</version>
+ <version>1.1.2.GA-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -39,6 +39,14 @@
</modules>
</profile>
<profile>
+ <id>examples</id>
+ <modules>
+ <module>example/simple</module>
+ <module>example/auth</module>
+ <module>example/auth-simple</module>
+ </modules>
+ </profile>
+ <profile>
<id>distro</id>
<modules>
<module>parent</module>
@@ -51,8 +59,8 @@
<module>picketlink-idm-cache</module>
<module>picketlink-idm-auth</module>
<module>picketlink-idm-testsuite</module>
+ <module>integration</module>
<module>picketlink-idm-docs</module>
- <module>integration</module>
<module>assembly</module>
</modules>
<properties>
More information about the jboss-cvs-commits
mailing list