Author: bdaw
Date: 2009-05-09 05:51:45 -0400 (Sat, 09 May 2009)
New Revision: 481
Added:
idm/trunk/idm-auth/
idm/trunk/idm-auth/pom.xml
idm/trunk/idm-auth/src/
idm/trunk/idm-auth/src/main/
idm/trunk/idm-auth/src/main/java/
idm/trunk/idm-auth/src/main/java/org/
idm/trunk/idm-auth/src/main/java/org/jboss/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java
idm/trunk/idm-auth/src/main/resources/
idm/trunk/idm-auth/src/main/test/
idm/trunk/idm-auth/src/main/test/java/
idm/trunk/idm-auth/src/main/test/resources/
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
idm/trunk/pom.xml
Log:
some small corrections and placeholder auth module
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -105,4 +105,14 @@
result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleGroup{" +
+ "name='" + name + '\'' +
+ ", id='" + id + '\'' +
+ ", groupType='" + groupType + '\'' +
+ '}';
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRole.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -35,20 +35,20 @@
{
private final RoleType type;
- private final User identity;
+ private final User user;
private final Group group;
- public SimpleRole(RoleType type, User identity, Group group)
+ public SimpleRole(RoleType type, User user, Group group)
{
this.type = type;
- this.identity = identity;
+ this.user = user;
this.group = group;
}
- public User getIdentity()
+ public User getUser()
{
- return identity;
+ return user;
}
public Group getGroup()
@@ -79,7 +79,7 @@
{
return false;
}
- if (identity != null ? !identity.equals(that.identity) : that.identity != null)
+ if (user != null ? !user.equals(that.user) : that.user != null)
{
return false;
}
@@ -95,8 +95,18 @@
public int hashCode()
{
int result = type != null ? type.hashCode() : 0;
- result = 31 * result + (identity != null ? identity.hashCode() : 0);
+ result = 31 * result + (user != null ? user.hashCode() : 0);
result = 31 * result + (group != null ? group.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleRole{" +
+ "type=" + type +
+ ", identity=" + user +
+ ", group=" + group +
+ '}';
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleRoleType.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -71,4 +71,12 @@
{
return (name != null ? name.hashCode() : 0);
}
+
+ @Override
+ public String toString()
+ {
+ return "SimpleRoleType{" +
+ "name='" + name + '\'' +
+ '}';
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -71,5 +71,11 @@
return id != null ? id.hashCode() : 0;
}
-
+ @Override
+ public String toString()
+ {
+ return "SimpleUser{" +
+ "id='" + id + '\'' +
+ '}';
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -97,7 +97,20 @@
return this;
}
+ public QueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium
+ {
+ try
+ {
+ searchCriteria.idFilter(idFilter);
+ }
+ catch (UnsupportedCriterium unsupportedCriterium)
+ {
+ throw new UnsupportedQueryCriterium(unsupportedCriterium);
+ }
+ return this;
+ }
+
protected void checkNotNullArgument(Object arg, String name)
{
if (arg == null)
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -25,6 +25,7 @@
import org.jboss.identity.idm.api.query.UserQueryBuilder;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
+import org.jboss.identity.idm.api.query.QueryBuilder;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
@@ -188,4 +189,9 @@
{
return (UserQueryBuilder)super.attributeValuesFilter(attributeName,
attributeValue);
}
+
+ public UserQueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium
+ {
+ return (UserQueryBuilder)super.idFilter(idFilter);
+ }
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -118,11 +118,11 @@
}
}
- protected IdentityObject createIdentityObject(User identity)
+ protected IdentityObject createIdentityObject(User user)
{
IdentityObjectType iot =
getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
- return new SimpleIdentityObject(identity.getId(), iot);
+ return new SimpleIdentityObject(user.getId(), iot);
}
protected IdentityObject createIdentityObjectForUserName(String userName)
@@ -184,20 +184,20 @@
return new SimpleGroup(new GroupId(id));
}
- protected IdentityObjectSearchCriteria convertSearchControls(IdentitySearchCriteria
controls)
+ protected IdentityObjectSearchCriteria convertSearchControls(IdentitySearchCriteria
criteria)
{
- if (controls == null)
+ if (criteria == null)
{
return null;
}
- if (controls instanceof IdentityObjectSearchCriteria)
+ if (criteria instanceof IdentityObjectSearchCriteria)
{
- return (IdentityObjectSearchCriteria)controls;
+ return (IdentityObjectSearchCriteria)criteria;
}
else
{
- throw new IllegalArgumentException("Not supported IdentitySearchConstraints
implementation: " + controls.getClass());
+ throw new IllegalArgumentException("Not supported IdentitySearchCriteria
implementation: " + criteria.getClass());
}
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -34,7 +34,6 @@
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
-import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
import org.jboss.identity.idm.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.api.PasswordCredential;
@@ -146,11 +145,11 @@
return getSupportedAttributeNames(identityType);
}
- public Map<String, Attribute> getAttributes(IdentityType identity) throws
IdentityException
+ public Map<String, Attribute> getAttributes(IdentityType identityType) throws
IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
- Map<String, IdentityObjectAttribute> map =
getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
+ Map<String, IdentityObjectAttribute> map =
getRepository().getAttributes(getInvocationContext(),
createIdentityObject(identityType));
Map<String, Attribute> newMap = new HashMap<String, Attribute>();
@@ -192,12 +191,12 @@
}
- public Attribute getAttribute(IdentityType identity, String attributeName) throws
IdentityException
+ public Attribute getAttribute(IdentityType identityType, String attributeName) throws
IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
- return getAttributes(identity).get(attributeName);
+ return getAttributes(identityType).get(attributeName);
}
public Attribute getAttribute(String id, String attributeName) throws
IdentityException
@@ -210,15 +209,15 @@
return getAttribute(identityType, attributeName);
}
- public void addAttribute(IdentityType identity, String attributeName, Object[] values)
throws IdentityException
+ public void addAttribute(IdentityType identityType, String attributeName, Object[]
values) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(values, "Attribute values");
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
- addAttributes(identity, attrs);
+ addAttributes(identityType, attrs);
}
public void addAttributes(String id, Attribute[] attributes) throws IdentityException
@@ -232,16 +231,16 @@
}
- public void addAttribute(IdentityType identity, String attributeName, Object value)
throws IdentityException
+ public void addAttribute(IdentityType identityType, String attributeName, Object
value) throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeName, "Attribute name");
checkNotNullArgument(value, "Attribute value");
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
- addAttributes(identity, attrs);
+ addAttributes(identityType, attrs);
}
@@ -269,20 +268,20 @@
}
- public void addAttributes(IdentityType identity, Attribute[] attributes) throws
IdentityException
+ public void addAttributes(IdentityType identityType, Attribute[] attributes) throws
IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributes, "Attributes");
- getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identity), convertAttributes(attributes));
+ getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identityType), convertAttributes(attributes));
}
- public void removeAttributes(IdentityType identity, String[] attributeNames) throws
IdentityException
+ public void removeAttributes(IdentityType identityType, String[] attributeNames)
throws IdentityException
{
- checkNotNullArgument(identity, "IdentityType");
+ checkNotNullArgument(identityType, "IdentityType");
checkNotNullArgument(attributeNames, "Attribute names");
- getRepository().removeAttributes(getInvocationContext(),
createIdentityObject(identity), attributeNames);
+ getRepository().removeAttributes(getInvocationContext(),
createIdentityObject(identityType), attributeNames);
}
public void removeAttributes(String id, String[] attributeNames) throws
IdentityException
@@ -296,24 +295,24 @@
}
- public boolean hasPassword(User identity) throws IdentityException
+ public boolean hasPassword(User user) throws IdentityException
{
- checkNotNullArgument(identity, "User");
- return
getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(),
PasswordCredential.TYPE);
+ checkNotNullArgument(user, "User");
+ return
getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(user).getIdentityType(),
PasswordCredential.TYPE);
}
- public boolean validatePassword(User identity, String password) throws
IdentityException
+ public boolean validatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(password, "Password");
- return getRepository().validateCredential(getInvocationContext(),
createIdentityObject(identity), new PasswordCredential(password));
+ return getRepository().validateCredential(getInvocationContext(),
createIdentityObject(user), new PasswordCredential(password));
}
- public void updatePassword(User identity, String password) throws IdentityException
+ public void updatePassword(User user, String password) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(password, "Password");
- getRepository().updateCredential(getInvocationContext(),
createIdentityObject(identity), new PasswordCredential(password));
+ getRepository().updateCredential(getInvocationContext(),
createIdentityObject(user), new PasswordCredential(password));
}
public boolean isCredentialTypeSupported(CredentialType credentialType) throws
IdentityException
@@ -323,9 +322,9 @@
return
getRepository().getSupportedFeatures().isCredentialSupported(getUserObjectType(), new
SimpleCredentialType(credentialType.getName()));
}
- public boolean validateCredentials(User identity, Credential[] credentials) throws
IdentityException
+ public boolean validateCredentials(User user, Credential[] credentials) throws
IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(credentials, "Credentials");
for (Credential credential : credentials)
@@ -343,7 +342,7 @@
// All credentials must pass
- if (!getRepository().validateCredential(getInvocationContext(),
createIdentityObject(identity), ioc))
+ if (!getRepository().validateCredential(getInvocationContext(),
createIdentityObject(user), ioc))
{
return false;
}
@@ -352,14 +351,14 @@
return true;
}
- public void updateCredential(User identity, Credential credential) throws
IdentityException
+ public void updateCredential(User user, Credential credential) throws
IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(credential, "Credential");
if (credential instanceof IdentityObjectCredential)
{
- getRepository().updateCredential(getInvocationContext(),
createIdentityObject(identity), (IdentityObjectCredential)credential);
+ getRepository().updateCredential(getInvocationContext(),
createIdentityObject(user), (IdentityObjectCredential)credential);
}
else
{
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -202,11 +202,11 @@
return createUser(getRepository().findIdentityObject(getInvocationContext(), name,
getUserObjectType()));
}
- public Collection<User> findUser(IdentitySearchCriteria controls) throws
IdentityException
+ public Collection<User> findUser(IdentitySearchCriteria criteria) throws
IdentityException
{
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(),
convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), getUserObjectType(),
convertSearchControls(criteria));
List<User> identities = new LinkedList<User>();
for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
@@ -232,11 +232,11 @@
return createGroup(getRepository().findIdentityObject(getInvocationContext(),
id));
}
- public Collection<Group> findGroup(String groupType, IdentitySearchCriteria
controls) throws IdentityException
+ public Collection<Group> findGroup(String groupType, IdentitySearchCriteria
criteria) throws IdentityException
{
checkNotNullArgument(groupType, "Group type");
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(),
getIdentityObjectType(groupType), convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(),
getIdentityObjectType(groupType), convertSearchControls(criteria));
List<Group> groups = new LinkedList<Group>();
for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
@@ -255,7 +255,7 @@
return findGroup(groupType, (IdentitySearchCriteria) null);
}
-// public boolean isVirtual(User identity)
+// public boolean isVirtual(User user)
// {
// //TODO:NYI
// throw new NotYetImplementedException("Postponed");
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -467,7 +467,7 @@
return true;
}
- public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean cascade, IdentitySearchCriteria controls) throws
IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws
IdentityException
{
checkNotNullArgument(group, "Group");
@@ -483,7 +483,7 @@
throw new NotYetImplementedException("Support for 'cascade'
argument is not yet implemented. Please use 'false' value for now");
}
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, parent, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, parent, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -497,14 +497,14 @@
}
- public Collection<Group> findAssociatedGroups(String groupId, String groupType,
boolean parent, boolean cascade, IdentitySearchCriteria controls) throws
IdentityException
+ public Collection<Group> findAssociatedGroups(String groupId, String groupType,
boolean parent, boolean cascade, IdentitySearchCriteria criteria) throws
IdentityException
{
checkNotNullArgument(groupId, "Group Id");
// checkNotNullArgument(groupType, "Group type");
Group group = createGroupFromId(groupId);
- return findAssociatedGroups(group, groupType, parent, cascade, controls);
+ return findAssociatedGroups(group, groupType, parent, cascade, criteria);
}
public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean cascade) throws IdentityException
@@ -515,16 +515,16 @@
return findAssociatedGroups(group, groupType, parent, cascade, null);
}
- public Collection<Group> findAssociatedGroups(User identity, String groupType,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, String groupType,
IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
//checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = groupType != null ? getIdentityObjectType(groupType) :
null;
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user),
MEMBER, false, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -537,31 +537,31 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(String userName, String groupType,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String userName, String groupType,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
//checkNotNullArgument(groupType, "Group type");
User user = createUserFromId(userName);
- return findAssociatedGroups(user, groupType, controls);
+ return findAssociatedGroups(user, groupType, criteria);
}
- public Collection<Group> findAssociatedGroups(User identity, String groupType)
throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, String groupType)
throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
//checkNotNullArgument(groupType, "Group type");
- return findAssociatedGroups(identity, groupType, null);
+ return findAssociatedGroups(user, groupType, null);
}
- public Collection<Group> findAssociatedGroups(User identity,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(User user, IdentitySearchCriteria
criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user),
MEMBER, false, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -577,23 +577,23 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(String userName,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findAssociatedGroups(String userName,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findAssociatedGroups(user, controls);
+ return findAssociatedGroups(user, criteria);
}
- public Collection<Group> findAssociatedGroups(User identity) throws
IdentityException
+ public Collection<Group> findAssociatedGroups(User user) throws
IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
- return findAssociatedGroups(identity, (IdentitySearchCriteria)null);
+ return findAssociatedGroups(user, (IdentitySearchCriteria)null);
}
- public Collection<User> findAssociatedUsers(Group group, boolean cascade,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(Group group, boolean cascade,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -605,7 +605,7 @@
throw new NotYetImplementedException("Support for 'cascade'
argument is not yet implemented. Please use 'false' value for now");
}
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, true, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, true, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -621,13 +621,13 @@
return identities;
}
- public Collection<User> findAssociatedUsers(String groupId, boolean cascade,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findAssociatedUsers(String groupId, boolean cascade,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findAssociatedUsers(group, cascade, controls);
+ return findAssociatedUsers(group, cascade, criteria);
}
public Collection<User> findAssociatedUsers(Group group, boolean cascade) throws
IdentityException
@@ -637,13 +637,13 @@
return findAssociatedUsers(group, cascade, null);
}
- public Collection<Group> findRelatedGroups(User user, String groupType,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findRelatedGroups(User user, String groupType,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user),
null, false, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user),
null, false, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -658,22 +658,22 @@
return identities;
}
- public Collection<Group> findRelatedGroups(String userName, String groupType,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findRelatedGroups(String userName, String groupType,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findRelatedGroups(user, groupType, controls);
+ return findRelatedGroups(user, groupType, criteria);
}
- public Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria
controls) throws IdentityException
+ public Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria
criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
List<User> identities = new LinkedList<User>();
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
null, true, convertSearchControls(controls));
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
null, true, convertSearchControls(criteria));
String userTypeName = getUserObjectType().getName();
@@ -693,12 +693,12 @@
return identities;
}
- public Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria
controls) throws IdentityException
+ public Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria
criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findRelatedUsers(group, controls);
+ return findRelatedUsers(group, criteria);
}
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -41,8 +41,6 @@
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
import org.jboss.identity.idm.impl.api.model.SimpleRole;
-import org.jboss.identity.idm.impl.api.model.SimpleUser;
-import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.types.SimpleIdentityObjectRelationship;
import java.util.Collection;
@@ -101,7 +99,7 @@
{
return new SimpleIdentityObjectRelationship(
createIdentityObject(role.getGroup()),
- createIdentityObject(role.getIdentity()),
+ createIdentityObject(role.getUser()),
role.getRoleType().getName(),
ROLE
);
@@ -172,13 +170,13 @@
return null;
}
- public Collection<RoleType> findRoleTypes(IdentitySearchCriteria controls)
throws IdentityException
+ public Collection<RoleType> findRoleTypes(IdentitySearchCriteria criteria)
throws IdentityException
{
try
{
- Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
convertSearchControls(controls));
+ Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
convertSearchControls(criteria));
Set<RoleType> types = new HashSet<RoleType>();
for (String name : names)
@@ -195,15 +193,20 @@
}
- public Role createRole(RoleType roleType, User identity, Group group) throws
IdentityException
+ public Collection<RoleType> findRoleTypes() throws IdentityException
{
+ return findRoleTypes(null);
+ }
+
+ public Role createRole(RoleType roleType, User user, Group group) throws
IdentityException
+ {
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
//TODO: add createRoleType switch to the API
- IdentityObjectRelationship rel =
getRepository().createRelationship(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE, roleType.getName(), false);
+ IdentityObjectRelationship rel =
getRepository().createRelationship(getInvocationContext(), createIdentityObject(group),
createIdentityObject(user), ROLE, roleType.getName(), false);
//TODO: null id - IdentityObjectRelationship doesn't have id
return new SimpleRole(new SimpleRoleType(rel.getName()),
createUser(rel.getToIdentityObject()), createGroup(rel.getFromIdentityObject()));
@@ -222,13 +225,13 @@
return createRole(new SimpleRoleType(roleTypeName), user, group);
}
- public void removeRole(RoleType roleType, User identity, Group group) throws
IdentityException
+ public void removeRole(RoleType roleType, User user, Group group) throws
IdentityException
{
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(group), createIdentityObject(identity), ROLE, roleType.getName());
+ getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(group), createIdentityObject(user), ROLE, roleType.getName());
}
public void removeRole(String roleTypeName, String userName, String groupId) throws
IdentityException
@@ -247,18 +250,18 @@
{
checkNotNullArgument(role, "Role");
- getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(role.getGroup()), createIdentityObject(role.getIdentity()), ROLE,
role.getRoleType().getName());
+ getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(role.getGroup()), createIdentityObject(role.getUser()), ROLE,
role.getRoleType().getName());
}
- public boolean hasRole(User identity, Group group, RoleType roleType) throws
IdentityException
+ public boolean hasRole(User user, Group group, RoleType roleType) throws
IdentityException
{
checkNotNullArgument(roleType, "RoleType");
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
//TODO: does separate hasRelationship method in IdentityStore makes sense?
- Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE);
+ Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(user), ROLE);
for (IdentityObjectRelationship rel : rels)
{
@@ -328,21 +331,21 @@
return getRole(roleType, user, group);
}
- public Collection<RoleType> findRoleTypes(User identity, Group group) throws
IdentityException
+ public Collection<RoleType> findRoleTypes(User user, Group group) throws
IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- return findRoleTypes(identity, group, null);
+ return findRoleTypes(user, group, null);
}
- public Collection<RoleType> findRoleTypes(User identity, Group group,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findRoleTypes(User user, Group group,
IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
checkNotNullArgument(group, "Group");
- Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(identity), ROLE);
+ Set<IdentityObjectRelationship> rels =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(group),
createIdentityObject(user), ROLE);
Set<RoleType> types = new HashSet<RoleType>();
for (IdentityObjectRelationship rel : rels)
@@ -355,7 +358,7 @@
}
- public Collection<RoleType> findRoleTypes(String userName, String groupId,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findRoleTypes(String userName, String groupId,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
checkNotNullArgument(groupId, "Group Id");
@@ -363,25 +366,25 @@
User user = createUserFromId(userName);
Group group = createGroupFromId(groupId);
- return findRoleTypes(user, group, controls);
+ return findRoleTypes(user, group, criteria);
}
- public Collection<RoleType> findUserRoleTypes(User identity) throws
IdentityException
+ public Collection<RoleType> findUserRoleTypes(User user) throws
IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
- return findUserRoleTypes(identity, null);
+ return findUserRoleTypes(user, null);
}
- public Collection<RoleType> findUserRoleTypes(User identity,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria
criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
createIdentityObject(identity), convertSearchControls(controls));
+ Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(user),
convertSearchControls(criteria));
for (String name : names)
{
@@ -398,13 +401,13 @@
}
- public Collection<RoleType> findUserRoleTypes(String userName,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findUserRoleTypes(String userName,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findUserRoleTypes(user, controls);
+ return findUserRoleTypes(user, criteria);
}
public Collection<RoleType> findGroupRoleTypes(Group group) throws
IdentityException
@@ -414,16 +417,16 @@
return findGroupRoleTypes(group, null);
}
- public Collection<RoleType> findGroupRoleTypes(String groupId,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(String groupId,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group Id");
Group group = createGroupFromId(groupId);
- return findGroupRoleTypes(group, controls);
+ return findGroupRoleTypes(group, criteria);
}
- public Collection<RoleType> findGroupRoleTypes(Group group,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(Group group,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -431,7 +434,7 @@
try
{
- Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group),
convertSearchControls(controls));
+ Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group),
convertSearchControls(criteria));
for (String name : names)
{
@@ -448,7 +451,7 @@
}
- public Collection<User> findUsersWithRelatedRole(Group group,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findUsersWithRelatedRole(Group group,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(group, "Group");
@@ -457,7 +460,7 @@
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(group), ROLE, true, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(group), ROLE, true, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -467,25 +470,25 @@
return identities;
}
- public Collection<User> findUsersWithRelatedRole(String groupId,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<User> findUsersWithRelatedRole(String groupId,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(groupId, "Group id");
Group group = createGroupFromId(groupId);
- return findUsersWithRelatedRole(group, controls);
+ return findUsersWithRelatedRole(group, criteria);
}
- public Collection<Group> findGroupsWithRelatedRole(User identity,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(User user,
IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
for (IdentityObject io : ios)
{
@@ -496,25 +499,25 @@
return identities;
}
- public Collection<Group> findGroupsWithRelatedRole(String userName,
IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(String userName,
IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
User user = createUserFromId(userName);
- return findGroupsWithRelatedRole(user, controls);
+ return findGroupsWithRelatedRole(user, criteria);
}
- public Collection<Group> findGroupsWithRelatedRole(User identity, String
groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(User user, String groupType,
IdentitySearchCriteria criteria) throws IdentityException
{
- checkNotNullArgument(identity, "User");
+ checkNotNullArgument(user, "User");
// checkNotNullArgument(groupType, "Group type");
List<Group> identities = new LinkedList<Group>();
Collection<IdentityObject> ios = null;
- ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(identity), ROLE, false, convertSearchControls(controls));
+ ios = getRepository().findIdentityObject(getInvocationContext(),
createIdentityObject(user), ROLE, false, convertSearchControls(criteria));
if (groupType != null)
{
@@ -540,7 +543,7 @@
return identities;
}
- public Collection<Group> findGroupsWithRelatedRole(String userName, String
groupType, IdentitySearchCriteria controls) throws IdentityException
+ public Collection<Group> findGroupsWithRelatedRole(String userName, String
groupType, IdentitySearchCriteria criteria) throws IdentityException
{
checkNotNullArgument(userName, "User name");
// checkNotNullArgument(groupType, "Group type");
@@ -548,7 +551,7 @@
User user = createUserFromId(userName);
- return findGroupsWithRelatedRole(user, groupType, controls);
+ return findGroupsWithRelatedRole(user, groupType, criteria);
}
public Collection<Role> findRoles(IdentityType identityType, RoleType roleType)
throws IdentityException
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/IdentityStoreCacheSupport.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -456,10 +456,10 @@
}
protected void putIdentityObjectSearchIntoCache(IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls,
+ IdentityObjectSearchCriteria criteria,
Collection<IdentityObject>
results)
{
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(controls));
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
Node searchNode = getCache().getRoot().addChild(nodeFqn);
@@ -472,9 +472,9 @@
}
protected Collection<IdentityObject>
getIdentityObjectSearchFromCache(IdentityObjectType identityType,
-
IdentityObjectSearchCriteria controls)
+
IdentityObjectSearchCriteria criteria)
{
- Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(controls));
+ Fqn nodeFqn = createIOTypeSearchNodeFQN(identityType, getControlsHash(criteria));
Node searchNode = getCache().getRoot().getChild(nodeFqn);
@@ -499,11 +499,11 @@
protected void putIdentityObjectSearchToCache(IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria controls,
+ IdentityObjectSearchCriteria criteria,
Collection<IdentityObject> results)
{
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent,
getControlsHash(controls));
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent,
getControlsHash(criteria));
Node searchNode = getCache().getRoot().addChild(nodeFqn);
@@ -521,10 +521,10 @@
protected Collection<IdentityObject>
getIdentityObjectSearchFromCache(IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
-
IdentityObjectSearchCriteria controls)
+
IdentityObjectSearchCriteria criteria)
{
- Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent,
getControlsHash(controls));
+ Fqn nodeFqn = createIOSearchNodeFQN(identity, relationshipType, parent,
getControlsHash(criteria));
Node searchNode = getCache().getRoot().getChild(nodeFqn);
@@ -811,10 +811,10 @@
- protected void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria
controls, Set<String> results)
+ protected void putRelationshipNamesSearchIntoCache(IdentityObjectSearchCriteria
criteria, Set<String> results)
{
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
Node node = getCache().getRoot().addChild(fqn);
@@ -822,16 +822,16 @@
if (getLog().isLoggable(Level.FINER))
{
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search
results invalidated in cache: controls hash=" +
- getControlsHash(controls)) ;
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search
results invalidated in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
}
}
- protected Set<String>
getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria controls)
+ protected Set<String>
getRelationshipNamesSearchFromCache(IdentityObjectSearchCriteria criteria)
{
- Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesAllSearchFqn(getControlsHash(criteria));
Node node = getCache().getRoot().getChild(fqn);
@@ -841,8 +841,8 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
- getLog().finer(this.toString() + "IdentityObjectRelationshipName search
result found in cache: controls hash=" +
- getControlsHash(controls)) ;
+ getLog().finer(this.toString() + "IdentityObjectRelationshipName search
result found in cache: criteria hash=" +
+ getControlsHash(criteria)) ;
}
return results;
@@ -853,11 +853,11 @@
}
protected void putRelationshipNamesSearchIntoCache(IdentityObject identity,
- IdentityObjectSearchCriteria
controls,
+ IdentityObjectSearchCriteria
criteria,
Set<String> results)
{
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity,
getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity,
getControlsHash(criteria));
Node node = getCache().getRoot().addChild(fqn);
@@ -866,17 +866,17 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
getLog().finer(this.toString() + "IdentityObjectRelationshipName search
result stored in cache: " +
- "controls hash=" + getControlsHash(controls) +
+ "criteria hash=" + getControlsHash(criteria) +
"identity=" + identity.toString()) ;
}
}
- protected Set<String> getRelationshipNamesSearchFromCache(IdentityObject
identity, IdentityObjectSearchCriteria controls)
+ protected Set<String> getRelationshipNamesSearchFromCache(IdentityObject
identity, IdentityObjectSearchCriteria criteria)
{
- Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity,
getControlsHash(controls));
+ Fqn fqn = createRelationshipNamesIdentityObjectSearchFqn(identity,
getControlsHash(criteria));
Node node = getCache().getRoot().getChild(fqn);
@@ -887,7 +887,7 @@
if (results != null && getLog().isLoggable(Level.FINER))
{
getLog().finer(this.toString() + "IdentityObjectRelationshipName search
result found in cache: " +
- "controls hash=" + getControlsHash(controls) +
+ "criteria hash=" + getControlsHash(criteria) +
"identity=" + identity.toString()) ;
}
@@ -896,14 +896,14 @@
return null;
}
- private int getControlsHash(IdentityObjectSearchCriteria controls)
+ private int getControlsHash(IdentityObjectSearchCriteria criteria)
{
- // Convert controls to Set to have the same hashcode regardles order of controls
+ // Convert criteria to Set to have the same hashcode regardles order of criteria
int hashcode = 0;
- if (controls != null)
+ if (criteria != null)
{
- hashcode = controls.hashCode();
+ hashcode = criteria.hashCode();
}
return hashcode;
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -191,16 +191,16 @@
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria
controls) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
- Collection<IdentityObject> results =
getIdentityObjectSearchFromCache(identityType, controls);
+ Collection<IdentityObject> results =
getIdentityObjectSearchFromCache(identityType, criteria);
if (results == null)
{
- results = identityStore.findIdentityObject(invocationCtx, identityType,
controls);
+ results = identityStore.findIdentityObject(invocationCtx, identityType,
criteria);
- putIdentityObjectSearchIntoCache(identityType, controls, results);
+ putIdentityObjectSearchIntoCache(identityType, criteria, results);
// Put all the results into cache separately
for (IdentityObject result : results)
@@ -221,16 +221,16 @@
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
controls) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
- Collection<IdentityObject> results =
getIdentityObjectSearchFromCache(identity, relationshipType, parent, controls);
+ Collection<IdentityObject> results =
getIdentityObjectSearchFromCache(identity, relationshipType, parent, criteria);
if (results == null)
{
- results = identityStore.findIdentityObject(invocationCtx, identity,
relationshipType, parent, controls);
+ results = identityStore.findIdentityObject(invocationCtx, identity,
relationshipType, parent, criteria);
- putIdentityObjectSearchToCache(identity, relationshipType,parent,controls,
results);
+ putIdentityObjectSearchToCache(identity, relationshipType,parent,criteria,
results);
for (IdentityObject result : results)
{
@@ -343,15 +343,15 @@
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException
{
- Set<String> results = getRelationshipNamesSearchFromCache(controls);
+ Set<String> results = getRelationshipNamesSearchFromCache(criteria);
if (results == null)
{
- results = identityStore.getRelationshipNames(ctx, controls);
+ results = identityStore.getRelationshipNames(ctx, criteria);
- putRelationshipNamesSearchIntoCache(controls, results);
+ putRelationshipNamesSearchIntoCache(criteria, results);
}
return results;
@@ -360,17 +360,17 @@
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException
{
- Set<String> results = getRelationshipNamesSearchFromCache(identity,
controls);
+ Set<String> results = getRelationshipNamesSearchFromCache(identity,
criteria);
if (results == null)
{
- results = identityStore.getRelationshipNames(ctx, identity, controls);
+ results = identityStore.getRelationshipNames(ctx, identity, criteria);
- putRelationshipNamesSearchIntoCache(identity, controls, results);
+ putRelationshipNamesSearchIntoCache(identity, criteria, results);
}
return results;
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -71,7 +71,7 @@
*/
public class FallbackIdentityStoreRepository extends AbstractIdentityStoreRepository
{
- //TODO: - filter out controls based on features MD before passing
+ //TODO: - filter out criteria based on features MD before passing
//TODO: - configuration option to store not mapped attributes in default store
//TODO: - configuration option to fallback named relationships to default store when
not supported in mapped one
@@ -403,19 +403,19 @@
return defaultIdentityStore.findIdentityObject(invocationContext, id);
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, IdentityObjectSearchCriteria controls) throws IdentityException
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, IdentityObjectSearchCriteria criteria) throws IdentityException
{
IdentityStore targetStore = resolveIdentityStore(identityType);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore,
invocationCtx);
- return targetStore.findIdentityObject(targetCtx, identityType, controls);
+ return targetStore.findIdentityObject(targetCtx, identityType, criteria);
}
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCxt,
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
constraints) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
// Check in the mapped store and merge with default
@@ -428,7 +428,7 @@
if (mappedStore == defaultIdentityStore)
{
- return defaultIdentityStore.findIdentityObject(defaultCtx, identity,
relationshipType, parent, constraints);
+ return defaultIdentityStore.findIdentityObject(defaultCtx, identity,
relationshipType, parent, criteria);
}
Collection<IdentityObject> results = new LinkedList<IdentityObject>();
@@ -436,7 +436,7 @@
if (relationshipType == null ||
!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) ||
mappedStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
- results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType,
parent, constraints);
+ results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType,
parent, criteria);
}
IdentityObject defaultStoreIdentityObject = null;
@@ -452,7 +452,7 @@
if (defaultStoreIdentityObject != null)
{
- Collection<IdentityObject> objects =
defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent,
constraints);
+ Collection<IdentityObject> objects =
defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent,
criteria);
// If default store contain related relationships merge and sort/page once more
if (objects != null && objects.size() != 0)
@@ -461,15 +461,15 @@
results.addAll(objects);
//TODO: hardcoded - expects List
- if (constraints != null && constraints.isPaged() && results
instanceof List)
+ if (criteria != null && criteria.isPaged() && results
instanceof List)
{
- results = cutPageFromResults((List<IdentityObject>)results,
constraints);
+ results = cutPageFromResults((List<IdentityObject>)results,
criteria);
}
//TODO: hardcoded - expects List
- if (constraints != null && constraints.isSorted() && results
instanceof List)
+ if (criteria != null && criteria.isSorted() && results
instanceof List)
{
- sortByName((List<IdentityObject>)results,
constraints.isAscending());
+ sortByName((List<IdentityObject>)results, criteria.isAscending());
}
}
}
@@ -663,7 +663,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria controls) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
Set<String> results = new HashSet<String>();
@@ -673,7 +673,7 @@
if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
IdentityStoreInvocationContext storeCtx =
resolveInvocationContext(identityStore, ctx);
- results.addAll(identityStore.getRelationshipNames(storeCtx, controls));
+ results.addAll(identityStore.getRelationshipNames(storeCtx, criteria));
}
}
@@ -681,7 +681,7 @@
return results;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria controls) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
IdentityStore toStore = resolveIdentityStore(identity);
@@ -689,11 +689,11 @@
if (toStore.getSupportedFeatures().isNamedRelationshipsSupported())
{
- return toStore.getRelationshipNames(targetCtx, identity, controls);
+ return toStore.getRelationshipNames(targetCtx, identity, criteria);
}
IdentityStoreInvocationContext defaultCtx =
resolveInvocationContext(defaultIdentityStore, ctx);
- return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, controls);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, criteria);
}
public Map<String, String>
getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws
IdentityException, OperationNotSupportedException
@@ -1107,10 +1107,10 @@
}
//TODO: other way
- private List<IdentityObject> cutPageFromResults(List<IdentityObject>
objects, IdentityObjectSearchCriteria constraints)
+ private List<IdentityObject> cutPageFromResults(List<IdentityObject>
objects, IdentityObjectSearchCriteria criteria)
{
List<IdentityObject> results = new LinkedList<IdentityObject>();
- for (int i = constraints.getFirstResult(); i < constraints.getFirstResult() +
constraints.getMaxResults(); i++)
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() +
criteria.getMaxResults(); i++)
{
if (i < objects.size())
{
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -163,18 +163,18 @@
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria
controls) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
- return
defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx),
identityType, controls);
+ return
defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx),
identityType, criteria);
}
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
controls) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
- return
defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx),
identity, relationshipType, parent, controls);
+ return
defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx),
identity, relationshipType, parent, criteria);
}
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
invocationCxt,
@@ -237,16 +237,16 @@
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException
{
- return
defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx),
controls);
+ return
defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx),
criteria);
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException
{
- return
defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx),
identity, controls);
+ return
defaultIdentityStore.getRelationshipNames(resolveIdentityStoreInvocationContext(ctx),
identity, criteria);
}
public Map<String, String>
getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name) throws
IdentityException, OperationNotSupportedException
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/FeaturesMetaDataImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -62,7 +62,7 @@
public FeaturesMetaDataImpl(IdentityStoreConfigurationMetaData configurationMD,
- Set<IdentityObjectSearchCriteriaType>
supportedControls,
+ Set<IdentityObjectSearchCriteriaType>
supportedCriteria,
boolean relationshipPropertiesSupport,
boolean namedRelationshipsSupport,
Set<String> readOnlyObjectTypes)
@@ -90,7 +90,7 @@
this.supportedCredentials = Collections.unmodifiableMap(supportedCredentials);
- this.supportedSearchConstraintTypes =
Collections.unmodifiableSet(supportedControls);
+ this.supportedSearchConstraintTypes =
Collections.unmodifiableSet(supportedCriteria);
@@ -226,7 +226,7 @@
public boolean isRoleNameSearchCriteriaTypeSupported(IdentityObjectSearchCriteriaType
constraint)
{
- // For now simple - use the same allowed controls list for everything
+ // For now simple - use the same allowed criteria list for everything
return isNamedRelationshipsSupported() &&
isSearchCriteriaTypeSupported(null, constraint);
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -140,7 +140,7 @@
// TODO: rewrite this into some more handy object
private IdentityStoreConfigurationMetaData configurationMD;
- private static Set<IdentityObjectSearchCriteriaType>
supportedIdentityObjectSearchControls =
+ private static Set<IdentityObjectSearchCriteriaType>
supportedIdentityObjectSearchCriteria =
new HashSet<IdentityObjectSearchCriteriaType>();
private static Set<String> supportedCredentialTypes = new
HashSet<String>();
@@ -155,12 +155,12 @@
private Map<String, Map<String, String>> reverseAttributeMappings = new
HashMap<String, Map<String, String>>();
static {
- // List all supported controls classes
+ // List all supported criteria classes
-
supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.ATTRIBUTE_FILTER);
-
supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.PAGE);
- supportedIdentityObjectSearchControls.add(IdentityObjectSearchCriteriaType.SORT);
+
supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.ATTRIBUTE_FILTER);
+
supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.PAGE);
+ supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.SORT);
// credential types supported by this impl
supportedCredentialTypes.add(CREDENTIAL_TYPE_PASSWORD);
@@ -179,7 +179,7 @@
id = configurationMD.getId();
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedIdentityObjectSearchControls, true, true, new HashSet<String>());
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedIdentityObjectSearchCriteria, true, true, new HashSet<String>());
String populateMembershipTypes =
configurationMD.getOptionSingleValue(POPULATE_MEMBERSHIP_TYPES);
@@ -603,7 +603,7 @@
@SuppressWarnings("unchecked")
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria
constraints) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
checkIOType(identityType);
@@ -618,9 +618,9 @@
Query q = null;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q =
hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectsByTypeOrderedByNameAsc);
}
@@ -634,22 +634,22 @@
q =
hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectsByType);
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- if (constraints.getMaxResults() > 0)
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
- q.setFirstResult(constraints.getFirstResult());
+ q.setFirstResult(criteria.getFirstResult());
}
q.setParameter("realm", getRealm(hibernateSession, ctx))
.setParameter("typeName", hibernateType.getName());
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter",
constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter",
criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -666,9 +666,9 @@
throw new IdentityException("Cannot find IdentityObjects with type
'" + identityType.getName() + "'", e);
}
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
- filterByAttributesValues(results, constraints.getValues());
+ filterByAttributesValues(results, criteria.getValues());
}
return results;
@@ -687,7 +687,7 @@
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
constraints) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
//TODO:test
@@ -698,10 +698,10 @@
boolean orderByName = false;
boolean ascending = true;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
orderByName = true;
- ascending = constraints.isAscending();
+ ascending = criteria.isAscending();
}
try
@@ -775,9 +775,9 @@
q.setParameter("relType", relationshipType.getName());
}
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter",
constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter",
criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -785,12 +785,12 @@
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getFirstResult());
- if (constraints.getMaxResults() > 0)
+ q.setFirstResult(criteria.getFirstResult());
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -805,9 +805,9 @@
throw new IdentityException("Cannot find IdentityObjects", e);
}
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
- filterByAttributesValues(results, constraints.getValues());
+ filterByAttributesValues(results, criteria.getValues());
}
return results;
@@ -1113,7 +1113,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria constraints) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
Set<String> names = null;
@@ -1124,9 +1124,9 @@
{
Query q = null;
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q =
em.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNamesOrderedByNameAsc);
}
@@ -1142,9 +1142,9 @@
q.setParameter("realm", getRealm(em, ctx));
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- q.setParameter("nameFilter",
constraints.getFilter().replaceAll("\\*", "%"));
+ q.setParameter("nameFilter",
criteria.getFilter().replaceAll("\\*", "%"));
}
else
{
@@ -1152,12 +1152,12 @@
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getMaxResults());
- if (constraints.getFirstResult() > 0)
+ q.setFirstResult(criteria.getMaxResults());
+ if (criteria.getFirstResult() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -1179,7 +1179,7 @@
return getRelationshipNames(ctx, (IdentityObjectSearchCriteria)null);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria constraints) throws
IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
Set<String> names;
@@ -1192,9 +1192,9 @@
{
Query q = null;
- if (constraints != null)
+ if (criteria != null)
{
- if (constraints.isAscending())
+ if (criteria.isAscending())
{
q =
em.createQuery(HibernateIdentityObjectRelationshipName.findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameAsc);
}
@@ -1210,12 +1210,12 @@
q.setParameter("identityObject", hibernateObject);
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- q.setFirstResult(constraints.getFirstResult());
- if (constraints.getMaxResults() > 0)
+ q.setFirstResult(criteria.getFirstResult());
+ if (criteria.getMaxResults() > 0)
{
- q.setMaxResults(constraints.getMaxResults());
+ q.setMaxResults(criteria.getMaxResults());
}
}
@@ -2291,20 +2291,6 @@
return isAllowNotDefinedAttributes;
}
-// private void checkControls(IdentityObjectSearchConstraints controls) throws
IdentityException
-// {
-// if (controls != null)
-// {
-// for (IdentityObjectSearchControl control : controls)
-// {
-// if (!supportedIdentityObjectSearchControls.contains(control.getClass()))
-// {
-// throw new IdentityException("IdentityObjectSearchControl not
supported by this IdentityStore: " + control.getClass());
-// }
-// }
-// }
-// }
-
/**
* Resolve store mapping for attribute name. If attribute is not mapped and store
doesn't allow not defined
* attributes throw exception
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -102,7 +102,7 @@
IdentityStoreConfigurationMetaData configurationMD;
- private static Set<IdentityObjectSearchCriteriaType>
supportedSearchConstraintTypes =
+ private static Set<IdentityObjectSearchCriteriaType>
supportedSearchCriteriaTypes =
new HashSet<IdentityObjectSearchCriteriaType>();
// <IdentityObjectType name, <Attribute name, MD>
@@ -112,9 +112,9 @@
// List all supported controls classes
//TODO: attribute filter
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.SORT);
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.PAGE);
- supportedSearchConstraintTypes.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.SORT);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.PAGE);
+ supportedSearchCriteriaTypes.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
//supportedSearchControls.add(AttributeFilterSearchControl.class);
}
@@ -144,7 +144,7 @@
}
}
- supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedSearchConstraintTypes, false, false, readOnlyObjectTypes);
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedSearchCriteriaTypes, false, false, readOnlyObjectTypes);
// Attribute mappings - helper structures
@@ -551,7 +551,7 @@
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType type,
- IdentityObjectSearchCriteria
constraints) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
//TODO: page control with LDAP request control
@@ -561,9 +561,9 @@
String nameFilter = "*";
//Filter by name
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- nameFilter = constraints.getFilter();
+ nameFilter = criteria.getFilter();
}
@@ -581,7 +581,7 @@
Control[] requestControls = null;
// Sort control
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
//TODO: make criticallity optional
//TODO sort by attribute name
@@ -593,11 +593,11 @@
StringBuilder af = new StringBuilder();
// Filter by attribute values
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
af.append("(&");
- for (Map.Entry<String, String[]> stringEntry :
constraints.getValues().entrySet())
+ for (Map.Entry<String, String[]> stringEntry :
criteria.getValues().entrySet())
{
for (String value : stringEntry.getValue())
{
@@ -644,11 +644,11 @@
{
ctx = (LdapContext)res.getObject();
String dn = ctx.getNameInNamespace();
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
// It seams that the sort order is not configurable and
// sort control returns entries in descending order by default...
- if (!constraints.isAscending())
+ if (!criteria.isAscending())
{
objects.addFirst(createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn));
}
@@ -690,9 +690,9 @@
}
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- objects = (LinkedList)cutPageFromResults(objects, constraints);
+ objects = (LinkedList)cutPageFromResults(objects, criteria);
}
return objects;
@@ -708,7 +708,7 @@
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
constraints) throws IdentityException
+ IdentityObjectSearchCriteria
criteria) throws IdentityException
{
//TODO: relationshipType is ignored - maybe check and allow only MEMBERSHIP?
@@ -749,10 +749,10 @@
{
//TODO: use direct LDAP query instaed of other find method and add
attributesFilter
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
String name = Tools.stripDnToName(memberRef);
- String regex = Tools.wildcardToRegex(constraints.getFilter());
+ String regex = Tools.wildcardToRegex(criteria.getFilter());
if (Pattern.matches(regex, name))
{
@@ -798,9 +798,9 @@
String nameFilter = "*";
//Filter by name
- if (constraints != null && constraints.getFilter() != null)
+ if (criteria != null && criteria.getFilter() != null)
{
- nameFilter = constraints.getFilter();
+ nameFilter = criteria.getFilter();
}
Control[] requestControls = null;
@@ -808,11 +808,11 @@
StringBuilder af = new StringBuilder();
// Filter by attribute values
- if (constraints != null && constraints.isFiltered())
+ if (criteria != null && criteria.isFiltered())
{
af.append("(&");
- for (Map.Entry<String, String[]> stringEntry :
constraints.getValues().entrySet())
+ for (Map.Entry<String, String[]> stringEntry :
criteria.getValues().entrySet())
{
for (String value : stringEntry.getValue())
{
@@ -899,14 +899,14 @@
}
}
- if (constraints != null && constraints.isPaged())
+ if (criteria != null && criteria.isPaged())
{
- objects = cutPageFromResults(objects, constraints);
+ objects = cutPageFromResults(objects, criteria);
}
- if (constraints != null && constraints.isSorted())
+ if (criteria != null && criteria.isSorted())
{
- sortByName(objects, constraints.isAscending());
+ sortByName(objects, criteria.isAscending());
}
return objects;
@@ -1324,7 +1324,7 @@
throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria controls) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
}
@@ -1334,7 +1334,7 @@
throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria controls) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchCriteria criteria) throws IdentityException,
OperationNotSupportedException
{
throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
@@ -2095,10 +2095,10 @@
}
//TODO: dummy and inefficient temporary workaround. Need to be implemented with ldap
request control
- private List<IdentityObject> cutPageFromResults(List<IdentityObject>
objects, IdentityObjectSearchCriteria constraints)
+ private List<IdentityObject> cutPageFromResults(List<IdentityObject>
objects, IdentityObjectSearchCriteria criteria)
{
List<IdentityObject> results = new LinkedList<IdentityObject>();
- for (int i = constraints.getFirstResult(); i < constraints.getFirstResult() +
constraints.getMaxResults(); i++)
+ for (int i = criteria.getFirstResult(); i < criteria.getFirstResult() +
criteria.getMaxResults(); i++)
{
if (i < objects.size())
{
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -40,7 +40,7 @@
//TODO:
//TODO: - force in removeGroup (NYI)
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -43,7 +43,7 @@
//TODO: - inheritence in find methods
//TODO: - creating forbidden associations
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -45,7 +45,7 @@
{
//TODO:
//TODO: - exception handling
- //TODO: - search controls
+ //TODO: - search criteria
//TODO: - features description
APITestContext ctx;
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -27,10 +27,13 @@
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.RoleType;
import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.UserQueryBuilder;
import junit.framework.Assert;
+import java.util.List;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
* @version : 0.1 $
@@ -62,6 +65,10 @@
User user2 = ids.getPersistenceManager().createUser("user2");
User user3 = ids.getPersistenceManager().createUser("user3");
User user4 = ids.getPersistenceManager().createUser("user4");
+ User testUser1 = ids.getPersistenceManager().createUser("testUser1");
+ User testUser2 = ids.getPersistenceManager().createUser("testUser2");
+ User testUser3 = ids.getPersistenceManager().createUser("testUser3");
+ User testUser4 = ids.getPersistenceManager().createUser("testUser4");
Group group1 = ids.getPersistenceManager().createGroup("group1",
ORGANIZATION);
Group group2 = ids.getPersistenceManager().createGroup("group2",
ORGANIZATION_UNIT);
@@ -151,9 +158,58 @@
//
qb.reset();
- assertEquals(4, ids.execute(qb.createQuery()).size());
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+ // Criteria
+
+ // All users
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+ // All users sorted
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+
+ List<User> results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(0));
+ assertEquals(user4, results.get(7));
+
+ // All users sorted desc
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(7));
+ assertEquals(user4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+ qb.idFilter("test*");
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(4, results.size());
+ assertEquals(testUser1, results.get(3));
+ assertEquals(testUser4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+ qb.idFilter("user*");
+ qb.page(1, 2);
+ results = ids.list(qb.createQuery());
+
+ assertEquals(2, results.size());
+ assertEquals(user2, results.get(0));
+ assertEquals(user3, results.get(1));
+
+
+
ctx.commit();
}
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -357,7 +357,7 @@
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
testContext.begin();
@@ -371,7 +371,7 @@
IdentityObject group8 =
testContext.getStore().createIdentityObject(testContext.getCtx(), "Entity3",
IdentityTypeEnum.USER);
Collection<IdentityObject> results = null;
- IdentityObjectSearchCriteria constraints = null;
+ IdentityObjectSearchCriteria criteria = null;
// TODO: by RelationshipType
@@ -379,45 +379,45 @@
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER,
IdentityObjectSearchCriteriaType.NAME_FILTER))
{
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(8, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("D*");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("D*");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*2");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*2");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*3");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("*3");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(2, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("Company1");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("Company1");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(1, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("Toronto");
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().idFilter("Toronto");
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(0, results.size());
}
@@ -427,18 +427,18 @@
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER,
IdentityObjectSearchCriteriaType.PAGE))
{
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().page(0, 3);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().page(0, 3);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().page(2, 2);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().page(2, 2);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(2, results.size());
@@ -448,11 +448,11 @@
{
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
criteria);
assertEquals(8, results.size());
@@ -462,11 +462,11 @@
// And reverse order
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.DESCENDING);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.DESCENDING);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
criteria);
assertEquals(8, results.size());
@@ -478,26 +478,26 @@
- // Combine controls to check that the results are diffrent for pagination
+ // Combine criteria to check that the results are diffrent for pagination
if (testContext.getStore().getSupportedFeatures().
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER,
IdentityObjectSearchCriteriaType.PAGE))
{
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(0,3);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(0,3);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
criteria);
assertEquals(3, results.size());
assertEquals("Company1",
((List<IdentityObject>)results).get(0).getName());
assertEquals("Division1",
((List<IdentityObject>)results).get(2).getName());
- constraints = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(3,1);
+ criteria = (IdentityObjectSearchCriteria)new
IdentitySearchCriteriaImpl().sort(SortOrder.ASCENDING).page(3,1);
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
criteria);
assertEquals(1, results.size());
@@ -517,14 +517,14 @@
testContext.getStore().addAttributes(testContext.getCtx(), group1, new
IdentityObjectAttribute[]{phone, description});
- constraints = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl()
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl()
.attributeValuesFilter("phone", new String[] {"777 777
777"})
.attributeValuesFilter("description", new String[] {"sample
desc"});
results = testContext.getStore().
- findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
constraints);
+ findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
criteria);
assertEquals(1, results.size());
@@ -534,5 +534,5 @@
}
-
+
}
\ No newline at end of file
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -41,15 +41,12 @@
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.IdentityTestPOJO;
import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Test;
-import static org.jboss.unit.api.Assert.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import java.util.Map;
-import java.io.File;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -301,9 +298,9 @@
}
@Test
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
- commonTest.testControls();
+ commonTest.testCriteria();
}
}
\ No newline at end of file
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -22,8 +22,6 @@
package org.jboss.identity.idm.impl.store.ldap;
-import junit.framework.TestCase;
-import org.jboss.identity.idm.opends.OpenDSService;
import org.jboss.identity.idm.spi.store.IdentityStore;
import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
@@ -45,19 +43,13 @@
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Test;
-import org.opends.server.tools.LDAPModify;
import javax.naming.Context;
import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.InitialLdapContext;
import java.util.Hashtable;
import java.util.Map;
-import java.io.File;
-import static org.jboss.unit.api.Assert.*;
/**
@@ -419,11 +411,11 @@
}
@Test
- public void testControls() throws Exception
+ public void testCriteria() throws Exception
{
populateClean();
- commonTest.testControls();
+ commonTest.testCriteria();
}
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -241,30 +241,30 @@
/**
* Check if given identity can be protected with text password
*
- * @param identity
+ * @param user
* @return
* @throws IdentityException
*/
- boolean hasPassword(User identity) throws IdentityException;
+ boolean hasPassword(User user) throws IdentityException;
/**
* Validate text password for a given identity
*
- * @param identity
+ * @param user
* @param password
* @return
* @throws IdentityException
*/
- boolean validatePassword(User identity, String password) throws IdentityException;
+ boolean validatePassword(User user, String password) throws IdentityException;
/**
* Update text password for a given identity
*
- * @param identity
+ * @param user
* @param password
* @throws IdentityException
*/
- void updatePassword(User identity, String password) throws IdentityException;
+ void updatePassword(User user, String password) throws IdentityException;
/**
* Check if user can be protected with a given credential type
@@ -276,18 +276,18 @@
/**
* Validate credential for a given identity
*
- * @param identity
+ * @param user
* @param credentials
* @return
*/
- boolean validateCredentials(User identity, Credential[] credentials) throws
IdentityException;
+ boolean validateCredentials(User user, Credential[] credentials) throws
IdentityException;
/**
* Update credential for a given identity
*
- * @param identity
+ * @param user
* @param credential
*/
- void updateCredential(User identity, Credential credential) throws IdentityException;
+ void updateCredential(User user, Credential credential) throws IdentityException;
}
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -149,11 +149,11 @@
/**
*
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
- Collection<User> findUser(IdentitySearchCriteria controls) throws
IdentityException;
+ Collection<User> findUser(IdentitySearchCriteria criteria) throws
IdentityException;
// Search Groups
@@ -180,11 +180,11 @@
/**
*
* @param groupType
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
- Collection<Group> findGroup(String groupType, IdentitySearchCriteria controls)
throws IdentityException;
+ Collection<Group> findGroup(String groupType, IdentitySearchCriteria criteria)
throws IdentityException;
/**
*
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -312,7 +312,7 @@
String groupType,
boolean parent,
boolean cascade,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find groups that are associated with given group.
@@ -332,7 +332,7 @@
String groupType,
boolean parent,
boolean cascade,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -354,7 +354,7 @@
*/
Collection<Group> findAssociatedGroups(User user,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -366,7 +366,7 @@
*/
Collection<Group> findAssociatedGroups(String userId,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -376,7 +376,7 @@
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(User user,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -386,7 +386,7 @@
* @throws org.jboss.identity.idm.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(String userId,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -418,7 +418,7 @@
*/
Collection<User> findAssociatedUsers(Group group,
boolean cascade,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find identities that have relationship with given parent group.
@@ -430,7 +430,7 @@
*/
Collection<User> findAssociatedUsers(String groupId,
boolean cascade,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
@@ -443,7 +443,7 @@
*/
Collection<Group> findRelatedGroups(User user,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all groups that given identity is associated with. Will return groups
connected with a given user with a role
@@ -455,7 +455,7 @@
*/
Collection<Group> findRelatedGroups(String userId,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find identities that have relationship with given parent group. Will return users
connected with a given group with a role
@@ -464,7 +464,7 @@
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria controls)
throws IdentityException;
+ Collection<User> findRelatedUsers(Group group, IdentitySearchCriteria criteria)
throws IdentityException;
/**
* Find identities that have relationship with given parent group. Will return users
connected with a given group with a role
@@ -473,7 +473,7 @@
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria
controls) throws IdentityException;
+ Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria
criteria) throws IdentityException;
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java 2009-05-08
20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Role.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -40,7 +40,7 @@
/**
* @return identity participating in this role
*/
- User getIdentity();
+ User getUser();
/**
* @return group associated with this role
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-08
20:46:17 UTC (rev 480)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -91,9 +91,16 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(IdentitySearchCriteria controls) throws
IdentityException;
+ Collection<RoleType> findRoleTypes(IdentitySearchCriteria criteria) throws
IdentityException;
+ /**
+ * Find all RoleType objects stored
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findRoleTypes() throws IdentityException;
+
// Role
/**
* Create role
@@ -188,7 +195,7 @@
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(User user, Group group,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find RoleType objects for roles associated with a given User and Group
@@ -198,7 +205,7 @@
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(String userId, String groupId,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find RoleType objects for roles associated with a given User and Group
@@ -223,7 +230,7 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria
controls) throws IdentityException;
+ Collection<RoleType> findUserRoleTypes(User user, IdentitySearchCriteria
criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Identity
@@ -231,7 +238,7 @@
* @return
* @throws IdentityException
*/
- Collection<RoleType> findUserRoleTypes(String userId, IdentitySearchCriteria
controls) throws IdentityException;
+ Collection<RoleType> findUserRoleTypes(String userId, IdentitySearchCriteria
criteria) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Group
@@ -248,7 +255,7 @@
* @throws IdentityException
*/
Collection<RoleType> findGroupRoleTypes(Group group,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find RoleType objects for roles associated with a given Group
@@ -257,76 +264,76 @@
* @throws IdentityException
*/
Collection<RoleType> findGroupRoleTypes(String groupId,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param user
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(User user,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param userId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(String userId,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param user
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(User user,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Groups with which User has a Role association
*
* @param userId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<Group> findGroupsWithRelatedRole(String userId,
String groupType,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Users with which Group has a Role association
*
* @param group
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<User> findUsersWithRelatedRole(Group group,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find all Users with which Group has a Role association
*
* @param groupId
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<User> findUsersWithRelatedRole(String groupId,
- IdentitySearchCriteria controls) throws
IdentityException;
+ IdentitySearchCriteria criteria) throws
IdentityException;
/**
* Find Role objects with a given RoleType associated with a given IdentityType
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -72,4 +72,6 @@
UserQueryBuilder attributeValuesFilter(String attributeName, String[] attributeValue)
throws UnsupportedQueryCriterium;
+ UserQueryBuilder idFilter(String idFilter) throws UnsupportedQueryCriterium;
+
}
Added: idm/trunk/idm-auth/pom.xml
===================================================================
--- idm/trunk/idm-auth/pom.xml (rev 0)
+++ idm/trunk/idm-auth/pom.xml 2009-05-09 09:51:45 UTC (rev 481)
@@ -0,0 +1,86 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>idm-auth</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity IDM Auth</name>
+ <
url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity Auth</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <
url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+
<
connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/trunk&...
+
<
developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/trunk&...
+
<
url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/trunk<...
+ </scm>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>idm-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss.jbossas.core-libs</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>4.0.4.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>5.5.12</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <doclet>org.jboss.apiviz.APIviz</doclet>
+ <docletArtifact>
+ <groupId>org.jboss.apiviz</groupId>
+ <artifactId>apiviz</artifactId>
+ <version>1.2.5.GA</version>
+ </docletArtifact>
+ <additionalparam>
+ -charset UTF-8
+ -docencoding UTF-8
+ -version
+ -author
+ -breakiterator
+ -windowtitle "${project.name} ${project.version} API Reference"
+ -doctitle "${project.name} ${project.version} API Reference"
+ -bottom "Copyright © ${project.inceptionYear}-Present
${project.organization.name}. All Rights Reserved."
+ -link
http://java.sun.com/javase/6/docs/api/
+ -sourceclasspath ${project.build.outputDirectory}
+ </additionalparam>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Added:
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
===================================================================
---
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
(rev 0)
+++
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -0,0 +1,325 @@
+///*
+//* JBoss, a division of Red Hat
+//* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+//* by the @authors tag. See the copyright.txt in the distribution for a
+//* full listing of individual contributors.
+//*
+//* This is free software; you can redistribute it and/or modify it
+//* under the terms of the GNU Lesser General Public License as
+//* published by the Free Software Foundation; either version 2.1 of
+//* the License, or (at your option) any later version.
+//*
+//* This software is distributed in the hope that it will be useful,
+//* but WITHOUT ANY WARRANTY; without even the implied warranty of
+//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//* Lesser General Public License for more details.
+//*
+//* You should have received a copy of the GNU Lesser General Public
+//* License along with this software; if not, write to the Free
+//* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+//* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+//*/
+//
+//package org.jboss.identity.idm.auth;
+//
+//import org.jboss.security.SimpleGroup;
+//import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+//
+//import javax.security.auth.Subject;
+//import javax.security.auth.login.LoginException;
+//import javax.security.auth.callback.CallbackHandler;
+//import javax.naming.NamingException;
+//import javax.naming.InitialContext;
+//import java.util.Map;
+//import java.util.Set;
+//import java.util.Iterator;
+//import java.security.acl.Group;
+//import java.security.Principal;
+//
+///**
+// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+// * @version : 0.1 $
+// */
+//public class JBossIdentityIDMLoginModule extends UsernamePasswordLoginModule
+//{
+//
+// protected String userModuleJNDIName;
+//
+// protected String roleModuleJNDIName;
+//
+// protected String userProfileModuleJNDIName;
+//
+// protected String membershipModuleJNDIName;
+//
+// protected String additionalRole;
+//
+// protected String havingRole;
+//
+// protected String validateUserNameCase;
+//
+// protected String userNameToLowerCase;
+//
+// public void initialize(Subject subject, CallbackHandler callbackHandler, Map
sharedState, Map options)
+// {
+// super.initialize(subject, callbackHandler, sharedState, options);
+//
+// // Get data
+// userModuleJNDIName = (String) options.get("userModuleJNDIName");
+// roleModuleJNDIName = (String) options.get("roleModuleJNDIName");
+// userProfileModuleJNDIName = (String) options
+// .get("userProfileModuleJNDIName");
+// membershipModuleJNDIName = (String) options
+// .get("membershipModuleJNDIName");
+// additionalRole = (String) options.get("additionalRole");
+// havingRole = (String) options.get("havingRole");
+// validateUserNameCase = (String) options.get("validateUserNameCase");
+// userNameToLowerCase = (String) options.get("userNameToLowerCase");
+//
+//// // Some info
+//// log.trace("userModuleJNDIName = " + userModuleJNDIName);
+//// log.trace("roleModuleJNDIName = " + roleModuleJNDIName);
+//// log.trace("userProfileModuleJNDIName = " +
userProfileModuleJNDIName);
+//// log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
+//// log.trace("additionalRole = " + additionalRole);
+//// log.trace("havingRole = " + havingRole);
+//// log.trace("validateUserNameCase = " + validateUserNameCase);
+//// log.trace("userNameToLowerCase = " + userNameToLowerCase);
+// }
+//
+// protected String getUsersPassword() throws LoginException
+// {
+// return "";
+// }
+//
+// protected boolean validatePassword(final String inputPassword, String
expectedPassword)
+// {
+//
+// HttpServletRequest request = null;
+// try
+// {
+// request = (HttpServletRequest)
PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
+// }
+// catch(Exception e)
+// {
+// log.error(this,e);
+// throw new RuntimeException(e);
+// }
+//
+// Object ssoSuccess = request.getAttribute("ssoSuccess");
+// if(ssoSuccess != null)
+// {
+// return true;
+// }
+//
+// if (inputPassword != null)
+// {
+// try
+// {
+// try
+// {
+//
+// UserStatus userStatus = getUserStatus(inputPassword);
+//
+// // Set the user Status in the request so that the login page can show an
error message accordingly
+// request.setAttribute("org.jboss.portal.userStatus",
userStatus);
+//
+// if (userStatus == UserStatus.DISABLE)
+// {
+// request.setAttribute("org.jboss.portal.loginError",
"Your account is disabled");
+// return false;
+// }
+// else if (userStatus == UserStatus.NOTASSIGNEDTOROLE)
+// {
+// request.setAttribute("org.jboss.portal.loginError",
"The user doesn't have the correct role");
+// return false;
+// }
+// else if ((userStatus == UserStatus.UNEXISTING) || userStatus ==
UserStatus.WRONGPASSWORD)
+// {
+// request.setAttribute("org.jboss.portal.loginError",
"The user doesn't exist or the password is incorrect");
+// return false;
+// }
+// else if (userStatus == UserStatus.OK)
+// {
+// return true;
+// }
+// else
+// {
+// log.error("Unexpected error while logging in");
+// return false;
+// } }
+// catch (Exception e)
+// {
+// log.error("Error when validating password", e);
+// }
+// }
+// catch (Exception e)
+// {
+// log.debug("Failed to validate password", e);
+// }
+// }
+// return false;
+// }
+//
+// protected UserStatus getUserStatus(final String inputPassword)
+// {
+// UserStatus result = UserStatus.OK;
+//
+//// try {
+//// TransactionManager tm = (TransactionManager)new
InitialContext().lookup("java:/TransactionManager");
+//// UserStatus tmp = (UserStatus)Transactions.required(tm, new
Transactions.Runnable()
+//// {
+//// public Object run() throws Exception
+//// {
+//// try
+//// {
+//// User user = getUserModule().findUserByUserName(getUsername());
+//// // in case module implementation doesn't throw proper
+//// // exception...
+//// if (user == null)
+//// {
+//// throw new NoSuchUserException("UserModule returned null
user object");
+//// }
+////
+//// //This is because LDAP binds can be non case sensitive
+//// if (validateUserNameCase != null &&
validateUserNameCase.equalsIgnoreCase("true")
+//// && !getUsername().equals(user.getUserName()))
+//// {
+//// return UserStatus.UNEXISTING;
+//// }
+////
+//// boolean enabled = false;
+//// try {
+//// Object enabledS;
+//// enabledS = getUserProfileModule().getProperty(user,
+//// User.INFO_USER_ENABLED);
+//// if (enabledS != null) {
+//// enabled = new Boolean(enabledS.toString());
+//// }
+//// } catch (Exception e) {
+//// e.printStackTrace();
+//// }
+//// if (!enabled) {
+//// return UserStatus.DISABLE;
+//// }
+//// if (havingRole != null)
+//// {
+//// boolean hasTheRole = false;
+//// Set roles = getMembershipModule().getRoles(user);
+//// for (Iterator i = roles.iterator(); i.hasNext();)
+//// {
+//// Role role = (Role)i.next();
+//// if (havingRole.equals(role.getName()))
+//// {
+//// hasTheRole = true;
+//// break;
+//// }
+//// }
+//// if (!hasTheRole)
+//// {
+//// return UserStatus.NOTASSIGNEDTOROLE;
+//// }
+//// }
+//// if (!user.validatePassword(inputPassword))
+//// {
+//// return UserStatus.WRONGPASSWORD;
+//// }
+//// }
+//// catch (NoSuchUserException e1)
+//// {
+//// return UserStatus.UNEXISTING;
+//// }
+//// catch (Exception e)
+//// {
+//// throw new LoginException(e.toString());
+//// }
+//// return null;
+//// }
+//// });
+//// if (tmp != null)
+//// {
+//// result = tmp;
+//// }
+//// } catch (NamingException e1) {
+//// // TODO Auto-generated catch block
+//// e1.printStackTrace();
+//// }
+//// return result;
+// }
+//
+// protected Group[] getRoleSets() throws LoginException
+// {
+//// try {
+//// TransactionManager tm = (TransactionManager) new InitialContext()
+//// .lookup("java:/TransactionManager");
+//// return (Group[]) Transactions.required(tm, new Transactions.Runnable()
+//// {
+//// public Object run() throws Exception
+//// {
+//// Group rolesGroup = new SimpleGroup("Roles");
+////
+//// //
+//// if (additionalRole != null) {
+//// rolesGroup.addMember(createIdentity(additionalRole));
+//// }
+////
+//// try {
+//// User user = getUserModule().findUserByUserName(getUsername());
+//// Set roles = getMembershipModule().getRoles(user);
+////
+//// //
+////
+//// for (Iterator iterator = roles.iterator(); iterator.hasNext();) {
+//// Role role = (Role) iterator.next();
+//// String roleName = role.getName();
+//// try {
+//// Principal p = createIdentity(roleName);
+//// rolesGroup.addMember(p);
+//// } catch (Exception e) {
+//// log.debug("Failed to create principal " + roleName,
e);
+//// }
+//// }
+////
+////
+//// } catch (Exception e) {
+//// throw new LoginException(e.toString());
+//// }
+//// //
+//// return new Group[] { rolesGroup };
+//// }
+//// });
+//// } catch (Exception e) {
+//// Throwable cause = e.getCause();
+//// throw new LoginException(cause.toString());
+//// }
+// }
+//
+// /** Subclass to use the PortalPrincipal to make the username easier to retrieve by
the portal. */
+// protected Principal createIdentity(String username) throws Exception
+// {
+// return new UserPrincipal(username);
+// }
+//
+// protected String getUsername()
+// {
+// if (userNameToLowerCase != null &&
userNameToLowerCase.equalsIgnoreCase("true"))
+// {
+// return super.getUsername().toLowerCase();
+// }
+// return super.getUsername();
+// }
+//
+// protected String[] getUsernameAndPassword() throws LoginException
+// {
+// String[] names = super.getUsernameAndPassword();
+//
+// if (userNameToLowerCase != null &&
userNameToLowerCase.equalsIgnoreCase("true"))
+// {
+// if (names[0] != null)
+// {
+// names[0] = names[0].toLowerCase();
+// }
+// }
+// return names;
+//
+// }
+//}
Added: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java
(rev 0)
+++
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserPrincipal.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -0,0 +1,74 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.auth;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserPrincipal implements Principal
+{
+
+ /** . */
+ private final String name;
+
+ public UserPrincipal(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null principal name
accepted");
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String toString()
+ {
+ return "PortalPrincipal[" + name + "]";
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof Principal)
+ {
+ Principal that = (Principal)o;
+ return name.equals(that.getName());
+ }
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+}
\ No newline at end of file
Added: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java
(rev 0)
+++
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/UserStatus.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -0,0 +1,45 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.auth;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 5907 $
+ */
+
+public class UserStatus {
+
+ public static UserStatus OK = new UserStatus(0);
+ public static UserStatus DISABLE = new UserStatus(1);
+ public static UserStatus UNEXISTING = new UserStatus(2);
+ public static UserStatus NOTASSIGNEDTOROLE = new UserStatus(3);
+ public static UserStatus WRONGPASSWORD = new UserStatus(4);
+
+ private int value;
+
+ private UserStatus(int value)
+ {
+ this.value = value;
+ }
+
+}
\ No newline at end of file
Modified:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-08
20:46:17 UTC (rev 480)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-05-09
09:51:45 UTC (rev 481)
@@ -144,13 +144,13 @@
*
* @param invocationCtx
* @param identityType
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCtx,
IdentityObjectType identityType,
- IdentityObjectSearchCriteria controls)
throws IdentityException;
+ IdentityObjectSearchCriteria criteria)
throws IdentityException;
/**
* Find identites that have relationship with given identity. Relationships are
directional (from parent to child).
*
@@ -159,14 +159,14 @@
* @param relationshipType
* @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCxt, IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- IdentityObjectSearchCriteria
controls) throws IdentityException;
+ IdentityObjectSearchCriteria
criteria) throws IdentityException;
@@ -341,27 +341,27 @@
/**
*
* @param ctx
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
* @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException;
/**
*
* @param ctx
* @param identity
- * @param controls
+ * @param criteria
* @return
* @throws IdentityException
* @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- IdentityObjectSearchCriteria controls) throws
IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchCriteria criteria) throws
IdentityException, OperationNotSupportedException;
// Credentials
Modified: idm/trunk/pom.xml
===================================================================
--- idm/trunk/pom.xml 2009-05-08 20:46:17 UTC (rev 480)
+++ idm/trunk/pom.xml 2009-05-09 09:51:45 UTC (rev 481)
@@ -19,6 +19,7 @@
<module>idm-spi</module>
<module>idm-api</module>
<module>idm</module>
+ <module>idm-auth</module>
<module>integration</module>
<module>assembly</module>
</modules>