Author: bdaw
Date: 2010-11-25 16:58:33 -0500 (Thu, 25 Nov 2010)
New Revision: 563
Modified:
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/helper/Tools.java
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectRelationshipType.java
idm/branches/1.1.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectRelationshipTypeImpl.java
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
Log:
- caching improvements for LDAP store
- more defensive code to prevent NPEs from method that should not return null...
Modified:
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -256,12 +256,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, user);
- ioNode.put(NODE_OBJECT_KEY, user);
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "User stored in cache: " + user.getId() +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User stored in cache: " + user.getId()
+ ";namespace=" + ns);
+ }
}
}
@@ -304,13 +306,16 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(users));
-
- if (log.isLoggable(Level.FINER))
+ if (ioNode != null)
{
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(users));
- log.finer(this.toString() + "User criteria search stored in cache:
users.size()=" + users.size() +
- "; criteria.hash()=" + criteria + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+
+ log.finer(this.toString() + "User criteria search stored in cache:
users.size()=" + users.size() +
+ "; criteria.hash()=" + criteria + ";namespace=" +
ns);
+ }
}
}
@@ -355,11 +360,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, count);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, count);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Users count stored in cache: " + count +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Users count stored in cache: " + count
+ ";namespace=" + ns);
+ }
}
}
@@ -404,11 +412,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, group);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, group);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group stored in cache: " + group.getKey()
+ ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group stored in cache: " +
group.getKey() + ";namespace=" + ns);
+ }
}
}
@@ -452,12 +463,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(groups));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(groups));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group criteria search stored in cache:
groups.size()=" + groups.size() +
- "; criteria.hash()=" + criteria + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group criteria search stored in cache:
groups.size()=" + groups.size() +
+ "; criteria.hash()=" + criteria + ";namespace=" +
ns);
+ }
}
}
@@ -502,12 +516,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, count);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, count);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group count stored in cache: type=" +
groupType + "; count=" + count
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group count stored in cache: type=" +
groupType + "; count=" + count
+ + ";namespace=" + ns);
+ }
}
}
@@ -553,12 +570,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, role);
- ioNode.put(NODE_OBJECT_KEY, role);
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Role stored in cache: " + role +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role stored in cache: " + role +
";namespace=" + ns);
+ }
}
}
@@ -595,11 +614,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, role);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, role);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "RoleType stored in cache: name=" +
role.getName() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType stored in cache: name=" +
role.getName() + ";namespace=" + ns);
+ }
}
}
@@ -635,12 +657,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(attributes));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(attributes));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Attributes stored in cache: id=" + id +
"; attributes.size()="
- + attributes.size() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Attributes stored in cache: id=" + id
+ "; attributes.size()="
+ + attributes.size() + ";namespace=" + ns);
+ }
}
}
@@ -690,12 +715,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Role properties stored in cache: role=" +
role + "; properties.size()="
- + properties.size() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role properties stored in cache:
role=" + role + "; properties.size()="
+ + properties.size() + ";namespace=" + ns);
+ }
}
}
@@ -745,12 +773,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, Collections.unmodifiableMap(properties));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "RoleType properties stored in cache:
roleType=" + roleType
- + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType properties stored in cache:
roleType=" + roleType
+ + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ }
}
}
@@ -818,12 +849,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "User search stored in cache:
results.size()=" + results.size()
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User search stored in cache:
results.size()=" + results.size()
+ + ";namespace=" + ns);
+ }
}
}
@@ -855,11 +889,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ }
}
}
@@ -890,11 +927,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, result);
+ if (ioNode == null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, result);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Relationship search stored in cache:
result=" + result + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Relationship search stored in cache:
result=" + result + ";namespace=" + ns);
+ }
}
}
@@ -925,11 +965,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Role search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ }
}
}
@@ -960,11 +1003,14 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, unmodifiableCollection(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "RoleType search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "RoleType search stored in cache:
results.size()=" + results.size() + ";namespace=" + ns);
+ }
}
}
@@ -1007,12 +1053,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_KEY, results);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_KEY, results);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "User query stored in cache:
q.hashCode()=" + q.hashCode()
- + "; results.size()=" + results.size() + ";namespace=" +
ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query stored in cache:
q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace="
+ ns);
+ }
}
}
@@ -1022,12 +1071,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_UNIQUE_KEY, user);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, user);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "User query stored in cache:
q.hashCode()=" + q.hashCode() + "; user=" + user
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "User query stored in cache:
q.hashCode()=" + q.hashCode() + "; user=" + user
+ + ";namespace=" + ns);
+ }
}
}
@@ -1089,12 +1141,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_KEY, unmodifiableCollection(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_KEY, unmodifiableCollection(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group query stored in cache:
q.hashCode()=" + q.hashCode()
- + "; results.size()=" + results.size() + ";namespace=" +
ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query stored in cache:
q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace="
+ ns);
+ }
}
}
@@ -1104,12 +1159,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_UNIQUE_KEY, group);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, group);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Group query stored in cache:
q.hashCode()=" + q.hashCode()
- + "; group=" + group + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Group query stored in cache:
q.hashCode()=" + q.hashCode()
+ + "; group=" + group + ";namespace=" + ns);
+ }
}
}
@@ -1171,26 +1229,33 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_KEY, results);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_KEY, results);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Role query stored in cache:
q.hashCode()=" + q.hashCode()
- + "; results.size()=" + results.size() + ";namespace=" +
ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query stored in cache:
q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace="
+ ns);
+ }
}
}
+
public void putRoleQueryUnique(String ns, RoleQuery q, Role role)
{
Fqn nodeFqn = getFqn(ns, NODE_ROLE_QUERIES, q.hashCode());
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_QUERY_UNIQUE_KEY, role);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_QUERY_UNIQUE_KEY, role);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Role query stored in cache:
q.hashCode()=" + q.hashCode() + "; role=" + role
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Role query stored in cache:
q.hashCode()=" + q.hashCode() + "; role=" + role
+ + ";namespace=" + ns);
+ }
}
}
@@ -1248,6 +1313,10 @@
private Collection unmodifiableCollection(Collection collection)
{
+ if (collection == null)
+ {
+ return collection;
+ }
if (collection instanceof List)
{
return Collections.unmodifiableList((List)collection);
Modified:
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -246,12 +246,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, count);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, count);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObject count stored in cache: " +
count + "; type=" + type
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject count stored in cache:
" + count + "; type=" + type
+ + ";namespace=" + ns);
+ }
}
}
@@ -298,12 +301,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, safeCopyIO(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, safeCopyIO(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObject search stored in cache:
results.size()=" + results.size()
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject search stored in cache:
results.size()=" + results.size()
+ + ";namespace=" + ns);
+ }
}
}
@@ -344,12 +350,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, safeCopyIOR(results));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, safeCopyIOR(results));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObjectRelationship search stored in
cache: results.size()=" + results.size()
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship search stored in
cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
+ }
}
}
@@ -390,12 +399,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, results);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, results);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObjectRelationshipName search stored
in cache: results.size()=" + results.size()
- + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName search
stored in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
+ }
}
}
@@ -436,12 +448,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, properties);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, properties);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObjectRelationship properties stored
in cache: relationship="
- + relationship + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationship properties
stored in cache: relationship="
+ + relationship + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ }
}
}
@@ -501,12 +516,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, properties);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, properties);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObjectRelationshipName properties
stored in cache: name="
- + name + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObjectRelationshipName properties
stored in cache: name="
+ + name + "; properties.size()=" + properties.size() +
";namespace=" + ns);
+ }
}
}
@@ -559,12 +577,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, safeCopyAttr(attributes));
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, safeCopyAttr(attributes));
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "IdentityObject attributes stored in cache:
io=" + io
- + "; attributes.size()=" + attributes.size() +
";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "IdentityObject attributes stored in cache:
io=" + io
+ + "; attributes.size()=" + attributes.size() +
";namespace=" + ns);
+ }
}
}
@@ -614,12 +635,15 @@
Node ioNode = getCache().getRoot().addChild(nodeFqn);
- ioNode.put(NODE_OBJECT_KEY, value);
+ if (ioNode != null)
+ {
+ ioNode.put(NODE_OBJECT_KEY, value);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(this.toString() + "Object stored in cache: hash=" + hash
- + "; value=" + value + ";namespace=" + ns);
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(this.toString() + "Object stored in cache: hash=" + hash
+ + "; value=" + value + ";namespace=" + ns);
+ }
}
}
Modified:
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/helper/Tools.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/helper/Tools.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/helper/Tools.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -22,10 +22,14 @@
package org.picketlink.idm.impl.helper;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Enumeration;
import java.util.ArrayList;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -161,4 +165,71 @@
}
return sb.toString();
}
+
+ public static void logMethodIn(Logger log, Level level, String methodName, Object[]
args)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' called with arguments: ");
+
+ if (args != null)
+ {
+ for (Object arg : args)
+ {
+ if (arg != null && arg instanceof Object[])
+ {
+ sb.append(Arrays.toString((Object[])arg))
+ .append("; ");
+ }
+ else
+ {
+ sb.append(arg)
+ .append("; ");
+ }
+ }
+ }
+ log.log(level, sb.toString());
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application
code): ", t);
+ }
+
+ }
+
+ public static void logMethodOut(Logger log, Level level, String methodName, Object
result)
+ {
+ try
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Method '")
+ .append(methodName)
+ .append("' returning object: ");
+
+ if (result != null && result instanceof Collection)
+ {
+ sb.append("Collection of size:
").append(((Collection)result).size());
+ }
+ else
+ {
+ if (result != null)
+ {
+
sb.append("[").append(result.getClass().getCanonicalName()).append("]");
+ }
+ sb.append(result);
+ }
+
+ log.log(level, sb.toString());
+
+ }
+ catch (Throwable t)
+ {
+ log.log(level, "Error in logging code block (not related to application
code): ", t);
+ }
+ }
+
+
}
Modified:
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectRelationshipType.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectRelationshipType.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectRelationshipType.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -41,4 +41,12 @@
{
return name;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleIdentityObjectRelationshipType{" +
+ "name='" + name + '\'' +
+ '}';
+ }
}
Modified:
idm/branches/1.1.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectRelationshipTypeImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectRelationshipTypeImpl.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectRelationshipTypeImpl.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -41,4 +41,12 @@
{
return name;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleIdentityObjectRelationshipTypeImpl{" +
+ "name='" + name + '\'' +
+ '}';
+ }
}
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-11-24
23:56:13 UTC (rev 562)
+++
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-11-25
21:58:33 UTC (rev 563)
@@ -329,6 +329,30 @@
IdentityObjectType type,
Map<String, String[]> attributes)
throws IdentityException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "createIdentityObject",
+ new Object[]{
+ "name", name,
+ "IdentityObjectType", type,
+ "attributes", attributes
+ });
+ }
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "",
+ new Object[]{
+
+ });
+ }
+
if (name == null)
{
throw new IdentityException("Name cannot be null");
@@ -336,11 +360,6 @@
checkIOType(type);
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".createIdentityObject with name: " + name +
" and type: " + type.getName());
- }
-
LdapContext ldapContext = getLDAPContext(invocationCtx);
String dn = null;
@@ -446,15 +465,32 @@
}
}
- return new SimpleIdentityObject(name, dn, type);
+ IdentityObject result = new SimpleIdentityObject(name, dn, type);
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "createIdentityObject",
+ result);
+ }
+
+ return result;
+
}
public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity) throws IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".removeIdentityObject: " + identity);
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "removeIdentityObject",
+ new Object[]{
+ "IdentityObject", identity
+ });
}
LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(invocationCtx, identity);
@@ -510,7 +546,13 @@
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".getIdentityObjectsCount for type: " +
identityType);
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "getIdentityObjectsCount",
+ new Object[]{
+ "IdentityObjectType", identityType
+ });
}
checkIOType(identityType);
@@ -543,8 +585,19 @@
scope,
null);
- return sr.size();
+ int result = sr.size();
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "getIdentityObjectsCount",
+ result);
+ }
+
+ return result;
+
}
catch (NoSuchElementException e)
{
@@ -558,15 +611,34 @@
}
throw new IdentityException("User search failed.", e);
}
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "getIdentityObjectsCount",
+ 0);
+ }
+
return 0;
}
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationCtx,
String name, IdentityObjectType type) throws IdentityException
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationCtx,
+ String name,
+ IdentityObjectType type) throws
IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".findIdentityObject with name: " + name +
"; and type: " + type);
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ new Object[]{
+ "name", name,
+ "IdentityObjectType", type
+ });
}
Context ctx = null;
@@ -633,6 +705,15 @@
io = null;
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ io);
+ }
+
return io;
}
@@ -669,6 +750,15 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ null);
+ }
+
return null;
}
@@ -676,7 +766,13 @@
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".findIdentityObject with id: " + id);
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ new Object[]{
+ "id", id
+ });
}
LdapContext ldapContext = getLDAPContext(ctx);
@@ -750,8 +846,19 @@
throw new IdentityException("Can't find identity entry with DN:
" + dn);
}
- return createIdentityObjectInstance(ctx, type, attrs, dn);
+ IdentityObject result = createIdentityObjectInstance(ctx, type, attrs, dn);
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ result);
+ }
+
+ return result;
+
}
catch (NoSuchElementException e)
{
@@ -782,6 +889,16 @@
throw new IdentityException("Failed to close LDAP connection", e);
}
}
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ null);
+ }
+
return null;
}
@@ -792,6 +909,17 @@
//TODO: page control with LDAP request control
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ new Object[]{
+ "IdentityObjectType", type,
+ "IdentityObjectSearchCriteria", criteria
+ });
+ }
String nameFilter = "*";
@@ -957,6 +1085,15 @@
objects = (LinkedList)cutPageFromResults(objects, criteria);
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ objects);
+ }
+
return objects;
}
@@ -973,7 +1110,21 @@
boolean parent,
IdentityObjectSearchCriteria
criteria) throws IdentityException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ new Object[]{
+ "IdentityObject", identity,
+ "IdentityObjectRelationshipType", relationshipType,
+ "parent", parent,
+ "IdentityObjectSearchCriteria", criteria
+ });
+ }
+
if (relationshipType != null &&
!relationshipType.getName().equals(MEMBERSHIP_TYPE))
{
throw new IdentityException("This store implementation supports only
'" + MEMBERSHIP_TYPE +"' relationship type");
@@ -1150,6 +1301,15 @@
sortByName(objects, criteria.isAscending());
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObject",
+ objects);
+ }
+
return objects;
}
@@ -1161,6 +1321,20 @@
throws IdentityException, NamingException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findRelatedIdentityObjects",
+ new Object[]{
+ "IdentityObject", identity,
+ "LDAPIdentityObjectImpl", ldapIO,
+ "IdentityObjectSearchCriteria", criteria,
+ "parents", parents
+ });
+ }
+
List<IdentityObject> objects = new LinkedList<IdentityObject>();
LDAPIdentityObjectTypeConfiguration typeConfiguration = getTypeConfiguration(ctx,
identity.getIdentityType());
@@ -1324,6 +1498,15 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findRelatedIdentityObjects",
+ objects);
+ }
+
return objects;
}
@@ -1335,6 +1518,21 @@
String name) throws
IdentityException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "resolveRelationships",
+ new Object[]{
+ "IdentityObject", identity,
+ "IdentityObjectRelationshipType", type,
+ "parent", parent,
+ "named", named,
+ "name", name
+ });
+ }
+
if (type == null || !type.getName().equals(MEMBERSHIP_TYPE))
{
throw new IdentityException("This store implementation supports only
'" + MEMBERSHIP_TYPE +"' relationship type");
@@ -1477,6 +1675,14 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "resolveRelationships",
+ relationships);
+ }
return relationships;
}
@@ -1500,6 +1706,19 @@
throws IdentityException, NamingException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findRelationships",
+ new Object[]{
+ "IdentityObject", identity,
+ "LDAPIdentityObjectImpl", ldapIO,
+ "parents", parents
+ });
+ }
+
Set<LDAPIdentityObjectRelationshipImpl> relationships = new
HashSet<LDAPIdentityObjectRelationshipImpl>();
LDAPIdentityObjectTypeConfiguration typeConfiguration = getTypeConfiguration(ctx,
identity.getIdentityType());
@@ -1631,6 +1850,15 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findRelationships",
+ relationships);
+ }
+
return relationships;
}
@@ -1642,20 +1870,29 @@
return findIdentityObject(ctx, identity, relationshipType, parent, null);
}
- public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String name, boolean createNames) throws
IdentityException
+ public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
ctx,
+ IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType
relationshipType,
+ String name,
+ boolean createNames) throws
IdentityException
{
//TODO: relationshipType is ignored for now
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".createRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "createRelationship",
+ new Object[]{
+ "fromIdentity", fromIdentity,
+ "toIdentity", toIdentity,
+ "IdentityObjectRelationshipType", relationshipType,
+ "name", name,
+ "createNames", createNames
+ });
}
if (relationshipType == null ||
!relationshipType.getName().equals(MEMBERSHIP_TYPE))
@@ -1761,21 +1998,38 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "createRelationship",
+ relationship);
+ }
return relationship;
}
- public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject
fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType,
String name) throws IdentityException
+ public void removeRelationship(IdentityStoreInvocationContext ctx,
+ IdentityObject fromIdentity,
+ IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ String name) throws IdentityException
{
// relationshipType is ignored for now
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".removeRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "removeRelationship",
+ new Object[]{
+ "fromIdentity", fromIdentity,
+ "toIdentity", toIdentity,
+ "IdentityObjectRelationshipType", relationshipType,
+ "name", name
+ });
}
LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
@@ -1880,14 +2134,22 @@
}
}
- public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject
identity1, IdentityObject identity2, boolean named) throws IdentityException
+ public void removeRelationships(IdentityStoreInvocationContext ctx,
+ IdentityObject identity1,
+ IdentityObject identity2,
+ boolean named) throws IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".removeRelationships with "
- + "identity1: " + identity1
- + "; identity2: " + identity2
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "removeRelationships",
+ new Object[]{
+ "identity1", identity1,
+ "identity2", identity2,
+ "named", named
+ });
}
@@ -1907,10 +2169,15 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".resolveRelationships with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "resolveRelationships",
+ new Object[]{
+ "fromIdentity", fromIdentity,
+ "toIdentity", toIdentity,
+ "IdentityObjectRelationshipType", relationshipType
+ });
}
if (relationshipType != null &&
!relationshipType.getName().equals(MEMBERSHIP_TYPE))
@@ -2015,6 +2282,16 @@
throw new IdentityException("Failed to close LDAP connection", e);
}
}
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "resolveRelationships",
+ relationships);
+ }
+
return relationships;
}
@@ -2399,8 +2676,22 @@
}
- public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx,
+ IdentityObject identityObject,
+ IdentityObjectCredential credential) throws
IdentityException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "validateCredential",
+ new Object[]{
+ "IdentityObject", identityObject,
+ "IdentityObjectCredential", "****"
+ });
+ }
+
if (credential == null)
{
throw new IllegalArgumentException();
@@ -2421,6 +2712,16 @@
passwordString = credential.getValue().toString();
if (passwordString.length() == 0 && !getTypeConfiguration(ctx,
identityObject.getIdentityType()).isAllowEmptyPassword())
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "validateCredential",
+ false);
+ }
+
return false;
}
}
@@ -2451,6 +2752,16 @@
if (initialCtx != null)
{
initialCtx.close();
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "validateCredential",
+ true);
+ }
+
return true;
}
@@ -2475,6 +2786,15 @@
throw new IdentityException("Failed to close LDAP connection",
e);
}
}
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "validateCredential",
+ false);
+ }
return false;
@@ -2485,8 +2805,22 @@
}
}
- public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
+ public void updateCredential(IdentityStoreInvocationContext ctx,
+ IdentityObject identityObject,
+ IdentityObjectCredential credential) throws
IdentityException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "updateCredential",
+ new Object[]{
+ "IdentityObject", identityObject,
+ "IdentityObjectCredential", "****"
+ });
+ }
+
if (credential == null)
{
throw new IllegalArgumentException();
@@ -2632,40 +2966,84 @@
// Attributes
- public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext
invocationContext, IdentityObjectType identityType) throws IdentityException
+ public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext
invocationContext,
+ IdentityObjectType identityType) throws
IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".getSupportedAttributeNames with "
- + "identityType: " + identityType
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "getSupportedAttributeNames",
+ new Object[]{
+ "IdentityObjectType", identityType
+ });
}
checkIOType(identityType);
- return getTypeConfiguration(invocationContext,
identityType).getMappedAttributesNames();
+ Set<String> results = getTypeConfiguration(invocationContext,
identityType).getMappedAttributesNames();
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "getSupportedAttributeNames",
+ results);
+ }
+
+ return results;
}
- public Map<String, IdentityObjectAttributeMetaData>
getAttributesMetaData(IdentityStoreInvocationContext invocationContext, IdentityObjectType
identityObjectType)
+ public Map<String, IdentityObjectAttributeMetaData>
getAttributesMetaData(IdentityStoreInvocationContext invocationContext,
+
IdentityObjectType identityObjectType)
{
- return attributesMetaData.get(identityObjectType.getName());
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "getAttributeMetaData",
+ new Object[]{
+ "IdentityObjectType", identityObjectType
+ });
+ }
+ Map<String, IdentityObjectAttributeMetaData> results =
attributesMetaData.get(identityObjectType.getName());
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "getAttributesMetaData",
+ results);
+ }
+
+ return results;
}
- public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext
invocationContext, IdentityObject identity, String name) throws IdentityException
+ public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext
invocationContext,
+ IdentityObject identity, String name)
throws IdentityException
{
//TODO: dummy temporary implementation
return getAttributes(invocationContext, identity).get(name);
}
- public Map<String, IdentityObjectAttribute>
getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws
IdentityException
+ public Map<String, IdentityObjectAttribute>
getAttributes(IdentityStoreInvocationContext ctx,
+ IdentityObject identity)
throws IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".getAttributes with "
- + "identity: " + identity
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "getAttributes",
+ new Object[]{
+ "IdentityObject", identity
+ });
}
// Cache
@@ -2759,19 +3137,34 @@
getCache().putIdentityObjectAttributes(getNamespace(), identity, attrsMap);
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "getAttributes",
+ attrsMap);
+ }
+
return attrsMap;
}
- public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, IdentityObjectAttribute[] attributes) throws IdentityException
+ public void updateAttributes(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectAttribute[] attributes) throws
IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".updateAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "updateAttributes",
+ new Object[]{
+ "IdentityObject", identity,
+ "IdentityObjectAttribute[]", attributes
+ });
}
if (getCache() != null)
@@ -2900,15 +3293,21 @@
}
- public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectAttribute[] attributes) throws IdentityException
+ public void addAttributes(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectAttribute[] attributes) throws
IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".addAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "addAttributes",
+ new Object[]{
+ "IdentityObject", identity,
+ "IdentityObjectAttribute[]", attributes
+ });
}
if (getCache() != null)
@@ -3037,15 +3436,21 @@
}
}
- public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, String[] attributeNames) throws IdentityException
+ public void removeAttributes(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ String[] attributeNames) throws IdentityException
{
if (log.isLoggable(Level.FINER))
{
- log.finer(toString() + ".removeAttributes with "
- + "identity: " + identity
- + "attributeNames: " + attributeNames
- );
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "removeAttributes",
+ new Object[]{
+ "IdentityObject", identity,
+ "attributeNames", attributeNames
+ });
}
if (getCache() != null)
@@ -3140,8 +3545,24 @@
}
}
- public IdentityObject
findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType type, IdentityObjectAttribute attribute) throws IdentityException
+ public IdentityObject
findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx,
+ IdentityObjectType type,
+ IdentityObjectAttribute
attribute)
+ throws IdentityException
{
+
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "findIdentityObjectByUniqueAttribute",
+ new Object[]{
+ "IdentityObjectType", type,
+ "IdentityObjectAttribute", attribute
+ });
+ }
+
String nameFilter = "*";
@@ -3246,6 +3667,15 @@
if (objects.size() == 0)
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObjectByUniqueAttribute",
+ null);
+ }
+
return null;
}
if (objects.size() > 1)
@@ -3253,6 +3683,14 @@
throw new IdentityException("Illegal state - more than one IdentityObject
of same type share same unique attribute value");
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "findIdentityObjectByUniqueAttribute",
+ objects.get(0));
+ }
return objects.get(0);
}
@@ -3460,6 +3898,15 @@
}
}
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodOut(
+ log,
+ Level.FINER,
+ "searchIdentityObjects",
+ finalResults);
+ }
+
return finalResults;
}
@@ -3482,6 +3929,20 @@
Control[] requestControls) throws
NamingException
{
+ if (log.isLoggable(Level.FINER))
+ {
+ Tools.logMethodIn(
+ log,
+ Level.FINER,
+ "searchLDAP",
+ new Object[]{
+ "jndiName", jndiName,
+ "filterArgs", filterArgs,
+ "SearchControls", searchControls,
+ "requestControls", requestControls
+ });
+ }
+
// Add paged controls if needed
int pageSize = configuration.getPagedExtensionSize();