[picketlink-commits] Picketlink SVN: r752 - in idm/branches/2.0.0: assembly and 20 other directories.

picketlink-commits at lists.jboss.org picketlink-commits at lists.jboss.org
Thu Feb 17 14:31:33 EST 2011


Author: anil.saldhana at jboss.com
Date: 2011-02-17 14:31:32 -0500 (Thu, 17 Feb 2011)
New Revision: 752

Added:
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/factories/
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/factories/IdentityFactory.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityObjectRelationship.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStore.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreRepository.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreSession.java
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/model/
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/model/CorporateModelUnitTestCase.java
   idm/branches/2.0.0/picketlink-idm-core/src/test/resources/configs/
   idm/branches/2.0.0/picketlink-idm-core/src/test/resources/configs/memory-config.xml
Modified:
   idm/branches/2.0.0/assembly/pom.xml
   idm/branches/2.0.0/assembly/scripts/assembly-distro.xml
   idm/branches/2.0.0/parent/pom.xml
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java
   idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectType.java
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectTypeImpl.java
   idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/IdentityTypeEnum.java
   idm/branches/2.0.0/picketlink-idm-spi/src/main/java/org/picketlink/idm/spi/model/IdentityObjectType.java
   idm/branches/2.0.0/pom.xml
Log:
add memory based repo/store

Modified: idm/branches/2.0.0/assembly/pom.xml
===================================================================
--- idm/branches/2.0.0/assembly/pom.xml	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/assembly/pom.xml	2011-02-17 19:31:32 UTC (rev 752)
@@ -44,52 +44,8 @@
          <artifactId>picketlink-idm-core</artifactId>
          <version>${project.version}</version>
       </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm</groupId>
-         <artifactId>picketlink-idm-hibernate</artifactId>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm</groupId>
-         <artifactId>picketlink-idm-ldap</artifactId>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm</groupId>
-         <artifactId>picketlink-idm-cache</artifactId>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm.integration</groupId>
-         <artifactId>picketlink-idm-jboss5</artifactId>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm.integration</groupId>
-         <artifactId>picketlink-idm-jboss5-deployer</artifactId>
-         <classifier>config</classifier>
-         <type>zip</type>
-         <version>${project.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.picketlink.idm.integration</groupId>
-         <artifactId>picketlink-idm-jboss5-deployer</artifactId>
-         <classifier>deployer</classifier>
-         <type>zip</type>
-         <version>${project.version}</version>
-      </dependency>
                
       <dependency>
-         <groupId>org.hibernate</groupId>
-         <artifactId>hibernate-commons-annotations</artifactId>
-         <version>${hibernate-commons-annotations}</version>
-      </dependency>
-      <dependency>
-         <groupId>org.hibernate</groupId>
-         <artifactId>hibernate-tools</artifactId>
-         <version>${hibernate-tools-version}</version>
-      </dependency>
-      <dependency>
          <groupId>hsqldb</groupId>
          <artifactId>hsqldb</artifactId>
          <version>${hsqldb-version}</version>
@@ -100,27 +56,11 @@
          <version>${apache.ant.version}</version>
       </dependency>
 		    
-      <!-- Database Drivers -->
-      <dependency>
-         <groupId>mysql</groupId>
-         <artifactId>mysql-connector-java</artifactId>
-         <version>${mysql.connector.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>postgresql</groupId>
-         <artifactId>postgresql</artifactId>
-         <version>${postgresql.version}</version>
-      </dependency>
-      <dependency>
-         <groupId>net.sourceforge.jtds</groupId>
-         <artifactId>jtds</artifactId>
-         <version>${jtds.version}</version>
-      </dependency>
-			
    </dependencies>
 
    <build>
       <plugins>
+<!--
 	      <plugin>
 	        <artifactId>maven-antrun-plugin</artifactId>
 	        <executions>
@@ -140,6 +80,8 @@
 	          </execution>
 	        </executions>
 	      </plugin>
+
+   -->
 	      
 	    <plugin>
         <artifactId>maven-assembly-plugin</artifactId>

Modified: idm/branches/2.0.0/assembly/scripts/assembly-distro.xml
===================================================================
--- idm/branches/2.0.0/assembly/scripts/assembly-distro.xml	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/assembly/scripts/assembly-distro.xml	2011-02-17 19:31:32 UTC (rev 752)
@@ -20,6 +20,8 @@
     </dependencySet>
     
       <!-- modules -->    
+
+   <!--
      <dependencySet>
       <outputDirectory>modules</outputDirectory>
       <useStrictFiltering>true</useStrictFiltering>
@@ -36,6 +38,9 @@
       </includes>
       <unpack>true</unpack>
     </dependencySet>  
+
+   -->
+
   </dependencySets>
 
   <fileSets>
@@ -92,6 +97,8 @@
       <directory>../picketlink-idm-core/src/main/java</directory>
       <outputDirectory>src</outputDirectory>
     </fileSet>
+
+  <!--
     <fileSet>
       <directory>../picketlink-idm-hibernate/src/main/java</directory>
       <outputDirectory>src</outputDirectory>
@@ -116,5 +123,7 @@
       <directory>../integration/jboss5/src/main/resources</directory>
       <outputDirectory>src</outputDirectory>
     </fileSet>
+   -->
+
   </fileSets>
 </assembly>

Modified: idm/branches/2.0.0/parent/pom.xml
===================================================================
--- idm/branches/2.0.0/parent/pom.xml	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/parent/pom.xml	2011-02-17 19:31:32 UTC (rev 752)
@@ -515,7 +515,7 @@
          <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>3.8.1</version>
+            <version>4.4</version>
             <scope>test</scope>
          </dependency>
       </dependencies>

Added: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/factories/IdentityFactory.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/factories/IdentityFactory.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/core/factories/IdentityFactory.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.idm.core.factories;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.picketlink.idm.api.cfg.IdentityConfiguration;
+import org.picketlink.idm.common.exception.IdentityConfigurationException;
+import org.picketlink.idm.common.exception.IdentityException;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.spi.model.IdentityObjectCredentialType;
+import org.picketlink.idm.spi.model.IdentityObjectRelationshipType;
+import org.picketlink.idm.spi.model.IdentityObjectType;
+import org.picketlink.idm.spi.store.FeaturesMetaData;
+import org.picketlink.idm.spi.store.IdentityObjectSearchCriteriaType;
+
+/**
+ * Static Factory to obtain the default factories
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class IdentityFactory
+{
+   /**
+    * Given a configuration file, return {@link IdentityConfiguration}
+    * @param configFileName
+    * @return
+    * @throws IdentityConfigurationException
+    */
+   public static IdentityConfiguration createConfiguration( String configFileName ) throws IdentityConfigurationException
+   {
+      IdentityConfigurationImpl config = new IdentityConfigurationImpl();
+      return config.configure( configFileName );
+   }
+   
+   public static FeaturesMetaData createEmptyFeaturesMetaData()
+   {
+      return new InternalFeaturesMetadata();
+   }
+   
+   private static final class InternalFeaturesMetadata implements FeaturesMetaData
+   {   
+      public boolean isSearchCriteriaTypeSupported(IdentityObjectType identityObjectType,
+            IdentityObjectSearchCriteriaType storeSearchConstraint)
+      {
+         return false;
+      }
+      
+      public boolean isRoleNameSearchCriteriaTypeSupported(IdentityObjectSearchCriteriaType constraint)
+      {
+         return false;
+      }
+      
+      public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType,
+            IdentityObjectRelationshipType relationshipType) throws IdentityException
+      {
+         return false;
+      }
+      
+      public boolean isRelationshipPropertiesSupported()
+      {
+         return false;
+      }
+      
+      public boolean isRelationshipNameAddRemoveSupported()
+      {
+         return false;
+      }
+      
+      public boolean isNamedRelationshipsSupported()
+      {
+         return false;
+      }
+      
+      public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
+      {
+         return false;
+      }
+      
+      public boolean isIdentityObjectAddRemoveSupported(IdentityObjectType objectType)
+      {
+         return false;
+      }
+      
+      public boolean isCredentialSupported(IdentityObjectType identityObjectType,
+            IdentityObjectCredentialType credentialType)
+      {
+         return false;
+      }
+      
+      public Set<String> getSupportedRelationshipTypes()
+      {
+          return new HashSet<String>();
+      }
+      
+      public Set<String> getSupportedIdentityObjectTypes()
+      { 
+         return new HashSet<String>();
+      }
+   }
+}
\ No newline at end of file

Modified: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/managers/AbstractManager.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -213,7 +213,7 @@
       return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
    }
 
-   protected IdentityObjectType getIdentityObjectType(String groupType)
+   protected IdentityObjectType getIdentityObjectType( String groupType)
    {
       return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(groupType);
    }

Modified: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/api/session/mapper/DirectIdentityObjectTypeMapperImpl.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -25,6 +25,7 @@
 import java.io.Serializable;
 
 import org.picketlink.idm.spi.model.IdentityObjectType;
+import org.picketlink.idm.spi.model.IdentityObjectType.TYPE;
 import org.picketlink.idm.impl.types.SimpleIdentityObjectType;
 import org.picketlink.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
 
@@ -44,7 +45,9 @@
 
    public IdentityObjectType getIdentityObjectType()
    {
-      return new SimpleIdentityObjectType(identityTypeName);
+      SimpleIdentityObjectType simple =  new SimpleIdentityObjectType(identityTypeName);
+      simple.setType( TYPE.USER );
+      return simple;
    }
 
    public IdentityObjectType getIdentityObjectType(String groupType)
@@ -53,8 +56,10 @@
       {
          throw new IllegalArgumentException("groupType is null");
       }
-
-      return new SimpleIdentityObjectType(groupType);
+      
+      SimpleIdentityObjectType simple =  new SimpleIdentityObjectType(groupType);
+      simple.setType( TYPE.GROUP );
+      return simple;
    }
 
    public String getGroupType(IdentityObjectType identityObjectType)

Added: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityObjectRelationship.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityObjectRelationship.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityObjectRelationship.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.idm.impl.store.memory;
+
+import org.picketlink.idm.spi.model.IdentityObject;
+import org.picketlink.idm.spi.model.IdentityObjectRelationship;
+import org.picketlink.idm.spi.model.IdentityObjectRelationshipType;
+
+/**
+ * A {@link IdentityObjectRelationship} for use in the
+ * {@link MemoryIdentityStore}
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class MemoryIdentityObjectRelationship implements IdentityObjectRelationship
+{
+   private String name;
+   private IdentityObjectRelationshipType type;
+   private IdentityObject to;
+   private IdentityObject from;
+
+   public MemoryIdentityObjectRelationship( String name, IdentityObjectRelationshipType type,  
+         IdentityObject from, IdentityObject to )
+   {
+      this.name = name;
+      this.type = type;
+      this.to = to;
+      this.from = from;
+   }
+
+   public String getName()
+   { 
+      return name;
+   }
+
+   public IdentityObjectRelationshipType getType()
+   {
+      return type;
+   }
+
+   public IdentityObject getFromIdentityObject()
+   { 
+      return from;
+   }
+
+   public IdentityObject getToIdentityObject()
+   { 
+      return to;
+   } 
+}
\ No newline at end of file

Added: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStore.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStore.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStore.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,529 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.idm.impl.store.memory;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.picketlink.idm.common.exception.IdentityException;
+import org.picketlink.idm.impl.types.SimpleIdentityObject;
+import org.picketlink.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.picketlink.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.picketlink.idm.spi.exception.OperationNotSupportedException;
+import org.picketlink.idm.spi.model.IdentityObject;
+import org.picketlink.idm.spi.model.IdentityObjectAttribute;
+import org.picketlink.idm.spi.model.IdentityObjectCredential;
+import org.picketlink.idm.spi.model.IdentityObjectCredentialType;
+import org.picketlink.idm.spi.model.IdentityObjectRelationship;
+import org.picketlink.idm.spi.model.IdentityObjectRelationshipType;
+import org.picketlink.idm.spi.model.IdentityObjectType;
+import org.picketlink.idm.spi.model.IdentityObjectType.TYPE;
+import org.picketlink.idm.spi.search.IdentityObjectSearchCriteria;
+import org.picketlink.idm.spi.store.FeaturesMetaData;
+import org.picketlink.idm.spi.store.IdentityObjectSearchCriteriaType;
+import org.picketlink.idm.spi.store.IdentityStore;
+import org.picketlink.idm.spi.store.IdentityStoreInvocationContext;
+import org.picketlink.idm.spi.store.IdentityStoreSession;
+
+/**
+ * An implementation of {@link IdentityStore} that resides in memory
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class MemoryIdentityStore implements IdentityStore, Serializable
+{ 
+   private static final long serialVersionUID = 1L;
+   private String id;
+   
+   protected Map<String,IdentityObject> users = new HashMap<String,IdentityObject>();
+   
+   protected Map<String, IdentityObject> roles = new HashMap<String,IdentityObject>();
+   protected Map<String, IdentityObject> groups = new HashMap<String,IdentityObject>();
+   
+   protected Map<String, Set<IdentityObjectAttribute>> attributes = new HashMap<String, Set<IdentityObjectAttribute>>();
+   /**
+    * General hashmap that is keyed by relationship name.
+    */
+   protected Map<String, List<IdentityObjectRelationship>> relationships = new HashMap<String, List<IdentityObjectRelationship>>();
+   
+   protected Set<String> relationshipNames = new TreeSet<String>();
+   
+   public MemoryIdentityStore( String id )
+   {
+      this.id = id;
+   }
+
+   public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext,
+         IdentityObjectType identityType) throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(
+         IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType)
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext,
+         IdentityObject identity) throws IdentityException
+   {   
+      Map<String, IdentityObjectAttribute> map = new HashMap<String, IdentityObjectAttribute>();
+      
+      Set<IdentityObjectAttribute> attrs = attributes.get( identity.getName());
+      if( attrs != null )
+      {
+         for( IdentityObjectAttribute ioa: attrs )
+         {
+            map.put(ioa.getName(), ioa );
+         }
+      }
+      return map;
+   }
+
+   public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext invocationContext,
+         IdentityObject identity, String name) throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         IdentityObjectAttribute[] attributes) throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         IdentityObjectAttribute[] attributes) throws IdentityException
+   { 
+      Set<IdentityObjectAttribute> set = this.attributes.get( identity.getName() );
+      if( set == null)
+      {
+         set = new HashSet<IdentityObjectAttribute>();
+         this.attributes.put( identity.getName(), set );
+      }
+      set.addAll( Arrays.asList( attributes ));
+   }
+
+   public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         String[] attributeNames) throws IdentityException
+   {
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx,
+         IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityStoreSession createIdentityStoreSession() throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityStoreSession createIdentityStoreSession(Map<String, Object> sessionOptions) throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws IdentityException
+   {  
+   }
+
+   public String getId()
+   {
+      return id;
+   }
+
+   public FeaturesMetaData getSupportedFeatures()
+   { 
+      return new FeaturesMetaData()
+      {
+         public boolean isSearchCriteriaTypeSupported(IdentityObjectType identityObjectType,
+               IdentityObjectSearchCriteriaType storeSearchConstraint)
+         { 
+            return true;
+         }
+         
+         public boolean isRoleNameSearchCriteriaTypeSupported(IdentityObjectSearchCriteriaType constraint)
+         {  
+            return true;
+         }
+         
+         public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType,
+               IdentityObjectRelationshipType relationshipType) throws IdentityException
+         {   
+            return true;
+         }
+         
+         public boolean isRelationshipPropertiesSupported()
+         { 
+            return true;
+         }
+         
+         public boolean isRelationshipNameAddRemoveSupported()
+         { 
+            return true;
+         }
+         
+         public boolean isNamedRelationshipsSupported()
+         { 
+            return true;
+         }
+         
+         public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
+         { 
+            return true;
+         }
+         
+         public boolean isIdentityObjectAddRemoveSupported(IdentityObjectType objectType)
+         { 
+            return true;
+         }
+         
+         public boolean isCredentialSupported(IdentityObjectType identityObjectType,
+               IdentityObjectCredentialType credentialType)
+         {   
+            return true;
+         }
+         
+         public Set<String> getSupportedRelationshipTypes()
+         {   
+            return null;
+         }
+         
+         public Set<String> getSupportedIdentityObjectTypes()
+         { 
+            return null;
+         }
+      }; 
+   }
+
+   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name,
+         IdentityObjectType identityObjectType) throws IdentityException
+   { 
+      if( identityObjectType == null )
+         throw new IllegalArgumentException( "Identity Object Type is null" );
+      
+      IdentityObject io = null;
+      
+      String identityObjectTypeName =  identityObjectType.getName();
+      
+      TYPE type = identityObjectType.getType();
+      
+      if( type == TYPE.GROUP )
+      {
+         io = groups.get(identityObjectTypeName);
+         if( io == null )
+         {
+            io = new SimpleIdentityObject( name, identityObjectType );
+            groups.put(name, io);
+         }  
+      }
+      else if( type == TYPE.USER )
+      {
+         io = users.get(identityObjectTypeName);
+         if( io ==null)
+         {
+            io = new SimpleIdentityObject( name, identityObjectType );
+            users.put( name, io ); 
+         }
+      }
+      else
+      {
+         io = roles.get(identityObjectTypeName);
+         if( io == null )
+         {
+            io = new SimpleIdentityObject( name, identityObjectType );
+            roles.put(identityObjectTypeName, io);
+         }
+      }
+      /*if( identityObjectTypeName.equals( "ORGANIZATION" ) || identityObjectTypeName.equals( "DIVISION" )
+            || identityObjectTypeName.equals( "DEPARTMENT") ||  identityObjectTypeName.equals( "ORGANIZATION_UNIT")
+            || identityObjectTypeName.equals( "PROJECT" ) || identityObjectTypeName.equals( "PEOPLE" ))
+      {
+         io =  generalBucket.get(name);
+         
+         if( io == null )
+         {
+            io = new SimpleIdentityObject( name, identityObjectType );
+            generalBucket.put(name, io);
+         }  
+      } 
+      else if( identityObjectTypeName.equals( "USER" ))
+      {
+         io = users.get( name );
+         if( io == null )
+         {
+            io = new SimpleIdentityObject( name, identityObjectType );
+            users.put(name, io );
+         }
+      }
+      else 
+         throw new RuntimeException( "Unknown type : " + identityObjectTypeName );*/
+      return io;
+   }
+
+   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name,
+         IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException
+   {    
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity)
+         throws IdentityException
+   {
+      throw new RuntimeException( "NYI" );
+   }
+
+   public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType)
+         throws IdentityException
+   {
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name,
+         IdentityObjectType identityObjectType) throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id)
+         throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
+         IdentityObjectType identityType, IdentityObjectSearchCriteria criteria) throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent,
+         IdentityObjectSearchCriteria criteria) throws IdentityException
+   { 
+      Collection<IdentityObject> result = new HashSet<IdentityObject>();
+      
+      String relationshipName = relationshipType.getName();
+      List<IdentityObjectRelationship> rels = relationships.get(relationshipName);
+      if( rels != null )
+      {
+         for( IdentityObjectRelationship rel: rels )
+         {
+            String identityName = identity.getName();
+            IdentityObject from = rel.getFromIdentityObject();
+            IdentityObject to = rel.getToIdentityObject();
+            
+            if( from.getName().equals(identityName) || to.getName().equals(identityName) )
+            {
+               result.add( from ); 
+               result.add( to);
+            }
+         }
+      }
+      
+      /*TYPE type = identity.getIdentityType().getType();
+      if( type == TYPE.GROUP )
+      {
+         IdentityObject io = groups.get( identity.getName() );
+         System.out.println( io ); 
+         
+      }
+      throw new RuntimeException( "NYI" );*/
+      return result;
+   }
+
+   public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType,
+         String relationshipName, boolean createNames) throws IdentityException
+   { 
+      String relationshipTypeName = relationshipType.getName(); 
+      
+      List<IdentityObjectRelationship> rels;
+      
+      IdentityObjectRelationship  ior = new MemoryIdentityObjectRelationship(relationshipName, 
+                                                      relationshipType, fromIdentity, toIdentity);
+      
+      if( ! relationships.containsKey(relationshipTypeName) )
+      {
+         rels = new ArrayList<IdentityObjectRelationship>();
+         rels.add(ior); 
+         relationships.put(relationshipTypeName, rels ); 
+      }
+      else
+      {
+         rels = relationships.get(relationshipTypeName);
+         rels.add(ior); 
+      }
+      return ior;
+   }
+
+   public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity,
+         IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName)
+         throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1,
+         IdentityObject identity2, boolean named) throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType)
+         throws IdentityException
+   { 
+      Set<IdentityObjectRelationship> set = new HashSet<IdentityObjectRelationship>();
+      
+      String relationshipTypeName = relationshipType.getName();
+      List<IdentityObjectRelationship> rels = relationships.get(relationshipTypeName);
+      if( rels != null )
+      {
+         for( IdentityObjectRelationship ior : rels )
+         {
+            IdentityObject iroFrom = ior.getFromIdentityObject();
+            IdentityObject iroTo = ior.getToIdentityObject();
+            if( iroFrom.getName().equals( fromIdentity.getName() ) && iroTo.getName().equals( toIdentity.getName() ) )
+               set.add(ior);
+         } 
+      }
+      return set;
+   }
+
+   public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, boolean named,
+         String name) throws IdentityException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException,
+         OperationNotSupportedException
+   {  
+      relationshipNames.add(name);
+      return name;
+   }
+
+   public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException,
+         OperationNotSupportedException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name)
+         throws IdentityException, OperationNotSupportedException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name,
+         Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties)
+         throws IdentityException, OperationNotSupportedException
+   {
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx,
+         IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship,
+         Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void removeRelationshipProperties(IdentityStoreInvocationContext ctx,
+         IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException,
+         OperationNotSupportedException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria)
+         throws IdentityException, OperationNotSupportedException
+   {   
+      return Collections.unmodifiableSet( relationshipNames );
+   }
+
+   public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity,
+         IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
+   {    
+      Set<String> result = new TreeSet<String>();
+      
+      String identityName = identity.getName();
+      
+      if( identityName == null )
+         throw new IllegalStateException( "Identity Name null" );
+      
+      Set<String> keys =  relationships.keySet();
+      for( String key : keys )
+      {
+         List<IdentityObjectRelationship> iors = relationships.get(key);
+         for( IdentityObjectRelationship ior: iors )
+         {
+            if( ior.getName() == null )
+               continue;
+            
+            String fromID = ior.getFromIdentityObject().getName();
+            String toID = ior.getToIdentityObject().getName();
+             
+            if( fromID.equals( identityName) || toID.equals( identityName ))
+                result.add(ior.getName());   
+         }
+      }
+      return result;
+   }
+
+   public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject,
+         IdentityObjectCredential credential) throws IdentityException
+   {   
+      return false;
+   }
+
+   public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject,
+         IdentityObjectCredential credential) throws IdentityException
+   { 
+      throw new RuntimeException( "NYI" );
+   }
+}
\ No newline at end of file

Added: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreRepository.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreRepository.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreRepository.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,378 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.idm.impl.store.memory;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.picketlink.idm.common.exception.IdentityException;
+import org.picketlink.idm.core.factories.IdentityFactory;
+import org.picketlink.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.picketlink.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.picketlink.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.picketlink.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.picketlink.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.picketlink.idm.spi.exception.OperationNotSupportedException;
+import org.picketlink.idm.spi.model.IdentityObject;
+import org.picketlink.idm.spi.model.IdentityObjectAttribute;
+import org.picketlink.idm.spi.model.IdentityObjectCredential;
+import org.picketlink.idm.spi.model.IdentityObjectRelationship;
+import org.picketlink.idm.spi.model.IdentityObjectRelationshipType;
+import org.picketlink.idm.spi.model.IdentityObjectType;
+import org.picketlink.idm.spi.repository.IdentityStoreRepository;
+import org.picketlink.idm.spi.search.IdentityObjectSearchCriteria;
+import org.picketlink.idm.spi.store.AttributeStore;
+import org.picketlink.idm.spi.store.FeaturesMetaData;
+import org.picketlink.idm.spi.store.IdentityObjectSearchCriteriaType;
+import org.picketlink.idm.spi.store.IdentityStore;
+import org.picketlink.idm.spi.store.IdentityStoreInvocationContext;
+import org.picketlink.idm.spi.store.IdentityStoreSession;
+
+/**
+ * A {@link IdentityStoreRepository} that resides in memory
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class MemoryIdentityStoreRepository implements IdentityStoreRepository
+{ 
+   private static final long serialVersionUID = 1L;
+
+   protected String id = null;
+   
+   protected IdentityStore store;
+   
+   protected IdentityConfigurationMetaData md;
+   
+   protected IdentityRepositoryConfigurationMetaData repoMD = null;
+   
+   protected IdentityStoreConfigurationMetaData storeMD = null;
+   
+   private static Set<IdentityObjectSearchCriteriaType> supportedIdentityObjectSearchCriteria =
+      new HashSet<IdentityObjectSearchCriteriaType>();
+
+   private static Set<String> supportedCredentialTypes = new HashSet<String>();
+   
+   public static final String CREDENTIAL_TYPE_PASSWORD = "PASSWORD";
+
+   public static final String CREDENTIAL_TYPE_BINARY = "BINARY";
+   
+   static {
+      // List all supported criteria classes
+
+      supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.ATTRIBUTE_FILTER);
+      supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.NAME_FILTER);
+      supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.PAGE);
+      supportedIdentityObjectSearchCriteria.add(IdentityObjectSearchCriteriaType.SORT);
+
+      // credential types supported by this impl
+      supportedCredentialTypes.add(CREDENTIAL_TYPE_PASSWORD);
+      supportedCredentialTypes.add(CREDENTIAL_TYPE_BINARY);
+
+   }
+
+   
+   public MemoryIdentityStoreRepository( String id )
+   {
+      this.id = id;
+      store = new MemoryIdentityStore(id);
+   }
+    
+   public String getId()
+   {
+      return id;
+   }
+
+   public FeaturesMetaData getSupportedFeatures()
+   {   
+      return store.getSupportedFeatures();
+   }
+
+   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name,
+         IdentityObjectType identityObjectType) throws IdentityException
+   {    
+      return store.createIdentityObject(invocationCtx, name, identityObjectType);
+   }
+
+   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name,
+         IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException
+   {
+      return store.createIdentityObject(invocationCtx, name, identityObjectType, attributes ); 
+   }
+
+   public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity)
+         throws IdentityException
+   { 
+      store.removeIdentityObject(invocationCtx, identity);
+   }
+
+   public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType)
+         throws IdentityException
+   {   
+      return store.getIdentityObjectsCount(invocationCtx, identityType);
+   }
+
+   public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name,
+         IdentityObjectType identityObjectType) throws IdentityException
+   {  
+      return store.findIdentityObject(invocationContext, name, identityObjectType ); 
+   }
+
+   public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id)
+         throws IdentityException
+   {  
+      return store.findIdentityObject(invocationContext, id); 
+   }
+
+   public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
+         IdentityObjectType identityType, IdentityObjectSearchCriteria criteria) throws IdentityException
+   {  
+      return store.findIdentityObject(invocationCtx, identityType, criteria);
+   }
+
+   public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent,
+         IdentityObjectSearchCriteria criteria) throws IdentityException
+   {   
+      return store.findIdentityObject(invocationCxt, identity, relationshipType, parent, criteria);
+   }
+
+   public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType,
+         String relationshipName, boolean createNames) throws IdentityException
+   {    
+      return store.createRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+   }
+
+   public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity,
+         IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName)
+         throws IdentityException
+   { 
+      store.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
+   }
+
+   public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1,
+         IdentityObject identity2, boolean named) throws IdentityException
+   { 
+      store.removeRelationships(invocationCtx, identity1, identity2, named);
+   }
+
+   public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType)
+         throws IdentityException
+   {   
+      return store.resolveRelationships(invocationCxt, fromIdentity, toIdentity, relationshipType);
+   }
+
+   public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt,
+         IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, boolean named,
+         String name) throws IdentityException
+   {    
+      return store.resolveRelationships(invocationCxt, identity, relationshipType, parent, named, name );
+   }
+
+   public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException,
+         OperationNotSupportedException
+   {  
+      return store.createRelationshipName(ctx, name); 
+   }
+
+   public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException,
+         OperationNotSupportedException
+   {   
+      return store.removeRelationshipName(ctx, name);
+   }
+
+   public Map<String, String> getRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name)
+         throws IdentityException, OperationNotSupportedException
+   {  
+      return store.getRelationshipNameProperties(ctx, name); 
+   }
+
+   public void setRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name,
+         Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+   { 
+      store.setRelationshipNameProperties(ctx, name, properties);
+   }
+
+   public void removeRelationshipNameProperties(IdentityStoreInvocationContext ctx, String name, Set<String> properties)
+         throws IdentityException, OperationNotSupportedException
+   { 
+      store.removeRelationshipNameProperties(ctx, name, properties);
+   }
+
+   public Map<String, String> getRelationshipProperties(IdentityStoreInvocationContext ctx,
+         IdentityObjectRelationship relationship) throws IdentityException, OperationNotSupportedException
+   {   
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void setRelationshipProperties(IdentityStoreInvocationContext ctx, IdentityObjectRelationship relationship,
+         Map<String, String> properties) throws IdentityException, OperationNotSupportedException
+   {
+      
+
+   }
+
+   public void removeRelationshipProperties(IdentityStoreInvocationContext ctx,
+         IdentityObjectRelationship relationship, Set<String> properties) throws IdentityException,
+         OperationNotSupportedException
+   { 
+   }
+
+   public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchCriteria criteria)
+         throws IdentityException, OperationNotSupportedException
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity,
+         IdentityObjectSearchCriteria criteria) throws IdentityException, OperationNotSupportedException
+   {    
+      return store.getRelationshipNames(ctx, identity, criteria);
+   }
+
+   public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject,
+         IdentityObjectCredential credential) throws IdentityException
+   {   
+      return false;
+   }
+
+   public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject,
+         IdentityObjectCredential credential) throws IdentityException
+   { 
+   }
+
+   public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext,
+         IdentityObjectType identityType) throws IdentityException
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(
+         IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType)
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext,
+         IdentityObject identity) throws IdentityException
+   {   
+      return store.getAttributes( invocationContext, identity);
+   }
+
+   public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext invocationContext,
+         IdentityObject identity, String name) throws IdentityException
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         IdentityObjectAttribute[] attributes) throws IdentityException
+   { 
+   }
+
+   public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         IdentityObjectAttribute[] attributes) throws IdentityException
+   {   
+      store.addAttributes(  invocationCtx,   identity,  attributes);
+   }
+
+   public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity,
+         String[] attributeNames) throws IdentityException
+   { 
+      store.removeAttributes(invocationCtx, identity, attributeNames);
+   }
+
+   public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx,
+         IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException
+   {  
+      return store.findIdentityObjectByUniqueAttribute(invocationCtx, identityObjectType, attribute); 
+   }
+
+   public IdentityStoreSession createIdentityStoreSession() throws IdentityException
+   {   
+      return store.createIdentityStoreSession(); 
+   }
+
+   public IdentityStoreSession createIdentityStoreSession(Map<String, Object> sessionOptions) throws IdentityException
+   { 
+      return new MemoryIdentityStoreSession();
+   }
+
+   public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
+         Map<String, IdentityStore> bootstrappedIdentityStores, Map<String, AttributeStore> bootstrappedAttributeStores)
+         throws IdentityException
+   { 
+      repoMD = configurationContext.getRepositoryConfigurationMetaData(); 
+      storeMD =  configurationContext.getConfigurationMetaData().getIdentityStores().get(0);
+   }
+   
+
+   public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws IdentityException
+   { 
+      storeMD = configurationContext.getStoreConfigurationMetaData();
+   }
+
+   public Set<IdentityStore> getConfiguredIdentityStores()
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Set<AttributeStore> getConfiguredAttributeStores()
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, IdentityStore> getIdentityStoreMappings()
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public Map<String, AttributeStore> getAttributeStoreMappings()
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public IdentityStore getIdentityStore(IdentityObjectType identityObjectType) throws IdentityException
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+
+   public AttributeStore getAttributeStore(IdentityObjectType identityObjectType) throws IdentityException
+   {   
+      
+      throw new RuntimeException( "NYI" );
+   }
+}
\ No newline at end of file

Added: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreSession.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreSession.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/store/memory/MemoryIdentityStoreSession.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.idm.impl.store.memory;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.common.exception.IdentityException;
+import org.picketlink.idm.spi.store.IdentityStoreSession;
+
+/**
+ * A {@link IdentitySession} for memory
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class MemoryIdentityStoreSession implements IdentityStoreSession
+{
+
+   public Object getSessionContext() throws IdentityException
+   { 
+      return null;
+   }
+
+   public void close() throws IdentityException
+   {    
+   }
+
+   public void save() throws IdentityException
+   { 
+   }
+
+   public void clear() throws IdentityException
+   { 
+   }
+
+   public boolean isOpen()
+   {
+      
+      return false;
+   }
+
+   public boolean isTransactionSupported()
+   {
+      
+      return false;
+   }
+
+   public void startTransaction()
+   {
+      
+      
+   }
+
+   public void commitTransaction()
+   {
+      
+      
+   }
+
+   public void rollbackTransaction()
+   {
+      
+      
+   }
+
+   public boolean isTransactionActive()
+   {
+      
+      return false;
+   } 
+}
\ No newline at end of file

Modified: idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectType.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectType.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/types/SimpleIdentityObjectType.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -34,6 +34,8 @@
 {
    private String name;
 
+   private TYPE t = TYPE.GROUP;
+   
    private SimpleIdentityObjectType()
    { 
    }
@@ -88,4 +90,14 @@
    {
       return name != null ? name.hashCode() : 0;
    }
-}
+   
+   public void setType( TYPE T)
+   {
+      t = T;
+   }
+
+   public TYPE getType()
+   { 
+      return t;
+   }
+}
\ No newline at end of file

Modified: idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectTypeImpl.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectTypeImpl.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/SimpleIdentityObjectTypeImpl.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -23,6 +23,7 @@
 package org.picketlink.idm.impl;
 
 import org.picketlink.idm.spi.model.IdentityObjectType;
+import org.picketlink.idm.spi.model.IdentityObjectType.TYPE;
 
 import java.io.Serializable;
 
@@ -33,6 +34,8 @@
 public class SimpleIdentityObjectTypeImpl implements IdentityObjectType, Serializable
 {
    String name;
+   
+   private TYPE t = TYPE.GROUP;
 
    public SimpleIdentityObjectTypeImpl(String name)
    {
@@ -66,6 +69,17 @@
       return true;
    }
 
+   public void setType( TYPE T)
+   {
+      t = T;
+   }
+   
+
+   public TYPE getType()
+   { 
+      return t;
+   }
+   
    @Override
    public int hashCode()
    {

Modified: idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/IdentityTypeEnum.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/IdentityTypeEnum.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/idm/impl/store/IdentityTypeEnum.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -42,4 +42,9 @@
       return this.name();
    }
 
+   public TYPE getType()
+   { 
+      return null;
+   }
+
 }
\ No newline at end of file

Added: idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/model/CorporateModelUnitTestCase.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/model/CorporateModelUnitTestCase.java	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/test/java/org/picketlink/test/idm/api/model/CorporateModelUnitTestCase.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,454 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.picketlink.test.idm.api.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.junit.Test;
+import org.picketlink.idm.api.Attribute;
+import org.picketlink.idm.api.AttributesManager;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.PersistenceManager;
+import org.picketlink.idm.api.RelationshipManager;
+import org.picketlink.idm.api.RoleManager;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.cfg.IdentityConfiguration;
+import org.picketlink.idm.common.p3p.P3PConstants;
+import org.picketlink.idm.core.factories.IdentityFactory;
+import org.picketlink.idm.impl.api.SimpleAttribute;
+
+/**
+ * Unit test a typical corporate model
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @author Anil.Saldhana at redhat.com
+ * @since Feb 14, 2011
+ */
+public class CorporateModelUnitTestCase
+{
+   private String sampleOrganizationRealmName = "realm://memory";
+
+   String configFileName = "configs/memory-config.xml";
+   
+   
+   @Test
+   public void testModel() throws Exception
+   {
+      IdentityConfiguration config = IdentityFactory.createConfiguration( configFileName );
+      assertNotNull( config );
+      IdentitySessionFactory sessionFactory = config.buildIdentitySessionFactory();
+      assertNotNull( sessionFactory );    
+      
+      // GroupType
+
+      String ORGANIZATION = "ORGANIZATION";
+      String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+      String DIVISION = "DIVISION";
+      String DEPARTMENT = "DEPARTMENT";
+      String PROJECT = "PROJECT";
+      String PEOPLE = "PEOPLE";
+ 
+
+      IdentitySession session = sessionFactory .createIdentitySession( sampleOrganizationRealmName );
+ 
+
+      begin();
+
+      // Organization structure
+
+      PersistenceManager persistenceManager = session.getPersistenceManager();
+      Group rhOrg = persistenceManager.createGroup("RedHat", ORGANIZATION);
+
+      Group jbossDivision = persistenceManager.createGroup("JBoss", DIVISION);
+      Group rhelDivision = persistenceManager.createGroup("RHEL", DIVISION);
+
+      RelationshipManager relationshipManager = session.getRelationshipManager();
+      relationshipManager.associateGroups(rhOrg, jbossDivision);
+      relationshipManager.associateGroups(rhOrg, rhelDivision);
+
+      Group itDepartment = persistenceManager.createGroup("IT", DEPARTMENT);
+      Group hrDepartment = persistenceManager.createGroup("HR", DEPARTMENT);
+
+      relationshipManager.associateGroups(jbossDivision, itDepartment);
+      relationshipManager.associateGroups(jbossDivision, hrDepartment);
+
+      Group rndDepartment = persistenceManager.createGroup("RnD", DEPARTMENT); 
+
+      relationshipManager.associateGroups(itDepartment, rndDepartment);
+
+      Group projectsOU = persistenceManager.createGroup("Projects", ORGANIZATION_UNIT);
+      Group commonFrameworksOU = persistenceManager.createGroup("Common Frameworks", ORGANIZATION_UNIT);
+
+      relationshipManager.associateGroups(rndDepartment, projectsOU);
+
+      // Projects
+
+      Group portalProject = persistenceManager.createGroup("Portal", PROJECT);
+      Group soaProject = persistenceManager.createGroup("SOA", PROJECT);
+      Group jbpmProject = persistenceManager.createGroup("jBPM", PROJECT);
+      Group seamProject = persistenceManager.createGroup("Seam", PROJECT);
+      Group asProject = persistenceManager.createGroup("AS", PROJECT);
+      Group securityProject = persistenceManager.createGroup("Security", PROJECT);
+
+      relationshipManager.associateGroups(projectsOU, portalProject);
+      relationshipManager.associateGroups(projectsOU, soaProject);
+      relationshipManager.associateGroups(projectsOU, jbpmProject);
+      relationshipManager.associateGroups(projectsOU, asProject);
+      relationshipManager.associateGroups(projectsOU, seamProject);
+
+      // Check...
+      assertTrue(relationshipManager.isAssociated(projectsOU, portalProject));
+      assertTrue(relationshipManager.isAssociated(projectsOU, soaProject));
+      assertTrue(relationshipManager.isAssociated(projectsOU, jbpmProject));
+      assertTrue(relationshipManager.isAssociated(projectsOU, asProject));
+      assertTrue(relationshipManager.isAssociated(projectsOU, seamProject));
+
+      // Portal is part of common frameworks
+      relationshipManager.associateGroups(commonFrameworksOU, portalProject);
+
+      // People
+
+      Group employeesGroup = persistenceManager.createGroup("Employees", PEOPLE);
+
+      // Management
+
+      User theuteUser = persistenceManager.createUser("theute");
+      User mlittleUser = persistenceManager.createUser("mlittle");
+      User bgeorgesUser = persistenceManager.createUser("bgeorges");
+      User asaldhanaUser = persistenceManager.createUser("asaldhana");
+      User janderseUser = persistenceManager.createUser("janderse");
+
+       // Portal Team
+
+      User bdawidowUser = persistenceManager.createUser("bdawidow");
+      User claprunUser = persistenceManager.createUser("claprun");
+      User whalesUser = persistenceManager.createUser("whales");
+      User sshahUser = persistenceManager.createUser("sshah");
+      User mwringeUser = persistenceManager.createUser("mwringe");
+
+      // Store as employees
+
+      relationshipManager.associateUser(employeesGroup, theuteUser);
+      relationshipManager.associateUser(employeesGroup, mlittleUser);
+      relationshipManager.associateUser(employeesGroup, asaldhanaUser);
+      relationshipManager.associateUser(employeesGroup, bdawidowUser);
+      relationshipManager.associateUser(employeesGroup, claprunUser);
+      relationshipManager.associateUser(employeesGroup, whalesUser);
+      relationshipManager.associateUser(employeesGroup, sshahUser);
+      relationshipManager.associateUser(employeesGroup, mwringeUser);
+
+      // Portal team for management purposes
+
+      Group portalTeamGroup = persistenceManager.createGroup("Portal Team", PEOPLE);
+      relationshipManager.associateUser(portalTeamGroup, bdawidowUser);
+      relationshipManager.associateUser(portalTeamGroup, claprunUser);
+      relationshipManager.associateUser(portalTeamGroup, whalesUser);
+      relationshipManager.associateUser(portalTeamGroup, sshahUser);
+      relationshipManager.associateUser(portalTeamGroup, mwringeUser);
+
+      // Portal team is under common frameworks
+
+      relationshipManager.associateGroups(commonFrameworksOU, portalTeamGroup);
+
+      // Role Types
+
+      RoleManager roleManager = session.getRoleManager();
+      RoleType developerRT = roleManager.createRoleType("Developer");
+      RoleType managerRT = roleManager.createRoleType("Manager");
+      RoleType leadDeveloperRT = roleManager.createRoleType("Lead Developer");
+      RoleType productManagerRT = roleManager.createRoleType("Product Manager");
+
+      // Assign roles
+
+      // Common frameworks manager
+
+      roleManager.createRole(managerRT, bgeorgesUser, commonFrameworksOU);
+
+      // Portal developers
+
+      roleManager.createRole(developerRT, theuteUser, portalProject);
+      roleManager.createRole(developerRT, bdawidowUser, portalProject);
+      roleManager.createRole(developerRT, claprunUser, portalProject);
+      roleManager.createRole(developerRT, whalesUser, portalProject);
+      roleManager.createRole(developerRT, sshahUser, portalProject);
+      roleManager.createRole(developerRT, mwringeUser, portalProject);
+
+      // Portal management
+      roleManager.createRole(leadDeveloperRT, theuteUser, portalProject);
+      roleManager.createRole(managerRT, theuteUser, portalTeamGroup);
+      roleManager.createRole(productManagerRT, janderseUser, portalProject);
+
+      // SOA
+
+      roleManager.createRole(developerRT, mlittleUser, portalProject);
+      roleManager.createRole(productManagerRT, mlittleUser, portalProject);
+
+      // AS & Security
+
+      roleManager.createRole(developerRT, asaldhanaUser, asProject);
+      roleManager.createRole(developerRT, asaldhanaUser, securityProject);
+      roleManager.createRole(leadDeveloperRT, asaldhanaUser, securityProject);
+
+
+      // Check what RoleTypes has user theute
+      Collection<RoleType> roleTypes = roleManager.findUserRoleTypes(theuteUser);
+      assertEquals(3, roleTypes.size());
+      assertTrue(roleTypes.contains(developerRT));
+      assertTrue(roleTypes.contains(leadDeveloperRT));
+      assertTrue(roleTypes.contains(managerRT));
+      assertFalse(roleTypes.contains(productManagerRT));
+
+      assertTrue(roleManager.hasRole(theuteUser, portalProject, developerRT));
+      assertTrue(roleManager.hasRole(theuteUser, portalProject, leadDeveloperRT));
+      assertTrue(roleManager.hasRole(theuteUser, portalTeamGroup, managerRT));
+
+      // Check where anil is Lead Developer and where Developer
+
+      roleTypes = roleManager.findUserRoleTypes(asaldhanaUser);
+      assertEquals(2, roleTypes.size());
+      assertTrue(roleTypes.contains(developerRT));
+      assertTrue(roleTypes.contains(leadDeveloperRT));
+
+      roleTypes = roleManager.findRoleTypes(asaldhanaUser, securityProject);
+      assertEquals(2, roleTypes.size());
+      assertTrue(roleTypes.contains(leadDeveloperRT));
+
+      roleTypes = roleManager.findRoleTypes(asaldhanaUser, asProject);
+      assertEquals(1, roleTypes.size());
+      assertTrue(roleTypes.contains(developerRT));
+
+      // and simpler...
+      assertTrue(roleManager.hasRole(asaldhanaUser, asProject, developerRT));
+
+      // Assert relationships
+
+      Collection<User> identities = relationshipManager.findAssociatedUsers(portalTeamGroup, false);
+      assertEquals(5, identities.size());
+      assertTrue(identities.contains(claprunUser));
+      assertTrue(identities.contains(mwringeUser));
+      assertTrue(identities.contains(sshahUser));
+      assertTrue(identities.contains(whalesUser));
+      assertTrue(identities.contains(bdawidowUser));
+
+      Collection<Group> groups = relationshipManager.findAssociatedGroups(rndDepartment, PROJECT, true, false);
+      assertEquals(0, groups.size());
+
+      // Check to which group Anil belongs
+      groups = relationshipManager.findAssociatedGroups(asaldhanaUser, PEOPLE);
+      assertEquals(1, groups.size());
+      assertTrue(groups.contains(employeesGroup));
+
+      // Now check sshah
+      groups = relationshipManager.findAssociatedGroups(sshahUser, PEOPLE);
+      assertEquals(2, groups.size());
+      assertTrue(groups.contains(employeesGroup));
+      assertTrue(groups.contains(portalTeamGroup));
+
+
+
+      
+      // User attributes
+      Attribute[] userInfo = new Attribute[]
+         {
+            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}),
+            new SimpleAttribute("email", new String[]{"bd at example.com"})
+         };
+
+      AttributesManager attributesManager = session.getAttributesManager();
+      attributesManager.addAttributes(bdawidowUser, userInfo);
+
+      Map<String, Attribute> attributes = attributesManager.getAttributes(bdawidowUser);
+      assertEquals(3, attributes.keySet().size());
+      assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+      
+      /* // Check readOnly attribute change
+      userInfo = new Attribute[]
+         {
+            new SimpleAttribute("description", new String[]{"some description"})
+         };
+
+      attributesManager.addAttributes(bdawidowUser, userInfo);
+      attributesManager.updateAttributes(bdawidowUser, userInfo);
+
+      attributes = attributesManager.getAttributes(bdawidowUser);
+      assertEquals(3, attributes.keySet().size());
+      assertEquals(null, (attributes.get("description")));
+
+      // Generate random binary data for binary attribute
+      Random random = new Random();
+
+      // Check that binary attribute picture is mapped
+      AttributeDescription attributeDescription = attributesManager.getAttributeDescription(bdawidowUser, "picture");
+
+      if (attributeDescription != null && attributeDescription.getType().equals("binary"))
+      {
+
+         // 900 kilobytes
+         byte[] picture = new byte[921600];
+         random.nextBytes(picture);
+
+         userInfo = new Attribute[]
+         {
+            new SimpleAttribute("picture", new byte[][]{picture}),
+         };
+
+
+         attributesManager.addAttributes(bdawidowUser, userInfo);
+
+         attributes = attributesManager.getAttributes(bdawidowUser);
+         assertEquals(4, attributes.keySet().size());
+         assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+         assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
+
+         // Update
+
+         // 500 kilobytes
+         picture = new byte[50600];
+         random.nextBytes(picture);
+
+         userInfo = new Attribute[]
+         {
+            new SimpleAttribute("picture", new byte[][]{picture}),
+         };
+
+
+         attributesManager.updateAttributes(bdawidowUser, userInfo);
+
+         attributes = attributesManager.getAttributes(bdawidowUser);
+         assertEquals(4, attributes.keySet().size());
+         assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
+      }
+
+
+      // Find user by email
+      assertNull(attributesManager.findUserByUniqueAttribute("email", "toto"));
+      User user = attributesManager.findUserByUniqueAttribute("email", "bd at example.com");
+      assertEquals(bdawidowUser, user);
+
+
+      // If email is configured as unique it should not be possible to set same value for different user
+      
+      attributeDescription = attributesManager.getAttributeDescription(bdawidowUser, "email");
+
+      if (attributeDescription != null && attributeDescription.isUnique())
+      {
+
+
+         // check if same unique email can be used for other user
+         try
+         {
+            userInfo = new Attribute[]
+               {
+                  new SimpleAttribute("email", new String[]{"bd at example.com"})
+               };
+
+            attributesManager.addAttributes(theuteUser, userInfo);
+            fail();
+         }
+         catch (IdentityException e)
+         {
+            // expected
+         }
+      }
+
+
+
+      // Credential
+      User anotherOne = bdawidowUser; //session.getPersistenceManager().createUser("blah1");
+
+      if (attributesManager.isCredentialTypeSupported(PasswordCredential.TYPE))
+      {
+
+         // There is a known issue that on some LDAP servers (MSAD at least) old password can
+         // still be used for some time together with the new one. Because of this testsuite cannot
+         // assert previously set password values
+
+         // #1
+         attributesManager.updatePassword(anotherOne, "Password2000");
+         assertTrue(attributesManager.validatePassword(anotherOne, "Password2000"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2001"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2002"));
+
+         // #1
+         attributesManager.updatePassword(anotherOne, "Password2002");
+         assertTrue(attributesManager.validatePassword(anotherOne, "Password2002"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2001"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "wirdPasswordValue"));
+//         assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2003"));
+
+
+         // #1
+         attributesManager.updatePassword(anotherOne, "Password2003");
+         assertTrue(attributesManager.validatePassword(anotherOne, "Password2003"));
+//         assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
+//         assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2005"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2006"));
+         assertFalse(attributesManager.validatePassword(anotherOne, "Password2007"));
+
+
+         // #2
+         Credential password = new PasswordCredential("SuperPassword2345");
+         attributesManager.updateCredential(anotherOne, password);
+         assertTrue(attributesManager.validateCredentials(anotherOne, new Credential[]{password}));
+
+         // #3
+      }
+
+      if (attributesManager.isCredentialTypeSupported(BinaryCredential.TYPE))
+      {
+         // 500 kilobytes
+         byte[] cert = new byte[512000];
+         random.nextBytes(cert);
+         Credential binaryCredential = new BinaryCredential(cert);
+         attributesManager.updateCredential(anotherOne, binaryCredential);
+         assertTrue(attributesManager.validateCredentials(anotherOne, new Credential[]{binaryCredential}));
+      }
+
+      persistenceManager.createUser("!(06_13_07 Sche) !(0");
+
+      User u1 = persistenceManager.findUser("!(06_13_07 Sche) !(0");
+
+      assertNotNull(u1);*/
+
+
+      commit();
+   }
+   
+   
+   public void begin()
+   {}
+   
+   public void commit()
+   {}
+}
\ No newline at end of file

Added: idm/branches/2.0.0/picketlink-idm-core/src/test/resources/configs/memory-config.xml
===================================================================
--- idm/branches/2.0.0/picketlink-idm-core/src/test/resources/configs/memory-config.xml	                        (rev 0)
+++ idm/branches/2.0.0/picketlink-idm-core/src/test/resources/configs/memory-config.xml	2011-02-17 19:31:32 UTC (rev 752)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:picketlink:idm:config:v1_0_0_ga"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:schemaLocation="urn:picketlink:idm:config:v1_0_0_ga identity-config.xsd">
+    <realms>
+        <realm>
+            <id>realm://memory</id>
+            <repository-id-ref>Memory based repo</repository-id-ref>
+            <identity-type-mappings>
+                <user-mapping>USER</user-mapping>
+            </identity-type-mappings>
+        </realm>
+    </realms>
+    <repositories>
+        <repository>
+            <id>Memory based repo</id>
+            <class>org.picketlink.idm.impl.store.memory.MemoryIdentityStoreRepository</class>
+            <external-config/>
+            <default-identity-store-id>MemoryStore</default-identity-store-id>
+            <default-attribute-store-id>MemoryStore</default-attribute-store-id>
+            <!--<identity-store-mappings>-->
+                <!--<identity-store-mapping>-->
+                    <!--<identity-store-id>HibernateTestStore</identity-store-id>-->
+                    <!--<identity-object-types/>-->
+                    <!--<options/>-->
+                <!--</identity-store-mapping>-->
+            <!--</identity-store-mappings>-->
+        </repository>
+    </repositories>
+    <stores>
+        <attribute-stores/>
+        <identity-stores>
+            <identity-store>
+                <id>MemoryStore</id>
+                <class>org.picketlink.idm.impl.store.memory.MemoryIdentityStore</class>
+                <external-config/>
+                <supported-relationship-types>
+                    <relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+                    <relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+                </supported-relationship-types>
+                <supported-identity-object-types>
+                    <identity-object-type>
+                        <name>USER</name>
+                        <relationships/>
+                        <credentials>
+                            <credential-type>PASSWORD</credential-type>
+                            <credential-type>BINARY</credential-type>
+                        </credentials>
+                        <attributes/>
+                        <options/>
+                    </identity-object-type>
+                    <identity-object-type>
+                        <name>GROUP</name>
+                        <relationships/>
+                        <credentials/>
+                        <attributes/>
+                        <options/>
+                    </identity-object-type>
+                    <identity-object-type>
+                        <name>ORGANIZATION</name>
+                        <relationships>
+                            <relationship>
+                                <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+                                <identity-object-type-ref>USER</identity-object-type-ref>
+                            </relationship>
+                            <relationship>
+                                <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+                                <identity-object-type-ref>ROLE</identity-object-type-ref>
+                            </relationship>
+                            <relationship>
+                                <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+                                <identity-object-type-ref>GROUP</identity-object-type-ref>
+                            </relationship>
+                            <relationship>
+                                <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+                                <identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
+                            </relationship>
+                        </relationships>
+                        <credentials/>
+                        <attributes/>
+                        <options/>
+                    </identity-object-type>
+                    <identity-object-type>
+                        <name>ROLE</name>
+                        <relationships>
+                            <relationship>
+                                <relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
+                                <identity-object-type-ref>USER</identity-object-type-ref>
+                            </relationship>
+                        </relationships>
+                        <credentials/>
+                        <attributes/>
+                        <options/>
+                    </identity-object-type>
+                </supported-identity-object-types>
+                <options>
+                    <!--<option>-->
+                        <!--<name>hibernateConfiguration</name>-->
+                        <!--<value>hibernate-jboss-identity.cfg.xml</value>-->
+                    <!--</option>-->
+                    <option>
+                        <name>hibernateSessionFactoryJNDIName</name>
+                        <value>java:/jbossidentity/HibernateStoreSessionFactory</value>
+                    </option>
+                    <option>
+                        <name>populateRelationshipTypes</name>
+                        <value>true</value>
+                    </option>
+                    <option>
+                        <name>populateIdentityObjectTypes</name>
+                        <value>true</value>
+                    </option>
+                    <option>
+                        <name>isRealmAware</name>
+                        <value>false</value>
+                    </option>
+                    <option>
+                        <name>allowNotDefinedAttributes</name>
+                        <value>true</value>
+                    </option>
+                </options>
+            </identity-store>
+        </identity-stores>
+    </stores>
+</jboss-identity>
\ No newline at end of file

Modified: idm/branches/2.0.0/picketlink-idm-spi/src/main/java/org/picketlink/idm/spi/model/IdentityObjectType.java
===================================================================
--- idm/branches/2.0.0/picketlink-idm-spi/src/main/java/org/picketlink/idm/spi/model/IdentityObjectType.java	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/picketlink-idm-spi/src/main/java/org/picketlink/idm/spi/model/IdentityObjectType.java	2011-02-17 19:31:32 UTC (rev 752)
@@ -33,5 +33,8 @@
     * @return
     */
    String getName();
-
+   
+   public enum TYPE { USER,ROLE,GROUP};
+   
+   TYPE getType(); 
 }
\ No newline at end of file

Modified: idm/branches/2.0.0/pom.xml
===================================================================
--- idm/branches/2.0.0/pom.xml	2011-02-11 21:05:14 UTC (rev 751)
+++ idm/branches/2.0.0/pom.xml	2011-02-17 19:31:32 UTC (rev 752)
@@ -33,15 +33,11 @@
             <module>picketlink-idm-spi</module>
             <module>picketlink-idm-api</module>
             <module>picketlink-idm-core</module>
-            <module>picketlink-idm-hibernate</module>
-            <module>picketlink-idm-ldap</module>
-            <module>picketlink-idm-cache</module>
-            <module>picketlink-idm-auth</module>
-            <module>picketlink-idm-testsuite</module>
-            <module>integration</module>
             <module>picketlink-idm-docs</module>
          </modules>
       </profile>
+
+    <!--
       <profile>
          <id>all</id>
          <modules>
@@ -125,6 +121,8 @@
          </build>
       </profile>     
 
+     -->
+
    </profiles>
 
    <reporting>



More information about the picketlink-commits mailing list