Author: bdaw
Date: 2008-11-12 09:36:05 -0500 (Wed, 12 Nov 2008)
New Revision: 122
Added:
trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java
Removed:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
trunk/identity-impl/src/test/resources/identity-config.xml
trunk/identity-impl/src/test/resources/identity-config.xsd
trunk/identity-impl/src/test/resources/organization-test-config.xml
trunk/identity-impl/src/test/resources/test-config.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
Log:
another code backup
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
===================================================================
---
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -124,7 +124,7 @@
*
* @param identity
* @param attributeName
- * @param values
+ * @param value
* @throws org.jboss.identity.exception.IdentityException
*/
void addAttribute(IdentityType identity, String attributeName, String value)
@@ -136,7 +136,7 @@
* @param identity
* @param attributes
*/
- void removeAttributes(IdentityType identity, Set<String> attributes)
+ void removeAttributes(IdentityType identity, String[] attributes)
throws IdentityException;
/**
@@ -162,5 +162,27 @@
* @throws IdentityException
*/
void updatePasswordAttribute(Identity identity, String password) throws
IdentityException;
-
+
+ /**
+ *
+ * @param identity
+ * @param credentialType
+ */
+ void hasCredential(Identity identity, CredentialType credentialType);
+
+ /**
+ *
+ * @param identity
+ * @param credentials
+ * @return
+ */
+ boolean validateCredentials(Identity identity, Credential[] credentials);
+
+ /**
+ *
+ * @param identity
+ * @param credential
+ */
+ void updateCredential(Identity identity, Credential credential);
+
}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
(rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,36 @@
+/*
+* 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.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Credential
+{
+ /**
+ *
+ * @return
+ */
+ CredentialType getType();
+}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
(rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,36 @@
+/*
+* 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.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface CredentialType
+{
+ /**
+ *
+ * @return
+ */
+ String getName();
+}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
(rev 0)
+++
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,31 @@
+/*
+* 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.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentitySearchControl
+{
+}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java 2008-11-06
23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -36,7 +36,7 @@
/**
* @return id of this IdentityType object
*/
- Object getId();
+ String getId();
/**
* @return the name of the IdentityType
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
===================================================================
---
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -122,43 +122,25 @@
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
- Identity findIdentity(Object id) throws IdentityException;
+ Identity findIdentityById(String id) throws IdentityException;
- /**
- * Find identities with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated
- * parameters will take no effect
- *
- * @param filterName can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
- * @return
- * @throws org.jboss.identity.exception.IdentityException
- */
- Collection<Identity> findIdentity(String filterName, int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ //Collection<Identity> findIdentity(String filterName, int offset, int limit,
+// boolean orderedByName,
+// boolean ascending) throws IdentityException;
+
+// Collection<Identity> findIdentity(String filterName, Map<String,
String[]> attributes,
+// int offset, int limit,
+// boolean orderedByName, boolean ascending) throws
IdentityException;
+
+
/**
- * Find identities with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported, dedicated parameters will take no effect
*
- * @param filterName can be null
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
+ * @param controls
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Identity> findIdentity(String filterName, Map<String, String[]>
attributes,
- int offset, int limit,
- boolean orderedByName, boolean ascending) throws
IdentityException;
+ Collection<Identity> findIdentity(IdentitySearchControl[] controls) throws
IdentityException;
// Search Groups
@@ -179,46 +161,36 @@
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
- Group findGroup(Object id) throws IdentityException;
+ Group findGroupById(String id) throws IdentityException;
+
/**
- * Find group with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated
- * parameters will take no effect
*
* @param groupType
- * @param filterName can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName can be null
- * @param ascending
+ * @param controls
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Group> findGroup(GroupType groupType, String filterName,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[]
controls) throws IdentityException;
/**
- * Find group with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported, dedicated parameters will take no effect
- *
+ *
* @param groupType
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName can be null
- * @param ascending
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Group> findGroup(GroupType groupType, Map<String, String[]>
attributes,
- int offset, int limit,
- boolean orderedByName, boolean ascending) throws
IdentityException;
+ Collection<Group> findGroup(GroupType groupType) throws IdentityException;
+
+// Collection<Group> findGroup(GroupType groupType, String filterName,
+// int offset, int limit,
+// boolean orderedByName,
+// boolean ascending) throws IdentityException;
+
+// Collection<Group> findGroup(GroupType groupType, Map<String, String[]>
attributes,
+// int offset, int limit,
+// boolean orderedByName, boolean ascending) throws
IdentityException;
+
/**
* Whether Identity is a virtual
* (such as a pseudonym)
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
===================================================================
---
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -136,21 +136,50 @@
* relationship - default is true (parent)
* @param inherited if true also identities from subgroubs will be retreived. Matters
only when parent is set to true.
* Default is false
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Group group,
GroupType groupType,
boolean parent,
+ boolean inherited) throws IdentityException;
+
+ /**
+ * Find groups that are associated with given group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect. If 'parent' parameter is set to false, all parent group
will be returned. If parent parameter is
+ * set to true and 'inherited' is set to true all nested subgroubs will be
returned.
+ *
+ * @param group parent group
+ * @param groupType can be null
+ * @param parent defines if given identity is parent or child side in the
+ * relationship - default is true (parent)
+ * @param inherited if true also identities from subgroubs will be retreived. Matters
only when parent is set to true.
+ * Default is false
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Group group,
+ GroupType groupType,
+ boolean parent,
boolean inherited,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws
IdentityException;
+ /**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param identity child identity
+ * @param groupType can be null
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Identity identity,
+ GroupType groupType) throws IdentityException;
+
/**
* Find all groups that given identity is associated with.
* If the paginatedSearch or orderedSearch operations
@@ -159,18 +188,12 @@
*
* @param identity child identity
* @param groupType can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Identity identity,
- GroupType groupType,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ GroupType groupType,
+ IdentitySearchControl[] controls) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -179,19 +202,25 @@
* take no effect
*
* @param identity child identity
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Identity identity,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws
IdentityException;
/**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param identity child identity
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Identity identity) throws
IdentityException;
+
+ /**
* Find identities that have relationship with given parent group.
* If the paginatedSearch or orderedSearch operations
* are not supported in this store implementation, dedicated parameters will
@@ -199,18 +228,26 @@
*
* @param group parent group
* @param inherited if true also identities from subgroubs will be retrieved. Default
is false
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Identity> findAssociatedIdentities(Group group,
+ boolean inherited) throws IdentityException;
+
+ /**
+ * Find identities that have relationship with given parent group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will
+ * take no effect
+ *
+ * @param group parent group
+ * @param inherited if true also identities from subgroubs will be retrieved. Default
is false
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Identity> findAssociatedIdentities(Group group,
boolean inherited,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws
IdentityException;
}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-11-06
23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -82,16 +82,10 @@
/**
* Find all RoleType objects stored
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls) throws
IdentityException;
// Role
@@ -137,63 +131,73 @@
* Find RoleType objects for roles associated with a given Identity and Group
* @param identity
* @param group
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(Identity identity, Group group,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws
IdentityException;
/**
+ * Find RoleType objects for roles associated with a given Identity and Group
+ * @param identity
+ * @param group
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findRoleTypes(Identity identity, Group group) throws
IdentityException;
+
+ /**
* Find RoleType objects for roles associated with a given Identity
* @param identity
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
- Collection<RoleType> findIdentityRoleTypes(Identity identity,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<RoleType> findIdentityRoleTypes(Identity identity) throws
IdentityException;
+ /**
+ * Find RoleType objects for roles associated with a given Identity
+ * @param identity
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findIdentityRoleTypes(Identity identity,
IdentitySearchControl[] controls) throws IdentityException;
+
/**
* Find RoleType objects for roles associated with a given Group
* @param group
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
+ Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException;
+
+ /**
+ * Find RoleType objects for roles associated with a given Group
+ * @param group
+ * @return
+ * @throws IdentityException
+ */
Collection<RoleType> findGroupRoleTypes(Group group,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
-
+ IdentitySearchControl[] controls) throws
IdentityException;
+
/**
* Find Role objects with a given RoleType associated with a given IdentityType
* @param identityType
* @param roleType
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
<T extends IdentityType> Collection<Role> findRoles(T identityType,
+ RoleType roleType) throws
IdentityException;
+
+ /**
+ * Find Role objects with a given RoleType associated with a given IdentityType
+ * @param identityType
+ * @param roleType
+ * @return
+ * @throws IdentityException
+ */
+ <T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws
IdentityException;
+ IdentitySearchControl[] controls)
throws IdentityException;
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -27,12 +27,17 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.GroupType;
import org.jboss.identity.api.IdentityType;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.spi.repository.IdentityStoreRepository;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.impl.types.SimpleIdentityObject;
+import java.util.List;
+import java.util.LinkedList;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
* @version : 0.1 $
@@ -110,6 +115,33 @@
}
+ protected IdentityObjectSearchControl[] convertSearchControls(IdentitySearchControl[]
controls)
+ {
+ if (controls == null)
+ {
+ return null;
+ }
+
+ //TODO: simples check
+ List<IdentityObjectSearchControl> result = new
LinkedList<IdentityObjectSearchControl>();
+
+ for (IdentitySearchControl control : controls)
+ {
+ if (control instanceof IdentityObjectSearchControl)
+ {
+ result.add((IdentityObjectSearchControl)control);
+ }
+ }
+
+ if (result.size() == 0)
+ {
+ return null;
+ }
+
+ return result.toArray(new IdentityObjectSearchControl[result.size()]);
+
+ }
+
protected IdentityObjectType getIdentityObjectType()
{
return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -27,13 +27,14 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.Identity;
import org.jboss.identity.api.AttributeDescription;
+import org.jboss.identity.api.CredentialType;
+import org.jboss.identity.api.Credential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.NotYetImplementedException;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
-import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -56,8 +57,6 @@
return null;
}
- //TODO: fix to have similar signatures in API/SPI for String[] and avoid unnesesary
iterations
-
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws
IdentityException
{
return getRepository().getSupportedAttributeNames(getInvocationContext(),
createIdentityObject(identityType).getIdentityType());
@@ -65,35 +64,13 @@
public Map<String, String[]> getAttributes(IdentityType identity) throws
IdentityException
{
- Map<String, Set<String>> attributes =
getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
-
- Map<String, String[]> attrs = new HashMap<String, String[]>();
-
- for (Map.Entry<String, Set<String>> entry : attributes.entrySet())
- {
- attrs.put(entry.getKey(), entry.getValue().toArray(new
String[entry.getValue().size()]));
- }
-
- return attrs;
+ return getRepository().getAttributes(getInvocationContext(),
createIdentityObject(identity));
}
public void updateAttributes(IdentityType identity, Map<String, String[]>
attributes) throws IdentityException
{
- Map<String, Set<String>> attrs = new HashMap<String,
Set<String>>();
+ getRepository().updateAttributes(getInvocationContext(),
createIdentityObject(identity), attributes);
- for (Map.Entry<String, String[]> entry : attributes.entrySet())
- {
- Set<String> vals = new HashSet<String>();
- for (String s : entry.getValue())
- {
- vals.add(s);
- }
-
- attrs.put(entry.getKey(),vals);
- }
-
- getRepository().updateAttributes(getInvocationContext(),
createIdentityObject(identity), attrs);
-
}
public String[] getAttributeValues(IdentityType identity, String attributeName) throws
IdentityException
@@ -121,23 +98,10 @@
public void addAttributes(IdentityType identity, Map<String, String[]>
attributes) throws IdentityException
{
- Map<String, Set<String>> attrs = new HashMap<String,
Set<String>>();
-
- for (Map.Entry<String, String[]> entry : attributes.entrySet())
- {
- Set<String> vals = new HashSet<String>();
- for (String s : entry.getValue())
- {
- vals.add(s);
- }
-
- attrs.put(entry.getKey(),vals);
- }
-
- getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identity), attrs);
+ getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identity), attributes);
}
- public void removeAttributes(IdentityType identity, Set<String> attributes)
throws IdentityException
+ public void removeAttributes(IdentityType identity, String[] attributes) throws
IdentityException
{
getRepository().removeAttributes(getInvocationContext(),
createIdentityObject(identity), attributes);
@@ -160,4 +124,22 @@
//TODO:NYI
throw new NotYetImplementedException();
}
+
+ public void hasCredential(Identity identity, CredentialType credentialType)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
+
+ public boolean validateCredentials(Identity identity, Credential[] credentials)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
+
+ public void updateCredential(Identity identity, Credential credential)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -29,6 +29,7 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.IdentitySession;
import org.jboss.identity.api.PersistenceManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObject;
@@ -110,29 +111,16 @@
return createIdentity(getRepository().findIdentityObject(getInvocationContext(),
name, getIdentityObjectType()));
}
- public Identity findIdentity(Object id) throws IdentityException
+ public Identity findIdentityById(String id) throws IdentityException
{
return createIdentity(getRepository().findIdentityObject(getInvocationContext(),
id));
}
- public Collection<Identity> findIdentity(String filterName, int offset, int
limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Identity> findIdentity(IdentitySearchControl[] controls)
throws IdentityException
{
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(),
filterName, offset, limit, orderedByName, ascending);
- List<Identity> identities = new LinkedList<Identity>();
- for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- identities.add(createIdentity(identityObject));
- }
- return identities;
-
- }
-
- public Collection<Identity> findIdentity(String filterName, Map<String,
String[]> attributes, int offset, int limit, boolean orderedByName, boolean ascending)
throws IdentityException
- {
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(),
attributes, offset, limit, orderedByName, ascending);
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(),
convertSearchControls(controls));
List<Identity> identities = new LinkedList<Identity>();
for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
@@ -149,14 +137,14 @@
return createGroup(getRepository().findIdentityObject(getInvocationContext(), name,
getIdentityObjectType(groupType)));
}
- public Group findGroup(Object id) throws IdentityException
+ public Group findGroupById(String id) throws IdentityException
{
return createGroup(getRepository().findIdentityObject(getInvocationContext(),
id));
}
- public Collection<Group> findGroup(GroupType groupType, String filterName, int
offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[]
controls) throws IdentityException
{
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(),
getIdentityObjectType(groupType), filterName, offset, limit, orderedByName, ascending);
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(),
getIdentityObjectType(groupType), convertSearchControls(controls));
List<Group> groups = new LinkedList<Group>();
for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
@@ -168,18 +156,9 @@
return groups;
}
- public Collection<Group> findGroup(GroupType groupType, Map<String,
String[]> attributes, int offset, int limit, boolean orderedByName, boolean ascending)
throws IdentityException
+ public Collection<Group> findGroup(GroupType groupType) throws
IdentityException
{
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(),
getIdentityObjectType(groupType), attributes, offset, limit, orderedByName, ascending);
- List<Group> groups = new LinkedList<Group>();
-
- for (Iterator<IdentityObject> iterator = ios.iterator();
iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- groups.add(createGroup(identityObject));
- }
-
- return groups;
+ return findGroup(groupType, null);
}
public boolean isVirtual(Identity identity)
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -29,6 +29,7 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.GroupType;
import org.jboss.identity.api.RelationshipManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -184,15 +185,17 @@
return isAssociated(parents, members);
}
- public Collection<Group> findAssociatedGroups(Group group, GroupType groupType,
boolean parent, boolean inherited, int offset, int limit, boolean orderedByName, boolean
ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, GroupType groupType,
boolean parent, boolean inherited, IdentitySearchControl[] controls) throws
IdentityException
{
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = getIdentityObjectType(groupType);
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, true, offset, limit, false, false);
+ //TODO inherited
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, parent, convertSearchControls(controls));
+
for (IdentityObject io : ios)
{
if (io.getIdentityType().getName().equals(iot.getName()))
@@ -205,13 +208,18 @@
}
- public Collection<Group> findAssociatedGroups(Identity identity, GroupType
groupType, int offset, int limit, boolean orderedByName, boolean ascending) throws
IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, GroupType groupType,
boolean parent, boolean inherited) throws IdentityException
{
+ return findAssociatedGroups(group, groupType, parent, inherited, null);
+ }
+
+ public Collection<Group> findAssociatedGroups(Identity identity, GroupType
groupType, IdentitySearchControl[] controls) throws IdentityException
+ {
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = getIdentityObjectType(groupType);
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, offset, limit, false, false);
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -224,11 +232,16 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(Identity identity, int offset, int
limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Identity identity, GroupType
groupType) throws IdentityException
{
+ return findAssociatedGroups(identity, groupType, null);
+ }
+
+ public Collection<Group> findAssociatedGroups(Identity identity,
IdentitySearchControl[] controls) throws IdentityException
+ {
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, offset, limit, false, false);
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity),
MEMBER, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -238,14 +251,19 @@
return identities;
}
+ public Collection<Group> findAssociatedGroups(Identity identity) throws
IdentityException
+ {
+ return findAssociatedGroups(identity, new IdentitySearchControl[] {});
+ }
-
- public Collection<Identity> findAssociatedIdentities(Group group, boolean
inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws
IdentityException
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean
inherited, IdentitySearchControl[] controls) throws IdentityException
{
List<Identity> identities = new LinkedList<Identity>();
- Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, true, offset, limit, false, false);
+ //TODO inherited
+ Collection<IdentityObject> ios =
getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group),
MEMBER, true, convertSearchControls(controls));
+
for (IdentityObject io : ios)
{
identities.add(createIdentity(io));
@@ -253,4 +271,9 @@
return identities;
}
+
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean
inherited) throws IdentityException
+ {
+ return findAssociatedIdentities(group, inherited, null);
+ }
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -30,6 +30,7 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.RoleManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -101,7 +102,7 @@
{
try
{
- Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(), 0, 0, false, false);
+ Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(), null);
if (names.contains(name))
{
return new SimpleRoleType(name);
@@ -115,12 +116,12 @@
return null;
}
- public Collection<RoleType> findRoleTypes(int offset, int limit, boolean
orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls)
throws IdentityException
{
try
{
- Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(), offset, limit, orderedByName,
ascending);
+ Set<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
convertSearchControls(controls));
Set<RoleType> types = new HashSet<RoleType>();
for (String name : names)
@@ -175,8 +176,13 @@
return false;
}
- public Collection<RoleType> findRoleTypes(Identity identity, Group group, int
offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findRoleTypes(Identity identity, Group group) throws
IdentityException
{
+ return findRoleTypes(identity, group, null);
+ }
+
+ public Collection<RoleType> findRoleTypes(Identity identity, Group group,
IdentitySearchControl[] controls) throws IdentityException
+ {
//TODO: improve IdentityStore SPI....
@@ -196,13 +202,18 @@
}
- public Collection<RoleType> findIdentityRoleTypes(Identity identity, int offset,
int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findIdentityRoleTypes(Identity identity) throws
IdentityException
{
+ return findIdentityRoleTypes(identity, null);
+ }
+
+ public Collection<RoleType> findIdentityRoleTypes(Identity identity,
IdentitySearchControl[] controls) throws IdentityException
+ {
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
createIdentityObject(identity), offset, limit, orderedByName, ascending);
+ Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(),
createIdentityObject(identity), convertSearchControls(controls));
for (String name : names)
{
@@ -217,18 +228,20 @@
throw new IdentityException("Role management not supported");
}
+ }
-
-
+ public Collection<RoleType> findGroupRoleTypes(Group group) throws
IdentityException
+ {
+ return findGroupRoleTypes(group, null);
}
- public Collection<RoleType> findGroupRoleTypes(Group group, int offset, int
limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(Group group,
IdentitySearchControl[] controls) throws IdentityException
{
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group),
offset, limit, orderedByName, ascending);
+ Collection<String> names =
getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group),
convertSearchControls(controls));
for (String name : names)
{
@@ -245,8 +258,13 @@
}
- public <T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType, int offset, int limit, boolean orderedByName, boolean ascending) throws
IdentityException
+ public <T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType) throws IdentityException
{
+ return findRoles(identityType, roleType, null);
+ }
+
+ public <T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType, IdentitySearchControl[] controls) throws IdentityException
+ {
throw new NotYetImplementedException();
}
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -24,7 +24,6 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.GroupType;
-import org.jboss.identity.spi.model.IdentityObject;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -34,11 +33,11 @@
{
private final String name;
- private final Object id;
+ private final String id;
private final GroupType groupType;
- public SimpleGroupImpl(String name, Object id, GroupType groupType)
+ public SimpleGroupImpl(String name, String id, GroupType groupType)
{
this.name = name;
this.id = id;
@@ -55,7 +54,7 @@
return groupType;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -32,10 +32,10 @@
{
private final String name;
- private final Object id;
+ private final String id;
- public SimpleIdentityImpl(String name, Object id)
+ public SimpleIdentityImpl(String name, String id)
{
this.name = name;
this.id = id;
@@ -51,7 +51,7 @@
return false;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -64,7 +64,7 @@
public abstract class JAXB2IdentityConfiguration
{
- //TODO: check if configuration is consistent
+ //TODO: check if configuration is consistent. Part of constraints should be checked by
schema. Test cases needed :)
public static IdentityConfigurationMetaData createConfigurationMetaData(File
xmlConfig) throws IdentityConfigurationException
@@ -118,17 +118,17 @@
RealmConfigurationMetaDataImpl realmMD = new RealmConfigurationMetaDataImpl();
realmMD.setId(realmType.getId());
- if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ if (realmType.getIdentityTypeMappings() != null)
{
-
realmMD.setIdentityMapping(realmType.getRealmConfiguration().getIdentityTypeMappings().getIdentityMapping());
+
realmMD.setIdentityMapping(realmType.getIdentityTypeMappings().getIdentityMapping());
}
realmMD.setIdentityRepositoryIdRef(realmType.getRepositoryIdRef());
Map<String, String> groupMappings = new HashMap<String, String>();
- if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ if (realmType.getIdentityTypeMappings() != null)
{
- for (GroupTypeMappingType groupTypeMappingType :
realmType.getRealmConfiguration().getIdentityTypeMappings().getGroupTypeMapping())
+ for (GroupTypeMappingType groupTypeMappingType :
realmType.getIdentityTypeMappings().getGroupTypeMapping())
{
groupMappings.put(groupTypeMappingType.getGroupTypeName(),
groupTypeMappingType.getIdentityObjectTypeName());
}
@@ -136,7 +136,7 @@
realmMD.setGroupTypeMappings(groupMappings);
- realmMD.setOptions(createOptions(realmType.getRealmConfiguration().getOptions()));
+ realmMD.setOptions(createOptions(realmType.getOptions()));
return realmMD;
@@ -149,16 +149,16 @@
repoMD.setId(repositoryType.getId());
repoMD.setClassName(repositoryType.getClazz());
- if (repositoryType.getRepositoryConfiguration().getExternalConfig() != null)
+ if (repositoryType.getExternalConfig() != null)
{
-
repoMD.setExternalConfig(repositoryType.getRepositoryConfiguration().getExternalConfig().getValue());
+ repoMD.setExternalConfig(repositoryType.getExternalConfig().getValue());
}
-
repoMD.setDefaultAttributeStroeId(repositoryType.getRepositoryConfiguration().getDefaultAttributeStoreId());
-
repoMD.setDefaultIdentityStoreId(repositoryType.getRepositoryConfiguration().getDefaultIdentityStoreId());
+ repoMD.setDefaultAttributeStroeId(repositoryType.getDefaultAttributeStoreId());
+ repoMD.setDefaultIdentityStoreId(repositoryType.getDefaultIdentityStoreId());
List<IdentityStoreMappingMetaData> storeMappings = new
LinkedList<IdentityStoreMappingMetaData>();
- for (IdentityStoreMappingType identityStoreMappingType :
repositoryType.getRepositoryConfiguration().getIdentityStoreMappings().getIdentityStoreMapping())
+ for (IdentityStoreMappingType identityStoreMappingType :
repositoryType.getIdentityStoreMappings().getIdentityStoreMapping())
{
IdentityStoreMappingMetaDataImpl mapping = new
IdentityStoreMappingMetaDataImpl();
@@ -171,7 +171,7 @@
repoMD.setIdentityStoreToIdentityObjectTypeMappings(storeMappings);
-
repoMD.setOptions(createOptions(repositoryType.getRepositoryConfiguration().getOptions()));
+ repoMD.setOptions(createOptions(repositoryType.getOptions()));
return repoMD;
@@ -184,14 +184,14 @@
storeMD.setId(identityStoreType.getId());
storeMD.setClassName(identityStoreType.getClazz());
- if (identityStoreType.getIdentityStoreConfiguration().getExternalConfig() != null)
+ if (identityStoreType.getExternalConfig() != null)
{
-
storeMD.setExternalConfig(identityStoreType.getIdentityStoreConfiguration().getExternalConfig().getValue());
+ storeMD.setExternalConfig(identityStoreType.getExternalConfig().getValue());
}
-
storeMD.setSupportedRelationshipTypes(identityStoreType.getIdentityStoreConfiguration().getSupportedRelationshipTypes().getRelationshipType());
+
storeMD.setSupportedRelationshipTypes(identityStoreType.getSupportedRelationshipTypes().getRelationshipType());
- for (IdentityObjectTypeType identityObjectTypeType :
identityStoreType.getIdentityStoreConfiguration().getSupportedIdentityObjectTypes().getIdentityObjectType())
+ for (IdentityObjectTypeType identityObjectTypeType :
identityStoreType.getSupportedIdentityObjectTypes().getIdentityObjectType())
{
IdentityObjectTypeMetaDataImpl identityObjectTypeMD = new
IdentityObjectTypeMetaDataImpl();
@@ -246,7 +246,7 @@
Map<String, List<String>> options = new HashMap<String,
List<String>>();
- for (OptionType optionType :
identityStoreType.getIdentityStoreConfiguration().getOptions().getOption())
+ for (OptionType optionType : identityStoreType.getOptions().getOption())
{
options.put(optionType.getName(), optionType.getValue());
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -1,224 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
-// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for identity-store-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within
this class.
- *
- * <pre>
- * <complexType name="identity-store-configurationType">
- * <complexContent>
- * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="external-config"
type="{urn:jboss:identity:config:v0_1}external-configType"/>
- * <element name="supported-relationship-types"
type="{urn:jboss:identity:config:v0_1}supported-relationship-typesType"/>
- * <element name="supported-identity-object-types"
type="{urn:jboss:identity:config:v0_1}supported-identity-object-typesType"/>
- * <element name="options">
- * <complexType>
- * <complexContent>
- * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="option"
type="{urn:jboss:identity:config:v0_1}optionType"
maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "identity-store-configurationType", propOrder = {
- "externalConfig",
- "supportedRelationshipTypes",
- "supportedIdentityObjectTypes",
- "options"
-})
-public class IdentityStoreConfigurationType {
-
- @XmlElement(name = "external-config", required = true)
- protected ExternalConfigType externalConfig;
- @XmlElement(name = "supported-relationship-types", required = true)
- protected SupportedRelationshipTypesType supportedRelationshipTypes;
- @XmlElement(name = "supported-identity-object-types", required = true)
- protected SupportedIdentityObjectTypesType supportedIdentityObjectTypes;
- @XmlElement(required = true)
- protected IdentityStoreConfigurationType.Options options;
-
- /**
- * Gets the value of the externalConfig property.
- *
- * @return
- * possible object is
- * {@link ExternalConfigType }
- *
- */
- public ExternalConfigType getExternalConfig() {
- return externalConfig;
- }
-
- /**
- * Sets the value of the externalConfig property.
- *
- * @param value
- * allowed object is
- * {@link ExternalConfigType }
- *
- */
- public void setExternalConfig(ExternalConfigType value) {
- this.externalConfig = value;
- }
-
- /**
- * Gets the value of the supportedRelationshipTypes property.
- *
- * @return
- * possible object is
- * {@link SupportedRelationshipTypesType }
- *
- */
- public SupportedRelationshipTypesType getSupportedRelationshipTypes() {
- return supportedRelationshipTypes;
- }
-
- /**
- * Sets the value of the supportedRelationshipTypes property.
- *
- * @param value
- * allowed object is
- * {@link SupportedRelationshipTypesType }
- *
- */
- public void setSupportedRelationshipTypes(SupportedRelationshipTypesType value) {
- this.supportedRelationshipTypes = value;
- }
-
- /**
- * Gets the value of the supportedIdentityObjectTypes property.
- *
- * @return
- * possible object is
- * {@link SupportedIdentityObjectTypesType }
- *
- */
- public SupportedIdentityObjectTypesType getSupportedIdentityObjectTypes() {
- return supportedIdentityObjectTypes;
- }
-
- /**
- * Sets the value of the supportedIdentityObjectTypes property.
- *
- * @param value
- * allowed object is
- * {@link SupportedIdentityObjectTypesType }
- *
- */
- public void setSupportedIdentityObjectTypes(SupportedIdentityObjectTypesType value)
{
- this.supportedIdentityObjectTypes = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link IdentityStoreConfigurationType.Options }
- *
- */
- public IdentityStoreConfigurationType.Options getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link IdentityStoreConfigurationType.Options }
- *
- */
- public void setOptions(IdentityStoreConfigurationType.Options value) {
- this.options = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained
within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="option"
type="{urn:jboss:identity:config:v0_1}optionType"
maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "option"
- })
- public static class Options {
-
- protected List<OptionType> option;
-
- /**
- * Gets the value of the option property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the option
property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getOption().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link OptionType }
- *
- *
- */
- public List<OptionType> getOption() {
- if (option == null) {
- option = new ArrayList<OptionType>();
- }
- return this.option;
- }
-
- }
-
-}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,12 +2,14 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
package org.jboss.identity.impl.configuration.jaxb2.generated;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -26,7 +28,20 @@
* <sequence>
* <element name="id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class"
type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="identity-store-configuration"
type="{urn:jboss:identity:config:v0_1}identity-store-configurationType"/>
+ * <element name="external-config"
type="{urn:jboss:identity:config:v0_1}external-configType"/>
+ * <element name="supported-relationship-types"
type="{urn:jboss:identity:config:v0_1}supported-relationship-typesType"/>
+ * <element name="supported-identity-object-types"
type="{urn:jboss:identity:config:v0_1}supported-identity-object-typesType"/>
+ * <element name="options">
+ * <complexType>
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option"
type="{urn:jboss:identity:config:v0_1}optionType"
maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +54,10 @@
@XmlType(name = "identity-storeType", propOrder = {
"id",
"clazz",
- "identityStoreConfiguration"
+ "externalConfig",
+ "supportedRelationshipTypes",
+ "supportedIdentityObjectTypes",
+ "options"
})
public class IdentityStoreType {
@@ -47,8 +65,14 @@
protected String id;
@XmlElement(name = "class", required = true)
protected String clazz;
- @XmlElement(name = "identity-store-configuration", required = true)
- protected IdentityStoreConfigurationType identityStoreConfiguration;
+ @XmlElement(name = "external-config", required = true)
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "supported-relationship-types", required = true)
+ protected SupportedRelationshipTypesType supportedRelationshipTypes;
+ @XmlElement(name = "supported-identity-object-types", required = true)
+ protected SupportedIdentityObjectTypesType supportedIdentityObjectTypes;
+ @XmlElement(required = true)
+ protected IdentityStoreType.Options options;
/**
* Gets the value of the id property.
@@ -99,27 +123,158 @@
}
/**
- * Gets the value of the identityStoreConfiguration property.
+ * Gets the value of the externalConfig property.
*
* @return
* possible object is
- * {@link IdentityStoreConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public IdentityStoreConfigurationType getIdentityStoreConfiguration() {
- return identityStoreConfiguration;
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
}
/**
- * Sets the value of the identityStoreConfiguration property.
+ * Sets the value of the externalConfig property.
*
* @param value
* allowed object is
- * {@link IdentityStoreConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public void setIdentityStoreConfiguration(IdentityStoreConfigurationType value) {
- this.identityStoreConfiguration = value;
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
}
+ /**
+ * Gets the value of the supportedRelationshipTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public SupportedRelationshipTypesType getSupportedRelationshipTypes() {
+ return supportedRelationshipTypes;
+ }
+
+ /**
+ * Sets the value of the supportedRelationshipTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public void setSupportedRelationshipTypes(SupportedRelationshipTypesType value) {
+ this.supportedRelationshipTypes = value;
+ }
+
+ /**
+ * Gets the value of the supportedIdentityObjectTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public SupportedIdentityObjectTypesType getSupportedIdentityObjectTypes() {
+ return supportedIdentityObjectTypes;
+ }
+
+ /**
+ * Sets the value of the supportedIdentityObjectTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public void setSupportedIdentityObjectTypes(SupportedIdentityObjectTypesType value)
{
+ this.supportedIdentityObjectTypes = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreType.Options }
+ *
+ */
+ public IdentityStoreType.Options getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreType.Options }
+ *
+ */
+ public void setOptions(IdentityStoreType.Options value) {
+ this.options = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option"
type="{urn:jboss:identity:config:v0_1}optionType"
maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "option"
+ })
+ public static class Options {
+
+ protected List<OptionType> option;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option
property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link OptionType }
+ *
+ *
+ */
+ public List<OptionType> getOption() {
+ if (option == null) {
+ option = new ArrayList<OptionType>();
+ }
+ return this.option;
+ }
+
+ }
+
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -41,19 +41,19 @@
}
/**
- * Create an instance of {@link IdentityStoreMappingType }
+ * Create an instance of {@link RelationshipsType }
*
*/
- public IdentityStoreMappingType createIdentityStoreMappingType() {
- return new IdentityStoreMappingType();
+ public RelationshipsType createRelationshipsType() {
+ return new RelationshipsType();
}
/**
- * Create an instance of {@link IdentityStoreType }
+ * Create an instance of {@link IdentityObjectTypeType }
*
*/
- public IdentityStoreType createIdentityStoreType() {
- return new IdentityStoreType();
+ public IdentityObjectTypeType createIdentityObjectTypeType() {
+ return new IdentityObjectTypeType();
}
/**
@@ -65,78 +65,86 @@
}
/**
- * Create an instance of {@link OptionType }
+ * Create an instance of {@link OptionsType }
*
*/
- public OptionType createOptionType() {
- return new OptionType();
+ public OptionsType createOptionsType() {
+ return new OptionsType();
}
/**
- * Create an instance of {@link AttributeType }
+ * Create an instance of {@link IdentityObjectTypeType.Options }
*
*/
- public AttributeType createAttributeType() {
- return new AttributeType();
+ public IdentityObjectTypeType.Options createIdentityObjectTypeTypeOptions() {
+ return new IdentityObjectTypeType.Options();
}
/**
- * Create an instance of {@link RepositoryType }
+ * Create an instance of {@link RepositoriesType }
*
*/
- public RepositoryType createRepositoryType() {
- return new RepositoryType();
+ public RepositoriesType createRepositoriesType() {
+ return new RepositoriesType();
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Options }
+ * Create an instance of {@link IdentityObjectTypesType }
*
*/
- public IdentityObjectTypeType.Options createIdentityObjectTypeTypeOptions() {
- return new IdentityObjectTypeType.Options();
+ public IdentityObjectTypesType createIdentityObjectTypesType() {
+ return new IdentityObjectTypesType();
}
/**
- * Create an instance of {@link IdentityObjectTypesType }
+ * Create an instance of {@link SupportedRelationshipTypesType }
*
*/
- public IdentityObjectTypesType createIdentityObjectTypesType() {
- return new IdentityObjectTypesType();
+ public SupportedRelationshipTypesType createSupportedRelationshipTypesType() {
+ return new SupportedRelationshipTypesType();
}
/**
- * Create an instance of {@link StoresType }
+ * Create an instance of {@link ExternalConfigType }
*
*/
- public StoresType createStoresType() {
- return new StoresType();
+ public ExternalConfigType createExternalConfigType() {
+ return new ExternalConfigType();
}
/**
- * Create an instance of {@link RealmConfigurationType }
+ * Create an instance of {@link AttributeType }
*
*/
- public RealmConfigurationType createRealmConfigurationType() {
- return new RealmConfigurationType();
+ public AttributeType createAttributeType() {
+ return new AttributeType();
}
/**
- * Create an instance of {@link OptionsType }
+ * Create an instance of {@link RealmsType }
*
*/
- public OptionsType createOptionsType() {
- return new OptionsType();
+ public RealmsType createRealmsType() {
+ return new RealmsType();
}
/**
- * Create an instance of {@link RealmType }
+ * Create an instance of {@link AttributesType }
*
*/
- public RealmType createRealmType() {
- return new RealmType();
+ public AttributesType createAttributesType() {
+ return new AttributesType();
}
/**
+ * Create an instance of {@link IdentityObjectTypeType.Attributes }
+ *
+ */
+ public IdentityObjectTypeType.Attributes createIdentityObjectTypeTypeAttributes() {
+ return new IdentityObjectTypeType.Attributes();
+ }
+
+ /**
* Create an instance of {@link RelationshipType }
*
*/
@@ -145,51 +153,51 @@
}
/**
- * Create an instance of {@link IdentityStoreConfigurationType }
+ * Create an instance of {@link IdentityStoreType.Options }
*
*/
- public IdentityStoreConfigurationType createIdentityStoreConfigurationType() {
- return new IdentityStoreConfigurationType();
+ public IdentityStoreType.Options createIdentityStoreTypeOptions() {
+ return new IdentityStoreType.Options();
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Relationships }
+ * Create an instance of {@link IdentityStoreType }
*
*/
- public IdentityObjectTypeType.Relationships
createIdentityObjectTypeTypeRelationships() {
- return new IdentityObjectTypeType.Relationships();
+ public IdentityStoreType createIdentityStoreType() {
+ return new IdentityStoreType();
}
/**
- * Create an instance of {@link AttributesType }
+ * Create an instance of {@link StoresType }
*
*/
- public AttributesType createAttributesType() {
- return new AttributesType();
+ public StoresType createStoresType() {
+ return new StoresType();
}
/**
- * Create an instance of {@link IdentityObjectTypeType }
+ * Create an instance of {@link IdentityStoreMappingType }
*
*/
- public IdentityObjectTypeType createIdentityObjectTypeType() {
- return new IdentityObjectTypeType();
+ public IdentityStoreMappingType createIdentityStoreMappingType() {
+ return new IdentityStoreMappingType();
}
/**
- * Create an instance of {@link RealmsType }
+ * Create an instance of {@link IdentityObjectTypeType.Relationships }
*
*/
- public RealmsType createRealmsType() {
- return new RealmsType();
+ public IdentityObjectTypeType.Relationships
createIdentityObjectTypeTypeRelationships() {
+ return new IdentityObjectTypeType.Relationships();
}
/**
- * Create an instance of {@link SupportedIdentityObjectTypesType }
+ * Create an instance of {@link OptionType }
*
*/
- public SupportedIdentityObjectTypesType createSupportedIdentityObjectTypesType() {
- return new SupportedIdentityObjectTypesType();
+ public OptionType createOptionType() {
+ return new OptionType();
}
/**
@@ -201,19 +209,19 @@
}
/**
- * Create an instance of {@link SupportedRelationshipTypesType }
+ * Create an instance of {@link GroupTypeMappingType }
*
*/
- public SupportedRelationshipTypesType createSupportedRelationshipTypesType() {
- return new SupportedRelationshipTypesType();
+ public GroupTypeMappingType createGroupTypeMappingType() {
+ return new GroupTypeMappingType();
}
/**
- * Create an instance of {@link GroupTypeMappingType }
+ * Create an instance of {@link SupportedIdentityObjectTypesType }
*
*/
- public GroupTypeMappingType createGroupTypeMappingType() {
- return new GroupTypeMappingType();
+ public SupportedIdentityObjectTypesType createSupportedIdentityObjectTypesType() {
+ return new SupportedIdentityObjectTypesType();
}
/**
@@ -225,30 +233,14 @@
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Attributes }
+ * Create an instance of {@link RealmType }
*
*/
- public IdentityObjectTypeType.Attributes createIdentityObjectTypeTypeAttributes() {
- return new IdentityObjectTypeType.Attributes();
+ public RealmType createRealmType() {
+ return new RealmType();
}
/**
- * Create an instance of {@link RelationshipsType }
- *
- */
- public RelationshipsType createRelationshipsType() {
- return new RelationshipsType();
- }
-
- /**
- * Create an instance of {@link RepositoriesType }
- *
- */
- public RepositoriesType createRepositoriesType() {
- return new RepositoriesType();
- }
-
- /**
* Create an instance of {@link IdentityStoreMappingsType }
*
*/
@@ -257,30 +249,14 @@
}
/**
- * Create an instance of {@link RepositoryConfigurationType }
+ * Create an instance of {@link RepositoryType }
*
*/
- public RepositoryConfigurationType createRepositoryConfigurationType() {
- return new RepositoryConfigurationType();
+ public RepositoryType createRepositoryType() {
+ return new RepositoryType();
}
/**
- * Create an instance of {@link IdentityStoreConfigurationType.Options }
- *
- */
- public IdentityStoreConfigurationType.Options
createIdentityStoreConfigurationTypeOptions() {
- return new IdentityStoreConfigurationType.Options();
- }
-
- /**
- * Create an instance of {@link ExternalConfigType }
- *
- */
- public ExternalConfigType createExternalConfigType() {
- return new ExternalConfigType();
- }
-
- /**
* Create an instance of {@link JAXBElement }{@code <}{@link JbossIdentityType
}{@code >}}
*
*/
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -1,96 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
-// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for realm-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within
this class.
- *
- * <pre>
- * <complexType name="realm-configurationType">
- * <complexContent>
- * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="identity-type-mappings"
type="{urn:jboss:identity:config:v0_1}identity-type-mappingsType"
minOccurs="0"/>
- * <element name="options"
type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "realm-configurationType", propOrder = {
- "identityTypeMappings",
- "options"
-})
-public class RealmConfigurationType {
-
- @XmlElement(name = "identity-type-mappings")
- protected IdentityTypeMappingsType identityTypeMappings;
- protected OptionsType options;
-
- /**
- * Gets the value of the identityTypeMappings property.
- *
- * @return
- * possible object is
- * {@link IdentityTypeMappingsType }
- *
- */
- public IdentityTypeMappingsType getIdentityTypeMappings() {
- return identityTypeMappings;
- }
-
- /**
- * Sets the value of the identityTypeMappings property.
- *
- * @param value
- * allowed object is
- * {@link IdentityTypeMappingsType }
- *
- */
- public void setIdentityTypeMappings(IdentityTypeMappingsType value) {
- this.identityTypeMappings = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link OptionsType }
- *
- */
- public OptionsType getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link OptionsType }
- *
- */
- public void setOptions(OptionsType value) {
- this.options = value;
- }
-
-}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -26,7 +26,8 @@
* <sequence>
* <element name="id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="repository-id-ref"
type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="realm-configuration"
type="{urn:jboss:identity:config:v0_1}realm-configurationType"/>
+ * <element name="identity-type-mappings"
type="{urn:jboss:identity:config:v0_1}identity-type-mappingsType"
minOccurs="0"/>
+ * <element name="options"
type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +40,8 @@
@XmlType(name = "realmType", propOrder = {
"id",
"repositoryIdRef",
- "realmConfiguration"
+ "identityTypeMappings",
+ "options"
})
public class RealmType {
@@ -47,8 +49,9 @@
protected String id;
@XmlElement(name = "repository-id-ref", required = true)
protected String repositoryIdRef;
- @XmlElement(name = "realm-configuration", required = true)
- protected RealmConfigurationType realmConfiguration;
+ @XmlElement(name = "identity-type-mappings")
+ protected IdentityTypeMappingsType identityTypeMappings;
+ protected OptionsType options;
/**
* Gets the value of the id property.
@@ -99,27 +102,51 @@
}
/**
- * Gets the value of the realmConfiguration property.
+ * Gets the value of the identityTypeMappings property.
*
* @return
* possible object is
- * {@link RealmConfigurationType }
+ * {@link IdentityTypeMappingsType }
*
*/
- public RealmConfigurationType getRealmConfiguration() {
- return realmConfiguration;
+ public IdentityTypeMappingsType getIdentityTypeMappings() {
+ return identityTypeMappings;
}
/**
- * Sets the value of the realmConfiguration property.
+ * Sets the value of the identityTypeMappings property.
*
* @param value
* allowed object is
- * {@link RealmConfigurationType }
+ * {@link IdentityTypeMappingsType }
*
*/
- public void setRealmConfiguration(RealmConfigurationType value) {
- this.realmConfiguration = value;
+ public void setIdentityTypeMappings(IdentityTypeMappingsType value) {
+ this.identityTypeMappings = value;
}
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -1,180 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
-// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for repository-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within
this class.
- *
- * <pre>
- * <complexType name="repository-configurationType">
- * <complexContent>
- * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="external-config"
type="{urn:jboss:identity:config:v0_1}external-configType"
minOccurs="0"/>
- * <element name="default-identity-store-id"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="default-attribute-store-id"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="identity-store-mappings"
type="{urn:jboss:identity:config:v0_1}identity-store-mappingsType"
minOccurs="0"/>
- * <element name="options"
type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "repository-configurationType", propOrder = {
- "externalConfig",
- "defaultIdentityStoreId",
- "defaultAttributeStoreId",
- "identityStoreMappings",
- "options"
-})
-public class RepositoryConfigurationType {
-
- @XmlElement(name = "external-config")
- protected ExternalConfigType externalConfig;
- @XmlElement(name = "default-identity-store-id")
- protected String defaultIdentityStoreId;
- @XmlElement(name = "default-attribute-store-id")
- protected String defaultAttributeStoreId;
- @XmlElement(name = "identity-store-mappings")
- protected IdentityStoreMappingsType identityStoreMappings;
- protected OptionsType options;
-
- /**
- * Gets the value of the externalConfig property.
- *
- * @return
- * possible object is
- * {@link ExternalConfigType }
- *
- */
- public ExternalConfigType getExternalConfig() {
- return externalConfig;
- }
-
- /**
- * Sets the value of the externalConfig property.
- *
- * @param value
- * allowed object is
- * {@link ExternalConfigType }
- *
- */
- public void setExternalConfig(ExternalConfigType value) {
- this.externalConfig = value;
- }
-
- /**
- * Gets the value of the defaultIdentityStoreId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDefaultIdentityStoreId() {
- return defaultIdentityStoreId;
- }
-
- /**
- * Sets the value of the defaultIdentityStoreId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDefaultIdentityStoreId(String value) {
- this.defaultIdentityStoreId = value;
- }
-
- /**
- * Gets the value of the defaultAttributeStoreId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDefaultAttributeStoreId() {
- return defaultAttributeStoreId;
- }
-
- /**
- * Sets the value of the defaultAttributeStoreId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDefaultAttributeStoreId(String value) {
- this.defaultAttributeStoreId = value;
- }
-
- /**
- * Gets the value of the identityStoreMappings property.
- *
- * @return
- * possible object is
- * {@link IdentityStoreMappingsType }
- *
- */
- public IdentityStoreMappingsType getIdentityStoreMappings() {
- return identityStoreMappings;
- }
-
- /**
- * Sets the value of the identityStoreMappings property.
- *
- * @param value
- * allowed object is
- * {@link IdentityStoreMappingsType }
- *
- */
- public void setIdentityStoreMappings(IdentityStoreMappingsType value) {
- this.identityStoreMappings = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link OptionsType }
- *
- */
- public OptionsType getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link OptionsType }
- *
- */
- public void setOptions(OptionsType value) {
- this.options = value;
- }
-
-}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -26,7 +26,11 @@
* <sequence>
* <element name="id"
type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class"
type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="repository-configuration"
type="{urn:jboss:identity:config:v0_1}repository-configurationType"/>
+ * <element name="external-config"
type="{urn:jboss:identity:config:v0_1}external-configType"
minOccurs="0"/>
+ * <element name="default-identity-store-id"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="default-attribute-store-id"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="identity-store-mappings"
type="{urn:jboss:identity:config:v0_1}identity-store-mappingsType"
minOccurs="0"/>
+ * <element name="options"
type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +43,11 @@
@XmlType(name = "repositoryType", propOrder = {
"id",
"clazz",
- "repositoryConfiguration"
+ "externalConfig",
+ "defaultIdentityStoreId",
+ "defaultAttributeStoreId",
+ "identityStoreMappings",
+ "options"
})
public class RepositoryType {
@@ -47,8 +55,15 @@
protected String id;
@XmlElement(name = "class", required = true)
protected String clazz;
- @XmlElement(name = "repository-configuration", required = true)
- protected RepositoryConfigurationType repositoryConfiguration;
+ @XmlElement(name = "external-config")
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "default-identity-store-id")
+ protected String defaultIdentityStoreId;
+ @XmlElement(name = "default-attribute-store-id")
+ protected String defaultAttributeStoreId;
+ @XmlElement(name = "identity-store-mappings")
+ protected IdentityStoreMappingsType identityStoreMappings;
+ protected OptionsType options;
/**
* Gets the value of the id property.
@@ -99,27 +114,123 @@
}
/**
- * Gets the value of the repositoryConfiguration property.
+ * Gets the value of the externalConfig property.
*
* @return
* possible object is
- * {@link RepositoryConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public RepositoryConfigurationType getRepositoryConfiguration() {
- return repositoryConfiguration;
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
}
/**
- * Sets the value of the repositoryConfiguration property.
+ * Sets the value of the externalConfig property.
*
* @param value
* allowed object is
- * {@link RepositoryConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public void setRepositoryConfiguration(RepositoryConfigurationType value) {
- this.repositoryConfiguration = value;
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
}
+ /**
+ * Gets the value of the defaultIdentityStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultIdentityStoreId() {
+ return defaultIdentityStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultIdentityStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultIdentityStoreId(String value) {
+ this.defaultIdentityStoreId = value;
+ }
+
+ /**
+ * Gets the value of the defaultAttributeStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultAttributeStoreId() {
+ return defaultAttributeStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultAttributeStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultAttributeStoreId(String value) {
+ this.defaultAttributeStoreId = value;
+ }
+
+ /**
+ * Gets the value of the identityStoreMappings property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public IdentityStoreMappingsType getIdentityStoreMappings() {
+ return identityStoreMappings;
+ }
+
+ /**
+ * Sets the value of the identityStoreMappings property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public void setIdentityStoreMappings(IdentityStoreMappingsType value) {
+ this.identityStoreMappings = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference
Implementation, vJAXB 2.1.3 in JDK
// See <a
href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/...
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@javax.xml.bind.annotation.XmlSchema(namespace =
"urn:jboss:identity:config:v0_1", elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -27,6 +27,9 @@
import java.util.Set;
import java.util.HashMap;
import java.util.Collections;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.CascadeType;
@@ -100,14 +103,14 @@
this.identityType = identityType;
}
- public Long getId()
+ public String getId()
{
- return id;
+ return id.toString();
}
- public void setId(Long id)
+ public void setId(String id)
{
- this.id = id;
+ this.id = Long.valueOf(id);
}
public String getName()
@@ -144,24 +147,32 @@
return new HashSet<String>();
}
- public Map<String, Set<String>> getAttributes()
+ public Map<String, String[]> getAttributes()
{
- Map<String, Set<String>> map = new HashMap<String,
Set<String>>();
+ Map<String, String[]> map = new HashMap<String, String[]>();
for (HibernateIdentityObjectAttribute attribute : attributes.values())
{
- map.put(attribute.getName(),
Collections.unmodifiableSet(attribute.getValues()));
+ Set<String> values = attribute.getValues();
+ map.put(attribute.getName(),values.toArray(new String[values.size()]));
}
return Collections.unmodifiableMap(map);
}
+ public void setAttribute(String name, String[] values)
+ {
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
+ }
+
public void setAttribute(String name, Set<String> values)
{
- attributes.put(name, new HibernateIdentityObjectAttribute(name, new
HashSet<String>(values)));
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
}
- public void addAttributeValues(String name, Set<String> values)
+ public void addAttributeValues(String name, String[] values)
{
if (!attributes.containsKey(name))
{
@@ -170,7 +181,8 @@
else
{
Set<String> mergedValues = new
HashSet<String>((attributes.get(name)).getValues());
- mergedValues.addAll(values);
+ List<String> list = Arrays.asList(values);
+ mergedValues.addAll(new HashSet<String>(list));
setAttribute(name, mergedValues);
}
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -33,6 +33,8 @@
import javax.persistence.Embedded;
import java.util.Set;
import java.util.HashSet;
+import java.util.List;
+import java.util.Arrays;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -66,6 +68,13 @@
this.values = values;
}
+ public HibernateIdentityObjectAttribute(String name, String[] values)
+ {
+ List<String> list = Arrays.asList(values);
+ this.name = name;
+ this.values = new HashSet<String>(list);
+ }
+
public Long getId()
{
return id;
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -25,7 +25,6 @@
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.exception.PolicyValidationException;
-import org.jboss.identity.impl.types.SimpleIdentityObjectType;
import java.util.Set;
import java.util.Map;
@@ -49,7 +48,7 @@
this.type = type;
}
- public Object getId()
+ public String getId()
{
return dn;
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -27,6 +27,7 @@
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
@@ -34,6 +35,7 @@
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import
org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
@@ -41,7 +43,6 @@
import java.util.Collection;
import java.util.Set;
import java.util.HashMap;
-import java.io.IOException;
/**
* LADP + DB
@@ -130,6 +131,7 @@
public FeaturesMetaData getSupportedFeatures()
{
+ //TODO: a wrapper around all stores metadata
return null;
}
@@ -212,7 +214,7 @@
return targetStore.findIdentityObject(targetCtx, name, identityObjectType);
}
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, Object id) throws IdentityException
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, String id) throws IdentityException
{
//TODO: store
@@ -230,32 +232,24 @@
return defaultIdentityStore.findIdentityObject(invocationContext, id);
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean
ascending) throws IdentityException
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, IdentityObjectSearchControl[] controls) throws IdentityException
{
IdentityStore targetStore = resolveIdentityStore(identityType);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore,
invocationCtx);
- return targetStore.findIdentityObject(targetCtx, identityType, nameFilter, offset,
limit, orderByName, ascending);
+ return targetStore.findIdentityObject(targetCtx, identityType, controls);
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, Map<String, String[]> attributes, int offset, int limit, boolean
orderByName, boolean ascending) throws IdentityException
- {
- IdentityStore targetStore = resolveIdentityStore(identityType);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore,
invocationCtx);
-
- return targetStore.findIdentityObject(targetCtx, identityType, attributes, offset,
limit, orderByName, ascending);
- }
-
public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCxt,
IdentityObject identity,
IdentityObjectRelationshipType
relationshipType,
boolean parent,
- int offset, int limit, boolean
orderByName, boolean ascending) throws IdentityException
+ IdentityObjectSearchControl[]
controls) throws IdentityException
{
//TODO:
IdentityStoreInvocationContext targetCtx =
resolveInvocationContext(defaultIdentityStore, invocationCxt);
- return defaultIdentityStore.findIdentityObject(targetCtx, identity,
relationshipType, parent, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.findIdentityObject(targetCtx, identity,
relationshipType, parent, controls);
}
@@ -393,46 +387,38 @@
return defaultIdentityStore.removeRelationshipName(defaultCtx, name);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int
offset, int limit, boolean orderByName, boolean ascending) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
{
IdentityStoreInvocationContext defaultCtx =
resolveInvocationContext(defaultIdentityStore, ctx);
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(defaultCtx, offset, limit,
orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, controls);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending)
throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
{
IdentityStoreInvocationContext defaultCtx =
resolveInvocationContext(defaultIdentityStore, ctx);
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, offset,
limit, orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, controls);
}
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx,
IdentityObjectType type) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
{
- IdentityStore toStore = resolveIdentityStore(type);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
-
- return toStore.hasPasswordAttribute(targetCtx, type);
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
- {
IdentityStore toStore = resolveIdentityStore(identityObject);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- return toStore.validatePassword(targetCtx, identityObject, password);
+ return toStore.validateCredential(targetCtx, identityObject, credential);
}
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
{
IdentityStore toStore = resolveIdentityStore(identityObject);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- toStore.updatePassword(targetCtx, identityObject, password);
+ toStore.updateCredential(targetCtx, identityObject, credential);
}
@@ -446,7 +432,7 @@
//return
resolveIdentityStore(identityType).getSupportedAttributeNames(invocationContext,
identityType);
}
- public Map<String, Set<String>>
getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity)
throws IdentityException
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext
invocationContext, IdentityObject identity) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from
defaultAttributeStore. For now just use the default one.
@@ -456,7 +442,7 @@
//return resolveIdentityStore(identity).getAttributes(invocationContext,
identity);
}
- public void updateAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Map<String, Set<String>> attributes) throws
IdentityException
+ public void updateAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from
defaultAttributeStore. For now just use the default one.
@@ -466,7 +452,7 @@
//resolveIdentityStore(identity).updateAttributes(invocationCtx, identity,
attributes);
}
- public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, String[]> attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from
defaultAttributeStore. For now just use the default one.
@@ -476,7 +462,7 @@
//resolveIdentityStore(identity).addAttributes(invocationCtx, identity,
attributes);
}
- public void removeAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Set<String> attributes) throws IdentityException
+ public void removeAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, String[] attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from
defaultAttributeStore. For now just use the default one.
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -46,160 +46,160 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
* @version : 0.1 $
*/
-public class WrapperIdentityStoreRepository extends AbstractIdentityStoreRepository
-{
-
- private final IdentityStore identityStore;
-
- private final AttributeStore attributeStore;
-
- public WrapperIdentityStoreRepository(IdentityStore identityStore, AttributeStore
attributeStore,
- Map<String, IdentityStore>
identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
- {
-// super(identityStoreMappings, attributeStoreMappings);
+//public class WrapperIdentityStoreRepository extends AbstractIdentityStoreRepository
+//{
//
- this.identityStore = identityStore;
- this.attributeStore = attributeStore;
- }
-
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
- {
- //TODO
- }
-
- public IdentityStoreSession createIdentityStoreSession()
- {
- //TODO
- return null;
- }
-
- public String getId()
- {
- return null;
- }
-
- public FeaturesMetaData getSupportedFeatures()
- {
- return null;
- }
-
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext
invocationCtx, String name, IdentityObjectType identityObjectType) throws
IdentityException
- {
- return identityStore.createIdentityObject(invocationCtx, name,
identityObjectType);
- }
-
- public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity) throws IdentityException
- {
- identityStore.removeIdentityObject(invocationCtx, identity);
- }
-
- public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType) throws IdentityException
- {
- return identityStore.getIdentityObjectsCount(invocationCtx, identityType);
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, String name, IdentityObjectType identityObjectType) throws
IdentityException
- {
- return identityStore.findIdentityObject(invocationContext, name,
identityObjectType);
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, Object id) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationContext, id);
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean
ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCtx, identityType, nameFilter,
offset, limit, orderByName, ascending);
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, Map<String, String[]> attributes, int offset, int limit, boolean
orderByName, boolean ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCtx, identityType, attributes,
offset, limit, orderByName, ascending);
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit,
boolean orderByName, boolean ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCxt, identity, relationshipType,
parent, offset, limit, orderByName, ascending);
- }
-
- public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType, String relationshipName, boolean
createNames) throws IdentityException
- {
- return identityStore.createRelationship(invocationCxt, fromIdentity, toIdentity,
relationshipType, relationshipName, createNames);
- }
-
- public void removeRelationship(IdentityStoreInvocationContext invocationCxt,
IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType
relationshipType, String relationshipName) throws IdentityException
- {
- identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity,
relationshipType, relationshipName);
- }
-
- public void removeRelationships(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity1, IdentityObject identity2, boolean named) throws
IdentityException
- {
- identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
- }
-
- public Set<IdentityObjectRelationship>
resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject
fromIdentity, IdentityObject toIdentity) throws IdentityException
- {
- return identityStore.resolveRelationships(invocationCxt, fromIdentity,
toIdentity);
- }
-
- public String createRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
- {
- return identityStore.createRelationshipName(ctx, name);
- }
-
- public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
- {
- return identityStore.removeRelationshipName(ctx, name);
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int
offset, int limit, boolean orderByName, boolean ascending) throws IdentityException,
OperationNotSupportedException
- {
- return identityStore.getRelationshipNames(ctx, offset, limit, orderByName,
ascending);
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending)
throws IdentityException, OperationNotSupportedException
- {
- return identityStore.getRelationshipNames(ctx, identity, offset, limit,
orderByName, ascending);
- }
-
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx,
IdentityObjectType type) throws IdentityException
- {
- return identityStore.hasPasswordAttribute(ctx, type);
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
- {
- return identityStore.validatePassword(ctx, identityObject, password);
- }
-
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
- {
- identityStore.updatePassword(ctx, identityObject, password);
- }
-
- public <T extends IdentityObjectType> Set<String>
getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, T
identityType) throws IdentityException
- {
- return attributeStore.getSupportedAttributeNames(invocationContext, identityType);
- }
-
- public Map<String, Set<String>>
getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity)
throws IdentityException
- {
- return attributeStore.getAttributes(invocationContext, identity);
- }
-
- public void updateAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Map<String, Set<String>> attributes) throws
IdentityException
- {
- attributeStore.updateAttributes(invocationCtx, identity, attributes);
- }
-
- public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, Set<String>> attributes) throws IdentityException
- {
- attributeStore.addAttributes(invocationCtx, identity, attributes);
- }
-
- public void removeAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Set<String> attributes) throws IdentityException
- {
- attributeStore.removeAttributes(invocationCtx, identity, attributes);
- }
-}
+// private final IdentityStore identityStore;
+//
+// private final AttributeStore attributeStore;
+//
+// public WrapperIdentityStoreRepository(IdentityStore identityStore, AttributeStore
attributeStore,
+// Map<String, IdentityStore>
identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
+// {
+//// super(identityStoreMappings, attributeStoreMappings);
+////
+// this.identityStore = identityStore;
+// this.attributeStore = attributeStore;
+// }
+//
+// public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+// {
+// //TODO
+// }
+//
+// public IdentityStoreSession createIdentityStoreSession()
+// {
+// //TODO
+// return null;
+// }
+//
+// public String getId()
+// {
+// return null;
+// }
+//
+// public FeaturesMetaData getSupportedFeatures()
+// {
+// return null;
+// }
+//
+// public IdentityObject createIdentityObject(IdentityStoreInvocationContext
invocationCtx, String name, IdentityObjectType identityObjectType) throws
IdentityException
+// {
+// return identityStore.createIdentityObject(invocationCtx, name,
identityObjectType);
+// }
+//
+// public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity) throws IdentityException
+// {
+// identityStore.removeIdentityObject(invocationCtx, identity);
+// }
+//
+// public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx,
IdentityObjectType identityType) throws IdentityException
+// {
+// return identityStore.getIdentityObjectsCount(invocationCtx, identityType);
+// }
+//
+// public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, String name, IdentityObjectType identityObjectType) throws
IdentityException
+// {
+// return identityStore.findIdentityObject(invocationContext, name,
identityObjectType);
+// }
+//
+// public IdentityObject findIdentityObject(IdentityStoreInvocationContext
invocationContext, Object id) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationContext, id);
+// }
+//
+// public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean
ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCtx, identityType, nameFilter,
offset, limit, orderByName, ascending);
+// }
+//
+// public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType
identityType, Map<String, String[]> attributes, int offset, int limit, boolean
orderByName, boolean ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCtx, identityType, attributes,
offset, limit, orderByName, ascending);
+// }
+//
+// public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit,
boolean orderByName, boolean ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCxt, identity,
relationshipType, parent, offset, limit, orderByName, ascending);
+// }
+//
+// public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType, String relationshipName, boolean
createNames) throws IdentityException
+// {
+// return identityStore.createRelationship(invocationCxt, fromIdentity, toIdentity,
relationshipType, relationshipName, createNames);
+// }
+//
+// public void removeRelationship(IdentityStoreInvocationContext invocationCxt,
IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType
relationshipType, String relationshipName) throws IdentityException
+// {
+// identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity,
relationshipType, relationshipName);
+// }
+//
+// public void removeRelationships(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity1, IdentityObject identity2, boolean named) throws
IdentityException
+// {
+// identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
+// }
+//
+// public Set<IdentityObjectRelationship>
resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject
fromIdentity, IdentityObject toIdentity) throws IdentityException
+// {
+// return identityStore.resolveRelationships(invocationCxt, fromIdentity,
toIdentity);
+// }
+//
+// public String createRelationshipName(IdentityStoreInvocationContext ctx, String
name) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.createRelationshipName(ctx, name);
+// }
+//
+// public String removeRelationshipName(IdentityStoreInvocationContext ctx, String
name) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.removeRelationshipName(ctx, name);
+// }
+//
+// public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException,
OperationNotSupportedException
+// {
+// return identityStore.getRelationshipNames(ctx, offset, limit, orderByName,
ascending);
+// }
+//
+// public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending)
throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.getRelationshipNames(ctx, identity, offset, limit,
orderByName, ascending);
+// }
+//
+// public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx,
IdentityObjectType type) throws IdentityException
+// {
+// return identityStore.hasPasswordAttribute(ctx, type);
+// }
+//
+// public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
+// {
+// return identityStore.validatePassword(ctx, identityObject, password);
+// }
+//
+// public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
+// {
+// identityStore.updatePassword(ctx, identityObject, password);
+// }
+//
+// public <T extends IdentityObjectType> Set<String>
getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, T
identityType) throws IdentityException
+// {
+// return attributeStore.getSupportedAttributeNames(invocationContext,
identityType);
+// }
+//
+// public Map<String, Set<String>>
getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity)
throws IdentityException
+// {
+// return attributeStore.getAttributes(invocationContext, identity);
+// }
+//
+// public void updateAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Map<String, Set<String>> attributes) throws
IdentityException
+// {
+// attributeStore.updateAttributes(invocationCtx, identity, attributes);
+// }
+//
+// public void addAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Map<String, Set<String>> attributes) throws
IdentityException
+// {
+// attributeStore.addAttributes(invocationCtx, identity, attributes);
+// }
+//
+// public void removeAttributes(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity, Set<String> attributes) throws IdentityException
+// {
+// attributeStore.removeAttributes(invocationCtx, identity, attributes);
+// }
+//}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -23,14 +23,22 @@
package org.jboss.identity.impl.store;
import org.jboss.identity.spi.store.FeaturesMetaData;
-import org.jboss.identity.spi.store.OperationType;
-import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.spi.credential.IdentityObjectCredentialType;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
import org.jboss.identity.exception.IdentityException;
import java.util.Set;
import java.util.Map;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.HashSet;
+import java.util.Collections;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -38,43 +46,145 @@
*/
public class FeaturesMetaDataImpl implements FeaturesMetaData
{
- public Set<OperationType> getSupportedOperations(IdentityObjectType
identityObjectType) throws IdentityTypeNotSupportedException
+ private Set<String> supportedTypeNames = new HashSet<String>();
+
+ private final Set<Class> supportedSearchControls;
+
+ private final Map<String, Set<String>> supportedCredentials;
+
+ private Map<String, Map<String, Set<String>>>
supportedRelationshipMappings = new HashMap<String, Map<String,
Set<String>>>();
+
+
+ public FeaturesMetaDataImpl(IdentityStoreConfigurationMetaData configurationMD,
+ Set<Class> supportedControls,
+ Map<String, Set<String>>
supportedCredentials)
{
- return null;
+ for (IdentityObjectTypeMetaData typeMetaData :
configurationMD.getSupportedIdentityTypes())
+ {
+ supportedTypeNames.add(typeMetaData.getName());
+ }
+
+ supportedTypeNames = Collections.unmodifiableSet(supportedTypeNames);
+
+ this.supportedSearchControls = Collections.unmodifiableSet(supportedControls);
+
+ this.supportedCredentials = Collections.unmodifiableMap(supportedCredentials);
+
+
+ // Supported relationships
+
+ List<String> relationshipNames =
configurationMD.getSupportedRelationshipTypes();
+
+ for (IdentityObjectTypeMetaData identityObjectTypeMetaData :
configurationMD.getSupportedIdentityTypes())
+ {
+ String fromTypeName = identityObjectTypeMetaData.getName();
+
+ if (identityObjectTypeMetaData.getRelationships() == null)
+ {
+ continue;
+ }
+
+ for (RelationshipMetaData relationshipMetaData :
identityObjectTypeMetaData.getRelationships())
+ {
+ String relationshipName = relationshipMetaData.getRelationshipTypeRef();
+ String toTypeName = relationshipMetaData.getIdentityObjectTypeRef();
+
+ // Check if metadata info is consistent
+ if (relationshipNames.contains(relationshipName))
+ {
+ // Populate
+
+ Map<String, Set<String>> mappings = null;
+
+ if (supportedRelationshipMappings.containsKey(relationshipName))
+ {
+ mappings = supportedRelationshipMappings.get(relationshipName);
+
+ }
+ else
+ {
+ mappings = new HashMap<String, Set<String>>();
+ supportedRelationshipMappings.put(relationshipName, mappings);
+ }
+
+ Set<String> toTypes = null;
+ if (mappings.containsKey(fromTypeName))
+ {
+ toTypes = mappings.get(fromTypeName);
+ }
+ else
+ {
+ toTypes = new HashSet<String>();
+ mappings.put(fromTypeName, toTypes);
+ }
+
+ toTypes.add(toTypeName);
+
+ }
+ }
+ }
+
+
+
}
- public boolean isOperationSupported(OperationType operationType, IdentityObjectType
identityObjectType) throws IdentityTypeNotSupportedException
+ public boolean isControlSupported(IdentityObjectType identityObjectType,
IdentityObjectSearchControl control)
{
- return true;
+ if (supportedSearchControls.contains(control.getClass()))
+ {
+ return true;
+ }
+ return false;
}
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType
operationType)
+ public boolean isControlSupported(IdentityObjectType identityObjectType, Class
controlClazz)
{
- return null;
+ if (supportedSearchControls.contains(controlClazz))
+ {
+ return true;
+ }
+ return false;
}
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes()
+ public Set<String> getSupportedIdentityObjectTypes()
{
- return null;
+ return supportedTypeNames;
}
public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
{
- return true;
+ if (supportedTypeNames.contains(identityObjectType.getName()))
+ {
+ return true;
+ }
+ return false;
}
public boolean isRelationshipTypeSupported(IdentityObjectType fromType,
IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws
IdentityException
{
- return true;
+ Map<String, Set<String>> mappings =
supportedRelationshipMappings.get(relationshipType.getName());
+ if (mappings != null && mappings.containsKey(fromType.getName()))
+ {
+ if (mappings.get(fromType.getName()).contains(toType.getName()))
+ {
+ return true;
+ }
+ }
+ return false;
}
- public Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes()
+ public Set<String> getSupportedRelationshipTypes()
{
- return null;
+ return supportedRelationshipMappings.keySet();
}
- public Map<IdentityObjectRelationshipType, Map<IdentityObjectType,
IdentityObjectType>> getSupportedRelationshipTypeMappings()
+ public boolean isCredentialSupported(IdentityObjectType identityObjectType,
IdentityObjectCredentialType credentialType)
{
- return null;
+ Set<String> types = supportedCredentials.get(identityObjectType.getName());
+ if (types != null && types.contains(credentialType))
+ {
+ return true;
+ }
+ return false;
}
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -26,6 +26,7 @@
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -33,6 +34,7 @@
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
@@ -55,6 +57,7 @@
import java.util.Iterator;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
@@ -101,12 +104,17 @@
// TODO: rewrite this into some more handy object
private IdentityStoreConfigurationMetaData configurationMD;
+ private static Set<Class> supportedSearchControls = new HashSet<Class>();
+
+ static {
+ // List all supported controls classes
+
+ //TODO:
+ //supportedSearchControls.add()
+ }
+
public HibernateIdentityStoreImpl(String id)
{
- // For now just dummy impl
- //TODO: initialize with configuration
- supportedFeatures = new FeaturesMetaDataImpl();
-
this.id = id;
}
@@ -114,7 +122,7 @@
{
this.configurationMD = configurationMD;
- //TODO: bootstrap supportedFeatures from configMD
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedSearchControls, new HashMap<String, Set<String>>());
String persistenceUnit = configurationMD.getOptionSingleValue(PERSISTENCE_UNIT);
@@ -171,7 +179,6 @@
}
-
}
@@ -310,7 +317,7 @@
return hibernateObject;
}
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, Object
id) throws IdentityException
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, String
id) throws IdentityException
{
if (id == null)
{
@@ -331,9 +338,12 @@
return hibernateObject;
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType,
String nameFilter, int offset, int limit, boolean orderedByName, boolean ascending) throws
IdentityException
+
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx,
+ IdentityObjectType identityType,
+ IdentityObjectSearchControl[]
controls) throws IdentityException
{
-
//TODO:OrderBy
//TODO:Improve pagination
@@ -347,14 +357,16 @@
{
Query q =
getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectsByType")
- .setParameter("typeName", hibernateType.getName())
- .setFirstResult(offset);
+ .setParameter("typeName", hibernateType.getName());
- if (limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+ //.setFirstResult(offset);
+// if (limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
+
results = (List<IdentityObject>)q.getResultList();
}
@@ -366,13 +378,14 @@
return results;
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType,
Map<String, String[]> attributes, int offset, int limit, boolean orderByName,
boolean ascending) throws IdentityException
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType)
throws IdentityException
{
- //TODO: NYI
- throw new NotYetImplementedException();
+ return findIdentityObject(ctx, identityType, null);
}
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit,
boolean orderByName, boolean ascending) throws IdentityException
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent,
IdentityObjectSearchControl[] controls) throws IdentityException
{
//TODO:test
//TODO:Improve pagination
@@ -387,51 +400,57 @@
StringBuilder hqlString = new StringBuilder("");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
if (parent)
{
hqlString.append("select ior.toIdentityObject from
HibernateIdentityObjectRelationship ior where ior.type.name like :relType and
ior.fromIdentityObject like :identity");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
}
else
{
hqlString.append("select ior.fromIdentityObject from
HibernateIdentityObjectRelationship ior where ior.type.name like :relType and
ior.toIdentityObject like :identity");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
}
q =
getHibernateEntityManager(ctx).getSession().createQuery(hqlString.toString())
.setParameter("relType", relationshipType.getName())
- .setParameter("identity",hibernateObject)
- .setFirstResult(offset);
+ .setParameter("identity",hibernateObject);
+ //TODO: controls
+ //.setFirstResult(offset);
- if (limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if (limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
results = q.list();
@@ -445,6 +464,12 @@
return results;
}
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent) throws IdentityException
+ {
+
+ return findIdentityObject(ctx, identity, relationshipType, parent, null);
+ }
+
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType,
String name, boolean createNames) throws
IdentityException
@@ -545,6 +570,8 @@
}
+
+
public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject
identity1, IdentityObject identity2, boolean named) throws IdentityException
{
//TODO: named
@@ -641,7 +668,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int
offset, int limit, boolean orderByName, boolean ascending) throws IdentityException,
OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
{
//TODO: orderByName
@@ -650,13 +677,15 @@
try
{
- Query q =
getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNames")
- .setFirstResult(offset);
+ Query q =
getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNames");
+ //TODO: controls
+ // .setFirstResult(offset);
- if(limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if(limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
List<String> results = (List<String>)q.getResultList();
@@ -671,8 +700,15 @@
return names;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending)
throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx)
throws IdentityException, OperationNotSupportedException
{
+ return getRelationshipNames(ctx, new IdentityObjectSearchControl[]{});
+ }
+
+
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
+ {
//TODO: NYI
//TODO: orderByName
@@ -684,13 +720,15 @@
try
{
Query q =
getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObject")
- .setParameter("identityObject", hibernateObject)
- .setFirstResult(offset);
+ .setParameter("identityObject", hibernateObject);
+ //TODO: controls
+// .setFirstResult(offset);
- if(limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if(limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
List<String> results = (List<String>)q.getResultList();
@@ -705,6 +743,11 @@
return names;
}
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity) throws IdentityException, OperationNotSupportedException
+ {
+ return getRelationshipNames(ctx, identity, null);
+ }
+
// Attribute store
public <T extends IdentityObjectType> Set<String>
getSupportedAttributeNames(IdentityStoreInvocationContext ctx, T identityType) throws
IdentityException
@@ -713,7 +756,7 @@
throw new NotYetImplementedException();
}
- public Map<String, Set<String>>
getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws
IdentityException
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext ctx,
IdentityObject identity) throws IdentityException
{
HibernateIdentityObject hibernateObject = safeGet(ctx, identity);
@@ -722,7 +765,7 @@
}
- public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Map<String, String[]> attributes) throws IdentityException
{
if (attributes == null)
@@ -739,7 +782,7 @@
}
- public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity,
Map<String, Set<String>> attributes) throws IdentityException
+ public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity,
Map<String, String[]> attributes) throws IdentityException
{
if (attributes == null)
@@ -755,7 +798,7 @@
}
}
- public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Set<String> attributes) throws IdentityException
+ public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, String[] attributes) throws IdentityException
{
if (attributes == null)
@@ -777,13 +820,13 @@
throw new NotYetImplementedException();
}
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
throw new NotYetImplementedException();
}
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
throw new NotYetImplementedException();
Deleted:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -1,1446 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.impl.store.ldap;
-
-import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.FeaturesMetaData;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.spi.store.IdentityStoreSession;
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.spi.model.IdentityObjectRelationship;
-import org.jboss.identity.spi.exception.OperationNotSupportedException;
-import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
-import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
-import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
-import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectRelationshipImpl;
-import org.jboss.identity.impl.helper.Tools;
-import org.jboss.identity.impl.NotYetImplementedException;
-
-import javax.naming.ldap.LdapContext;
-import javax.naming.ldap.LdapName;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.DirContext;
-import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Context;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Arrays;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPIdentityStore implements IdentityStore
-{
-
- private static Logger log = Logger.getLogger(LDAPIdentityStore.class.getName());
-
- private final String id;
-
- private FeaturesMetaData supportedFeatures;
-
- LDAPIdentityStoreConfiguration configuration;
-
- public LDAPIdentityStore(String id)
- {
- this.id = id;
- }
-
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
- {
- configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
-
- //TODO: populate with configuration
- supportedFeatures = new FeaturesMetaDataImpl();
-
- }
-
- public IdentityStoreSession createIdentityStoreSession()
- {
-
- return new LDAPIdentityStoreSessionImpl(
- "com.sun.jndi.ldap.LdapCtxFactory",
- configuration.getProviderURL(),
- "simple",
- configuration.getAdminDN(),
- configuration.getAdminPassword());
-
- }
-
- public String getId()
- {
- return id;
- }
-
- public FeaturesMetaData getSupportedFeatures()
- {
- return supportedFeatures;
- }
-
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext
invocationCtx, String name, IdentityObjectType type) throws IdentityException
- {
- if (name == null)
- {
- throw new IdentityException("Name cannot be null");
- }
-
- checkIOType(type);
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".createIdentityObject with name: " + name +
" and type: " + type.getName());
- }
-
- LdapContext ldapContext = getLDAPContext(invocationCtx);
-
- try
- {
- // If there are many contexts specified in the configuration the first one is
used
- LdapContext ctx =
(LdapContext)ldapContext.lookup(getTypeConfiguration(invocationCtx,
type).getCtxDNs()[0]);
-
- //We store new entry using set of attributes. This should give more flexibility
then
- //extending identity object from ContextDir - configure what objectClass place
there
- Attributes attrs = new BasicAttributes(true);
-
- //create attribute using provided configuration
- Map<String, String[]> attributesToAdd =
getTypeConfiguration(invocationCtx, type).getCreateEntryAttributeValues();
-
- //attributes
- for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
- {
- String attributeName = (String)it1.next();
-
-
- Attribute attr = new BasicAttribute(attributeName);
- String[] attributeValues = attributesToAdd.get(attributeName);
-
- //values
-
- for (String attrValue : attributeValues)
- {
- attr.add(attrValue);
- }
-
- attrs.put(attr);
- }
-
- // Make it RFC 2253 compliant
- LdapName validLDAPName = new LdapName(getTypeConfiguration(invocationCtx,
type).getIdAttributeName().concat("=").concat(name));
-
- log.finer("creating ldap entry for: " + validLDAPName + "; "
+ attrs);
- ctx.createSubcontext(validLDAPName, attrs);
- }
- catch (Exception e)
- {
- throw new IdentityException("Failed to create identity object", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return findIdentityObject(invocationCtx, name, type);
-
- }
-
- public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeIdentityObject: " + identity);
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(invocationCtx, identity);
-
- String dn = ldapIdentity.getDn();
-
- if (dn == null)
- {
- throw new IdentityException("Cannot obtain DN of identity");
- }
-
- LdapContext ldapContext = getLDAPContext(invocationCtx);
-
- try
- {
- log.finer("removing entry: " + dn);
- ldapContext.unbind(dn);
- }
- catch (Exception e)
- {
- throw new IdentityException("Failed to remove identity: ", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- }
-
- public int getIdentityObjectsCount(IdentityStoreInvocationContext ctx,
IdentityObjectType identityType) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getIdentityObjectsCount for type: " +
identityType);
- }
-
- checkIOType(identityType);
-
- try
- {
- String filter = getTypeConfiguration(ctx, identityType).getEntrySearchFilter();
-
- if (filter != null && filter.length() > 0)
- {
- //* chars are escaped in filterArgs so we must replace it manually
- filter = filter.replaceAll("\\{0\\}", "*");
- }
- else
- {
- //search all entries
- filter = "(".concat(getTypeConfiguration(ctx,
identityType).getIdAttributeName()).concat("=").concat("*").concat(")");
- }
-
- //log.debug("Search filter: " + filter);
- List sr = searchIdentityObjects(ctx, identityType, filter, null, new
String[]{getTypeConfiguration(ctx, identityType).getIdAttributeName()});
-
- return sr.size();
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found", e);
- }
- catch (Exception e)
- {
- throw new IdentityException("User search failed.", e);
- }
- return 0;
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationCtx,
String name, IdentityObjectType type) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with name: " + name +
"; and type: " + type);
- }
-
- Context ctx = null;
- checkIOType(type);
- try
- {
- //log.debug("name = " + name);
-
- if (name == null)
- {
- throw new IdentityException("Identity object name canot be null");
- }
-
- String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
- List sr = null;
-
- if (filter != null && filter.length() > 0)
- {
- Object[] filterArgs = {name};
- sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- //search all entries
- filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat(name).concat(")");
- sr = searchIdentityObjects(invocationCtx, type, filter, null, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
-
- //log.debug("Search filter: " + filter);
-
- if (sr.size() > 1)
- {
- throw new IdentityException("Found more than one identity object with
name: " + name +
- "; Posible data inconsistency");
- }
- SearchResult res = (SearchResult)sr.iterator().next();
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- IdentityObject io = createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn);
- ctx.close();
- return io;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return null;
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, Object
id) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with id: " + id);
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- if (id == null)
- {
- throw new IdentityException("identity id cannot be null");
- }
-
- if (!(id instanceof String))
- {
- throw new IdentityException("identity id must be String object");
- }
-
- String dn = id.toString();
-
- IdentityObjectType type = null;
-
- //Recognize the type by ctx DN
-
- IdentityObjectType[] possibleTypes =
getConfiguration(ctx).getConfiguredTypes();
-
- for (IdentityObjectType possibleType : possibleTypes)
- {
- String[] typeCtxs = getTypeConfiguration(ctx, possibleType).getCtxDNs();
-
- for (String typeCtx : typeCtxs)
- {
- if (dn.endsWith(typeCtx))
- {
- type = possibleType;
- break;
- }
- }
- if (type != null)
- {
- break;
- }
- }
-
- if (type == null)
- {
- throw new IdentityException("Cannot recognize identity object type by
its DN: " + dn);
- }
-
- // Grab entry
-
- Attributes attrs = ldapContext.getAttributes(dn);
-
- if (attrs == null)
- {
- throw new IdentityException("Can't find identity entry with DN:
" + dn);
- }
-
- return createIdentityObjectInstance(ctx, type, attrs, dn);
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with dn: " + dn, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Identity object search failed.", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return null;
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type,
String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws
IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with type: " + type
- + "; nameFilter: " + nameFilter
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- //TODO: handle paged results and sort
-
- Context ctx = getLDAPContext(invocationCtx);
- checkIOType(type);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
- String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
- List<SearchResult> sr = null;
-
- if (filter != null && filter.length() > 0)
- {
-
- Object[] filterArgs = {nameFilter};
- sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat(nameFilter).concat(")");
- sr = searchIdentityObjects(invocationCtx, type, filter, null, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
-
-
- for (SearchResult res : sr)
- {
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- objects.add(createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn));
- }
-
- ctx.close();
- return objects;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return objects;
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type,
Map<String, String[]> attributes, int offset, int limit, boolean orderByName,
boolean ascending) throws IdentityException
- {
- //TODO: handle paged results and sort
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with type: " + type
- + "; attributes: " + attributes
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- Context ctx = getLDAPContext(invocationCtx);
- checkIOType(type);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
- String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
- List<SearchResult> sr = null;
-
- //TODO: if no search filter is present just use search method with
matchingAttributes from DirContext instead of
- //TODO: concatenating filter
-
- StringBuilder af = new StringBuilder("(&");
-
- for (Map.Entry<String, String[]> stringEntry : attributes.entrySet())
- {
- for (String value : stringEntry.getValue())
- {
- af.append("(")
- .append(stringEntry.getKey())
- .append("=")
- .append(value)
- .append(")");
- }
- }
-
- af.append(")");
-
- if (filter != null && filter.length() > 0)
- {
- // chars are escaped in filterArgs so we must replace it manually
- filter = filter.replaceAll("\\{0\\}", "*");
-
- Object[] filterArgs = {};
- sr = searchIdentityObjects(invocationCtx, type, "&(" + filter +
")" + af.toString(), filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat("*").concat(")");
- sr = searchIdentityObjects(invocationCtx, type, "&(" + filter +
")" + af.toString(), null, new String[]{getTypeConfiguration(invocationCtx,
type).getIdAttributeName()});
- }
-
-
- for (SearchResult res : sr)
- {
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- objects.add(createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn));
- }
-
- ctx.close();
- return objects;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return objects;
- }
-
- public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit,
boolean orderByName, boolean ascending) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with identity: " +
identity
- + "; relationshipType: " + relationshipType
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- //TODO: handle paged results and sort
-
- Set<IdentityObjectRelationship> relationships = new
HashSet<IdentityObjectRelationship>();
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, identity);
-
- LDAPIdentityObjectTypeConfiguration typeConfig = getTypeConfiguration(ctx,
identity.getIdentityType());
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
-
- // If parent simply look for all its members
- if (parent)
- {
- Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
- Attribute member = attrs.get(typeConfig.getMembershipAttributeName());
-
- if (member != null)
- {
- NamingEnumeration memberValues = member.getAll();
- while (memberValues.hasMoreElements())
- {
- String memberRef = memberValues.nextElement().toString();
-
- if (typeConfig.isMembershipAttributeDN())
- {
- //TODO: improve
- objects.add(findIdentityObject(ctx, memberRef));
- }
- else
- {
- //TODO:
- throw new NotYetImplementedException();
- }
- break;
- }
- }
- }
-
- // if not parent all parent entries need to be found
- else
- {
- //TODO:
- throw new NotYetImplementedException();
- }
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to resolve relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return objects;
- }
-
- public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String name, boolean createNames) throws
IdentityException
- {
-
- //TODO: relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".createRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
- }
-
- LDAPIdentityObjectRelationshipImpl relationship = null;
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
-
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- // Check posibilities
- //TODO: Supported features should handle information from type configurations
-
- if
(!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(),
toIdentity.getIdentityType(), relationshipType))
- {
- throw new IdentityException("Relationship not supported");
- }
-
- try
- {
- //construct new member attribute values
- Attributes attrs = new BasicAttributes(true);
-
- Attribute member = new
BasicAttribute(fromTypeConfig.getMembershipAttributeName());
-
- if (fromTypeConfig.isMembershipAttributeDN())
- {
- member.add(ldapToIO.getDn());
- }
- else
- {
- member.add(toIdentity.getName());
- }
-
- attrs.put(member);
-
- ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REPLACE_ATTRIBUTE,
attrs);
-
- relationship = new LDAPIdentityObjectRelationshipImpl(name, ldapFromIO,
ldapToIO);
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to create relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
-
- return relationship;
- }
-
- public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject
fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType,
String name) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
- }
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
-
- // If relationship is not allowed simply return
- //TODO: use features description instead
- if
(!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
- {
- return;
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- // Check posibilities
- //TODO: Supported features should handle information from type configurations
-
- if
(!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(),
toIdentity.getIdentityType(), relationshipType))
- {
- throw new IdentityException("Relationship not supported");
- }
-
- try
- {
- //construct new member attribute values
- Attributes attrs = new BasicAttributes(true);
-
- Attribute member = new
BasicAttribute(fromTypeConfig.getMembershipAttributeName());
-
- if (fromTypeConfig.isMembershipAttributeDN())
- {
- member.add(ldapToIO.getDn());
- }
- else
- {
- member.add(toIdentity.getName());
- }
-
- attrs.put(member);
-
- ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REMOVE_ATTRIBUTE,
attrs);
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to remove relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject
identity1, IdentityObject identity2, boolean named) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeRelationships with "
- + "identity1: " + identity1
- + "; identity2: " + identity2
- );
- }
-
- // as relationship type is ignored in this impl for now...
- removeRelationship(ctx, identity1, identity2, null, null);
- removeRelationship(ctx, identity2, identity1, null, null);
-
- }
-
- public Set<IdentityObjectRelationship>
resolveRelationships(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity,
IdentityObject toIdentity) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".resolveRelationships with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- );
- }
-
- Set<IdentityObjectRelationship> relationships = new
HashSet<IdentityObjectRelationship>();
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
-
- // If relationship is not allowed return empty set
- //TODO: use features description instead
- if
(!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
- {
- return relationships;
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
- Attribute member = attrs.get(fromTypeConfig.getMembershipAttributeName());
-
- if (member != null)
- {
- NamingEnumeration memberValues = member.getAll();
- while (memberValues.hasMoreElements())
- {
- String memberRef = memberValues.nextElement().toString();
-
- if ((fromTypeConfig.isMembershipAttributeDN() &&
memberRef.equals(ldapToIO.getDn())) ||
- (!fromTypeConfig.isMembershipAttributeDN() &&
memberRef.equals(ldapToIO.getName())))
- {
- //TODO: impl lacks support for rel type
- relationships.add(new LDAPIdentityObjectRelationshipImpl(null,
ldapFromIO, ldapToIO));
- }
- break;
- }
- }
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to resolve relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return relationships;
- }
-
- public String createRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
- }
-
- public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int
offset, int limit, boolean orderByName, boolean ascending) throws IdentityException,
OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
-
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending)
throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
-
- }
-
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx,
IdentityObjectType type) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
-
- // Attributes
-
- public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext
invocationContext, IdentityObjectType identityType) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getSupportedAttributeNames with "
- + "identityType: " + identityType
- );
- }
-
- checkIOType(identityType);
-
- return getTypeConfiguration(invocationContext,
identityType).getMappedAttributesNames();
- }
-
-
- public Map<String, Set<String>>
getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws
IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getAttributes with "
- + "identity: " + identity
- );
- }
-
- Map<String, Set<String>> attrsMap = new HashMap<String,
Set<String>>();
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- Set<String> mappedNames = getTypeConfiguration(ctx,
identity.getIdentityType()).getMappedAttributesNames();
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- Attributes attrs = ldapContext.getAttributes(dn);
-
- for (Iterator iterator = mappedNames.iterator(); iterator.hasNext();)
- {
- String name = (String)iterator.next();
- String attrName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
- Attribute attr = attrs.get(attrName);
-
- if (attr != null)
- {
- NamingEnumeration values = attr.getAll();
-
- Set<String> attrValues = new HashSet<String>();
-
- while (values.hasMoreElements())
- {
- String value = values.nextElement().toString();
- attrValues.add(value);
- }
-
- attrsMap.put(name, attrValues);
- }
- else
- {
- log.fine("No such attribute ('" + attrName + "') in
entry: " + dn);
- }
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot get attributes value.", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return attrsMap;
-
- }
-
- public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Map<String, Set<String>> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".updateAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
-
- for (String name : attributes.keySet())
- {
- String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
-
- Set<String> values = attributes.get(name);
-
-
- if (values != null)
- {
- for (String value : values)
- {
- attr.add(value);
- }
-
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.REPLACE_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot add attribute", e);
- }
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity,
Map<String, Set<String>> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".addAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- for (String name : attributes.keySet())
- {
- String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
-
- Set<String> values = attributes.get(name);
-
-
- if (values != null)
- {
- for (String value : values)
- {
- attr.add(value);
- }
-
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot add attribute", e);
- }
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Set<String> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- for (String name : attributes)
- {
- String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot remove attribute", e);
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- //Internal
-
- public LDAPIdentityObjectImpl
createIdentityObjectInstance(IdentityStoreInvocationContext ctx, IdentityObjectType type,
Attributes attrs, String dn) throws IdentityException
- {
- LDAPIdentityObjectImpl ldapio = null;
- try
- {
- String idAttrName = getTypeConfiguration(ctx, type).getIdAttributeName();
-
- Attribute ida = attrs.get(idAttrName);
- if (ida == null)
- {
- throw new IdentityException("LDAP entry doesn't contain proper
attribute:" + idAttrName);
- }
-
- //make DN as user ID
- ldapio = new LDAPIdentityObjectImpl(dn, ida.get().toString(), type);
-
- }
- catch (Exception e)
- {
- throw new IdentityException("Couldn't create LDAPIdentityObjectImpl
object from ldap entry (SearchResult)", e);
- }
-
- return ldapio;
- }
-
- public List<SearchResult> searchIdentityObjects(IdentityStoreInvocationContext
ctx, IdentityObjectType type, String filter, Object[] filterArgs, String[]
returningAttributes) throws NamingException, IdentityException
- {
-
- LdapContext ldapContext = getLDAPContext(ctx);
- NamingEnumeration results = null;
-
- try
- {
-
- SearchControls controls = new SearchControls();
- controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
- controls.setReturningObjFlag(true);
- controls.setTimeLimit(getConfiguration(ctx).getSearchTimeLimit());
-
-
- if (returningAttributes != null)
- {
- controls.setReturningAttributes(returningAttributes);
- }
-
-
- String[] entryCtxs = getTypeConfiguration(ctx, type).getCtxDNs();
-
- if (entryCtxs.length == 1)
- {
- if (filterArgs == null)
- {
- results = ldapContext.search(entryCtxs[0], filter, controls);
- }
- else
- {
- results = ldapContext.search(entryCtxs[0], filter, filterArgs, controls);
- }
- return Tools.toList(results);
-
-
- }
- else
- {
- List<SearchResult> merged = new LinkedList();
-
- for (String entryCtx : entryCtxs)
- {
- if (filterArgs == null)
- {
- results = ldapContext.search(entryCtx, filter, controls);
- }
- else
- {
- results = ldapContext.search(entryCtx, filter, filterArgs, controls);
- }
- merged.addAll(Tools.toList(results));
- results.close();
- }
-
- return merged;
- }
- }
- finally
- {
- if (results != null)
- {
- results.close();
- }
- ldapContext.close();
- }
- }
-
- // HELPER
-
- private LDAPIdentityObjectImpl getSafeLDAPIO(IdentityStoreInvocationContext ctx,
IdentityObject io) throws IdentityException
- {
- if (io == null)
- {
- throw new IllegalArgumentException("IdentityObject is null");
- }
-
- if (io instanceof LDAPIdentityObjectImpl)
- {
- return (LDAPIdentityObjectImpl)io;
- }
- else
- {
- try
- {
- return (LDAPIdentityObjectImpl)findIdentityObject(ctx, io.getName(),
io.getIdentityType());
- }
- catch (IdentityException e)
- {
- throw new IdentityException("Provided IdentityObject is not present in
the store. Cannot operate on not stored objects.", e);
- }
- }
-
- }
-
- private void checkIOType(IdentityObjectType iot) throws IdentityException
- {
- if (iot == null)
- {
- throw new IllegalArgumentException("IdentityObjectType is null");
- }
-
- if (!getSupportedFeatures().isIdentityObjectTypeSupported(iot))
- {
- throw new IdentityException("IdentityType not supported by this
IdentityStore implementation: " + iot);
- }
- }
-
-
- private LdapContext getLDAPContext(IdentityStoreInvocationContext ctx) throws
IdentityException
- {
- try
- {
- return (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
- }
- catch (Exception e)
- {
- throw new IdentityException("Could not obtain LDAP connection: ", e);
- }
- }
-
- private LDAPIdentityStoreConfiguration getConfiguration(IdentityStoreInvocationContext
ctx) throws IdentityException
- {
- return configuration;
- }
-
- private LDAPIdentityObjectTypeConfiguration
getTypeConfiguration(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws
IdentityException
- {
- return getConfiguration(ctx).getTypeConfiguration(type.getName());
- }
-
- public String toString()
- {
- return this.getClass().getName() + "[" + getId() +"]";
- }
-
-
-}
Copied:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
(from rev 120,
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java)
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
(rev 0)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,1474 @@
+/*
+* 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.impl.store.ldap;
+
+import org.jboss.identity.spi.store.IdentityStore;
+import org.jboss.identity.spi.store.FeaturesMetaData;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
+import org.jboss.identity.exception.IdentityException;
+import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
+import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
+import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectRelationshipImpl;
+import org.jboss.identity.impl.helper.Tools;
+import org.jboss.identity.impl.NotYetImplementedException;
+
+import javax.naming.ldap.LdapContext;
+import javax.naming.ldap.LdapName;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.DirContext;
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
+import javax.naming.Context;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPIdentityStoreImpl implements IdentityStore
+{
+
+ private static Logger log = Logger.getLogger(LDAPIdentityStoreImpl.class.getName());
+
+ private final String id;
+
+ private FeaturesMetaData supportedFeatures;
+
+ LDAPIdentityStoreConfiguration configuration;
+
+ private static Set<Class> supportedSearchControls = new HashSet<Class>();
+
+ static {
+ // List all supported controls classes
+
+ //TODO:
+ //supportedSearchControls.add()
+ }
+
+ public LDAPIdentityStoreImpl(String id)
+ {
+ this.id = id;
+ }
+
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ {
+ configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
+
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD,
supportedSearchControls, new HashMap<String, Set<String>>());
+ }
+
+ public IdentityStoreSession createIdentityStoreSession()
+ {
+
+ return new LDAPIdentityStoreSessionImpl(
+ "com.sun.jndi.ldap.LdapCtxFactory",
+ configuration.getProviderURL(),
+ "simple",
+ configuration.getAdminDN(),
+ configuration.getAdminPassword());
+
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public FeaturesMetaData getSupportedFeatures()
+ {
+ return supportedFeatures;
+ }
+
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext
invocationCtx, String name, IdentityObjectType type) throws IdentityException
+ {
+ if (name == null)
+ {
+ throw new IdentityException("Name cannot be null");
+ }
+
+ checkIOType(type);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".createIdentityObject with name: " + name +
" and type: " + type.getName());
+ }
+
+ LdapContext ldapContext = getLDAPContext(invocationCtx);
+
+ try
+ {
+ // If there are many contexts specified in the configuration the first one is
used
+ LdapContext ctx =
(LdapContext)ldapContext.lookup(getTypeConfiguration(invocationCtx,
type).getCtxDNs()[0]);
+
+ //We store new entry using set of attributes. This should give more flexibility
then
+ //extending identity object from ContextDir - configure what objectClass place
there
+ Attributes attrs = new BasicAttributes(true);
+
+ //create attribute using provided configuration
+ Map<String, String[]> attributesToAdd =
getTypeConfiguration(invocationCtx, type).getCreateEntryAttributeValues();
+
+ //attributes
+ for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
+ {
+ String attributeName = (String)it1.next();
+
+
+ Attribute attr = new BasicAttribute(attributeName);
+ String[] attributeValues = attributesToAdd.get(attributeName);
+
+ //values
+
+ for (String attrValue : attributeValues)
+ {
+ attr.add(attrValue);
+ }
+
+ attrs.put(attr);
+ }
+
+ // Make it RFC 2253 compliant
+ LdapName validLDAPName = new LdapName(getTypeConfiguration(invocationCtx,
type).getIdAttributeName().concat("=").concat(name));
+
+ log.finer("creating ldap entry for: " + validLDAPName + "; "
+ attrs);
+ ctx.createSubcontext(validLDAPName, attrs);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to create identity object", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return findIdentityObject(invocationCtx, name, type);
+
+ }
+
+ public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx,
IdentityObject identity) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeIdentityObject: " + identity);
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(invocationCtx, identity);
+
+ String dn = ldapIdentity.getDn();
+
+ if (dn == null)
+ {
+ throw new IdentityException("Cannot obtain DN of identity");
+ }
+
+ LdapContext ldapContext = getLDAPContext(invocationCtx);
+
+ try
+ {
+ log.finer("removing entry: " + dn);
+ ldapContext.unbind(dn);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to remove identity: ", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ }
+
+ public int getIdentityObjectsCount(IdentityStoreInvocationContext ctx,
IdentityObjectType identityType) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getIdentityObjectsCount for type: " +
identityType);
+ }
+
+ checkIOType(identityType);
+
+ try
+ {
+ String filter = getTypeConfiguration(ctx, identityType).getEntrySearchFilter();
+
+ if (filter != null && filter.length() > 0)
+ {
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ }
+ else
+ {
+ //search all entries
+ filter = "(".concat(getTypeConfiguration(ctx,
identityType).getIdAttributeName()).concat("=").concat("*").concat(")");
+ }
+
+ //log.debug("Search filter: " + filter);
+ List sr = searchIdentityObjects(ctx, identityType, filter, null, new
String[]{getTypeConfiguration(ctx, identityType).getIdAttributeName()});
+
+ return sr.size();
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return 0;
+ }
+
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationCtx,
String name, IdentityObjectType type) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".findIdentityObject with name: " + name +
"; and type: " + type);
+ }
+
+ Context ctx = null;
+ checkIOType(type);
+ try
+ {
+ //log.debug("name = " + name);
+
+ if (name == null)
+ {
+ throw new IdentityException("Identity object name canot be null");
+ }
+
+ String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
+ List sr = null;
+
+ if (filter != null && filter.length() > 0)
+ {
+ Object[] filterArgs = {name};
+ sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+ else
+ {
+ //search all entries
+ filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat(name).concat(")");
+ sr = searchIdentityObjects(invocationCtx, type, filter, null, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+
+ //log.debug("Search filter: " + filter);
+
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one identity object with
name: " + name +
+ "; Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ IdentityObject io = createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn);
+ ctx.close();
+ return io;
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("IdentityObject search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return null;
+ }
+
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, String
id) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".findIdentityObject with id: " + id);
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ if (id == null)
+ {
+ throw new IdentityException("identity id cannot be null");
+ }
+
+ String dn = id;
+
+ IdentityObjectType type = null;
+
+ //Recognize the type by ctx DN
+
+ IdentityObjectType[] possibleTypes =
getConfiguration(ctx).getConfiguredTypes();
+
+ for (IdentityObjectType possibleType : possibleTypes)
+ {
+ String[] typeCtxs = getTypeConfiguration(ctx, possibleType).getCtxDNs();
+
+ for (String typeCtx : typeCtxs)
+ {
+ if (dn.endsWith(typeCtx))
+ {
+ type = possibleType;
+ break;
+ }
+ }
+ if (type != null)
+ {
+ break;
+ }
+ }
+
+ if (type == null)
+ {
+ throw new IdentityException("Cannot recognize identity object type by
its DN: " + dn);
+ }
+
+ // Grab entry
+
+ Attributes attrs = ldapContext.getAttributes(dn);
+
+ if (attrs == null)
+ {
+ throw new IdentityException("Can't find identity entry with DN:
" + dn);
+ }
+
+ return createIdentityObjectInstance(ctx, type, attrs, dn);
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with dn: " + dn, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Identity object search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return null;
+ }
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type,
IdentityObjectSearchControl[] controls) throws IdentityException
+ {
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with type: " + type
+// + "; nameFilter: " + nameFilter
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+
+ //TODO: controls (name filter)
+ String nameFilter = "*";
+
+ //TODO: handle paged results and sort
+
+ Context ctx = getLDAPContext(invocationCtx);
+ checkIOType(type);
+
+ List<IdentityObject> objects = new LinkedList<IdentityObject>();
+
+ try
+ {
+ String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
+ List<SearchResult> sr = null;
+
+ if (filter != null && filter.length() > 0)
+ {
+
+ Object[] filterArgs = {nameFilter};
+ sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+ else
+ {
+ filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat(nameFilter).concat(")");
+ sr = searchIdentityObjects(invocationCtx, type, filter, null, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+
+
+ for (SearchResult res : sr)
+ {
+ ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ objects.add(createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn));
+ }
+
+ ctx.close();
+ return objects;
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("IdentityObject search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return objects;
+ }
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type)
throws IdentityException
+ {
+ return findIdentityObject(invocationCtx, type, null);
+ }
+
+// public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type,
Map<String, String[]> attributes, int offset, int limit, boolean orderByName,
boolean ascending) throws IdentityException
+// {
+// //TODO: handle paged results and sort
+//
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with type: " + type
+// + "; attributes: " + attributes
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+//
+// Context ctx = getLDAPContext(invocationCtx);
+// checkIOType(type);
+//
+// List<IdentityObject> objects = new LinkedList<IdentityObject>();
+//
+// try
+// {
+// String filter = getTypeConfiguration(invocationCtx,
type).getEntrySearchFilter();
+// List<SearchResult> sr = null;
+//
+// //TODO: if no search filter is present just use search method with
matchingAttributes from DirContext instead of
+// //TODO: concatenating filter
+//
+// StringBuilder af = new StringBuilder("(&");
+//
+// for (Map.Entry<String, String[]> stringEntry : attributes.entrySet())
+// {
+// for (String value : stringEntry.getValue())
+// {
+// af.append("(")
+// .append(stringEntry.getKey())
+// .append("=")
+// .append(value)
+// .append(")");
+// }
+// }
+//
+// af.append(")");
+//
+// if (filter != null && filter.length() > 0)
+// {
+// // chars are escaped in filterArgs so we must replace it manually
+// filter = filter.replaceAll("\\{0\\}", "*");
+//
+// Object[] filterArgs = {};
+// sr = searchIdentityObjects(invocationCtx, type, "&(" + filter
+ ")" + af.toString(), filterArgs, new
String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+// }
+// else
+// {
+// filter = "(".concat(getTypeConfiguration(invocationCtx,
type).getIdAttributeName()).concat("=").concat("*").concat(")");
+// sr = searchIdentityObjects(invocationCtx, type, "&(" + filter
+ ")" + af.toString(), null, new String[]{getTypeConfiguration(invocationCtx,
type).getIdAttributeName()});
+// }
+//
+//
+// for (SearchResult res : sr)
+// {
+// ctx = (Context)res.getObject();
+// String dn = ctx.getNameInNamespace();
+// objects.add(createIdentityObjectInstance(invocationCtx, type,
res.getAttributes(), dn));
+// }
+//
+// ctx.close();
+// return objects;
+//
+// }
+// catch (NoSuchElementException e)
+// {
+// //log.debug("No identity object found with name: " + name, e);
+// }
+// catch (NamingException e)
+// {
+// throw new IdentityException("IdentityObject search failed.", e);
+// }
+// finally
+// {
+// try
+// {
+// if (ctx != null)
+// {
+// ctx.close();
+// }
+// }
+// catch (NamingException e)
+// {
+// throw new IdentityException("Failed to close LDAP connection",
e);
+// }
+// }
+//
+// return objects;
+// }
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity,
IdentityObjectRelationshipType relationshipType, boolean parent,
IdentityObjectSearchControl[] controls) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with identity: " +
identity
+// + "; relationshipType: " + relationshipType
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+
+ //TODO: handle paged results and sort
+
+ Set<IdentityObjectRelationship> relationships = new
HashSet<IdentityObjectRelationship>();
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, identity);
+
+ LDAPIdentityObjectTypeConfiguration typeConfig = getTypeConfiguration(ctx,
identity.getIdentityType());
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ List<IdentityObject> objects = new LinkedList<IdentityObject>();
+
+ try
+ {
+
+ // If parent simply look for all its members
+ if (parent)
+ {
+ Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
+ Attribute member = attrs.get(typeConfig.getMembershipAttributeName());
+
+ if (member != null)
+ {
+ NamingEnumeration memberValues = member.getAll();
+ while (memberValues.hasMoreElements())
+ {
+ String memberRef = memberValues.nextElement().toString();
+
+ if (typeConfig.isMembershipAttributeDN())
+ {
+ //TODO: improve
+ objects.add(findIdentityObject(ctx, memberRef));
+ }
+ else
+ {
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+ break;
+ }
+ }
+ }
+
+ // if not parent all parent entries need to be found
+ else
+ {
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to resolve relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return objects;
+ }
+
+ public Collection<IdentityObject>
findIdentityObject(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectRelationshipType
relationshipType,
+ boolean parent) throws
IdentityException
+ {
+ return findIdentityObject(ctx, identity, relationshipType, parent, null);
+ }
+
+ public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ String name, boolean createNames) throws
IdentityException
+ {
+
+ //TODO: relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".createRelationship with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ + "; relationshipType: " + relationshipType
+ );
+ }
+
+ LDAPIdentityObjectRelationshipImpl relationship = null;
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ // Check posibilities
+ //TODO: Supported features should handle information from type configurations
+
+ if
(!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(),
toIdentity.getIdentityType(), relationshipType))
+ {
+ throw new IdentityException("Relationship not supported");
+ }
+
+ try
+ {
+ //construct new member attribute values
+ Attributes attrs = new BasicAttributes(true);
+
+ Attribute member = new
BasicAttribute(fromTypeConfig.getMembershipAttributeName());
+
+ if (fromTypeConfig.isMembershipAttributeDN())
+ {
+ member.add(ldapToIO.getDn());
+ }
+ else
+ {
+ member.add(toIdentity.getName());
+ }
+
+ attrs.put(member);
+
+ ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REPLACE_ATTRIBUTE,
attrs);
+
+ relationship = new LDAPIdentityObjectRelationshipImpl(name, ldapFromIO,
ldapToIO);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to create relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+
+ return relationship;
+ }
+
+ public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject
fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType,
String name) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeRelationship with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ + "; relationshipType: " + relationshipType
+ );
+ }
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
+
+ // If relationship is not allowed simply return
+ //TODO: use features description instead
+ if
(!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
+ {
+ return;
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ // Check posibilities
+ //TODO: Supported features should handle information from type configurations
+
+ if
(!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(),
toIdentity.getIdentityType(), relationshipType))
+ {
+ throw new IdentityException("Relationship not supported");
+ }
+
+ try
+ {
+ //construct new member attribute values
+ Attributes attrs = new BasicAttributes(true);
+
+ Attribute member = new
BasicAttribute(fromTypeConfig.getMembershipAttributeName());
+
+ if (fromTypeConfig.isMembershipAttributeDN())
+ {
+ member.add(ldapToIO.getDn());
+ }
+ else
+ {
+ member.add(toIdentity.getName());
+ }
+
+ attrs.put(member);
+
+ ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REMOVE_ATTRIBUTE,
attrs);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to remove relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject
identity1, IdentityObject identity2, boolean named) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeRelationships with "
+ + "identity1: " + identity1
+ + "; identity2: " + identity2
+ );
+ }
+
+ // as relationship type is ignored in this impl for now...
+ removeRelationship(ctx, identity1, identity2, null, null);
+ removeRelationship(ctx, identity2, identity1, null, null);
+
+ }
+
+ public Set<IdentityObjectRelationship>
resolveRelationships(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity,
IdentityObject toIdentity) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".resolveRelationships with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ );
+ }
+
+ Set<IdentityObjectRelationship> relationships = new
HashSet<IdentityObjectRelationship>();
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx,
fromIdentity.getIdentityType());
+
+ // If relationship is not allowed return empty set
+ //TODO: use features description instead
+ if
(!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
+ {
+ return relationships;
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
+ Attribute member = attrs.get(fromTypeConfig.getMembershipAttributeName());
+
+ if (member != null)
+ {
+ NamingEnumeration memberValues = member.getAll();
+ while (memberValues.hasMoreElements())
+ {
+ String memberRef = memberValues.nextElement().toString();
+
+ if ((fromTypeConfig.isMembershipAttributeDN() &&
memberRef.equals(ldapToIO.getDn())) ||
+ (!fromTypeConfig.isMembershipAttributeDN() &&
memberRef.equals(ldapToIO.getName())))
+ {
+ //TODO: impl lacks support for rel type
+ relationships.add(new LDAPIdentityObjectRelationshipImpl(null,
ldapFromIO, ldapToIO));
+ }
+ break;
+ }
+ }
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to resolve relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return relationships;
+ }
+
+ public String createRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+ }
+
+ public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name)
throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx)
throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException,
OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not
supported by this implementation of LDAP IdentityStore");
+ }
+
+ public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx,
IdentityObjectType type) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+
+ // Attributes
+
+ public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext
invocationContext, IdentityObjectType identityType) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getSupportedAttributeNames with "
+ + "identityType: " + identityType
+ );
+ }
+
+ checkIOType(identityType);
+
+ return getTypeConfiguration(invocationContext,
identityType).getMappedAttributesNames();
+ }
+
+
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext ctx,
IdentityObject identity) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getAttributes with "
+ + "identity: " + identity
+ );
+ }
+
+ Map<String, String[]> attrsMap = new HashMap<String, String[]>();
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ Set<String> mappedNames = getTypeConfiguration(ctx,
identity.getIdentityType()).getMappedAttributesNames();
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ Attributes attrs = ldapContext.getAttributes(dn);
+
+ for (Iterator iterator = mappedNames.iterator(); iterator.hasNext();)
+ {
+ String name = (String)iterator.next();
+ String attrName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
+ Attribute attr = attrs.get(attrName);
+
+ if (attr != null)
+ {
+ NamingEnumeration values = attr.getAll();
+
+ Set<String> attrValues = new HashSet<String>();
+
+ while (values.hasMoreElements())
+ {
+ String value = values.nextElement().toString();
+ attrValues.add(value);
+ }
+
+ attrsMap.put(name, attrValues.toArray(new String[attrValues.size()]));
+ }
+ else
+ {
+ log.fine("No such attribute ('" + attrName + "') in
entry: " + dn);
+ }
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot get attributes value.", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return attrsMap;
+
+ }
+
+ public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, Map<String, String[]> attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".updateAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+
+ for (String name : attributes.keySet())
+ {
+ String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+
+ String[] values = attributes.get(name);
+
+
+ if (values != null)
+ {
+ for (String value : values)
+ {
+ attr.add(value);
+ }
+
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.REPLACE_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot add attribute", e);
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity,
Map<String, String[]> attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".addAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ for (String name : attributes.keySet())
+ {
+ String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+
+ String[] values = attributes.get(name);
+
+
+ if (values != null)
+ {
+ for (String value : values)
+ {
+ attr.add(value);
+ }
+
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot add attribute", e);
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject
identity, String[] attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ for (String name : attributes)
+ {
+ String attributeName = getTypeConfiguration(ctx,
identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property
name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot remove attribute", e);
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ //Internal
+
+ public LDAPIdentityObjectImpl
createIdentityObjectInstance(IdentityStoreInvocationContext ctx, IdentityObjectType type,
Attributes attrs, String dn) throws IdentityException
+ {
+ LDAPIdentityObjectImpl ldapio = null;
+ try
+ {
+ String idAttrName = getTypeConfiguration(ctx, type).getIdAttributeName();
+
+ Attribute ida = attrs.get(idAttrName);
+ if (ida == null)
+ {
+ throw new IdentityException("LDAP entry doesn't contain proper
attribute:" + idAttrName);
+ }
+
+ //make DN as user ID
+ ldapio = new LDAPIdentityObjectImpl(dn, ida.get().toString(), type);
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Couldn't create LDAPIdentityObjectImpl
object from ldap entry (SearchResult)", e);
+ }
+
+ return ldapio;
+ }
+
+ public List<SearchResult> searchIdentityObjects(IdentityStoreInvocationContext
ctx, IdentityObjectType type, String filter, Object[] filterArgs, String[]
returningAttributes) throws NamingException, IdentityException
+ {
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+ NamingEnumeration results = null;
+
+ try
+ {
+
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getConfiguration(ctx).getSearchTimeLimit());
+
+
+ if (returningAttributes != null)
+ {
+ controls.setReturningAttributes(returningAttributes);
+ }
+
+
+ String[] entryCtxs = getTypeConfiguration(ctx, type).getCtxDNs();
+
+ if (entryCtxs.length == 1)
+ {
+ if (filterArgs == null)
+ {
+ results = ldapContext.search(entryCtxs[0], filter, controls);
+ }
+ else
+ {
+ results = ldapContext.search(entryCtxs[0], filter, filterArgs, controls);
+ }
+ return Tools.toList(results);
+
+
+ }
+ else
+ {
+ List<SearchResult> merged = new LinkedList();
+
+ for (String entryCtx : entryCtxs)
+ {
+ if (filterArgs == null)
+ {
+ results = ldapContext.search(entryCtx, filter, controls);
+ }
+ else
+ {
+ results = ldapContext.search(entryCtx, filter, filterArgs, controls);
+ }
+ merged.addAll(Tools.toList(results));
+ results.close();
+ }
+
+ return merged;
+ }
+ }
+ finally
+ {
+ if (results != null)
+ {
+ results.close();
+ }
+ ldapContext.close();
+ }
+ }
+
+ // HELPER
+
+ private LDAPIdentityObjectImpl getSafeLDAPIO(IdentityStoreInvocationContext ctx,
IdentityObject io) throws IdentityException
+ {
+ if (io == null)
+ {
+ throw new IllegalArgumentException("IdentityObject is null");
+ }
+
+ if (io instanceof LDAPIdentityObjectImpl)
+ {
+ return (LDAPIdentityObjectImpl)io;
+ }
+ else
+ {
+ try
+ {
+ return (LDAPIdentityObjectImpl)findIdentityObject(ctx, io.getName(),
io.getIdentityType());
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("Provided IdentityObject is not present in
the store. Cannot operate on not stored objects.", e);
+ }
+ }
+
+ }
+
+ private void checkIOType(IdentityObjectType iot) throws IdentityException
+ {
+ if (iot == null)
+ {
+ throw new IllegalArgumentException("IdentityObjectType is null");
+ }
+
+ if (!getSupportedFeatures().isIdentityObjectTypeSupported(iot))
+ {
+ throw new IdentityException("IdentityType not supported by this
IdentityStore implementation: " + iot);
+ }
+ }
+
+
+ private LdapContext getLDAPContext(IdentityStoreInvocationContext ctx) throws
IdentityException
+ {
+ try
+ {
+ return (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Could not obtain LDAP connection: ", e);
+ }
+ }
+
+ private LDAPIdentityStoreConfiguration getConfiguration(IdentityStoreInvocationContext
ctx) throws IdentityException
+ {
+ return configuration;
+ }
+
+ private LDAPIdentityObjectTypeConfiguration
getTypeConfiguration(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws
IdentityException
+ {
+ return getConfiguration(ctx).getTypeConfiguration(type.getName());
+ }
+
+ public String toString()
+ {
+ return this.getClass().getName() + "[" + getId() +"]";
+ }
+
+
+}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -39,7 +39,7 @@
this.name = name;
}
- public Object getId()
+ public String getId()
{
return null;
}
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java
===================================================================
---
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -21,17 +21,9 @@
*/
package org.jboss.identity.impl.types;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.jboss.identity.exception.PolicyValidationException;
import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectAttribute;
import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.api.Role;
/**
@@ -46,11 +38,11 @@
private final String name;
- private final Object id;
+ private final String id;
private final IdentityObjectType type;
- public SimpleIdentityObject(String name, Object id, IdentityObjectType type)
+ public SimpleIdentityObject(String name, String id, IdentityObjectType type)
{
this.name = name;
this.id = id;
@@ -62,7 +54,7 @@
return name;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
---
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -205,7 +205,7 @@
// Check what RoleTypes has user theute
- Collection<RoleType> roleTypes =
session.getRoleManager().findIdentityRoleTypes(theuteUser, 0, 0, false, false);
+ Collection<RoleType> roleTypes =
session.getRoleManager().findIdentityRoleTypes(theuteUser);
assertEquals(3, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
assertTrue(roleTypes.contains(leadDeveloperRT));
@@ -218,16 +218,16 @@
// Check where anil is Lead Developer and where Developer
- roleTypes = session.getRoleManager().findIdentityRoleTypes(asaldhanaUser, 0, 0,
false, false);
+ roleTypes = session.getRoleManager().findIdentityRoleTypes(asaldhanaUser);
assertEquals(2, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
assertTrue(roleTypes.contains(leadDeveloperRT));
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject,
0, 0, false, false);
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser,
securityProject);
assertEquals(2, roleTypes.size());
assertTrue(roleTypes.contains(leadDeveloperRT));
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject, 0, 0,
false, false);
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject);
assertEquals(1, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
@@ -236,7 +236,7 @@
// Assert relationships
- Collection<Identity> identities =
session.getRelationshipManager().findAssociatedIdentities(portalTeamGroup, false, 0, 0,
false, false);
+ Collection<Identity> identities =
session.getRelationshipManager().findAssociatedIdentities(portalTeamGroup, false);
assertEquals(5, identities.size());
assertTrue(identities.contains(claprunUser));
assertTrue(identities.contains(mwringeUser));
@@ -244,16 +244,16 @@
assertTrue(identities.contains(whalesUser));
assertTrue(identities.contains(bdawidowUser));
- Collection<Group> groups =
session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false,
0, 0, false, false);
+ Collection<Group> groups =
session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true,
false);
assertEquals(0, groups.size());
// Check to which group Anil belongs
- groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser,
PEOPLE, 0, 0, false, false);
+ groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser,
PEOPLE);
assertEquals(1, groups.size());
assertTrue(groups.contains(employeesGroup));
// Now check sshah
- groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE,
0, 0, false, false);
+ groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE);
assertEquals(2, groups.size());
assertTrue(groups.contains(employeesGroup));
assertTrue(groups.contains(portalTeamGroup));
@@ -467,9 +467,9 @@
// Some assertions
// How many users do we have in whole acme org and how many people in paris and
london offices
- assertEquals(11,
session.getRelationshipManager().findAssociatedIdentities(usersROOTGroup, false, 0, 0,
false, false).size());
- assertEquals(1,
session.getRelationshipManager().findAssociatedIdentities(parisOffice, false, 0, 0, false,
false).size());
- assertEquals(1,
session.getRelationshipManager().findAssociatedIdentities(londonOffice, false, 0, 0,
false, false).size());
+ assertEquals(11,
session.getRelationshipManager().findAssociatedIdentities(usersROOTGroup, false).size());
+ assertEquals(1,
session.getRelationshipManager().findAssociatedIdentities(parisOffice, false).size());
+ assertEquals(1,
session.getRelationshipManager().findAssociatedIdentities(londonOffice, false).size());
// Is anne geeks community owner?
@@ -479,7 +479,7 @@
assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup,
anneUser));
// Check all groups that anna belongs to
- Collection<Group> groups =
session.getRelationshipManager().findAssociatedGroups(anneUser, 0, 0, false, false );
+ Collection<Group> groups =
session.getRelationshipManager().findAssociatedGroups(anneUser);
assertEquals(3, groups.size());
assertTrue(groups.contains(usersROOTGroup));
assertTrue(groups.contains(parisOffice));
Modified:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java
===================================================================
---
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -116,13 +116,13 @@
xx = testContext.getStore().findIdentityObject(testContext.getCtx(),
user2.getId());
assertEquals(xx.getId(), user2.getId());
- Collection results =
testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
"*", 0, 0, true, true);
+ Collection results =
testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER,
null);
assertEquals(2, results.size());
- results = testContext.getStore().findIdentityObject(testContext.getCtx(),
IdentityTypeEnum.ORGANIZATION, "*", 0, 0, true, true);
+ results = testContext.getStore().findIdentityObject(testContext.getCtx(),
IdentityTypeEnum.ORGANIZATION, null);
assertEquals(4, results.size());
- results = testContext.getStore().findIdentityObject(testContext.getCtx(),
IdentityTypeEnum.ROLE, "*", 0, 0, true, true);
+ results = testContext.getStore().findIdentityObject(testContext.getCtx(),
IdentityTypeEnum.ROLE, null);
assertEquals(0, results.size());
@@ -140,42 +140,32 @@
testContext.flush();
- Map<String, Set<String>> attrs = new HashMap<String,
Set<String>>();
- HashSet<String> vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
- attrs.put("key1", vals);
+ attrs.put("key1", new String[]{"val1", "val2",
"val3"});
- vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
- vals.add("val4");
- attrs.put("key2", vals);
+ attrs.put("key2", new String[]{"val1", "val2",
"val3", "val4"});
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
testContext.flush();
- Map<String, Set<String>> persistedAttrs =
testContext.getStore().getAttributes(testContext.getCtx(), user1);
+ Map<String, String[]> persistedAttrs =
testContext.getStore().getAttributes(testContext.getCtx(), user1);
assertEquals(2, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
testContext.flush();
- attrs = new HashMap<String, Set<String>>();
- vals = new HashSet<String>();
- vals.add("val1");
- attrs.put("key3", vals);
+ attrs = new HashMap<String, String[]>();
+ attrs.put("key3", new String[]{"val1"});
+
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
testContext.flush();
@@ -185,19 +175,17 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
testContext.flush();
- vals = new HashSet<String>();
- vals.add("val2");
- attrs.put("key3", vals);
+ attrs.put("key3", new String[]{"val2"});
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
@@ -208,7 +196,7 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").size());
+ assertEquals(2, persistedAttrs.get("key3").length);
testContext.flush();
@@ -221,13 +209,11 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
testContext.flush();
- Set<String> names = new HashSet<String>();
- names.add("key3");
- testContext.getStore().removeAttributes(testContext.getCtx(), user1, names);
+ testContext.getStore().removeAttributes(testContext.getCtx(), user1, new String[]
{"key3"});
testContext.flush();
Modified:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
---
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -159,42 +159,31 @@
em.flush();
- Map<String, Set<String>> attrs = new HashMap<String,
Set<String>>();
- HashSet<String> vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
- attrs.put("key1", vals);
+ attrs.put("key1", new String[]{"val1", "val2",
"val3"});
+ attrs.put("key2", new String[]{"val1", "val2",
"val3", "val4"});
- vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
- vals.add("val4");
- attrs.put("key2", vals);
-
store.addAttributes(null, user1, attrs);
em.flush();
- Map<String, Set<String>> persistedAttrs = store.getAttributes(null,
user1);
+ Map<String, String[]> persistedAttrs = store.getAttributes(null, user1);
assertEquals(2, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
em.flush();
- attrs = new HashMap<String, Set<String>>();
- vals = new HashSet<String>();
- vals.add("val1");
- attrs.put("key3", vals);
+ attrs = new HashMap<String, String[]>();
+ attrs.put("key3", new String[]{"val1"});
+
store.addAttributes(null, user1, attrs);
em.flush();
@@ -204,19 +193,17 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
em.flush();
- vals = new HashSet<String>();
- vals.add("val2");
- attrs.put("key3", vals);
+ attrs.put("key3", new String[]{"val2"});
store.addAttributes(null, user1, attrs);
@@ -227,7 +214,7 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").size());
+ assertEquals(2, persistedAttrs.get("key3").length);
em.flush();
@@ -240,13 +227,13 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
em.flush();
Set<String> names = new HashSet<String>();
names.add("key3");
- store.removeAttributes(null, user1, names);
+ store.removeAttributes(null, user1, new String[] {"key3"});
em.flush();
Modified:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
===================================================================
---
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -267,12 +267,11 @@
user1 = em.find(HibernateIdentityObject.class, user1.getId());
assertEquals(2, user1.getAttributes().entrySet().size() );
assertNotNull(user1.getAttributes().get("simple1"));
- assertEquals(3, user1.getAttributes().get("simple1").size());
+ assertEquals(3, user1.getAttributes().get("simple1").length);
em.getTransaction().commit();
-
}
}
Modified: trunk/identity-impl/src/test/resources/identity-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xml 2008-11-06 23:37:49 UTC
(rev 121)
+++ trunk/identity-impl/src/test/resources/identity-config.xml 2008-11-12 14:36:05 UTC
(rev 122)
@@ -12,241 +12,231 @@
<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:identity:config:v0_1
identity-config.xsd">
- <realms>
- <realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration>
+ <realms>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
<identity-type-mappings>
- <identity-mapping></identity-mapping>
- <group-type-mapping>
- <group-type-name></group-type-name>
- <identity-object-type-name></identity-object-type-name>
- </group-type-mapping>
- <group-type-mapping>
- <group-type-name></group-type-name>
- <identity-object-type-name></identity-object-type-name>
- </group-type-mapping>
+ <identity-mapping></identity-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
</identity-type-mappings>
<options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
</options>
- </realm-configuration>
- </realm>
- <realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration/>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id></id>
- <class></class>
- <repository-configuration>
+ </realm>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id></id>
+ <class></class>
<external-config override="true"></external-config>
<default-identity-store-id></default-identity-store-id>
<default-attribute-store-id></default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id></identity-store-id>
- <identity-object-types>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- </identity-object-types>
- <options>
- <option>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id></id>
+ <class></class>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <external-config
override="false"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
<name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
<name></name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref></relationship-type-ref>
+
<identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ </identity-store>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <external-config
override="true"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name></name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping></mapping>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name></name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref></relationship-type-ref>
+
<identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ <relationship>
+
<relationship-type-ref></relationship-type-ref>
+
<identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>true</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name></name>
<value></value>
<value></value>
<value></value>
<value></value>
- </option>
- </options>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id></identity-store-id>
- <identity-object-types>
- <identity-object-type></identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </repository-configuration>
- </repository>
- <repository>
- <id></id>
- <class></class>
- <repository-configuration/>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id></id>
- <class></class>
- <identity-store-configuration>
- <external-config
override="false"></external-config>
- <supported-relationship-types>
- <relationship-type></relationship-type>
- <relationship-type></relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name></name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name></name>
- <relationships>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
-
<identity-object-type-ref></identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id></id>
- <class></class>
- <identity-store-configuration>
- <external-config override="true"></external-config>
- <supported-relationship-types>
- <relationship-type></relationship-type>
- <relationship-type></relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name></name>
- <relationships/>
- <attributes>
- <attribute>
- <name></name>
- <mapping></mapping>
- <isRequired></isRequired>
- <isMultivalued></isMultivalued>
- <isReadOnly></isReadOnly>
- </attribute>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired></isRequired>
- <isMultivalued></isMultivalued>
- <isReadOnly></isReadOnly>
- </attribute>
- </attributes>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name></name>
- <relationships>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
-
<identity-object-type-ref></identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
-
<identity-object-type-ref></identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired>true</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- </attribute>
- </attributes>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Modified: trunk/identity-impl/src/test/resources/identity-config.xsd
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xsd 2008-11-06 23:37:49 UTC
(rev 121)
+++ trunk/identity-impl/src/test/resources/identity-config.xsd 2008-11-12 14:36:05 UTC
(rev 122)
@@ -5,15 +5,26 @@
<
xs:documentation><xs:schemaattributeFormDefault="unqualifi...
</xs:annotation>
</xs:element>
+ <xs:complexType name="identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-object-type"
maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="repositoryType">
<xs:sequence>
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
- <xs:element type="urn:repository-configurationType"
name="repository-configuration"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:external-configType"
name="external-config" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="xs:string"
name="default-identity-store-id" minOccurs="0"/>
+ <xs:element type="xs:string"
name="default-attribute-store-id" minOccurs="0"/>
+ <xs:element type="urn:identity-store-mappingsType"
name="identity-store-mappings" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="identity-store-configurationType">
+ <xs:complexType name="identity-storeType">
<xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType"
name="external-config"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
<xs:element type="urn:supported-relationship-typesType"
name="supported-relationship-types"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
<xs:element type="urn:supported-identity-object-typesType"
name="supported-identity-object-types"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -38,6 +49,12 @@
<xs:element type="urn:identity-store-mappingType"
name="identity-store-mapping" maxOccurs="unbounded"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="storesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="attribute-stores"/>
+ <xs:element type="urn:identity-storesType"
name="identity-stores"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="jboss-identityType">
<xs:sequence>
<xs:element type="urn:realmsType" name="realms"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -45,12 +62,41 @@
<xs:element type="urn:storesType" name="stores"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="supported-identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-object-typeType"
name="identity-object-type" maxOccurs="unbounded"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="optionType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="value"
maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="group-type-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="group-type-name"/>
+ <xs:element type="xs:string"
name="identity-object-type-name"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repositoriesType">
+ <xs:sequence>
+ <xs:element type="urn:repositoryType" name="repository"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="repository-id-ref"/>
+ <xs:element type="urn:identity-type-mappingsType"
name="identity-type-mappings" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipsType">
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="realmsType">
<xs:sequence>
<xs:element type="urn:realmType" name="realm"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -62,11 +108,21 @@
<xs:element type="urn:group-type-mappingType"
name="group-type-mapping" maxOccurs="unbounded"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="supported-relationship-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type"
maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="identity-storesType">
<xs:sequence>
<xs:element type="urn:identity-storeType"
name="identity-store" maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="attributesType">
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="identity-store-mappingType">
<xs:sequence>
<xs:element type="xs:string" name="identity-store-id"/>
@@ -74,26 +130,17 @@
<xs:element type="urn:optionsType" name="options"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="attributesType">
+ <xs:complexType name="relationshipType">
<xs:sequence>
- <xs:element type="urn:attributeType" name="attribute"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="xs:string"
name="relationship-type-ref"/>
+ <xs:element type="xs:string"
name="identity-object-type-ref"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="realm-configurationType">
+ <xs:complexType name="optionsType">
<xs:sequence>
- <xs:element type="urn:identity-type-mappingsType"
name="identity-type-mappings" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="urn:optionsType" name="options"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionType" name="option"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="repository-configurationType">
- <xs:sequence>
- <xs:element type="urn:external-configType"
name="external-config" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="xs:string"
name="default-identity-store-id" minOccurs="0"/>
- <xs:element type="xs:string"
name="default-attribute-store-id" minOccurs="0"/>
- <xs:element type="urn:identity-store-mappingsType"
name="identity-store-mappings" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="urn:optionsType" name="options"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="identity-object-typeType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
@@ -120,68 +167,6 @@
</xs:element>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="identity-object-typesType">
- <xs:sequence>
- <xs:element type="xs:string" name="identity-object-type"
maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="identity-storeType">
- <xs:sequence>
- <xs:element type="xs:string" name="id"/>
- <xs:element type="xs:string" name="class"/>
- <xs:element type="urn:identity-store-configurationType"
name="identity-store-configuration"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="storesType">
- <xs:sequence>
- <xs:element type="xs:string" name="attribute-stores"/>
- <xs:element type="urn:identity-storesType"
name="identity-stores"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="supported-identity-object-typesType">
- <xs:sequence>
- <xs:element type="urn:identity-object-typeType"
name="identity-object-type" maxOccurs="unbounded"
minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="group-type-mappingType">
- <xs:sequence>
- <xs:element type="xs:string" name="group-type-name"/>
- <xs:element type="xs:string"
name="identity-object-type-name"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="repositoriesType">
- <xs:sequence>
- <xs:element type="urn:repositoryType" name="repository"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="realmType">
- <xs:sequence>
- <xs:element type="xs:string" name="id"/>
- <xs:element type="xs:string" name="repository-id-ref"/>
- <xs:element type="urn:realm-configurationType"
name="realm-configuration"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="relationshipsType">
- <xs:sequence>
- <xs:element type="urn:relationshipType" name="relationship"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="supported-relationship-typesType">
- <xs:sequence>
- <xs:element type="xs:string" name="relationship-type"
maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="optionsType">
- <xs:sequence>
- <xs:element type="urn:optionType" name="option"
maxOccurs="unbounded" minOccurs="0"
xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="relationshipType">
- <xs:sequence>
- <xs:element type="xs:string"
name="relationship-type-ref"/>
- <xs:element type="xs:string"
name="identity-object-type-ref"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="attributeType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
Modified: trunk/identity-impl/src/test/resources/organization-test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/organization-test-config.xml 2008-11-06
23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/resources/organization-test-config.xml 2008-11-12
14:36:05 UTC (rev 122)
@@ -2,438 +2,418 @@
<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:identity:config:v0_1
identity-config.xsd">
- <realms>
- <realm>
- <id>realm://RedHat/DB</id>
- <repository-id-ref>RedHat Repository DB</repository-id-ref>
- <realm-configuration>
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB</id>
- <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository
DB</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://RedHat/DB_LDAP</id>
- <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB_LDAP</id>
- <repository-id-ref>Sample Portal Repository
DB+LDAP</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository
DB+LDAP</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>RedHat Repository DB</id>
-
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity
Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity
Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity
Store</identity-store-id>
- <identity-object-types>
-
<identity-object-type>ORGANIZATION</identity-object-type>
-
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>ORGANIZATION</identity-object-type>
+
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+
<identity-object-type>DIVISION</identity-object-type>
+
<identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+
<identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>Sample Portal Repository DB</id>
-
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity
Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity
Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity
Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
-
<identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
-
<identity-object-type>ORGANIZATION</identity-object-type>
-
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity
Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+
<identity-object-type>ADMINISTRATION</identity-object-type>
+
<identity-object-type>COMMUNITY</identity-object-type>
+
<identity-object-type>ORGANIZATION</identity-object-type>
+
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+
<identity-object-type>DIVISION</identity-object-type>
+
<identity-object-type>DEPARTMENT</identity-object-type>
+
<identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+
<identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>RedHat Repository DB+LDAP</id>
-
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity
Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity
Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity
Store</identity-store-id>
- <identity-object-types>
-
<identity-object-type>ORGANIZATION</identity-object-type>
-
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
<identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-id>Hibernate Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>ORGANIZATION</identity-object-type>
+
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+
<identity-object-type>DIVISION</identity-object-type>
+
<identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>Sample Portal Repository DB+LDAP</id>
-
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity
Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity
Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity
Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
-
<identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
-
<identity-object-type>ORGANIZATION</identity-object-type>
-
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity
Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+
<identity-object-type>ADMINISTRATION</identity-object-type>
+
<identity-object-type>COMMUNITY</identity-object-type>
+
<identity-object-type>ORGANIZATION</identity-object-type>
+
<identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+
<identity-object-type>DIVISION</identity-object-type>
+
<identity-object-type>DEPARTMENT</identity-object-type>
+
<identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
-
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <external-config/>
- <supported-relationship-types>
-
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
- <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>IDENTITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DIVISION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PROJECT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PEOPLE</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ADMINISTRATION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>COMMUNITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SECURITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SYSTEM</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>persistenceUnit</name>
- <value>jboss-identity-model1</value>
- </option>
- <option>
- <name>populateRelationshipTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>populateIdentityObjectTypes</name>
- <value>true</value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
-
<class>org.jboss.identity.impl.store.ldap.LDAPIdentityStore</class>
- <identity-store-configuration>
- <external-config/>
- <supported-relationship-types/>
- <supported-identity-object-types>
- <identity-object-type>
- <name>IDENTITY</name>
- <relationships/>
- <attributes>
- <attribute>
- <name>phone</name>
- <mapping>telephoneNumber</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>description</name>
- <mapping>description</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>carLicense</name>
- <mapping>carLicense</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>ctxDNs</name>
-
<value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>GROUP</name>
- <relationships>
- <relationship>
- <relationship-type-ref/>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref/>
-
<identity-object-type-ref>ROLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref/>
-
<identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
-
<value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ROLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref/>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
-
<value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+
<relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>persistenceUnit</name>
+ <value>jboss-identity-model1</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+
<class>org.jboss.identity.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types/>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+
<value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+
<identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+
<identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+
<value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+
<value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Modified: trunk/identity-impl/src/test/resources/test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/test-config.xml 2008-11-06 23:37:49 UTC (rev
121)
+++ trunk/identity-impl/src/test/resources/test-config.xml 2008-11-12 14:36:05 UTC (rev
122)
@@ -4,51 +4,50 @@
xsi:schemaLocation="urn:jboss:identity:config:v0_1
identity-config.xsd">
<realms>
<realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration>
- <!--Use direct type mappper when not specified-->
- <!--<identity-type-mappings>-->
-
<!--<identity-mapping>JBOSS_IDENTITY_IDENTITY</identity-mapping>-->
- <!--<group-type-mapping>-->
- <!--<group-type-name>ORGANIZATION</group-type-name>-->
-
<!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type-name>-->
- <!--</group-type-mapping>-->
- <!--<group-type-mapping>-->
-
<!--<group-type-name>ORGANIZATION_UNIT</group-type-name>-->
-
<!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type-name>-->
- <!--</group-type-mapping>-->
- <!--</identity-type-mappings>-->
- </realm-configuration>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ <realm-configuration>
+ <!--Use direct type mappper when not specified-->
+ <!--<identity-type-mappings>-->
+
<!--<identity-mapping>JBOSS_IDENTITY_IDENTITY</identity-mapping>-->
+ <!--<group-type-mapping>-->
+ <!--<group-type-name>ORGANIZATION</group-type-name>-->
+
<!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--<group-type-mapping>-->
+
<!--<group-type-name>ORGANIZATION_UNIT</group-type-name>-->
+
<!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--</identity-type-mappings>-->
+ </realm-configuration>
</realm>
</realms>
- <repositories>
- <repository>
- <id>Fallback Repository - ACME</id>
-
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ <repositories>
+ <repository>
+ <id>Fallback Repository - ACME</id>
+
<class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config
override="false">path/to/file.xml</external-config>
<default-identity-store-id>Hibernate Identity
Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity
Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity
Store</identity-store-id>
- <identity-object-types>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_DIVISION</identity-object-type>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_DEPARTMENT</identity-object-type>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_PROJECT</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
<identity-store-mapping>
- <identity-store-id>LDAP Identity
Store</identity-store-id>
- <identity-object-types>
-
<identity-object-type>JBOSS_IDENTITY_GROUP_PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
+ <identity-store-id>Hibernate Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_DIVISION</identity-object-type>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_DEPARTMENT</identity-object-type>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_PROJECT</identity-object-type>
+ </identity-object-types>
+ <options/>
</identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity
Store</identity-store-id>
+ <identity-object-types>
+
<identity-object-type>JBOSS_IDENTITY_GROUP_PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
<!--<option-groups>-->
<!--<option-group>-->
@@ -63,109 +62,104 @@
<!--</options>-->
<!--</option-group>-->
<!--</option-groups>-->
- </repository-configuration>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
-
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <external-config/>
- <supported-relationship-types>
-
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
-
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>JBOSS_IDENTITY_IDENTITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>JBOSS_IDENTITY_GROUP</name>
- <relationships>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP</name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+
<identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
-
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <external-config
override="false">path/to/file.xml</external-config>
- <supported-relationship-types>
-
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
-
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>JBOSS_IDENTITY_IDENTITY</name>
- <relationships/>
- <attributes>
- <attribute>
- <name>user.name.given</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name>user.name.family</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>JBOSS_IDENTITY_GROUP_ORGANIZATION</name>
- <relationships>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes>
- <attribute>
- <name>user.name.given</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name>user.name.family</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
- <!--<options>-->
- <!--<option>-->
- <!--<name></name>-->
- <!--<values>-->
- <!--<value></value>-->
- <!--</values>-->
- <!--</option>-->
- <!--</options>-->
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+
<class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config
override="false">path/to/file.xml</external-config>
+ <supported-relationship-types>
+
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+
<relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP_ORGANIZATION</name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+
<identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ <!--<options>-->
+ <!--<option>-->
+ <!--<name></name>-->
+ <!--<values>-->
+ <!--<value></value>-->
+ <!--</values>-->
+ <!--</option>-->
+ <!--</options>-->
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java
(rev 0)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,38 @@
+/*
+* 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.spi.credential;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectCredential
+{
+
+ /**
+ *
+ * @return
+ */
+ IdentityObjectCredentialType getType();
+
+}
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java
(rev 0)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,37 @@
+/*
+* 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.spi.credential;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectCredentialType
+{
+
+ /**
+ *
+ * @return
+ */
+ String getName();
+}
Modified:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -38,7 +38,7 @@
/**
* @return id of this identity object
*/
- Object getId();
+ String getId();
/**
* FQDN identifies the context of this object - realm, identity store in which it is
persisted and object id in this store
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java
(rev 0)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -0,0 +1,31 @@
+/*
+* 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.spi.searchcontrol;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectSearchControl
+{
+}
Modified:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -61,18 +61,17 @@
* Get attributes for the given identity
*
* @param invocationContext
- *@param identity @return
- * @throws IdentityException
+ *@param identity @return @throws IdentityException
*/
- Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext
invocationContext, IdentityObject identity) throws IdentityException;
+ Map<String, String[]> getAttributes(IdentityStoreInvocationContext
invocationContext, IdentityObject identity) throws IdentityException;
/**
* Update attributes with new values - previous values will be overwritten. Attributes
not specified in the map are not changed.
* @param invocationCtx
- *@param identity
+ * @param identity
* @param attributes @throws IdentityException
*/
- void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, Set<String>> attributes)
+ void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, String[]> attributes)
throws IdentityException;
/**
@@ -80,10 +79,10 @@
* will be appended
*
* @param invocationCtx
- *@param identity
+ * @param identity
* @param attributes @throws IdentityException
*/
- void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, Set<String>> attributes)
+ void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Map<String, String[]> attributes)
throws IdentityException;
/**
@@ -93,7 +92,7 @@
* @param identity
* @param attributes
*/
- void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, Set<String> attributes)
+ void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject
identity, String[] attributes)
throws IdentityException;
}
Modified:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -27,6 +27,8 @@
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
+import org.jboss.identity.spi.credential.IdentityObjectCredentialType;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.exception.IdentityException;
/**
@@ -37,39 +39,27 @@
*/
public interface FeaturesMetaData
{
-
- //TODO: change supported operations to isControlSupported(IdentitySearchControl)
-
/**
- * Get the supported operations
- * @param identityObjectType a type representing identity, role, group
- * @return supported operations for given identity type
- * @throws org.jboss.identity.spi.exception.IdentityTypeNotSupportedException
+ *
+ * @param identityObjectType
+ * @param control
+ * @return
*/
- public Set<OperationType> getSupportedOperations(IdentityObjectType
identityObjectType)
- throws IdentityTypeNotSupportedException;
+ boolean isControlSupported(IdentityObjectType identityObjectType,
IdentityObjectSearchControl control);
/**
- * @param operationType
+ *
* @param identityObjectType
- * @return if given operation on given identity type is supported
- * @throws IdentityTypeNotSupportedException
+ * @param controlClazz
+ * @return
*/
- boolean isOperationSupported(OperationType operationType,
- IdentityObjectType identityObjectType) throws
IdentityTypeNotSupportedException;
+ boolean isControlSupported(IdentityObjectType identityObjectType, Class
controlClazz);
-
- /**
- * @param operationType
- * @return set of identity types that can be processed with a given operation
- * @throws org.jboss.identity.exception.IdentityException
- */
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType
operationType);
/**
* @return set of identity types that can be persisted
*/
- Set<IdentityObjectType> getSupportedIdentityObjectTypes();
+ Set<String> getSupportedIdentityObjectTypes();
/**
* @param identityObjectType
@@ -89,13 +79,16 @@
throws IdentityException;
/**
- * @return Set of RelationshipType supported in this store
+ * @return Set of relationship type names supported in this store
*/
- Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes();
+ Set<String> getSupportedRelationshipTypes();
/**
- * @return A mapping of RelationshipType and IdentityType objects that can have such
relationship in this store
+ *
+ * @param identityObjectType
+ * @param credentialType
+ * @return
*/
- Map<IdentityObjectRelationshipType, Map<IdentityObjectType,
IdentityObjectType>> getSupportedRelationshipTypeMappings();
+ boolean isCredentialSupported(IdentityObjectType identityObjectType,
IdentityObjectCredentialType credentialType);
}
\ No newline at end of file
Modified:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.util.Collection;
-import java.util.Map;
import java.util.Set;
import org.jboss.identity.spi.model.IdentityObject;
@@ -32,6 +31,8 @@
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.exception.IdentityException;
/**
@@ -119,76 +120,40 @@
* @return
* @throws IdentityException
*/
- IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext,
Object id) throws IdentityException;
+ IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext,
String id) throws IdentityException;
- /**
- * Find identities with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated
- * parameters will take no effect
- *
- * @param invocationCtx
- * @param identityType
- * @param nameFilter may be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending default true
- * @return
- * @throws IdentityException
- */
- Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCtx, IdentityObjectType identityType,
- String nameFilter,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws
IdentityException;
/**
- * Find identities with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will take no
effect
- *
+ * Find identities with a given type
+ *
* @param invocationCtx
* @param identityType
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
*/
- Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCtx, IdentityObjectType identityType,
- Map<String, String[]> attributes,
- int offset, int limit,
- boolean orderByName, boolean ascending)
throws IdentityException;
-
+ Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCtx,
+ IdentityObjectType identityType,
+ IdentityObjectSearchControl[] controls)
throws IdentityException;
/**
* Find identites that have relationship with given identity. Relationships are
directional (from parent to child).
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param invocationCxt
* @param identity
* @param relationshipType
- * @param parent defines if given identity is parent or child side in the
+ * @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext
invocationCxt, IdentityObject identity,
- IdentityObjectRelationshipType
relationshipType,
- boolean parent,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws
IdentityException;
+ IdentityObjectRelationshipType
relationshipType,
+ boolean parent,
+ IdentityObjectSearchControl[]
controls) throws IdentityException;
+
/**
* Create directional relationship of a given type between identities
*
@@ -201,7 +166,6 @@
* @throws IdentityException
*/
IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext
invocationCxt, IdentityObject fromIdentity,
-
IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType, String
relationshipName, boolean createNames) throws IdentityException;
@@ -268,66 +232,52 @@
String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws
IdentityException, OperationNotSupportedException;
+
/**
*
* @param ctx
- * @param offset
- * @param limit
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
+ * @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws
IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchControl[] controls) throws
IdentityException, OperationNotSupportedException;
+
/**
- *
+ *
* @param ctx
* @param identity
- * @param offset
- * @param limit
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
+ * @throws OperationNotSupportedException
*/
- Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
IdentityObject identity,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws
IdentityException, OperationNotSupportedException;
+ Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectSearchControl[] controls) throws
IdentityException, OperationNotSupportedException;
- // Passwords
+ // Credentials
/**
*
* @param ctx
- * @param type
- * @return
- * @throws IdentityException
- */
- boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType
type) throws IdentityException;
-
- /**
- *
- * @param ctx
* @param identityObject
- * @param password
+ * @param credential
* @return
* @throws IdentityException
*/
- boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, String password) throws IdentityException;
+ boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException;
/**
*
* @param ctx
* @param identityObject
- * @param password
+ * @param credential
* @throws IdentityException
*/
- void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject,
String password) throws IdentityException;
+ void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject
identityObject, IdentityObjectCredential credential) throws IdentityException;
}
\ No newline at end of file
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java
===================================================================
---
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java 2008-11-06
23:37:49 UTC (rev 121)
+++
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java 2008-11-12
14:36:05 UTC (rev 122)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.spi.store;
-
-/**
- * Operations supported by the Identity Stores
- * @author boleslaw dot dawidowicz at redhat anotherdot com
- * @author Anil.Saldhana(a)redhat.com
- * @since Jul 10, 2008
- */
-public enum OperationType
-{
- // createIdentity
- create,
-
- // removeIdentity
- remove,
-
- // updateAttribute, updateAttributes, addAttributes
- updateAttributes,
-
- // resolveRelationships
- resolveRelationships,
-
- // createRelationship
- modifyRelationships,
-
- // pagination in findIdentities
- paginatedSearch,
-
- // ordering in findIdentities
- orderedSearch,
-
- // names of relationships;
- namedRelationships;
-
-
- public String getName()
- {
- return this.name();
- }
-}
\ No newline at end of file