[jboss-identity-commits] JBoss Identity SVN: r211 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/api and 29 other directories.
jboss-identity-commits at lists.jboss.org
jboss-identity-commits at lists.jboss.org
Tue Jan 13 10:18:43 EST 2009
Author: bdaw
Date: 2009-01-13 10:18:42 -0500 (Tue, 13 Jan 2009)
New Revision: 211
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttribute.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/attribute/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/attribute/IdentityObjectAttributeMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroup.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroupType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleIdentity.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRole.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRoleType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/IdentitySessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/SimpleTransactionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContext.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContextImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentityStoreInvocationContextResolver.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AbstractManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AttributesManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/PersistenceManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RelationshipManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RoleManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapper.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapperImpl.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectAttributeMetaData.java
Removed:
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/DirectIdentityObjectTypeMapperImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/EntityManagerWrapper.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectAttributeMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapper.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapperImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContextImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityStoreInvocationContextResolver.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/RoleHandler.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/SessionWrapper.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttributeImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialTypeImpl.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/SimpleGroupType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/filesystem/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/IdentityObjectAttributeMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreContext.java
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/Attribute.java
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
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/Group.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/Realm.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleType.java
trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractCredential.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/BinaryCredential.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PasswordCredential.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/metadata/IdentityObjectTypeMetaDataImpl.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/ldap/LDAPIdentityObjectImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectRelationshipImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.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/RepositoryIdentityStoreSessionImpl.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/store/hibernate/HibernateIdentityStoreSessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityObjectTypeConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.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/ldap/LDAPIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/opends/OpenDSService.java
trunk/identity-impl/src/test/resources/ldap/initial-empty-opends.ldif
trunk/identity-impl/src/test/resources/organization-test-config.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectAttribute.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredential.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredentialType.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationship.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationshipType.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/IdentityTypePolicy.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/PasswordExpirationPolicy.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/RelationshipPolicy.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/IdentityStoreSession.java
Log:
refactoring
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Attribute.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Attribute.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Attribute.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -25,18 +25,36 @@
import java.util.Collection;
/**
+ * Abstract representation of attribute related to IdentityType object. Can have many values
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface Attribute
{
+ /**
+ * @return attribute name
+ */
String getName();
+ /**
+ * @return attribute value. If attribute has many values it may be any one of them.
+ */
Object getValue();
+ /**
+ * Add attribute value. It will be appended.
+ * @param value
+ */
void addValue(Object value);
+ /**
+ * @return attribute values
+ */
Collection getValues();
+ /**
+ * @return number of attribute values
+ */
int getSize();
}
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -88,6 +88,7 @@
/**
* Update attributes with new values - previous values will be overwritten. All the other attributes are not changed -
* method doesn't overwrite whole attribute set connected with a given IdentityType object.
+ *
* @param identity
* @param attributes
* @throws org.jboss.identity.exception.IdentityException
@@ -140,6 +141,8 @@
throws IdentityException;
/**
+ * Check if given identity can be protected with text password
+ *
* @param identity
* @return
* @throws IdentityException
@@ -147,6 +150,7 @@
boolean hasPassword(Identity identity) throws IdentityException;
/**
+ * Validate text password for a given identity
*
* @param identity
* @param password
@@ -156,7 +160,8 @@
boolean validatePassword(Identity identity, String password) throws IdentityException;
/**
- *
+ * Update text password for a given identity
+ *
* @param identity
* @param password
* @throws IdentityException
@@ -164,6 +169,7 @@
void updatePassword(Identity identity, String password) throws IdentityException;
/**
+ * Check if identity can be protected with a given credential type
*
* @param identity
* @param credentialType
@@ -171,6 +177,7 @@
boolean hasCredential(Identity identity, CredentialType credentialType) throws IdentityException;
/**
+ * Validate credential for a given identity
*
* @param identity
* @param credentials
@@ -179,6 +186,7 @@
boolean validateCredentials(Identity identity, Credential[] credentials) throws IdentityException;
/**
+ * Update credential for a given identity
*
* @param identity
* @param credential
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,14 +23,15 @@
package org.jboss.identity.api;
/**
+ * Credential object.
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface Credential
{
/**
- *
- * @return
+ *@return type of Credential
*/
CredentialType getType();
}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,14 +23,15 @@
package org.jboss.identity.api;
/**
+ * CredentialType defines type of Credential. Sample types can be binary certificate or text password
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface CredentialType
{
/**
- *
- * @return
+ * @return name of CredentialType
*/
String getName();
}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -34,7 +34,7 @@
public interface Group extends IdentityType
{
/**
- * @return
+ * @return GroupType
*/
GroupType getGroupType();
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.api;
/**
+ * IdentitySearchControl enables to add additional constraints to the results of operations on identity objects
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -65,9 +65,6 @@
*/
boolean isOpen();
- //TODO: expose metadata describing capabilities of underlaying stores - or split it between managers
- //TODO: which groupType names are supported and etc.
-
/**
* @return
* @throws IdentityException
@@ -93,14 +90,18 @@
RelationshipManager getRelationshipManager();
/**
- * RoleManager exposes operation on Role objects. This is optional feature that may be not supported
+ * AttributesManager exposes operation related to Attribute objects. It enables to associate and disassociate Attribute
+ * with a given Group and Identity objects
* @return
* @throws FeatureNotSupportedException
*/
AttributesManager getAttributesManager();
-
- //TODO: proper exception if roles are not supported
+ /**
+ * RoleManager exposes operation on Role objects. This is optional feature that may be not supported
+ * @return
+ * @throws FeatureNotSupportedException
+ */
RoleManager getRoleManager() throws FeatureNotSupportedException ;
}
\ No newline at end of file
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -43,7 +43,7 @@
/**
- * @return
+ * @return object describing supported features
*/
PersistenceManagerFeaturesDescription getFeaturesDescription();
@@ -124,16 +124,6 @@
*/
Identity findIdentityById(String id) 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;
-
-
/**
*
* @param controls
@@ -182,15 +172,6 @@
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/PersistenceManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.api;
/**
+ * Describes capabilities of PersistenceManager
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@@ -30,32 +32,38 @@
{
/**
+ * Check if Identity objects can be created
* @return
*/
boolean isIdentitiesCreationSupported();
/**
+ * Check if Group objects can be created
* @return
*/
boolean isGroupsCreationSupported();
/**
+ * Check if IdentitySearchControl for sorted results can be used in Identity object queries
* @return
*/
boolean isIdentitiesSortedSearchSupported();
/**
+ * Check if IdentitySearchControl for sorted results can be used in Group object queries
* @param groupType
* @return
*/
boolean isGroupsSortedSearchSupported(GroupType groupType);
/**
+ * Check if IdentitySearchControl for paged results can be used in Identity object queries
* @return
*/
boolean isIdentitiesPaginatedSearchSupported();
/**
+ * Check if IdentitySearchControl for sorted results can be used in Group object queries
* @param groupType
* @return
*/
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Realm.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Realm.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Realm.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,7 @@
/**
* <p>The <b>realm</b> contain configuration of a set of identity data providers</p>
+ *
* @author Anil.Saldhana at redhat.com
* @since Jul 9, 2008
*/
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.api;
/**
+ * Describes capabilities of RelationshipManager
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@@ -30,12 +32,14 @@
{
/**
+ * Can Identity objects have role association with a given GroupType
* @param fromGroupType
* @return
*/
boolean isIdentityAssociationSupported(GroupType fromGroupType);
/**
+ * Can given group types have role association
* @param fromGroupType
* @param toGroupType
* @return
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -89,8 +89,6 @@
// Role
-
-
/**
* Create role
* @param roleType
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,17 +23,22 @@
package org.jboss.identity.api;
/**
+ * Describes capabilities of RoleManager
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface RoleManagerFeaturesDescription
{
/**
+ * Can RoleType object be created
* @return
*/
boolean isRoleTypeCreationSupported();
/**
+ * Can RoleType objects be removed
+ *
* @return
*/
boolean isRoleTypeRemovalSupported();
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -24,6 +24,7 @@
/**
* Type of Role
+ *
* @author Anil.Saldhana at redhat.com
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @since Jun 30, 2008
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.api;
/**
+ * Transaction
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractCredential.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractCredential.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractCredential.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -31,9 +31,9 @@
*/
public abstract class AbstractCredential implements Credential, IdentityObjectCredential
{
- private final SimpleCredentialTypeImpl type;
+ private final SimpleCredentialType type;
- public AbstractCredential(SimpleCredentialTypeImpl type)
+ public AbstractCredential(SimpleCredentialType type)
{
if (type == null)
{
@@ -46,7 +46,7 @@
this.type = type;
}
- public SimpleCredentialTypeImpl getType()
+ public SimpleCredentialType getType()
{
return type;
}
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,205 +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.api;
-
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.api.Identity;
-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.api.Attribute;
-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.spi.model.IdentityObjectAttribute;
-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 $
- */
-public abstract class AbstractManager
-{
- protected final IdentitySession identitySession;
-
- protected AbstractManager(IdentitySession session)
- {
- this.identitySession = session;
- }
-
- public IdentitySession getIdentitySession()
- {
- return identitySession;
- }
-
- protected IdentitySessionContext getSessionContext()
- {
- if (identitySession instanceof IdentitySessionImpl)
- {
- return ((IdentitySessionImpl)identitySession).getSessionContext();
- }
- return null;
- }
-
- protected IdentityStoreRepository getRepository()
- {
- return getSessionContext().getIdentityStoreRepository();
- }
-
- protected IdentityStoreInvocationContext getInvocationContext()
- {
- return getSessionContext().resolveStoreInvocationContext();
- }
-
- protected Identity createIdentity(IdentityObject identityObject)
- {
- return new SimpleIdentityImpl(identityObject.getName(), identityObject.getId());
- }
-
- protected Group createGroup(IdentityObject identityObject)
- {
- GroupType groupType = getSessionContext().getIdentityObjectTypeMapper().getGroupType(identityObject.getIdentityType());
- return new SimpleGroupImpl(identityObject.getName(), identityObject.getId(), groupType);
- }
-
- protected IdentityObject createIdentityObject(Identity identity)
- {
- IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
-
- return new SimpleIdentityObject(identity.getName(), identity.getId(), iot);
- }
-
- protected IdentityObject createIdentityObject(Group group)
- {
- IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType());
-
- return new SimpleIdentityObject(group.getName(), group.getId(), iot);
- }
-
- protected IdentityObject createIdentityObject(IdentityType identityType)
- {
- if (identityType instanceof Identity)
- {
- return createIdentityObject((Identity)identityType);
- }
- else if (identityType instanceof Group)
- {
- return createIdentityObject((Group)identityType);
- }
-
- throw new IllegalStateException("Not supported IdentityType extension: " + identityType.getClass());
-
- }
-
- 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();
- }
-
- protected IdentityObjectType getIdentityObjectType(GroupType groupType)
- {
- return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(groupType);
- }
-
- protected IdentityObjectAttribute[] convertAttributes(Attribute[] attributes)
- {
- IdentityObjectAttribute[] convertedAttributes = new IdentityObjectAttribute[attributes.length];
-
- for (int i = 0; i < attributes.length; i++)
- {
- convertedAttributes[i] = convertAttribute(attributes[i]);
- }
- return convertedAttributes;
- }
-
- protected Attribute[] convertAttributes(IdentityObjectAttribute[] attributes)
- {
- Attribute[] convertedAttributes = new Attribute[attributes.length];
-
- for (int i = 0; i < attributes.length; i++)
- {
- convertedAttributes[i] = convertAttribute(attributes[i]);
- }
- return convertedAttributes;
- }
-
- protected Attribute convertAttribute(IdentityObjectAttribute attribute)
- {
- if (attribute instanceof Attribute)
- {
- return (Attribute)attribute;
- }
- else
- {
- return new SimpleAttributeImpl(attribute);
- }
- }
-
- protected IdentityObjectAttribute convertAttribute(Attribute attribute)
- {
- if (attribute instanceof IdentityObjectAttribute)
- {
- return (IdentityObjectAttribute)attribute;
- }
- else
- {
- return new SimpleAttributeImpl(attribute);
- }
- }
-
-
-
-}
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,216 +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.api;
-
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.api.AttributesManager;
-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.api.Attribute;
-import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.spi.model.IdentityObjectCredential;
-import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
-import org.jboss.identity.impl.NotYetImplementedException;
-
-import java.util.Set;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class AttributesManagerImpl extends AbstractManager implements AttributesManager
-{
-
- public AttributesManagerImpl(IdentitySession session)
- {
- super(session);
- }
-
- public AttributeDescription getAttributeDescription(IdentityType identityType, String name)
- {
-
- Map<String, IdentityObjectAttributeMetaData> mdMap =
- getRepository().getAttributesMetaData(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
-
- if (mdMap != null && mdMap.containsKey(name))
- {
- IdentityObjectAttributeMetaData attributeMD = mdMap.get(name);
- if (attributeMD instanceof AttributeDescription)
- {
- return (AttributeDescription)attributeMD;
- }
- else
- {
- return new IdentityObjectAttributeMetaDataImpl(attributeMD);
- }
- }
-
- return null;
-
- }
-
- public Map<String, AttributeDescription> getSupportedAttributesDescriptions(IdentityType identityType)
- {
-
- Map<String, IdentityObjectAttributeMetaData> mdMap =
- getRepository().getAttributesMetaData(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
-
- Map<String, AttributeDescription> descriptionMap = new HashMap<String, AttributeDescription>();
-
- if (mdMap != null)
- {
- for (IdentityObjectAttributeMetaData attributeMD : mdMap.values())
- {
- if (attributeMD instanceof AttributeDescription)
- {
- descriptionMap.put(attributeMD.getName(), (AttributeDescription)attributeMD);
- }
- else
- {
- descriptionMap.put(attributeMD.getName(), new IdentityObjectAttributeMetaDataImpl(attributeMD));
- }
- }
- }
-
- return descriptionMap;
- }
-
- public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException
- {
- return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
- }
-
- public Map<String, Attribute> getAttributes(IdentityType identity) throws IdentityException
- {
- Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
-
- Map<String, Attribute> newMap = new HashMap<String, Attribute>();
-
- for (Map.Entry<String, IdentityObjectAttribute> entry : map.entrySet())
- {
- newMap.put(entry.getKey(), convertAttribute(entry.getValue()));
- }
- return newMap;
- }
-
- public void updateAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
- {
- getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
-
- }
-
- public Attribute getAttribute(IdentityType identity, String attributeName) throws IdentityException
- {
- return getAttributes(identity).get(attributeName);
- }
-
- public void addAttribute(IdentityType identity, String attributeName, Object[] values) throws IdentityException
- {
- Attribute[] attrs = new Attribute[]{new SimpleAttributeImpl(attributeName, values)};
-
- addAttributes(identity, attrs);
-
- }
-
- public void addAttribute(IdentityType identity, String attributeName, Object value) throws IdentityException
- {
- Attribute[] attrs = new Attribute[]{new SimpleAttributeImpl(attributeName, value)};
-
-
- addAttributes(identity, attrs);
-
- }
-
- public void addAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
- {
- getRepository().addAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
- }
-
- public void removeAttributes(IdentityType identity, String[] attributeNames) throws IdentityException
- {
- getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identity), attributeNames);
- }
-
- public boolean hasPassword(Identity identity) throws IdentityException
- {
- return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), PasswordCredential.TYPE);
- }
-
- public boolean validatePassword(Identity identity, String password) throws IdentityException
- {
- return getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
- }
-
- public void updatePassword(Identity identity, String password) throws IdentityException
- {
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
- }
-
- public boolean hasCredential(Identity identity, CredentialType credentialType) throws IdentityException
- {
- return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), new SimpleCredentialTypeImpl(credentialType.getName()));
- }
-
- public boolean validateCredentials(Identity identity, Credential[] credentials) throws IdentityException
- {
-
- for (Credential credential : credentials)
- {
- IdentityObjectCredential ioc = null;
-
- //Handle only those credentials that implement SPI
-
- if (!(credential instanceof IdentityObjectCredential))
- {
- throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
- }
-
- // All credentials must pass
-
- if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), ioc))
- {
- return false;
- }
- }
-
- return true;
- }
-
- public void updateCredential(Identity identity, Credential credential) throws IdentityException
- {
- if (credential instanceof IdentityObjectCredential)
- {
- getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), (IdentityObjectCredential)credential);
- }
- else
- {
- throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
- }
- }
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/BinaryCredential.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/BinaryCredential.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/BinaryCredential.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -30,7 +30,7 @@
{
private final byte[] value;
- public static final SimpleCredentialTypeImpl TYPE = new SimpleCredentialTypeImpl("BINARY");
+ public static final SimpleCredentialType TYPE = new SimpleCredentialType("BINARY");
public BinaryCredential(byte[] value)
{
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/DirectIdentityObjectTypeMapperImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/DirectIdentityObjectTypeMapperImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/DirectIdentityObjectTypeMapperImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,101 +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.api;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.impl.types.SimpleIdentityObjectType;
-import org.jboss.identity.api.GroupType;
-
-import java.util.Map;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class DirectIdentityObjectTypeMapperImpl implements IdentityObjectTypeMapper
-{
-
- private final String identityTypeName;
-
- public DirectIdentityObjectTypeMapperImpl(String identityTypeName)
- {
- this.identityTypeName = identityTypeName;
- }
-
- public IdentityObjectType getIdentityObjectType()
- {
- return new SimpleIdentityObjectType(identityTypeName);
- }
-
- public IdentityObjectType getIdentityObjectType(GroupType groupType)
- {
- if (groupType == null)
- {
- throw new IllegalArgumentException("groupType is null");
- }
-
- return new SimpleIdentityObjectType(groupType.getName());
- }
-
- public GroupType getGroupType(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- return new SimpleGroupType(identityObjectType.getName());
-
- }
-
- public boolean isGroupType(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- if (isIdentity(identityObjectType))
- {
- return false;
- }
-
- return true;
- }
-
-
- public boolean isIdentity(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- if (identityObjectType.getName().equals(identityTypeName))
- {
- return true;
- }
- return false;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/EntityManagerWrapper.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/EntityManagerWrapper.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/EntityManagerWrapper.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,86 +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.api;
-
-import org.jboss.identity.exception.IdentityException;
-
-import javax.persistence.EntityManager;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class EntityManagerWrapper implements SessionWrapper
-{
- private final EntityManager em;
-
- public EntityManagerWrapper(EntityManager entityManager)
- {
- this.em = entityManager;
- }
-
- public void close() throws IdentityException
- {
- em.close();
- }
-
- public void save() throws IdentityException
- {
- em.flush();
- }
-
- public void clear() throws IdentityException
- {
- em.clear();
- }
-
- public boolean isOpen()
- {
- return em.isOpen();
- }
-
- public boolean isTransactionSupported()
- {
- return true;
- }
-
- public void startTransaction()
- {
- em.getTransaction().begin();
- }
-
- public void commitTransaction()
- {
- em.getTransaction().commit();
- }
-
- public void rollbackTransaction()
- {
- em.getTransaction().rollback();
- }
-
- public boolean isTransactionActive()
- {
- return em.getTransaction().isActive();
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectAttributeMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectAttributeMetaDataImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectAttributeMetaDataImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,96 +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.api;
-
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
-import org.jboss.identity.api.AttributeDescription;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityObjectAttributeMetaDataImpl implements IdentityObjectAttributeMetaData, AttributeDescription
-{
-
- private final String name;
-
- private final String storeMapping;
-
- private final String type;
-
- private final boolean readonly;
-
- private final boolean multivalued;
-
- private final boolean required;
-
- public IdentityObjectAttributeMetaDataImpl(String name, String storeMapping, String type, boolean readonly, boolean multivalued, boolean required)
- {
- this.name = name;
- this.storeMapping = storeMapping;
- this.type = type;
- this.readonly = readonly;
- this.multivalued = multivalued;
- this.required = required;
- }
-
- public IdentityObjectAttributeMetaDataImpl(IdentityObjectAttributeMetaData attributeMD)
- {
- this.name = attributeMD.getName();
- this.type = attributeMD.getType();
- this.readonly = attributeMD.isReadonly();
- this.multivalued = attributeMD.isMultivalued();
- this.required = attributeMD.isRequired();
- this.storeMapping = attributeMD.getStoreMapping();
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getStoreMapping()
- {
- return storeMapping;
- }
-
- public String getType()
- {
- return type;
- }
-
- public boolean isReadonly()
- {
- return readonly;
- }
-
- public boolean isMultivalued()
- {
- return multivalued;
- }
-
- public boolean isRequired()
- {
- return required;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapper.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapper.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapper.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,51 +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.api;
-
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.api.Identity;
-import org.jboss.identity.api.GroupType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface IdentityObjectTypeMapper
-{
-
- IdentityObjectType getIdentityObjectType();
-
-
- IdentityObjectType getIdentityObjectType(GroupType groupType);
-
-
- GroupType getGroupType(IdentityObjectType identityObjectType);
-
-
- boolean isGroupType(IdentityObjectType identityObjectType);
-
-
- boolean isIdentity(IdentityObjectType identityObjectType);
-
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapperImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapperImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapperImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,128 +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.api;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.api.Identity;
-import org.jboss.identity.api.GroupType;
-import org.jboss.identity.impl.types.SimpleIdentityObjectType;
-
-import java.util.Map;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityObjectTypeMapperImpl implements IdentityObjectTypeMapper
-{
-
- /**
- * IdentityObjectType --> GroupType
- */
- private final Map<String, String> groupTypeMap;
-
- private final String identityTypeName;
-
- public IdentityObjectTypeMapperImpl(Map<String, String> map, String identityTypeName)
- {
- groupTypeMap = Collections.unmodifiableMap(map);
- this.identityTypeName = identityTypeName;
- }
-
- public IdentityObjectType getIdentityObjectType()
- {
- return new SimpleIdentityObjectType(identityTypeName);
- }
-
- public IdentityObjectType getIdentityObjectType(GroupType groupType)
- {
- if (groupType == null)
- {
- throw new IllegalArgumentException("groupType is null");
- }
-
- for (Map.Entry<String, String> entry : groupTypeMap.entrySet())
- {
- if (entry.getValue().equals(groupType.getName()))
- {
- return new SimpleIdentityObjectType(entry.getKey());
- }
- }
-
- return null;
- }
-
- public GroupType getGroupType(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- String name = groupTypeMap.get(identityObjectType.getName());
-
- if (name != null)
- {
- return new SimpleGroupType(name);
- }
-
- return null;
-
- }
-
- public boolean isGroupType(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- if (isIdentity(identityObjectType))
- {
- return false;
- }
-
- if (groupTypeMap.containsKey(identityObjectType.getName()))
- {
- return true;
- }
-
- return false;
- }
-
-
- public boolean isIdentity(IdentityObjectType identityObjectType)
- {
- if (identityObjectType == null)
- {
- throw new IllegalArgumentException("identityObjectType is null");
- }
-
- if (identityObjectType.getName().equals(identityTypeName))
- {
- return true;
- }
- return false;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,41 +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.api;
-
-import org.jboss.identity.spi.repository.IdentityStoreRepository;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface IdentitySessionContext
-{
-
- IdentityStoreRepository getIdentityStoreRepository();
-
- IdentityObjectTypeMapper getIdentityObjectTypeMapper();
-
- IdentityStoreInvocationContext resolveStoreInvocationContext();
-
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContextImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContextImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContextImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,62 +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.api;
-
-import org.jboss.identity.spi.repository.IdentityStoreRepository;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentitySessionContextImpl implements IdentitySessionContext
-{
- private final IdentityStoreRepository identityStoreRepository;
-
- private final IdentityObjectTypeMapper identityObjectTypeMapper;
-
- private final IdentityStoreInvocationContextResolver contextResolver;
-
-
- public IdentitySessionContextImpl(IdentityStoreRepository identityStoreRepository, IdentityObjectTypeMapper identityObjectTypeMapper, IdentityStoreInvocationContextResolver contextResolver)
- {
- this.identityStoreRepository = identityStoreRepository;
- this.identityObjectTypeMapper = identityObjectTypeMapper;
- this.contextResolver = contextResolver;
- }
-
- public IdentityStoreRepository getIdentityStoreRepository()
- {
- return identityStoreRepository;
- }
-
- public IdentityObjectTypeMapper getIdentityObjectTypeMapper()
- {
- return identityObjectTypeMapper;
- }
-
- public IdentityStoreInvocationContext resolveStoreInvocationContext()
- {
- return contextResolver.resolveInvocationContext();
- }
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -32,6 +32,9 @@
import org.jboss.identity.spi.store.AttributeStore;
import org.jboss.identity.spi.repository.IdentityStoreRepository;
import org.jboss.identity.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.impl.api.session.mapper.DirectIdentityObjectTypeMapperImpl;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
import org.jboss.identity.exception.IdentityException;
import java.util.Map;
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,149 +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.api;
-
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.api.Transaction;
-import org.jboss.identity.api.PersistenceManager;
-import org.jboss.identity.api.RelationshipManager;
-import org.jboss.identity.api.AttributesManager;
-import org.jboss.identity.api.RoleManager;
-import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.spi.store.IdentityStoreSession;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.spi.repository.IdentityStoreRepository;
-import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
-
-import java.util.Set;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentitySessionImpl implements IdentitySession
-{
- private final String realmName;
-
- private final IdentitySessionContext sessionContext;
-
- private final PersistenceManager persistenceManager;
-
- private final RelationshipManager relationshipManager;
-
- private final AttributesManager profileManager;
-
- private final RoleManager roleManager;
-
- public IdentitySessionContext getSessionContext()
- {
- return sessionContext;
- }
-
- public IdentitySessionImpl(String realmName,
- IdentityStoreRepository repository,
- IdentityObjectTypeMapper typeMapper) throws IdentityException
- {
- this.realmName = realmName;
-
- IdentityStoreSession storeSession = repository.createIdentityStoreSession();
- final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName);
-
- IdentityStoreInvocationContextResolver resolver = new IdentityStoreInvocationContextResolver()
- {
- public IdentityStoreInvocationContext resolveInvocationContext()
- {
- return invocationCtx;
- }
- };
-
- sessionContext = new IdentitySessionContextImpl(repository, typeMapper, resolver);
-
- this.persistenceManager = new PersistenceManagerImpl(this);
- this.relationshipManager = new RelationshipManagerImpl(this);
- this.profileManager = new AttributesManagerImpl(this);
- this.roleManager = new RoleManagerImpl(this);
-
- }
-
-
-
-
-
- public String getRealmName()
- {
- return realmName;
- }
-
- public void close() throws IdentityException
- {
- sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().close();
- }
-
- public void save() throws IdentityException
- {
- sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().save();
- }
-
- public void clear() throws IdentityException
- {
- sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().clear();
- }
-
- public boolean isOpen()
- {
-
- return sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().isOpen();
- }
-
- public Transaction beginTransaction()
- {
- return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
- }
-
- public Transaction getTransaction()
- {
- return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
- }
-
- public PersistenceManager getPersistenceManager()
- {
- return persistenceManager;
- }
-
- public RelationshipManager getRelationshipManager()
- {
- return relationshipManager;
- }
-
- public AttributesManager getAttributesManager()
- {
- return profileManager;
- }
-
- //TODO: proper exception if roles are not supported
-
- public RoleManager getRoleManager()
- {
- return roleManager;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityStoreInvocationContextResolver.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityStoreInvocationContextResolver.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityStoreInvocationContextResolver.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,36 +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.api;
-
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface IdentityStoreInvocationContextResolver
-{
-
- IdentityStoreInvocationContext resolveInvocationContext();
-
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PasswordCredential.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PasswordCredential.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PasswordCredential.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -33,7 +33,7 @@
{
private final String value;
- public static final SimpleCredentialTypeImpl TYPE = new SimpleCredentialTypeImpl("PASSWORD");
+ public static final SimpleCredentialType TYPE = new SimpleCredentialType("PASSWORD");
public PasswordCredential(String value)
{
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,169 +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.api;
-
-import org.jboss.identity.api.PersistenceManager;
-import org.jboss.identity.api.Identity;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.api.GroupType;
-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;
-import org.jboss.identity.impl.types.SimpleIdentityObject;
-import org.jboss.identity.impl.NotYetImplementedException;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class PersistenceManagerImpl extends AbstractManager implements PersistenceManager
-{
-
- public PersistenceManagerImpl(IdentitySession session)
- {
- super(session);
- }
-
- public PersistenceManagerFeaturesDescription getFeaturesDescription()
- {
- return null;
- }
-
- public Identity createIdentity(String identityName) throws IdentityException
- {
- IdentityObjectType iot = getIdentityObjectType();
-
- IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), identityName, iot);
-
- return createIdentity(identityObject);
- }
-
- public Group createGroup(String groupName, GroupType groupType) throws IdentityException
- {
- IdentityObjectType iot = getIdentityObjectType(groupType);
-
- IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), groupName, iot);
-
- return createGroup(identityObject);
- }
-
- public void removeIdentity(Identity identity, boolean force) throws IdentityException
- {
- IdentityObjectType iot = getIdentityObjectType();
-
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(identity));
-
- }
-
- public void removeGroup(Group group, boolean force) throws IdentityException
- {
- //TODO: force
-
- getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(group));
- }
-
- public int getIdentityCount() throws IdentityException
- {
- IdentityObjectType iot = getIdentityObjectType();
-
- return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
- }
-
- public int getGroupTypeCount(GroupType groupType) throws IdentityException
- {
- IdentityObjectType iot = getIdentityObjectType(groupType);
-
- return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
- }
-
- public Identity findIdentity(String name) throws IdentityException
- {
- return createIdentity(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType()));
- }
-
- public Identity findIdentityById(String id) throws IdentityException
- {
- return createIdentity(getRepository().findIdentityObject(getInvocationContext(), id));
- }
-
- public Collection<Identity> findIdentity(IdentitySearchControl[] controls) throws IdentityException
- {
-
-
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(), convertSearchControls(controls));
- 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 Group findGroup(String name, GroupType groupType) throws IdentityException
- {
- return createGroup(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType)));
- }
-
- public Group findGroupById(String id) throws IdentityException
- {
- return createGroup(getRepository().findIdentityObject(getInvocationContext(), id));
- }
-
- public Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[] controls) throws IdentityException
- {
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(controls));
- List<Group> groups = new LinkedList<Group>();
-
- for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- groups.add(createGroup(identityObject));
- }
-
- return groups;
- }
-
- public Collection<Group> findGroup(GroupType groupType) throws IdentityException
- {
- return findGroup(groupType, null);
- }
-
- public boolean isVirtual(Identity identity)
- {
- //TODO:NYI
- throw new NotYetImplementedException("Postponed");
- }
-}
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,269 +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.api;
-
-import org.jboss.identity.api.RelationshipManager;
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.api.Identity;
-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;
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectType;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RelationshipManagerImpl extends AbstractManager implements RelationshipManager
-{
-
- public static final IdentityObjectRelationshipType MEMBER = new IdentityObjectRelationshipType()
- {
- public String getName()
- {
- return "JBOSS_IDENTITY_MEMBERSHIP";
- }
- };
-
- public RelationshipManagerImpl(IdentitySession session)
- {
- super(session);
- }
-
- public RelationshipManagerFeaturesDescription getFeaturesDescription()
- {
- return null;
- }
-
- public void associateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
- {
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- Group parent = parentsIterator.next();
-
- for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- Group member = membersIterator.next();
-
- associateGroups(parent, member);
- }
- }
- }
-
- public void associateGroups(Group parent, Group member) throws IdentityException
- {
- getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
- }
-
- public void associateIdentities(Collection<Group> parents, Collection<Identity> members) throws IdentityException
- {
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- Group parent = parentsIterator.next();
-
- for (Iterator<Identity> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- Identity member = membersIterator.next();
-
- associateIdentities(parent, member);
- }
- }
- }
-
- public void associateIdentities(Group parent, Identity member) throws IdentityException
- {
- getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
- }
-
- public void disassociateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
- {
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- Group parent = parentsIterator.next();
-
- for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- Group member = membersIterator.next();
-
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
- }
- }
- }
-
- public void disassociateIdentities(Collection<Group> parents, Collection<Identity> members) throws IdentityException
- {
- for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- Group parent = parentsIterator.next();
-
- for (Iterator<Identity> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- Identity member = membersIterator.next();
-
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
- }
- }
-
- }
-
- public <G extends IdentityType, I extends IdentityType> boolean isAssociated(Collection<G> parents, Collection<I> members) throws IdentityException
- {
- //TODO: maybe IdentityStore should have isRelationshipPresent method to improve this?
-
- for (Iterator<G> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
- {
- IdentityType parent = parentsIterator.next();
-
- for (Iterator<I> membersIterator = members.iterator(); membersIterator.hasNext();)
- {
- IdentityType member = membersIterator.next();
-
- Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
-
- if (relationships.size() == 0)
- {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public <G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member) throws IdentityException
- {
- Set<G> parents = new HashSet<G>();
- parents.add(parent);
- Set<I> members = new HashSet<I>();
- members.add(member);
-
- return isAssociated(parents, members);
- }
-
- 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);
-
- //TODO Handle inherited
-
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(controls));
-
- for (IdentityObject io : ios)
- {
- if (io.getIdentityType().getName().equals(iot.getName()))
- {
- identities.add(createGroup(io));
- }
- }
-
- return identities;
-
- }
-
- 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, convertSearchControls(controls));
-
- for (IdentityObject io : ios)
- {
- if (io.getIdentityType().getName().equals(iot.getName()))
- {
- identities.add(createGroup(io));
- }
- }
-
- return identities;
- }
-
- 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, convertSearchControls(controls));
-
- for (IdentityObject io : ios)
- {
- identities.add(createGroup(io));
- }
-
- return identities;
- }
-
- public Collection<Group> findAssociatedGroups(Identity identity) throws IdentityException
- {
- return findAssociatedGroups(identity, new IdentitySearchControl[] {});
- }
-
- public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, IdentitySearchControl[] controls) throws IdentityException
- {
- List<Identity> identities = new LinkedList<Identity>();
-
- //TODO Handle inherited
-
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(controls));
-
- //TODO: filter out groups....
-
- for (IdentityObject io : ios)
- {
- identities.add(createIdentity(io));
- }
-
- return identities;
- }
-
- public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited) throws IdentityException
- {
- return findAssociatedIdentities(group, inherited, null);
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleHandler.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleHandler.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleHandler.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,50 +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.api;
-
-import org.jboss.identity.spi.model.IdentityObjectRelationship;
-import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RoleHandler
-{
-
- boolean isNamedRole(IdentityObjectRelationshipType rt)
- {
- return false;
- }
-
- IdentityObjectRelationshipType createRelationshipType(String roleName)
- {
- return null;
- }
-
- String resolveRoleName(IdentityObjectRelationshipType rt)
- {
- return null;
- }
-
-}
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,286 +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.api;
-
-import org.jboss.identity.api.RoleManager;
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.api.RoleType;
-import org.jboss.identity.api.Role;
-import org.jboss.identity.api.Identity;
-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;
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.exception.OperationNotSupportedException;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RoleManagerImpl extends AbstractManager implements RoleManager
-{
- public static final IdentityObjectRelationshipType ROLE = new IdentityObjectRelationshipType()
- {
- public String getName()
- {
- return "JBOSS_IDENTITY_ROLE";
- }
- };
-
- public RoleManagerImpl(IdentitySession session)
- {
- super(session);
- }
-
- public RoleManagerFeaturesDescription getSupportedFeatures()
- {
- return null;
- }
-
- public RoleType createRoleType(String name) throws IdentityException
- {
- String roleType = null;
-
- try
- {
- roleType = getRepository().createRelationshipName(getInvocationContext(), name);
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported");
- }
-
- return new SimpleRoleType(roleType);
- }
-
- public void removeRoleType(String name) throws IdentityException
- {
- try
- {
- getRepository().removeRelationshipName(getInvocationContext(), name);
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported");
- }
- }
-
- public void removeRoleType(RoleType roleType) throws IdentityException
- {
- removeRoleType(roleType.getName());
- }
-
- public RoleType getRoleType(String name) throws IdentityException
- {
- try
- {
- Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), null);
- if (names.contains(name))
- {
- return new SimpleRoleType(name);
- }
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported");
- }
-
- return null;
- }
-
- public Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls) throws IdentityException
- {
-
- try
- {
- Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), convertSearchControls(controls));
- Set<RoleType> types = new HashSet<RoleType>();
-
- for (String name : names)
- {
- types.add(new SimpleRoleType(name));
- }
-
- return types;
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported");
- }
-
- }
-
- public Role createRole(RoleType roleType, Identity identity, Group group) throws IdentityException
- {
- //TODO: add createRoleType switch to the API
-
- IdentityObjectRelationship rel = getRepository().createRelationship(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName(), false);
-
- //TODO: null id - IdentityObjectRelationship doesn't have id
- return new SimpleRoleImpl(new SimpleRoleType(rel.getName()), createIdentity(rel.getFromIdentityObject()), createGroup(rel.getToIdentityObject()));
-
- }
-
- public void removeRole(RoleType roleType, Identity identity, Group group) throws IdentityException
- {
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName());
- }
-
- public void removeRole(Role role) throws IdentityException
- {
- getRepository().removeRelationship(getInvocationContext(), createIdentityObject(role.getIdentity()), createIdentityObject(role.getGroup()), ROLE, role.getRoleType().getName());
- }
-
- public boolean hasRole(Identity identity, Group group, RoleType roleType) throws IdentityException
- {
- //TODO: does separate hasRelationship method in IdentityStore makes sense?
-
- Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE);
-
- for (IdentityObjectRelationship rel : rels)
- {
- if (rel.getType().getName().equals(ROLE.getName()) && rel.getName() != null && rel.getName().equals(roleType.getName()))
- {
- return true;
- }
- }
-
- return false;
- }
-
- 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
- {
-
- Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE);
- Set<RoleType> types = new HashSet<RoleType>();
-
- for (IdentityObjectRelationship rel : rels)
- {
- types.add(new SimpleRoleType(rel.getName()));
- }
-
- return types;
-
-
- }
-
- 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), convertSearchControls(controls));
-
- for (String name : names)
- {
- types.add(new SimpleRoleType(name));
- }
-
- return types;
-
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported", e);
- }
-
- }
-
- public Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException
- {
- return findGroupRoleTypes(group, null);
- }
-
- 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), convertSearchControls(controls));
-
- for (String name : names)
- {
- types.add(new SimpleRoleType(name));
- }
-
- return types;
-
- }
- catch (OperationNotSupportedException e)
- {
- throw new IdentityException("Role management not supported");
- }
-
- }
-
- 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
- {
- Set<Role> roles = new HashSet<Role>();
-
- Set<IdentityObjectRelationship> relationships = null;
-
- // If Identity then search for parent relationships
- if (identityType instanceof Identity)
- {
- relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identityType), ROLE, true, true, null);
- }
- // If Group then search for child relationships
- else
- {
- relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identityType), ROLE, false, true, null);
- }
-
- for (IdentityObjectRelationship relationship : relationships)
- {
- roles.add(new SimpleRoleImpl(new SimpleRoleType(relationship.getName()), createIdentity(relationship.getFromIdentityObject()), createGroup(relationship.getToIdentityObject())));
- }
-
- return roles;
-
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SessionWrapper.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SessionWrapper.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SessionWrapper.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,83 +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.api;
-
-import org.jboss.identity.exception.IdentityException;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface SessionWrapper
-{
-
- /**
- * Close this session
- * @throws org.jboss.identity.exception.IdentityException
- */
- void close() throws IdentityException;
-
- /**
- * Save all pending changes
- * @throws org.jboss.identity.exception.IdentityException
- */
- void save() throws IdentityException;
-
- /**
- * Clear this session
- * @throws org.jboss.identity.exception.IdentityException
- */
- void clear() throws IdentityException;
-
- /**
- * Check if this session is open
- * @return
- */
- boolean isOpen();
-
-
- boolean isTransactionSupported();
-
- /**
- * Begin new transaction
- */
- void startTransaction();
-
- /**
- * Commit transaction - flush associated session
- */
- void commitTransaction();
-
- /**
- * Rollback transaction
- */
- void rollbackTransaction();
-
- /**
- *
- * @return
- */
- boolean isTransactionActive();
-
-
-}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttribute.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttributeImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttribute.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttribute.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,108 @@
+/*
+* 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.api;
+
+import org.jboss.identity.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.api.Attribute;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleAttribute implements IdentityObjectAttribute, Attribute
+{
+
+ private final String name;
+
+ private final List<Object> values = new LinkedList<Object>();
+
+ public SimpleAttribute(String name)
+ {
+ this.name = name;
+ }
+
+ public SimpleAttribute(String name, Object[] values)
+ {
+ this.name = name;
+ for (Object value : values)
+ {
+ this.values.add(value);
+ }
+ }
+
+ public SimpleAttribute(String name, Object value)
+ {
+ this.name = name;
+ this.values.add(value);
+ }
+
+ public SimpleAttribute(Attribute attribute)
+ {
+ this.name = attribute.getName();
+ this.values.addAll(attribute.getValues());
+ }
+
+ public SimpleAttribute(IdentityObjectAttribute attribute)
+ {
+ this.name = attribute.getName();
+ this.values.addAll(attribute.getValues());
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Collection getValues()
+ {
+ return Collections.unmodifiableList(values);
+ }
+
+ public Object getValue()
+ {
+ if (values.size() > 0)
+ {
+ return values.iterator().next();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public int getSize()
+ {
+ return values.size();
+ }
+
+ public void addValue(Object value)
+ {
+ values.add(value);
+ }
+}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttributeImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttributeImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleAttributeImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,108 +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.api;
-
-import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.api.Attribute;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleAttributeImpl implements IdentityObjectAttribute, Attribute
-{
-
- private final String name;
-
- private final List<Object> values = new LinkedList<Object>();
-
- public SimpleAttributeImpl(String name)
- {
- this.name = name;
- }
-
- public SimpleAttributeImpl(String name, Object[] values)
- {
- this.name = name;
- for (Object value : values)
- {
- this.values.add(value);
- }
- }
-
- public SimpleAttributeImpl(String name, Object value)
- {
- this.name = name;
- this.values.add(value);
- }
-
- public SimpleAttributeImpl(Attribute attribute)
- {
- this.name = attribute.getName();
- this.values.addAll(attribute.getValues());
- }
-
- public SimpleAttributeImpl(IdentityObjectAttribute attribute)
- {
- this.name = attribute.getName();
- this.values.addAll(attribute.getValues());
- }
-
- public String getName()
- {
- return name;
- }
-
- public Collection getValues()
- {
- return Collections.unmodifiableList(values);
- }
-
- public Object getValue()
- {
- if (values.size() > 0)
- {
- return values.iterator().next();
- }
- else
- {
- return null;
- }
- }
-
- public int getSize()
- {
- return values.size();
- }
-
- public void addValue(Object value)
- {
- values.add(value);
- }
-}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialType.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialTypeImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,46 @@
+/*
+* 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.api;
+
+import org.jboss.identity.api.CredentialType;
+import org.jboss.identity.spi.model.IdentityObjectCredentialType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleCredentialType implements CredentialType, IdentityObjectCredentialType
+{
+ private final String name;
+
+ public SimpleCredentialType(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
+
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialTypeImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialTypeImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleCredentialTypeImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,46 +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.api;
-
-import org.jboss.identity.api.CredentialType;
-import org.jboss.identity.spi.model.IdentityObjectCredentialType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleCredentialTypeImpl implements CredentialType, IdentityObjectCredentialType
-{
- private final String name;
-
- public SimpleCredentialTypeImpl(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-}
-
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,100 +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.api;
-
-import org.jboss.identity.api.Group;
-import org.jboss.identity.api.GroupType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleGroupImpl implements Group
-{
- private final String name;
-
- private final String id;
-
- private final GroupType groupType;
-
- public SimpleGroupImpl(String name, String id, GroupType groupType)
- {
- this.name = name;
- this.id = id;
- this.groupType = groupType;
- }
-
- public String getName()
- {
- return name;
- }
-
- public GroupType getGroupType()
- {
- return groupType;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- SimpleGroupImpl that = (SimpleGroupImpl)o;
-
- if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null)
- {
- return false;
- }
- if (name != null ? !name.equals(that.name) : that.name != null)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (name != null ? name.hashCode() : 0);
- result = 31 * result + (id != null ? id.hashCode() : 0);
- result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
- return result;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,71 +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.api;
-
-import org.jboss.identity.api.GroupType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleGroupType implements GroupType
-{
-
- private final String name;
-
- public SimpleGroupType(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- SimpleGroupType that = (SimpleGroupType)o;
-
- if (name != null ? !name.equals(that.name) : that.name != null)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- return (name != null ? name.hashCode() : 0);
- }
-}
Deleted: 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,92 +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.api;
-
-import org.jboss.identity.api.Identity;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleIdentityImpl implements Identity
-{
- private final String name;
-
- private final String id;
-
-
- public SimpleIdentityImpl(String name, String id)
- {
- this.name = name;
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public boolean isVirtual()
- {
- return false;
- }
-
- public String getId()
- {
- return id;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- SimpleIdentityImpl that = (SimpleIdentityImpl)o;
-
- if (name != null ? !name.equals(that.name) : that.name != null)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- int result;
- result = (name != null ? name.hashCode() : 0);
- result = 31 * result + (id != null ? id.hashCode() : 0);
- return result;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,68 +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.api;
-
-import org.jboss.identity.api.Role;
-import org.jboss.identity.api.RoleType;
-import org.jboss.identity.api.Identity;
-import org.jboss.identity.api.Group;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleRoleImpl implements Role
-{
- private final RoleType type;
-
- private final Identity identity;
-
- private final Group group;
-
- public SimpleRoleImpl(RoleType type, Identity identity, Group group)
- {
- this.type = type;
- this.identity = identity;
- this.group = group;
- }
-
- public Identity getIdentity()
- {
- return identity;
- }
-
- public Group getGroup()
- {
- return group;
- }
-
- public String getDescription()
- {
- return null;
- }
-
- public RoleType getRoleType()
- {
- return type;
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,74 +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.api;
-
-import org.jboss.identity.api.RoleType;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleRoleType implements RoleType
-{
- private final String name;
-
- public SimpleRoleType(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name cannot be null");
- }
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- public boolean equals(Object o)
- {
- if (this == o)
- {
- return true;
- }
- if (o == null || getClass() != o.getClass())
- {
- return false;
- }
-
- SimpleRoleType that = (SimpleRoleType)o;
-
- if (name != null ? !name.equals(that.name) : that.name != null)
- {
- return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- return (name != null ? name.hashCode() : 0);
- }
-}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,65 +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.api;
-
-import org.jboss.identity.api.Transaction;
-import org.jboss.identity.spi.store.IdentityStoreSession;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleTransactionImpl implements Transaction
-{
- private final IdentityStoreSession sessionWrapper;
-
- public SimpleTransactionImpl(IdentityStoreSession sessionWrapper)
- {
- this.sessionWrapper = sessionWrapper;
- }
-
- public void start()
- {
- sessionWrapper.startTransaction();
- }
-
- public void commit()
- {
-
- sessionWrapper.commitTransaction();
-
- }
-
- public void rollback()
- {
-
- sessionWrapper.rollbackTransaction();
-
- }
-
- public boolean isActive()
- {
-
- return sessionWrapper.isTransactionActive();
- }
-}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/attribute/IdentityObjectAttributeMetaDataImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectAttributeMetaDataImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/attribute/IdentityObjectAttributeMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/attribute/IdentityObjectAttributeMetaDataImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,96 @@
+/*
+* 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.api.attribute;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.jboss.identity.api.AttributeDescription;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityObjectAttributeMetaDataImpl implements IdentityObjectAttributeMetaData, AttributeDescription
+{
+
+ private final String name;
+
+ private final String storeMapping;
+
+ private final String type;
+
+ private final boolean readonly;
+
+ private final boolean multivalued;
+
+ private final boolean required;
+
+ public IdentityObjectAttributeMetaDataImpl(String name, String storeMapping, String type, boolean readonly, boolean multivalued, boolean required)
+ {
+ this.name = name;
+ this.storeMapping = storeMapping;
+ this.type = type;
+ this.readonly = readonly;
+ this.multivalued = multivalued;
+ this.required = required;
+ }
+
+ public IdentityObjectAttributeMetaDataImpl(IdentityObjectAttributeMetaData attributeMD)
+ {
+ this.name = attributeMD.getName();
+ this.type = attributeMD.getType();
+ this.readonly = attributeMD.isReadonly();
+ this.multivalued = attributeMD.isMultivalued();
+ this.required = attributeMD.isRequired();
+ this.storeMapping = attributeMD.getStoreMapping();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getStoreMapping()
+ {
+ return storeMapping;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public boolean isReadonly()
+ {
+ return readonly;
+ }
+
+ public boolean isMultivalued()
+ {
+ return multivalued;
+ }
+
+ public boolean isRequired()
+ {
+ return required;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroup.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroup.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroup.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,100 @@
+/*
+* 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.api.model;
+
+import org.jboss.identity.api.Group;
+import org.jboss.identity.api.GroupType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleGroup implements Group
+{
+ private final String name;
+
+ private final String id;
+
+ private final GroupType groupType;
+
+ public SimpleGroup(String name, String id, GroupType groupType)
+ {
+ this.name = name;
+ this.id = id;
+ this.groupType = groupType;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public GroupType getGroupType()
+ {
+ return groupType;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getDescription()
+ {
+ return null;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleGroup that = (SimpleGroup)o;
+
+ if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null)
+ {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (name != null ? name.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
+ return result;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroupType.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroupType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleGroupType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,71 @@
+/*
+* 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.api.model;
+
+import org.jboss.identity.api.GroupType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleGroupType implements GroupType
+{
+
+ private final String name;
+
+ public SimpleGroupType(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleGroupType that = (SimpleGroupType)o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return (name != null ? name.hashCode() : 0);
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleIdentity.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleIdentity.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleIdentity.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,92 @@
+/*
+* 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.api.model;
+
+import org.jboss.identity.api.Identity;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleIdentity implements Identity
+{
+ private final String name;
+
+ private final String id;
+
+
+ public SimpleIdentity(String name, String id)
+ {
+ this.name = name;
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean isVirtual()
+ {
+ return false;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getDescription()
+ {
+ return null;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleIdentity that = (SimpleIdentity)o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (name != null ? name.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ return result;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRole.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRole.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRole.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,68 @@
+/*
+* 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.api.model;
+
+import org.jboss.identity.api.Role;
+import org.jboss.identity.api.RoleType;
+import org.jboss.identity.api.Identity;
+import org.jboss.identity.api.Group;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleRole implements Role
+{
+ private final RoleType type;
+
+ private final Identity identity;
+
+ private final Group group;
+
+ public SimpleRole(RoleType type, Identity identity, Group group)
+ {
+ this.type = type;
+ this.identity = identity;
+ this.group = group;
+ }
+
+ public Identity getIdentity()
+ {
+ return identity;
+ }
+
+ public Group getGroup()
+ {
+ return group;
+ }
+
+ public String getDescription()
+ {
+ return null;
+ }
+
+ public RoleType getRoleType()
+ {
+ return type;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRoleType.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleRoleType.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRoleType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/model/SimpleRoleType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,74 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.impl.api.model;
+
+import org.jboss.identity.api.RoleType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleRoleType implements RoleType
+{
+ private final String name;
+
+ public SimpleRoleType(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleRoleType that = (SimpleRoleType)o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return (name != null ? name.hashCode() : 0);
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/IdentitySessionImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/IdentitySessionImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/IdentitySessionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,156 @@
+/*
+* 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.api.session;
+
+import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.Transaction;
+import org.jboss.identity.api.PersistenceManager;
+import org.jboss.identity.api.RelationshipManager;
+import org.jboss.identity.api.AttributesManager;
+import org.jboss.identity.api.RoleManager;
+import org.jboss.identity.exception.IdentityException;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
+import org.jboss.identity.impl.api.session.context.IdentitySessionContext;
+import org.jboss.identity.impl.api.session.context.IdentitySessionContextImpl;
+import org.jboss.identity.impl.api.session.context.IdentityStoreInvocationContextResolver;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
+import org.jboss.identity.impl.api.session.managers.PersistenceManagerImpl;
+import org.jboss.identity.impl.api.session.managers.RelationshipManagerImpl;
+import org.jboss.identity.impl.api.session.managers.AttributesManagerImpl;
+import org.jboss.identity.impl.api.session.managers.RoleManagerImpl;
+import org.jboss.identity.impl.api.session.SimpleTransactionImpl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentitySessionImpl implements IdentitySession
+{
+ private final String realmName;
+
+ private final IdentitySessionContext sessionContext;
+
+ private final PersistenceManager persistenceManager;
+
+ private final RelationshipManager relationshipManager;
+
+ private final AttributesManager profileManager;
+
+ private final RoleManager roleManager;
+
+ public IdentitySessionContext getSessionContext()
+ {
+ return sessionContext;
+ }
+
+ public IdentitySessionImpl(String realmName,
+ IdentityStoreRepository repository,
+ IdentityObjectTypeMapper typeMapper) throws IdentityException
+ {
+ this.realmName = realmName;
+
+ IdentityStoreSession storeSession = repository.createIdentityStoreSession();
+ final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName);
+
+ IdentityStoreInvocationContextResolver resolver = new IdentityStoreInvocationContextResolver()
+ {
+ public IdentityStoreInvocationContext resolveInvocationContext()
+ {
+ return invocationCtx;
+ }
+ };
+
+ sessionContext = new IdentitySessionContextImpl(repository, typeMapper, resolver);
+
+ this.persistenceManager = new PersistenceManagerImpl(this);
+ this.relationshipManager = new RelationshipManagerImpl(this);
+ this.profileManager = new AttributesManagerImpl(this);
+ this.roleManager = new RoleManagerImpl(this);
+
+ }
+
+
+
+
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
+
+ public void close() throws IdentityException
+ {
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().close();
+ }
+
+ public void save() throws IdentityException
+ {
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().save();
+ }
+
+ public void clear() throws IdentityException
+ {
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().clear();
+ }
+
+ public boolean isOpen()
+ {
+
+ return sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().isOpen();
+ }
+
+ public Transaction beginTransaction()
+ {
+ return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
+ }
+
+ public Transaction getTransaction()
+ {
+ return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
+ }
+
+ public PersistenceManager getPersistenceManager()
+ {
+ return persistenceManager;
+ }
+
+ public RelationshipManager getRelationshipManager()
+ {
+ return relationshipManager;
+ }
+
+ public AttributesManager getAttributesManager()
+ {
+ return profileManager;
+ }
+
+ //TODO: proper exception if roles are not supported
+
+ public RoleManager getRoleManager()
+ {
+ return roleManager;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/SimpleTransactionImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/SimpleTransactionImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/SimpleTransactionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,65 @@
+/*
+* 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.api.session;
+
+import org.jboss.identity.api.Transaction;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleTransactionImpl implements Transaction
+{
+ private final IdentityStoreSession sessionWrapper;
+
+ public SimpleTransactionImpl(IdentityStoreSession sessionWrapper)
+ {
+ this.sessionWrapper = sessionWrapper;
+ }
+
+ public void start()
+ {
+ sessionWrapper.startTransaction();
+ }
+
+ public void commit()
+ {
+
+ sessionWrapper.commitTransaction();
+
+ }
+
+ public void rollback()
+ {
+
+ sessionWrapper.rollbackTransaction();
+
+ }
+
+ public boolean isActive()
+ {
+
+ return sessionWrapper.isTransactionActive();
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContext.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContext.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContext.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,42 @@
+/*
+* 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.api.session.context;
+
+import org.jboss.identity.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentitySessionContext
+{
+
+ IdentityStoreRepository getIdentityStoreRepository();
+
+ IdentityObjectTypeMapper getIdentityObjectTypeMapper();
+
+ IdentityStoreInvocationContext resolveStoreInvocationContext();
+
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContextImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContextImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContextImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentitySessionContextImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,65 @@
+/*
+* 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.api.session.context;
+
+import org.jboss.identity.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.impl.api.session.context.IdentitySessionContext;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
+import org.jboss.identity.impl.api.session.context.IdentityStoreInvocationContextResolver;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentitySessionContextImpl implements IdentitySessionContext
+{
+ private final IdentityStoreRepository identityStoreRepository;
+
+ private final IdentityObjectTypeMapper identityObjectTypeMapper;
+
+ private final IdentityStoreInvocationContextResolver contextResolver;
+
+
+ public IdentitySessionContextImpl(IdentityStoreRepository identityStoreRepository, IdentityObjectTypeMapper identityObjectTypeMapper, IdentityStoreInvocationContextResolver contextResolver)
+ {
+ this.identityStoreRepository = identityStoreRepository;
+ this.identityObjectTypeMapper = identityObjectTypeMapper;
+ this.contextResolver = contextResolver;
+ }
+
+ public IdentityStoreRepository getIdentityStoreRepository()
+ {
+ return identityStoreRepository;
+ }
+
+ public IdentityObjectTypeMapper getIdentityObjectTypeMapper()
+ {
+ return identityObjectTypeMapper;
+ }
+
+ public IdentityStoreInvocationContext resolveStoreInvocationContext()
+ {
+ return contextResolver.resolveInvocationContext();
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentityStoreInvocationContextResolver.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityStoreInvocationContextResolver.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentityStoreInvocationContextResolver.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/context/IdentityStoreInvocationContextResolver.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -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.impl.api.session.context;
+
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreInvocationContextResolver
+{
+
+ IdentityStoreInvocationContext resolveInvocationContext();
+
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AbstractManager.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AbstractManager.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AbstractManager.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,210 @@
+/*
+* 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.api.session.managers;
+
+import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.Identity;
+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.api.Attribute;
+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.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.impl.types.SimpleIdentityObject;
+import org.jboss.identity.impl.api.session.context.IdentitySessionContext;
+import org.jboss.identity.impl.api.session.IdentitySessionImpl;
+import org.jboss.identity.impl.api.model.SimpleIdentity;
+import org.jboss.identity.impl.api.model.SimpleGroup;
+import org.jboss.identity.impl.api.SimpleAttribute;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class AbstractManager
+{
+ protected final IdentitySession identitySession;
+
+ protected AbstractManager(IdentitySession session)
+ {
+ this.identitySession = session;
+ }
+
+ public IdentitySession getIdentitySession()
+ {
+ return identitySession;
+ }
+
+ protected IdentitySessionContext getSessionContext()
+ {
+ if (identitySession instanceof IdentitySessionImpl)
+ {
+ return ((IdentitySessionImpl)identitySession).getSessionContext();
+ }
+ return null;
+ }
+
+ protected IdentityStoreRepository getRepository()
+ {
+ return getSessionContext().getIdentityStoreRepository();
+ }
+
+ protected IdentityStoreInvocationContext getInvocationContext()
+ {
+ return getSessionContext().resolveStoreInvocationContext();
+ }
+
+ protected Identity createIdentity(IdentityObject identityObject)
+ {
+ return new SimpleIdentity(identityObject.getName(), identityObject.getId());
+ }
+
+ protected Group createGroup(IdentityObject identityObject)
+ {
+ GroupType groupType = getSessionContext().getIdentityObjectTypeMapper().getGroupType(identityObject.getIdentityType());
+ return new SimpleGroup(identityObject.getName(), identityObject.getId(), groupType);
+ }
+
+ protected IdentityObject createIdentityObject(Identity identity)
+ {
+ IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
+
+ return new SimpleIdentityObject(identity.getName(), identity.getId(), iot);
+ }
+
+ protected IdentityObject createIdentityObject(Group group)
+ {
+ IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType());
+
+ return new SimpleIdentityObject(group.getName(), group.getId(), iot);
+ }
+
+ protected IdentityObject createIdentityObject(IdentityType identityType)
+ {
+ if (identityType instanceof Identity)
+ {
+ return createIdentityObject((Identity)identityType);
+ }
+ else if (identityType instanceof Group)
+ {
+ return createIdentityObject((Group)identityType);
+ }
+
+ throw new IllegalStateException("Not supported IdentityType extension: " + identityType.getClass());
+
+ }
+
+ protected IdentityObjectSearchControl[] convertSearchControls(IdentitySearchControl[] controls)
+ {
+ if (controls == null)
+ {
+ return null;
+ }
+
+ //TODO: simple 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();
+ }
+
+ protected IdentityObjectType getIdentityObjectType(GroupType groupType)
+ {
+ return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(groupType);
+ }
+
+ protected IdentityObjectAttribute[] convertAttributes(Attribute[] attributes)
+ {
+ IdentityObjectAttribute[] convertedAttributes = new IdentityObjectAttribute[attributes.length];
+
+ for (int i = 0; i < attributes.length; i++)
+ {
+ convertedAttributes[i] = convertAttribute(attributes[i]);
+ }
+ return convertedAttributes;
+ }
+
+ protected Attribute[] convertAttributes(IdentityObjectAttribute[] attributes)
+ {
+ Attribute[] convertedAttributes = new Attribute[attributes.length];
+
+ for (int i = 0; i < attributes.length; i++)
+ {
+ convertedAttributes[i] = convertAttribute(attributes[i]);
+ }
+ return convertedAttributes;
+ }
+
+ protected Attribute convertAttribute(IdentityObjectAttribute attribute)
+ {
+ if (attribute instanceof Attribute)
+ {
+ return (Attribute)attribute;
+ }
+ else
+ {
+ return new SimpleAttribute(attribute);
+ }
+ }
+
+ protected IdentityObjectAttribute convertAttribute(Attribute attribute)
+ {
+ if (attribute instanceof IdentityObjectAttribute)
+ {
+ return (IdentityObjectAttribute)attribute;
+ }
+ else
+ {
+ return new SimpleAttribute(attribute);
+ }
+ }
+
+
+
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AttributesManagerImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AttributesManagerImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/AttributesManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,220 @@
+/*
+* 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.api.session.managers;
+
+import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.AttributesManager;
+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.api.Attribute;
+import org.jboss.identity.exception.IdentityException;
+import org.jboss.identity.spi.model.IdentityObjectCredential;
+import org.jboss.identity.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.jboss.identity.impl.api.session.managers.AbstractManager;
+import org.jboss.identity.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
+import org.jboss.identity.impl.api.SimpleAttribute;
+import org.jboss.identity.impl.api.PasswordCredential;
+import org.jboss.identity.impl.api.SimpleCredentialType;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class AttributesManagerImpl extends AbstractManager implements AttributesManager
+{
+
+ public AttributesManagerImpl(IdentitySession session)
+ {
+ super(session);
+ }
+
+ public AttributeDescription getAttributeDescription(IdentityType identityType, String name)
+ {
+
+ Map<String, IdentityObjectAttributeMetaData> mdMap =
+ getRepository().getAttributesMetaData(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
+
+ if (mdMap != null && mdMap.containsKey(name))
+ {
+ IdentityObjectAttributeMetaData attributeMD = mdMap.get(name);
+ if (attributeMD instanceof AttributeDescription)
+ {
+ return (AttributeDescription)attributeMD;
+ }
+ else
+ {
+ return new IdentityObjectAttributeMetaDataImpl(attributeMD);
+ }
+ }
+
+ return null;
+
+ }
+
+ public Map<String, AttributeDescription> getSupportedAttributesDescriptions(IdentityType identityType)
+ {
+
+ Map<String, IdentityObjectAttributeMetaData> mdMap =
+ getRepository().getAttributesMetaData(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
+
+ Map<String, AttributeDescription> descriptionMap = new HashMap<String, AttributeDescription>();
+
+ if (mdMap != null)
+ {
+ for (IdentityObjectAttributeMetaData attributeMD : mdMap.values())
+ {
+ if (attributeMD instanceof AttributeDescription)
+ {
+ descriptionMap.put(attributeMD.getName(), (AttributeDescription)attributeMD);
+ }
+ else
+ {
+ descriptionMap.put(attributeMD.getName(), new IdentityObjectAttributeMetaDataImpl(attributeMD));
+ }
+ }
+ }
+
+ return descriptionMap;
+ }
+
+ public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException
+ {
+ return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
+ }
+
+ public Map<String, Attribute> getAttributes(IdentityType identity) throws IdentityException
+ {
+ Map<String, IdentityObjectAttribute> map = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
+
+ Map<String, Attribute> newMap = new HashMap<String, Attribute>();
+
+ for (Map.Entry<String, IdentityObjectAttribute> entry : map.entrySet())
+ {
+ newMap.put(entry.getKey(), convertAttribute(entry.getValue()));
+ }
+ return newMap;
+ }
+
+ public void updateAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
+ {
+ getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
+
+ }
+
+ public Attribute getAttribute(IdentityType identity, String attributeName) throws IdentityException
+ {
+ return getAttributes(identity).get(attributeName);
+ }
+
+ public void addAttribute(IdentityType identity, String attributeName, Object[] values) throws IdentityException
+ {
+ Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
+
+ addAttributes(identity, attrs);
+
+ }
+
+ public void addAttribute(IdentityType identity, String attributeName, Object value) throws IdentityException
+ {
+ Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, value)};
+
+
+ addAttributes(identity, attrs);
+
+ }
+
+ public void addAttributes(IdentityType identity, Attribute[] attributes) throws IdentityException
+ {
+ getRepository().addAttributes(getInvocationContext(), createIdentityObject(identity), convertAttributes(attributes));
+ }
+
+ public void removeAttributes(IdentityType identity, String[] attributeNames) throws IdentityException
+ {
+ getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identity), attributeNames);
+ }
+
+ public boolean hasPassword(Identity identity) throws IdentityException
+ {
+ return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), PasswordCredential.TYPE);
+ }
+
+ public boolean validatePassword(Identity identity, String password) throws IdentityException
+ {
+ return getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
+ }
+
+ public void updatePassword(Identity identity, String password) throws IdentityException
+ {
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), new PasswordCredential(password));
+ }
+
+ public boolean hasCredential(Identity identity, CredentialType credentialType) throws IdentityException
+ {
+ return getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(), new SimpleCredentialType(credentialType.getName()));
+ }
+
+ public boolean validateCredentials(Identity identity, Credential[] credentials) throws IdentityException
+ {
+
+ for (Credential credential : credentials)
+ {
+ IdentityObjectCredential ioc = null;
+
+ //Handle only those credentials that implement SPI
+
+ if (!(credential instanceof IdentityObjectCredential))
+ {
+ throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
+ }
+
+ // All credentials must pass
+
+ if (!getRepository().validateCredential(getInvocationContext(), createIdentityObject(identity), ioc))
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void updateCredential(Identity identity, Credential credential) throws IdentityException
+ {
+ if (credential instanceof IdentityObjectCredential)
+ {
+ getRepository().updateCredential(getInvocationContext(), createIdentityObject(identity), (IdentityObjectCredential)credential);
+ }
+ else
+ {
+ throw new IdentityException("Unsupported Credential implementation: " + credential.getClass());
+ }
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/PersistenceManagerImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/PersistenceManagerImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/PersistenceManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,167 @@
+/*
+* 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.api.session.managers;
+
+import org.jboss.identity.api.PersistenceManager;
+import org.jboss.identity.api.Identity;
+import org.jboss.identity.api.Group;
+import org.jboss.identity.api.GroupType;
+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;
+import org.jboss.identity.impl.NotYetImplementedException;
+import org.jboss.identity.impl.api.session.managers.AbstractManager;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class PersistenceManagerImpl extends AbstractManager implements PersistenceManager
+{
+
+ public PersistenceManagerImpl(IdentitySession session)
+ {
+ super(session);
+ }
+
+ public PersistenceManagerFeaturesDescription getFeaturesDescription()
+ {
+ throw new NotYetImplementedException("NYI");
+ }
+
+ public Identity createIdentity(String identityName) throws IdentityException
+ {
+ IdentityObjectType iot = getIdentityObjectType();
+
+ IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), identityName, iot);
+
+ return createIdentity(identityObject);
+ }
+
+ public Group createGroup(String groupName, GroupType groupType) throws IdentityException
+ {
+ IdentityObjectType iot = getIdentityObjectType(groupType);
+
+ IdentityObject identityObject = getRepository().createIdentityObject(getInvocationContext(), groupName, iot);
+
+ return createGroup(identityObject);
+ }
+
+ public void removeIdentity(Identity identity, boolean force) throws IdentityException
+ {
+ IdentityObjectType iot = getIdentityObjectType();
+
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(identity));
+
+ }
+
+ public void removeGroup(Group group, boolean force) throws IdentityException
+ {
+ //TODO: force
+
+ getRepository().removeIdentityObject(getInvocationContext(), createIdentityObject(group));
+ }
+
+ public int getIdentityCount() throws IdentityException
+ {
+ IdentityObjectType iot = getIdentityObjectType();
+
+ return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ }
+
+ public int getGroupTypeCount(GroupType groupType) throws IdentityException
+ {
+ IdentityObjectType iot = getIdentityObjectType(groupType);
+
+ return getRepository().getIdentityObjectsCount(getInvocationContext(), iot);
+ }
+
+ public Identity findIdentity(String name) throws IdentityException
+ {
+ return createIdentity(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType()));
+ }
+
+ public Identity findIdentityById(String id) throws IdentityException
+ {
+ return createIdentity(getRepository().findIdentityObject(getInvocationContext(), id));
+ }
+
+ public Collection<Identity> findIdentity(IdentitySearchControl[] controls) throws IdentityException
+ {
+
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(), convertSearchControls(controls));
+ 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 Group findGroup(String name, GroupType groupType) throws IdentityException
+ {
+ return createGroup(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType)));
+ }
+
+ public Group findGroupById(String id) throws IdentityException
+ {
+ return createGroup(getRepository().findIdentityObject(getInvocationContext(), id));
+ }
+
+ public Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[] controls) throws IdentityException
+ {
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(controls));
+ List<Group> groups = new LinkedList<Group>();
+
+ for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
+ {
+ IdentityObject identityObject = iterator.next();
+ groups.add(createGroup(identityObject));
+ }
+
+ return groups;
+ }
+
+ public Collection<Group> findGroup(GroupType groupType) throws IdentityException
+ {
+ return findGroup(groupType, null);
+ }
+
+ public boolean isVirtual(Identity identity)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException("Postponed");
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RelationshipManagerImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RelationshipManagerImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RelationshipManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,271 @@
+/*
+* 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.api.session.managers;
+
+import org.jboss.identity.api.RelationshipManager;
+import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.Group;
+import org.jboss.identity.api.Identity;
+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;
+import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.impl.NotYetImplementedException;
+import org.jboss.identity.impl.api.session.managers.AbstractManager;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RelationshipManagerImpl extends AbstractManager implements RelationshipManager
+{
+
+ public static final IdentityObjectRelationshipType MEMBER = new IdentityObjectRelationshipType()
+ {
+ public String getName()
+ {
+ return "JBOSS_IDENTITY_MEMBERSHIP";
+ }
+ };
+
+ public RelationshipManagerImpl(IdentitySession session)
+ {
+ super(session);
+ }
+
+ public RelationshipManagerFeaturesDescription getFeaturesDescription()
+ {
+ throw new NotYetImplementedException("NYI");
+ }
+
+ public void associateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
+ {
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ Group parent = parentsIterator.next();
+
+ for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ Group member = membersIterator.next();
+
+ associateGroups(parent, member);
+ }
+ }
+ }
+
+ public void associateGroups(Group parent, Group member) throws IdentityException
+ {
+ getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ }
+
+ public void associateIdentities(Collection<Group> parents, Collection<Identity> members) throws IdentityException
+ {
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ Group parent = parentsIterator.next();
+
+ for (Iterator<Identity> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ Identity member = membersIterator.next();
+
+ associateIdentities(parent, member);
+ }
+ }
+ }
+
+ public void associateIdentities(Group parent, Identity member) throws IdentityException
+ {
+ getRepository().createRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null, true);
+ }
+
+ public void disassociateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
+ {
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ Group parent = parentsIterator.next();
+
+ for (Iterator<Group> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ Group member = membersIterator.next();
+
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ }
+ }
+ }
+
+ public void disassociateIdentities(Collection<Group> parents, Collection<Identity> members) throws IdentityException
+ {
+ for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ Group parent = parentsIterator.next();
+
+ for (Iterator<Identity> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ Identity member = membersIterator.next();
+
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER, null);
+ }
+ }
+
+ }
+
+ public <G extends IdentityType, I extends IdentityType> boolean isAssociated(Collection<G> parents, Collection<I> members) throws IdentityException
+ {
+ //TODO: maybe IdentityStore should have isRelationshipPresent method to improve this?
+
+ for (Iterator<G> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
+ {
+ IdentityType parent = parentsIterator.next();
+
+ for (Iterator<I> membersIterator = members.iterator(); membersIterator.hasNext();)
+ {
+ IdentityType member = membersIterator.next();
+
+ Collection<IdentityObjectRelationship> relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent), createIdentityObject(member), MEMBER);
+
+ if (relationships.size() == 0)
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public <G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member) throws IdentityException
+ {
+ Set<G> parents = new HashSet<G>();
+ parents.add(parent);
+ Set<I> members = new HashSet<I>();
+ members.add(member);
+
+ return isAssociated(parents, members);
+ }
+
+ 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);
+
+ //TODO Handle inherited
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(controls));
+
+ for (IdentityObject io : ios)
+ {
+ if (io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
+ }
+
+ return identities;
+
+ }
+
+ 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, convertSearchControls(controls));
+
+ for (IdentityObject io : ios)
+ {
+ if (io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
+ }
+
+ return identities;
+ }
+
+ 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, convertSearchControls(controls));
+
+ for (IdentityObject io : ios)
+ {
+ identities.add(createGroup(io));
+ }
+
+ return identities;
+ }
+
+ public Collection<Group> findAssociatedGroups(Identity identity) throws IdentityException
+ {
+ return findAssociatedGroups(identity, new IdentitySearchControl[] {});
+ }
+
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, IdentitySearchControl[] controls) throws IdentityException
+ {
+ List<Identity> identities = new LinkedList<Identity>();
+
+ //TODO Handle inherited
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(controls));
+
+ //TODO: filter out groups....
+
+ for (IdentityObject io : ios)
+ {
+ identities.add(createIdentity(io));
+ }
+
+ return identities;
+ }
+
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited) throws IdentityException
+ {
+ return findAssociatedIdentities(group, inherited, null);
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RoleManagerImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RoleManagerImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/managers/RoleManagerImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,289 @@
+/*
+* 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.api.session.managers;
+
+import org.jboss.identity.api.RoleManager;
+import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.RoleType;
+import org.jboss.identity.api.Role;
+import org.jboss.identity.api.Identity;
+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;
+import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.impl.NotYetImplementedException;
+import org.jboss.identity.impl.api.session.managers.AbstractManager;
+import org.jboss.identity.impl.api.model.SimpleRoleType;
+import org.jboss.identity.impl.api.model.SimpleRole;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleManagerImpl extends AbstractManager implements RoleManager
+{
+ public static final IdentityObjectRelationshipType ROLE = new IdentityObjectRelationshipType()
+ {
+ public String getName()
+ {
+ return "JBOSS_IDENTITY_ROLE";
+ }
+ };
+
+ public RoleManagerImpl(IdentitySession session)
+ {
+ super(session);
+ }
+
+ public RoleManagerFeaturesDescription getSupportedFeatures()
+ {
+ throw new NotYetImplementedException("NYI");
+ }
+
+ public RoleType createRoleType(String name) throws IdentityException
+ {
+ String roleType = null;
+
+ try
+ {
+ roleType = getRepository().createRelationshipName(getInvocationContext(), name);
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported");
+ }
+
+ return new SimpleRoleType(roleType);
+ }
+
+ public void removeRoleType(String name) throws IdentityException
+ {
+ try
+ {
+ getRepository().removeRelationshipName(getInvocationContext(), name);
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported");
+ }
+ }
+
+ public void removeRoleType(RoleType roleType) throws IdentityException
+ {
+ removeRoleType(roleType.getName());
+ }
+
+ public RoleType getRoleType(String name) throws IdentityException
+ {
+ try
+ {
+ Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), null);
+ if (names.contains(name))
+ {
+ return new SimpleRoleType(name);
+ }
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported");
+ }
+
+ return null;
+ }
+
+ public Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls) throws IdentityException
+ {
+
+ try
+ {
+ Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), convertSearchControls(controls));
+ Set<RoleType> types = new HashSet<RoleType>();
+
+ for (String name : names)
+ {
+ types.add(new SimpleRoleType(name));
+ }
+
+ return types;
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported");
+ }
+
+ }
+
+ public Role createRole(RoleType roleType, Identity identity, Group group) throws IdentityException
+ {
+ //TODO: add createRoleType switch to the API
+
+ IdentityObjectRelationship rel = getRepository().createRelationship(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName(), false);
+
+ //TODO: null id - IdentityObjectRelationship doesn't have id
+ return new SimpleRole(new SimpleRoleType(rel.getName()), createIdentity(rel.getFromIdentityObject()), createGroup(rel.getToIdentityObject()));
+
+ }
+
+ public void removeRole(RoleType roleType, Identity identity, Group group) throws IdentityException
+ {
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName());
+ }
+
+ public void removeRole(Role role) throws IdentityException
+ {
+ getRepository().removeRelationship(getInvocationContext(), createIdentityObject(role.getIdentity()), createIdentityObject(role.getGroup()), ROLE, role.getRoleType().getName());
+ }
+
+ public boolean hasRole(Identity identity, Group group, RoleType roleType) throws IdentityException
+ {
+ //TODO: does separate hasRelationship method in IdentityStore makes sense?
+
+ Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE);
+
+ for (IdentityObjectRelationship rel : rels)
+ {
+ if (rel.getType().getName().equals(ROLE.getName()) && rel.getName() != null && rel.getName().equals(roleType.getName()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ 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
+ {
+
+ Set<IdentityObjectRelationship> rels = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identity), createIdentityObject(group), ROLE);
+ Set<RoleType> types = new HashSet<RoleType>();
+
+ for (IdentityObjectRelationship rel : rels)
+ {
+ types.add(new SimpleRoleType(rel.getName()));
+ }
+
+ return types;
+
+
+ }
+
+ 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), convertSearchControls(controls));
+
+ for (String name : names)
+ {
+ types.add(new SimpleRoleType(name));
+ }
+
+ return types;
+
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported", e);
+ }
+
+ }
+
+ public Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException
+ {
+ return findGroupRoleTypes(group, null);
+ }
+
+ 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), convertSearchControls(controls));
+
+ for (String name : names)
+ {
+ types.add(new SimpleRoleType(name));
+ }
+
+ return types;
+
+ }
+ catch (OperationNotSupportedException e)
+ {
+ throw new IdentityException("Role management not supported");
+ }
+
+ }
+
+ 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
+ {
+ Set<Role> roles = new HashSet<Role>();
+
+ Set<IdentityObjectRelationship> relationships = null;
+
+ // If Identity then search for parent relationships
+ if (identityType instanceof Identity)
+ {
+ relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identityType), ROLE, true, true, null);
+ }
+ // If Group then search for child relationships
+ else
+ {
+ relationships = getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(identityType), ROLE, false, true, null);
+ }
+
+ for (IdentityObjectRelationship relationship : relationships)
+ {
+ roles.add(new SimpleRole(new SimpleRoleType(relationship.getName()), createIdentity(relationship.getFromIdentityObject()), createGroup(relationship.getToIdentityObject())));
+ }
+
+ return roles;
+
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/DirectIdentityObjectTypeMapperImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,100 @@
+/*
+* 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.api.session.mapper;
+
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.impl.types.SimpleIdentityObjectType;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
+import org.jboss.identity.impl.api.model.SimpleGroupType;
+import org.jboss.identity.api.GroupType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class DirectIdentityObjectTypeMapperImpl implements IdentityObjectTypeMapper
+{
+
+ private final String identityTypeName;
+
+ public DirectIdentityObjectTypeMapperImpl(String identityTypeName)
+ {
+ this.identityTypeName = identityTypeName;
+ }
+
+ public IdentityObjectType getIdentityObjectType()
+ {
+ return new SimpleIdentityObjectType(identityTypeName);
+ }
+
+ public IdentityObjectType getIdentityObjectType(GroupType groupType)
+ {
+ if (groupType == null)
+ {
+ throw new IllegalArgumentException("groupType is null");
+ }
+
+ return new SimpleIdentityObjectType(groupType.getName());
+ }
+
+ public GroupType getGroupType(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ return new SimpleGroupType(identityObjectType.getName());
+
+ }
+
+ public boolean isGroupType(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ if (isIdentity(identityObjectType))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ public boolean isIdentity(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ if (identityObjectType.getName().equals(identityTypeName))
+ {
+ return true;
+ }
+ return false;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapper.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapper.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapper.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapper.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,51 @@
+/*
+* 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.api.session.mapper;
+
+import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.api.Identity;
+import org.jboss.identity.api.GroupType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectTypeMapper
+{
+
+ IdentityObjectType getIdentityObjectType();
+
+
+ IdentityObjectType getIdentityObjectType(GroupType groupType);
+
+
+ GroupType getGroupType(IdentityObjectType identityObjectType);
+
+
+ boolean isGroupType(IdentityObjectType identityObjectType);
+
+
+ boolean isIdentity(IdentityObjectType identityObjectType);
+
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapperImpl.java (from rev 198, trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentityObjectTypeMapperImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapperImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/session/mapper/IdentityObjectTypeMapperImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,129 @@
+/*
+* 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.api.session.mapper;
+
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.api.GroupType;
+import org.jboss.identity.impl.types.SimpleIdentityObjectType;
+import org.jboss.identity.impl.api.session.mapper.IdentityObjectTypeMapper;
+import org.jboss.identity.impl.api.model.SimpleGroupType;
+
+import java.util.Map;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityObjectTypeMapperImpl implements IdentityObjectTypeMapper
+{
+
+ /**
+ * IdentityObjectType --> GroupType
+ */
+ private final Map<String, String> groupTypeMap;
+
+ private final String identityTypeName;
+
+ public IdentityObjectTypeMapperImpl(Map<String, String> map, String identityTypeName)
+ {
+ groupTypeMap = Collections.unmodifiableMap(map);
+ this.identityTypeName = identityTypeName;
+ }
+
+ public IdentityObjectType getIdentityObjectType()
+ {
+ return new SimpleIdentityObjectType(identityTypeName);
+ }
+
+ public IdentityObjectType getIdentityObjectType(GroupType groupType)
+ {
+ if (groupType == null)
+ {
+ throw new IllegalArgumentException("groupType is null");
+ }
+
+ for (Map.Entry<String, String> entry : groupTypeMap.entrySet())
+ {
+ if (entry.getValue().equals(groupType.getName()))
+ {
+ return new SimpleIdentityObjectType(entry.getKey());
+ }
+ }
+
+ return null;
+ }
+
+ public GroupType getGroupType(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ String name = groupTypeMap.get(identityObjectType.getName());
+
+ if (name != null)
+ {
+ return new SimpleGroupType(name);
+ }
+
+ return null;
+
+ }
+
+ public boolean isGroupType(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ if (isIdentity(identityObjectType))
+ {
+ return false;
+ }
+
+ if (groupTypeMap.containsKey(identityObjectType.getName()))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+
+ public boolean isIdentity(IdentityObjectType identityObjectType)
+ {
+ if (identityObjectType == null)
+ {
+ throw new IllegalArgumentException("identityObjectType is null");
+ }
+
+ if (identityObjectType.getName().equals(identityTypeName))
+ {
+ return true;
+ }
+ return false;
+ }
+}
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -35,9 +35,9 @@
import org.jboss.identity.spi.configuration.metadata.IdentityStoreMappingMetaData;
import org.jboss.identity.spi.configuration.metadata.IdentityConfigurationMetaData;
import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.spi.exception.IdentityConfigurationException;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
-import org.jboss.identity.impl.api.IdentityObjectAttributeMetaDataImpl;
+import org.jboss.identity.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
import org.jboss.identity.impl.configuration.jaxb2.generated.JbossIdentityType;
import org.jboss.identity.impl.configuration.jaxb2.generated.IdentityStoreType;
import org.jboss.identity.impl.configuration.jaxb2.generated.RepositoryType;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -22,7 +22,7 @@
package org.jboss.identity.impl.configuration.metadata;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -27,8 +27,6 @@
import java.util.Set;
import java.util.HashMap;
import java.util.Collections;
-import java.util.Arrays;
-import java.util.List;
import java.util.Collection;
import javax.persistence.Column;
@@ -47,11 +45,8 @@
import javax.persistence.JoinTable;
import org.jboss.identity.exception.PolicyValidationException;
-import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectCredentialType;
-import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CollectionOfElements;
@@ -180,20 +175,6 @@
this.attributes = attributes;
}
-// public Collection getAttribute(String name)
-// {
-// for (HibernateIdentityObjectAttribute attribute : attributes)
-// {
-// if (attribute.getName().equals(name))
-// {
-// return Collections.unmodifiableCollection(attribute.getValues());
-// }
-// }
-//
-//
-// return new HashSet<String>();
-// }
-//
public Map<String, Collection> getAttributesAsMap()
{
Map<String, Collection> map = new HashMap<String, Collection>();
@@ -206,53 +187,12 @@
return Collections.unmodifiableMap(map);
}
-//
+
public void addTextAttribute(String name, String[] values)
{
attributes.add(new HibernateIdentityObjectTextAttribute(this, name, values));
}
-
- //
-// public void updateAttribute(String name, IdentityObjectAttribute attribute, IdentityObjectAttributeMetaData md)
-// throws IdentityException
-// {
-//
-// }
-//
-// public void addAttributeValues(String name, String[] values) throws IdentityException
-// {
-//
-// for (HibernateIdentityObjectAttribute attribute : attributes)
-// {
-// if (attribute.getName().equals(name))
-// {
-// Set<String> mergedValues = new HashSet<String>(attribute.getValues());
-// List<String> list = Arrays.asList(values);
-// mergedValues.addAll(new HashSet<String>(list));
-// attribute.setValues(mergedValues);
-//
-// return;
-// }
-// }
-//
-// addAttribute(name, values);
-// }
-//
-// public void updateAttributes(Map<String, Set<String>> values)
-// {
-// Set<HibernateIdentityObjectAttribute> newAttrs= new HashSet<HibernateIdentityObjectAttribute>();
-//
-// for (String name : values.keySet())
-// {
-// newAttrs.add(new HibernateIdentityObjectAttribute(this, name, new HashSet<String>(values.get(name))));
-// }
-//
-// attributes = newAttrs;
-// }
-
-
-
public void removeAttribute(String name)
{
HibernateIdentityObjectAttribute attributeToRemove = null;
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -58,11 +58,6 @@
return dn;
}
- public String getFQDN()
- {
- return null;
- }
-
public String getName()
{
return id;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectRelationshipImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectRelationshipImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectRelationshipImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -57,12 +57,12 @@
public IdentityObjectRelationshipType getType()
{
- //TODO
+ //TODO: for now just hardcoded value
return new IdentityObjectRelationshipType()
{
public String getName()
{
- return "";
+ return "JBOSS_IDENTITY_MEMBERSHIP";
}
};
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -118,7 +118,7 @@
catch (IdentityException e)
{
//store may throw exception if there is no identity so do nothing
- //TODO: this behaviour sucks...
+ //TODO: should have isIdentityPresent method
}
return false;
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -35,10 +35,10 @@
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.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.spi.model.IdentityObjectCredential;
import org.jboss.identity.spi.model.IdentityObjectCredentialType;
import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
import org.jboss.identity.impl.api.PageSearchControl;
@@ -70,8 +70,7 @@
*/
public class FallbackIdentityStoreRepository extends AbstractIdentityStoreRepository
{
- //TODO: - relationships in default store - after resolving relationships for synced IOs those IOs need to be retreived from proper stores once again
- //TODO: if they don't exist such relationship + synced identities need to be cleanedup from default store
+ //TODO: -
//TODO: - filter out controls based on features MD before passing
//TODO: - configuration option to store not mapped attributes in default store
//TODO: - configuration option to fallback named relationships to default store when not supported in mapped one
@@ -355,7 +354,7 @@
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id) throws IdentityException
{
- //TODO: information about the store mapping should be encoded in type as now its like random guess...
+ //TODO: information about the store mapping should be encoded in id as now its like random guess and this kills performance ...
for (IdentityStore identityStore : getIdentityStoreMappings().values())
{
@@ -401,45 +400,58 @@
Collection<IdentityObject> results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, controls);
- Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, controls);
+ IdentityObject defaultStoreIdentityObject = null;
- PageSearchControl pageSearchControl = null;
- SortByNameSearchControl sortSearchControl = null;
+ try
+ {
+ defaultStoreIdentityObject = defaultIdentityStore.findIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType());
+ }
+ catch (IdentityException e)
+ {
+ return results;
+ }
- if (controls != null)
+ if (defaultStoreIdentityObject != null)
{
- for (IdentityObjectSearchControl control : controls)
+ Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, controls);
+
+ PageSearchControl pageSearchControl = null;
+ SortByNameSearchControl sortSearchControl = null;
+
+ if (controls != null)
{
- if (control instanceof PageSearchControl)
+ for (IdentityObjectSearchControl control : controls)
{
- pageSearchControl = (PageSearchControl)control;
+ if (control instanceof PageSearchControl)
+ {
+ pageSearchControl = (PageSearchControl)control;
+ }
+ else if (control instanceof SortByNameSearchControl)
+ {
+ sortSearchControl = (SortByNameSearchControl)control;
+ }
}
- else if (control instanceof SortByNameSearchControl)
- {
- sortSearchControl = (SortByNameSearchControl)control;
- }
}
- }
- // If default store contain related relationships merge and sort/page once more
- if (objects != null && objects.size() != 0)
- {
- results.addAll(objects);
-
- //TODO: hardcoded List
- if (pageSearchControl != null && results instanceof List)
+ // If default store contain related relationships merge and sort/page once more
+ if (objects != null && objects.size() != 0)
{
- results = cutPageFromResults((List<IdentityObject>)results, pageSearchControl);
- }
+ results.addAll(objects);
- //TODO: hardcoded List
- if (sortSearchControl != null && results instanceof List)
- {
- sortByName((List<IdentityObject>)results, sortSearchControl.isAscending());
+ //TODO: hardcoded List
+ if (pageSearchControl != null && results instanceof List)
+ {
+ results = cutPageFromResults((List<IdentityObject>)results, pageSearchControl);
+ }
+
+ //TODO: hardcoded List
+ if (sortSearchControl != null && results instanceof List)
+ {
+ sortByName((List<IdentityObject>)results, sortSearchControl.isAscending());
+ }
}
}
-
return results;
}
@@ -978,7 +990,7 @@
});
}
- //TODO: other way?
+ //TODO: other way
private List<IdentityObject> cutPageFromResults(List<IdentityObject> objects, PageSearchControl pageControl)
{
List<IdentityObject> results = new LinkedList<IdentityObject>();
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -28,6 +28,8 @@
import java.util.Map;
/**
+ * Wrapper around many IdentityStoreSession objects. Simply iterates and delegates method invocation
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -104,38 +104,35 @@
String relationshipName = relationshipMetaData.getRelationshipTypeRef();
String toTypeName = relationshipMetaData.getIdentityObjectTypeRef();
- // Check if metadata info is consistent
- if (relationshipNames.contains(relationshipName))
- {
- // Populate
+ // Populate
- Map<String, Set<String>> mappings = null;
+ Map<String, Set<String>> mappings = null;
- if (supportedRelationshipMappings.containsKey(relationshipName))
- {
- mappings = supportedRelationshipMappings.get(relationshipName);
+ if (supportedRelationshipMappings.containsKey(relationshipName))
+ {
+ mappings = supportedRelationshipMappings.get(relationshipName);
- }
- else
- {
- mappings = new HashMap<String, Set<String>>();
- supportedRelationshipMappings.put(relationshipName, mappings);
- }
+ }
+ 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);
- }
+ Set<String> toTypes = null;
+ if (mappings.containsKey(fromTypeName))
+ {
+ toTypes = mappings.get(fromTypeName);
+ }
+ else
+ {
+ toTypes = new HashSet<String>();
+ mappings.put(fromTypeName, toTypes);
+ }
- toTypes.add(toTypeName);
+ toTypes.add(toTypeName);
- }
+
}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,170 +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.impl.store;
-//
-//import java.io.IOException;
-//import java.util.ArrayList;
-//import java.util.Collection;
-//import java.util.List;
-//import java.util.Map;
-//import java.util.Set;
-//
-//import org.jboss.identity.exception.IdentityException;
-//import org.jboss.identity.impl.types.SimpleIdentity;
-//import org.jboss.identity.model.core.IdentityObject;
-//import org.jboss.identity.model.core.IdentityObjectRelationshipType;
-//import org.jboss.identity.model.core.IdentityObjectType;
-//import org.jboss.identity.spi.store.FeaturesDescription;
-//import org.jboss.identity.spi.store.IdentityStore;
-//
-///**
-// * File Based Identity Store
-// * @author Anil.Saldhana at redhat.com
-// * @since Aug 1, 2008
-// */
-//public class FileBasedIdentityStore implements IdentityStore
-//{
-// //TODO: Handle file semantics
-//
-// private List<IdentityObject> identities = new ArrayList<IdentityObject>();
-//
-// public void addAttributes(IdentityObject identity, Map<String, Set<String>> attributes)
-// throws IdentityException
-// {
-// }
-//
-// public void bootstrap() throws IOException
-// {
-// }
-//
-//
-//
-// public IdentityObject createIdentityObject(String name, IdentityObjectType type) throws IdentityException
-// {
-// //Is there one already available?
-// IdentityObject identity = this.findIdentityObject(name);
-// if(identity == null)
-// {
-// identity = new SimpleIdentity(name);
-// identities.add(identity);
-// }
-// return identity;
-// }
-//
-// public <R extends IdentityObjectRelationshipType> void createRelationship(IdentityObject fromIdentity,
-// IdentityObject toIdentity,
-// IdentityObjectRelationshipType relationshipType)
-// throws IdentityException
-// {
-// }
-//
-// public <T extends IdentityObjectType> Collection<IdentityObject> findIdentityObject(IdentityObjectType identityType,
-// int offset,
-// int limit,
-// boolean orderedByName, boolean ascending) throws IdentityException
-// {
-// return null;
-// }
-//
-// public <T extends IdentityObjectType> Collection<IdentityObject> findIdentityObject(IdentityObjectType identityType,
-// Map<String, String[]> attributes, int offset,
-// int limit, boolean orderByName, boolean ascending)
-// throws IdentityException
-// {
-// return null;
-// }
-//
-// public <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(T identityType) throws IdentityException
-// {
-// return null;
-// }
-//
-// public IdentityObject findIdentityObject(String name, IdentityObjectType identityObjectType) throws IdentityException
-// {
-// return null;
-// }
-//
-// public IdentityObject findIdentityObject(Object id) throws IdentityException
-// {
-// return null;
-// }
-//
-// public Map<String, Set<String>> getAttributes(IdentityObject identity)
-// throws IdentityException
-// {
-// return null;
-// }
-//
-// public String getId()
-// {
-// return null;
-// }
-//
-//
-// public <T extends IdentityObjectType> int getIdentityObjectsCount(T identityType) throws IdentityException
-// {
-// return 0;
-// }
-//
-// public <R extends IdentityObjectRelationshipType> Collection<IdentityObject> findIdentityObject(IdentityObject identity, R relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
-// {
-// return null;
-// }
-//
-// public FeaturesDescription getSupportedFeatures()
-// {
-// return null;
-// }
-//
-// public void removeAttributes(IdentityObject identity, Set<String> attributes)
-// throws IdentityException
-// {
-// }
-//
-// public void removeIdentityObject(IdentityObject identity) throws IdentityException
-// {
-// }
-//
-// public <R extends IdentityObjectRelationshipType> void removeRelationship(IdentityObject fromIdentity,
-// IdentityObject toIdentity,
-// IdentityObjectRelationshipType relationshipType)
-// throws IdentityException
-// {
-// }
-//
-// public void removeRelationships(IdentityObject identity1, IdentityObject identity2)
-// throws IdentityException
-// {
-// }
-//
-// public Set<IdentityObjectRelationshipType> resolveRelationships(IdentityObject fromIdentity,
-// IdentityObject toIdentity)
-// throws IdentityException
-// {
-// return null;
-// }
-//
-// public void updateAttributes(IdentityObject identity, Map<String, Set<String>> attributes)
-// throws IdentityException
-// {
-// }
-//}
\ No newline at end of file
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -35,9 +35,9 @@
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.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.spi.model.IdentityObjectCredentialType;
import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
@@ -96,29 +96,6 @@
"select r from HibernateIdentityObjectRelationship r where r.fromIdentityObject like :fromIO and " +
"r.toIdentityObject like :toIO and r.type.name like :typeName and r.name.name like :name";
-// private final String QUERY_RELATIONSHIP_BY_FROM =
-// "select r from HibernateIdentityObjectRelationship r where r.fromIdentityObject like :fromIO";
-//
-// private final String QUERY_RELATIONSHIP_BY_FROM_NAMED =
-// "select r from HibernateIdentityObjectRelationship r where r.fromIdentityObject like :fromIO and " +
-// "r.name is not null";
-//
-// private final String QUERY_RELATIONSHIP_BY_FROM_NAME =
-// "select r from HibernateIdentityObjectRelationship r where r.fromIdentityObject like :fromIO and " +
-// "r.name.name = :name";
-//
-// private final String QUERY_RELATIONSHIP_BY_TO =
-// "select r from HibernateIdentityObjectRelationship r where r.toIdentityObject like :toIO";
-//
-// private final String QUERY_RELATIONSHIP_BY_TO_NAMED =
-// "select r from HibernateIdentityObjectRelationship r where r.toIdentityObject like :toIO and" +
-// "r.name is not null";
-//
-// private final String QUERY_RELATIONSHIP_BY_TO_NAME =
-// "select r from HibernateIdentityObjectRelationship r where r.toIdentityObject like :toIO and " +
-// "r.name.name = :name";
-
-
private final String QUERY_RELATIONSHIP_BY_IDENTITIES =
"select r from HibernateIdentityObjectRelationship r where " +
"(r.fromIdentityObject like :IO1 and r.toIdentityObject like :IO2) or " +
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,37 +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.hibernate;
-
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.hibernate.ejb.HibernateEntityManager;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-//public interface HibernateIdentityStoreInvocationContext extends IdentityStoreInvocationContext
-//{
-//
-// public HibernateEntityManager getHibernateEntityManager();
-//
-//}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -30,6 +30,8 @@
import javax.persistence.Persistence;
/**
+ * Wrapper around HibernateEntityManager
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityObjectTypeConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityObjectTypeConfiguration.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityObjectTypeConfiguration.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -27,6 +27,8 @@
import java.util.Map;
/**
+ * Helper interface to expose LDAP IdentityStore configuration in a different way
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreConfiguration.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreConfiguration.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -25,6 +25,8 @@
import org.jboss.identity.spi.model.IdentityObjectType;
/**
+ * Helper interface to expose LDAP IdentityStore configuration in a different way
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -36,7 +36,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.attribute.IdentityObjectAttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
@@ -47,7 +47,7 @@
import org.jboss.identity.impl.api.PageSearchControl;
import org.jboss.identity.impl.api.AttributeFilterSearchControl;
import org.jboss.identity.impl.api.NameFilterSearchControl;
-import org.jboss.identity.impl.api.SimpleAttributeImpl;
+import org.jboss.identity.impl.api.SimpleAttribute;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.LdapName;
@@ -1587,7 +1587,7 @@
if (attr != null)
{
- IdentityObjectAttribute identityObjectAttribute = new SimpleAttributeImpl(name);
+ IdentityObjectAttribute identityObjectAttribute = new SimpleAttribute(name);
NamingEnumeration values = attr.getAll();
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -31,10 +31,12 @@
import java.util.Hashtable;
/**
+ * Session around LDAP store. Exposes LDAP connection (LdapContext) and does nothing for transaction related methods
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class LDAPIdentityStoreSessionImpl implements IdentityStoreSession
+public class LDAPIdentityStoreSessionImpl implements IdentityStoreSession
{
private final String INITIAL_CONTEXT_FACTORY;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -24,7 +24,7 @@
import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import java.util.Map;
import java.util.Set;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -59,15 +59,6 @@
public static final int SEARCH_TIME_LIMIT_DEFAULT = 10000;
-// public SimpleLDAPIdentityStoreConfiguration(String providerURL, String adminDN, String adminPassword, int searchTimeLimit, Map<String, LDAPIdentityObjectTypeConfiguration> typesConfiguration)
-// {
-// this.providerURL = providerURL;
-// this.adminDN = adminDN;
-// this.adminPassword = adminPassword;
-// this.searchTimeLimit = searchTimeLimit;
-// this.typesConfiguration = typesConfiguration;
-// }
-
public SimpleLDAPIdentityStoreConfiguration(IdentityStoreConfigurationMetaData storeMD)
{
if (storeMD == 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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -28,6 +28,7 @@
/**
* Very simple identity object
+ *
* @author boleslaw dot dawidowicz at redhat anotherdot com
*
* @since Aug 6, 2008
@@ -76,11 +77,6 @@
return type;
}
- public String getFQDN()
- {
- return null;
- }
-
public void validatePolicy() throws PolicyValidationException
{
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -31,10 +31,10 @@
import org.jboss.identity.api.Attribute;
import org.jboss.identity.api.AttributeDescription;
import org.jboss.identity.p3p.P3PConstants;
+import org.jboss.identity.impl.api.model.SimpleGroupType;
import java.util.Collection;
import java.util.Map;
-import java.util.HashMap;
import java.util.Random;
import java.util.Arrays;
@@ -122,6 +122,13 @@
session.getRelationshipManager().associateGroups(projectsOU, asProject);
session.getRelationshipManager().associateGroups(projectsOU, seamProject);
+ // Check...
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, portalProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, soaProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, jbpmProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, asProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, seamProject));
+
// Portal is part of common frameworks
session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
@@ -279,9 +286,9 @@
// User attributes
Attribute[] userInfo = new Attribute[]
{
- new SimpleAttributeImpl(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"}),
- new SimpleAttributeImpl(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"}),
- new SimpleAttributeImpl("picture", new byte[][]{picture})
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"}),
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"}),
+ new SimpleAttribute("picture", new byte[][]{picture})
};
session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
@@ -310,8 +317,6 @@
IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
- //TODO: alter realm policies to make ORGANIZATION, ORGANIZATION_UNIT, DIVISION, DEPARTMENT and OFFICE hierarchical groups
-
IdentitySession session = factory.createIdentitySession(realmName);
session.getTransaction().start();
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -32,8 +32,7 @@
import org.jboss.identity.impl.api.SortByNameSearchControl;
import org.jboss.identity.impl.api.AttributeFilterSearchControl;
import org.jboss.identity.impl.api.PageSearchControl;
-import org.jboss.identity.impl.api.SimpleAttributeImpl;
-import org.jboss.identity.api.Attribute;
+import org.jboss.identity.impl.api.SimpleAttribute;
import java.util.Collection;
import java.util.Map;
@@ -153,8 +152,8 @@
//Map<String, String[]> attrs = new HashMap<String, String[]>();
IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key1", new String[]{"val1", "val2", "val3"}),
- new SimpleAttributeImpl("key2", new String[]{"val1", "val2", "val3", "val4"})
+ new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
};
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
@@ -174,7 +173,7 @@
testContext.flush();
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key3", new String[]{"val1"})
+ new SimpleAttribute("key3", new String[]{"val1"})
};
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
@@ -197,7 +196,7 @@
testContext.flush();
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key3", new String[]{"val2"})
+ new SimpleAttribute("key3", new String[]{"val2"})
};
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
@@ -506,8 +505,8 @@
attrs.put("phone", new String[] {"777 777 777"});
attrs.put("description", new String[] {"sample desc"});
- IdentityObjectAttribute phone = new SimpleAttributeImpl("phone", new String[] {"777 777 777"});
- IdentityObjectAttribute description = new SimpleAttributeImpl("description", new String[] {"sample desc"});
+ IdentityObjectAttribute phone = new SimpleAttribute("phone", new String[] {"777 777 777"});
+ IdentityObjectAttribute description = new SimpleAttribute("description", new String[] {"sample desc"});
testContext.getStore().addAttributes(testContext.getCtx(), group1, new IdentityObjectAttribute[]{phone, description});
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -35,12 +35,11 @@
import org.jboss.identity.impl.store.CommonIdentityStoreTest;
import org.jboss.identity.impl.store.IdentityStoreTestContext;
import org.jboss.identity.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.impl.api.SimpleAttributeImpl;
+import org.jboss.identity.impl.api.SimpleAttribute;
import org.jboss.identity.exception.IdentityException;
import org.hibernate.ejb.HibernateEntityManager;
import java.util.Map;
-import java.util.HashMap;
import java.io.File;
/**
@@ -171,8 +170,8 @@
em.flush();
IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key1", new String[]{"val1", "val2", "val3"}),
- new SimpleAttributeImpl("key2", new String[]{"val1", "val2", "val3", "val4"})
+ new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
};
store.addAttributes(ctx, user1, attrs);
@@ -192,7 +191,7 @@
em.flush();
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key3", new String[]{"val1"})
+ new SimpleAttribute("key3", new String[]{"val1"})
};
@@ -216,7 +215,7 @@
em.flush();
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("key3", new String[]{"val2"})
+ new SimpleAttribute("key3", new String[]{"val2"})
};
store.addAttributes(ctx, user1, attrs);
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -35,7 +35,7 @@
import org.jboss.identity.impl.store.CommonIdentityStoreTest;
import org.jboss.identity.impl.store.IdentityStoreTestContext;
import org.jboss.identity.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.impl.api.SimpleAttributeImpl;
+import org.jboss.identity.impl.api.SimpleAttribute;
import org.jboss.identity.exception.IdentityException;
import org.opends.server.tools.LDAPModify;
@@ -46,14 +46,8 @@
import javax.naming.directory.DirContext;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.InitialLdapContext;
-import java.net.URL;
import java.util.Hashtable;
import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.logging.Logger;
-import java.util.logging.Level;
import java.io.File;
/**
@@ -399,8 +393,8 @@
//
IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("phone", new String[]{"val1", "val2", "val3"}),
- new SimpleAttributeImpl("description", new String[]{"val1", "val2", "val3", "val4"}),
+ new SimpleAttribute("phone", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("description", new String[]{"val1", "val2", "val3", "val4"}),
};
@@ -421,7 +415,7 @@
//
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("carLicense", new String[]{"val1"})
+ new SimpleAttribute("carLicense", new String[]{"val1"})
};
store.addAttributes(ctx, user1, attrs);
@@ -442,7 +436,7 @@
assertEquals(1, persistedAttrs.get("carLicense").getSize());
attrs = new IdentityObjectAttribute[]{
- new SimpleAttributeImpl("carLicense", new String[]{"val2"})
+ new SimpleAttribute("carLicense", new String[]{"val2"})
};
store.addAttributes(ctx, user1, attrs);
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/opends/OpenDSService.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/opends/OpenDSService.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/opends/OpenDSService.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -29,6 +29,8 @@
import org.opends.server.types.InitializationException;
/**
+ * Simple service class that enables to bootstrap OpenDS LDAP server and to manage its lifecycle
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-impl/src/test/resources/ldap/initial-empty-opends.ldif
===================================================================
--- trunk/identity-impl/src/test/resources/ldap/initial-empty-opends.ldif 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/resources/ldap/initial-empty-opends.ldif 2009-01-13 15:18:42 UTC (rev 211)
@@ -30,3 +30,18 @@
objectclass: organizationalUnit
ou: Organizations
+dn: ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: OrganizationUnits
+
+dn: ou=Departments,o=test,dc=portal,dc=example,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Departments
+
+dn: ou=Offices,o=test,dc=portal,dc=example,dc=com
+objectclass: top
+objectclass: organizationalUnit
+ou: Offices
+
Modified: trunk/identity-impl/src/test/resources/organization-test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/organization-test-config.xml 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-impl/src/test/resources/organization-test-config.xml 2009-01-13 15:18:42 UTC (rev 211)
@@ -8,6 +8,7 @@
<repository-id-ref>RedHat Repository DB</repository-id-ref>
<identity-type-mappings>
<identity-mapping>IDENTITY</identity-mapping>
+ <!-- group types -->
</identity-type-mappings>
</realm>
<realm>
@@ -106,7 +107,7 @@
<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>DEPARTMENT</identity-object-type>-->
<identity-object-type>PROJECT</identity-object-type>
<identity-object-type>PEOPLE</identity-object-type>
</identity-object-types>
@@ -116,6 +117,9 @@
<identity-store-id>LDAP Identity Store</identity-store-id>
<identity-object-types>
<identity-object-type>IDENTITY</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
</identity-object-types>
<options/>
</identity-store-mapping>
@@ -140,11 +144,11 @@
<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>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>DEPARTMENT</identity-object-type>-->
<identity-object-type>SECURITY</identity-object-type>
<identity-object-type>PEOPLE</identity-object-type>
</identity-object-types>
@@ -154,6 +158,10 @@
<identity-store-id>LDAP Identity Store</identity-store-id>
<identity-object-types>
<identity-object-type>IDENTITY</identity-object-type>
+ <identity-object-type>DEPARTMENT</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-types>
<options/>
</identity-store-mapping>
@@ -305,7 +313,9 @@
<id>LDAP Identity Store</id>
<class>org.jboss.identity.impl.store.ldap.LDAPIdentityStoreImpl</class>
<external-config/>
- <supported-relationship-types/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+ </supported-relationship-types>
<supported-identity-object-types>
<identity-object-type>
<name>IDENTITY</name>
@@ -366,20 +376,28 @@
</options>
</identity-object-type>
<identity-object-type>
- <name>GROUP</name>
+ <name>ORGANIZATION</name>
<relationships>
<relationship>
- <relationship-type-ref/>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</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-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
</relationship>
<relationship>
- <relationship-type-ref/>
- <identity-object-type-ref>GROUP</identity-object-type-ref>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
</relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
</relationships>
<credentials/>
<attributes/>
@@ -390,7 +408,7 @@
</option>
<option>
<name>ctxDNs</name>
- <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ <value>ou=Organizations,o=test,dc=portal,dc=example,dc=com</value>
</option>
<!--<option>-->
<!--<name>entrySearchFilter</name>-->
@@ -420,12 +438,24 @@
</options>
</identity-object-type>
<identity-object-type>
- <name>ROLE</name>
+ <name>ORGANIZATION_UNIT</name>
<relationships>
<relationship>
- <relationship-type-ref/>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
</relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>OFFICE</identity-object-type-ref>
+ </relationship>
</relationships>
<credentials/>
<attributes/>
@@ -436,7 +466,7 @@
</option>
<option>
<name>ctxDNs</name>
- <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ <value>ou=OrganizationUnits,o=test,dc=portal,dc=example,dc=com</value>
</option>
<!--<option>-->
<!--<name>entrySearchFilter</name>-->
@@ -465,6 +495,106 @@
</option>
</options>
</identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>DEPARTMENT</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>ORGANIZATION_UNIT</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Departments,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>OFFICE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Offices,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>
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/IdentityObjectAttributeMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/IdentityObjectAttributeMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/IdentityObjectAttributeMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,64 +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.spi.attribute;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface IdentityObjectAttributeMetaData
-{
- public static final String TEXT_TYPE = "text";
-
- public static final String BINARY_TYPE = "binary";
-
- /**
- * @return
- */
- String getName();
-
- /**
- * @return
- */
- String getStoreMapping();
-
- /**
- * @return
- */
- String getType();
-
- /**
- * @return
- */
- boolean isReadonly();
-
- /**
- * @return
- */
- boolean isMultivalued();
-
- /**
- * @return
- */
- boolean isRequired();
-}
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,38 +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.spi.configuration;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface ConfigurationService
-{
-
-
-
-
-
-}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -26,16 +26,31 @@
import java.util.Map;
/**
+ * Main interface describing configuration of identity realms, repositories and global options
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface IdentityConfigurationMetaData
{
+
+ /**
+ * @return realms configuration
+ */
List<RealmConfigurationMetaData> getRealms();
+ /**
+ * @return repositories configuration
+ */
List<IdentityRepositoryConfigurationMetaData> getRepositories();
+ /**
+ * @return identity stores configuration
+ */
List<IdentityStoreConfigurationMetaData> getIdentityStores();
+ /**
+ * @return options map
+ */
Map<String, List<String>> getOptions();
}
Copied: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectAttributeMetaData.java (from rev 198, trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/IdentityObjectAttributeMetaData.java)
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectAttributeMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectAttributeMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -0,0 +1,64 @@
+/*
+* 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.configuration.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectAttributeMetaData
+{
+ public static final String TEXT_TYPE = "text";
+
+ public static final String BINARY_TYPE = "binary";
+
+ /**
+ * @return
+ */
+ String getName();
+
+ /**
+ * @return
+ */
+ String getStoreMapping();
+
+ /**
+ * @return
+ */
+ String getType();
+
+ /**
+ * @return
+ */
+ boolean isReadonly();
+
+ /**
+ * @return
+ */
+ boolean isMultivalued();
+
+ /**
+ * @return
+ */
+ boolean isRequired();
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -22,28 +22,53 @@
package org.jboss.identity.spi.configuration.metadata;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import java.util.List;
import java.util.Map;
/**
+ * Configuration of IdentityObjectType within IdentityStore
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface IdentityObjectTypeMetaData
{
+ /**
+ * @return name
+ */
String getName();
+ /**
+ * @return allowed relationships meta data
+ */
List<RelationshipMetaData> getRelationships();
+ /**
+ * @return allowed attributes meta data
+ */
List<IdentityObjectAttributeMetaData> getAttributes();
+ /**
+ * @return list of supported CredentialType names
+ */
List<String> getCredentials();
+ /**
+ * @return options
+ */
Map<String, List<String>> getOptions();
+ /**
+ * @param optionName
+ * @return option values
+ */
List<String> getOption(String optionName);
+ /**
+ * @param optionName
+ * @return single (first) value of a given option
+ */
String getOptionSingleValue(String optionName);
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -26,26 +26,57 @@
import java.util.Map;
/**
+ * Configuration of IdentityRepository
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface IdentityRepositoryConfigurationMetaData
{
+ /**
+ * @return id
+ */
String getId();
+ /**
+ * @return class name of IdentityStoreRepository implementation
+ */
String getClassName();
+ /**
+ * @return extenal configuration file
+ */
String getExternalConfig();
+ /**
+ * @return id of the default IdentityStore
+ */
String getDefaultIdentityStoreId();
+ /**
+ * @return id of the default AttributeStore
+ */
String getDefaultAttributeStroeId();
+ /**
+ * @return configuration meta data of IdentityStore mappings
+ */
List<IdentityStoreMappingMetaData> getIdentityStoreToIdentityObjectTypeMappings();
+ /**
+ * @return options
+ */
Map<String, List<String>> getOptions();
+ /**
+ * @param optionName
+ * @return values of a given option
+ */
List<String> getOption(String optionName);
+ /**
+ * @param optionName
+ * @return single (first) value of a given option
+ */
String getOptionSingleValue(String optionName);
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -26,24 +26,52 @@
import java.util.Map;
/**
+ * Configuration of IdentityStore
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface IdentityStoreConfigurationMetaData
{
+ /**
+ * @return id
+ */
String getId();
+ /**
+ * @return class name of an IdentityStore implementation
+ */
String getClassName();
+ /**
+ * @return external configuration file
+ */
String getExternalConfig();
+ /**
+ * @return list of supported RelationshipType names
+ */
List<String> getSupportedRelationshipTypes();
+ /**
+ * @return IdentityTypes configurations
+ */
List<IdentityObjectTypeMetaData> getSupportedIdentityTypes();
+ /**
+ * @return options
+ */
Map<String, List<String>> getOptions();
+ /**
+ * @param optionName
+ * @return option values
+ */
List<String> getOption(String optionName);
+ /**
+ * @param optionName
+ * @return single (first) value of a given option
+ */
String getOptionSingleValue(String optionName);
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -26,18 +26,37 @@
import java.util.Map;
/**
+ * Configuration of IdentityStore mappings within IdentityStoreRepository
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface IdentityStoreMappingMetaData
{
+ /**
+ * @return IdentityStore id
+ */
String getIdentityStoreId();
+ /**
+ * @return list of mapped IdentityObjectType names
+ */
List<String> getIdentityObjectTypeMappings();
+ /**
+ * @return options
+ */
Map<String, List<String>> getOptions();
+ /**
+ * @param optionName
+ * @return values of a given option
+ */
List<String> getOption(String optionName);
+ /**
+ * @param optionName
+ * @return single (first) value of a given option
+ */
String getOptionSingleValue(String optionName);
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -26,18 +26,34 @@
import java.util.List;
/**
+ * Configuration of a single realm
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface RealmConfigurationMetaData
{
+ /**
+ * @return realm id
+ */
String getId();
+ /**
+ * @return id of IdentityRepository
+ */
String getIdentityRepositoryIdRef();
+ /**
+ * @return name of IdentityObjectType that represents Identity object
+ */
String getIdentityMapping();
+ /**
+ *@return mappings between GroupType and IdentityObjectType names
+ */
Map<String, String> getGroupTypeMappings();
+ /**
+ * @return options
+ */
Map<String, List<String>> getOptions();
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,12 +23,20 @@
package org.jboss.identity.spi.configuration.metadata;
/**
+ * Relationship meta data
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface RelationshipMetaData
{
+ /**
+ * @return RelationshipType name
+ */
String getRelationshipTypeRef();
+ /**
+ * @return IdentityObjectType name
+ */
String getIdentityObjectTypeRef();
}
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -41,13 +41,6 @@
String getId();
/**
- * FQDN identifies the context of this object - realm, identity store in which it is persisted and object id in this store
- *
- * @return full qualified domain name for this identity
- */
- String getFQDN();
-
- /**
* <p>Return the name of the identity</p>
* @return
*/
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectAttribute.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectAttribute.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectAttribute.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -21,12 +21,11 @@
*/
package org.jboss.identity.spi.model;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
-
import java.util.Collection;
/**
- * An attribute of an identity
+ * Abstract representation of attribute related to IdentityObject object. Can have many values
+ *
* @author Anil.Saldhana at redhat.com
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @since Jun 30, 2008
@@ -34,14 +33,31 @@
public interface IdentityObjectAttribute
{
+ /**
+ * @return name
+ */
String getName();
+ /**
+ * @return attribute value. If attribute has many values it may be any one of them.
+ */
Object getValue();
+ /**
+ * Add attribute value. It will be appended.
+ *
+ * @param value
+ */
void addValue(Object value);
+ /**
+ * @return attribute values
+ */
Collection getValues();
+ /**
+ * @return number of attribute values
+ */
int getSize();
}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredential.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredential.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredential.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.spi.model;
/**
+ * Represents credential related to IdentityObject
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredentialType.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredentialType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectCredentialType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.spi.model;
/**
+ * Type of Credential
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@@ -30,8 +32,7 @@
{
/**
- *
- * @return
+ * @return name
*/
String getName();
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationship.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationship.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationship.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -23,6 +23,8 @@
package org.jboss.identity.spi.model;
/**
+ * Relationship between two IdentityObject objects
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@@ -30,18 +32,25 @@
{
/**
- * @return Relationship name or null if this relationship is not named
+ * @return relationship name or null if this relationship is not named
*/
String getName();
/**
*
- * @return
+ * @return relationship type
*/
IdentityObjectRelationshipType getType();
+ /**
+ *
+ * @return IdentityObject from which this relationship starts
+ */
IdentityObject getFromIdentityObject();
+ /**
+ * @return IdentityObject on which this relationship ends
+ */
IdentityObject getToIdentityObject();
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationshipType.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationshipType.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObjectRelationshipType.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -22,11 +22,17 @@
package org.jboss.identity.spi.model;
/**
+ * Type of Relationship
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @author Anil.Saldhana at redhat.com
* @since Jul 9, 2008
*/
public interface IdentityObjectRelationshipType
{
+
+ /**
+ * @return name
+ */
String getName();
}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/IdentityTypePolicy.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/IdentityTypePolicy.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/IdentityTypePolicy.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,32 +1,32 @@
-/*
- * 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.policy;
-
-/**
- * Marker Interface to indicate a policy
- * that governs one or more IdentityType(s)
- * @author Anil.Saldhana at redhat.com
- * @since Jul 13, 2008
- */
-public interface IdentityTypePolicy
-{
-}
\ No newline at end of file
+///*
+// * 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.policy;
+//
+///**
+// * Marker Interface to indicate a policy
+// * that governs one or more IdentityType(s)
+// * @author Anil.Saldhana at redhat.com
+// * @since Jul 13, 2008
+// */
+//public interface IdentityTypePolicy
+//{
+//}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/PasswordExpirationPolicy.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/PasswordExpirationPolicy.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/PasswordExpirationPolicy.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,34 +1,34 @@
-/*
- * 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.policy;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-
-/**
- * Policy to govern Passwords
- * @author Anil.Saldhana at redhat.com
- * @since Jul 13, 2008
- */
-public interface PasswordExpirationPolicy<P extends IdentityObjectType>
-extends IdentityTypePolicy
-{
-}
\ No newline at end of file
+///*
+// * 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.policy;
+//
+//import org.jboss.identity.spi.model.IdentityObjectType;
+//
+///**
+// * Policy to govern Passwords
+// * @author Anil.Saldhana at redhat.com
+// * @since Jul 13, 2008
+// */
+//public interface PasswordExpirationPolicy<P extends IdentityObjectType>
+//extends IdentityTypePolicy
+//{
+//}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/RelationshipPolicy.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/RelationshipPolicy.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/policy/RelationshipPolicy.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,50 +1,50 @@
-/*
- * 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.policy;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.exception.PolicyValidationException;
-
-/**
- * A Policy that governs the Relationships
- * @author Anil.Saldhana at redhat.com
- * @since Jul 13, 2008
- */
-public interface RelationshipPolicy<P extends IdentityObjectType, Q extends IdentityObjectType>
-extends IdentityTypePolicy
-{
- /**
- * Define a relationship
- * @param pIdentityType
- * @param qIdentityType
- */
- void definePolicy(P pIdentityType, Q qIdentityType);
-
- /**
- * Validate a relationship
- * @param typeA first type
- * @param typeB second type
- * @throws PolicyValidationException
- */
- void validate(P typeA, Q typeB)
- throws PolicyValidationException;
-}
\ No newline at end of file
+///*
+// * 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.policy;
+//
+//import org.jboss.identity.spi.model.IdentityObjectType;
+//import org.jboss.identity.exception.PolicyValidationException;
+//
+///**
+// * A Policy that governs the Relationships
+// * @author Anil.Saldhana at redhat.com
+// * @since Jul 13, 2008
+// */
+//public interface RelationshipPolicy<P extends IdentityObjectType, Q extends IdentityObjectType>
+//extends IdentityTypePolicy
+//{
+// /**
+// * Define a relationship
+// * @param pIdentityType
+// * @param qIdentityType
+// */
+// void definePolicy(P pIdentityType, Q qIdentityType);
+//
+// /**
+// * Validate a relationship
+// * @param typeA first type
+// * @param typeB second type
+// * @throws PolicyValidationException
+// */
+// void validate(P typeA, Q typeB)
+// throws PolicyValidationException;
+//}
\ No newline at end of file
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -25,7 +25,7 @@
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.spi.attribute.IdentityObjectAttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.exception.IdentityException;
import java.util.Set;
@@ -61,8 +61,6 @@
*/
Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType);
- //TODO: isNotConfiguredAttributeSupported - if store can handle attribute not mentioned in method above
-
/**
* Get attributes for the given identity
*
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 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -53,9 +53,6 @@
*/
boolean isControlSupported(IdentityObjectType identityObjectType, Class controlClazz);
- //TODO: isControlSupported per RelationshipType
-
-
/**
* @return set of identity types that can be persisted
*/
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreContext.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreContext.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreContext.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -1,31 +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.spi.store;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface IdentityStoreContext
-{
-}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java 2009-01-09 20:16:58 UTC (rev 210)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java 2009-01-13 15:18:42 UTC (rev 211)
@@ -25,6 +25,8 @@
import org.jboss.identity.exception.IdentityException;
/**
+ * Session related to the identity persistence store. Created by IdentityStoreSessionFactory
+ *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
More information about the jboss-identity-commits
mailing list