JBoss Identity SVN: r81 - /.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 17:47:08 -0400 (Thu, 11 Sep 2008)
New Revision: 81
Added:
identity-federation/
Log:
fed id project
15 years, 9 months
JBoss Identity SVN: r80 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/fedid and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 16:51:52 -0400 (Thu, 11 Sep 2008)
New Revision: 80
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java
Log:
JBID-30: pseudonym gen
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/fedid/UUIDPseudonymGenerator.java 2008-09-11 20:51:52 UTC (rev 80)
@@ -0,0 +1,41 @@
+/*
+ * 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.fedid;
+
+import org.jboss.identity.spi.fedid.PseudonymGenerator;
+
+/**
+ * Pseudonym generator that is
+ * based on the JDK5+s UUID Generator
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public class UUIDPseudonymGenerator implements PseudonymGenerator
+{
+ /**
+ * @see PseudonymGenerator#generatePseudonym()
+ */
+ public String generatePseudonym()
+ {
+ return java.util.UUID.randomUUID().toString();
+ }
+}
\ No newline at end of file
Added: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java (rev 0)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/fedid/PseudonymGeneratorUnitTestCase.java 2008-09-11 20:51:52 UTC (rev 80)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.identity.impl.test.fedid;
+
+import org.jboss.identity.impl.fedid.UUIDPseudonymGenerator;
+import org.jboss.identity.spi.fedid.PseudonymGenerator;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit Test the pseudonym generator
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public class PseudonymGeneratorUnitTestCase extends TestCase
+{
+ public void testUUID()
+ {
+ PseudonymGenerator pseudoGen = new UUIDPseudonymGenerator();
+ String first = pseudoGen.generatePseudonym();
+ String second = pseudoGen.generatePseudonym();
+ String third = pseudoGen.generatePseudonym();
+
+ assertFalse(first.equals(second));
+ assertFalse(third.equals(second));
+ assertFalse(first.equals(third));
+ }
+}
\ No newline at end of file
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/fedid/PseudonymGenerator.java 2008-09-11 20:51:52 UTC (rev 80)
@@ -0,0 +1,36 @@
+/*
+ * 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.fedid;
+
+/**
+ * Generator for Pseudonyms
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Sep 11, 2008
+ */
+public interface PseudonymGenerator
+{
+ /**
+ * Generate a pseudonym
+ * @return
+ */
+ String generatePseudonym();
+}
\ No newline at end of file
15 years, 9 months
JBoss Identity SVN: r79 - trunk/identity-impl/src/main/java/org/jboss/identity/impl/model.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-09-11 16:49:20 -0400 (Thu, 11 Sep 2008)
New Revision: 79
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectAttribute.java
Log:
oups... forgot to commit one class
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectAttribute.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectAttribute.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectAttribute.java 2008-09-11 20:49:20 UTC (rev 79)
@@ -0,0 +1,101 @@
+/*
+* 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.model;
+
+import org.hibernate.annotations.CollectionOfElements;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.OneToMany;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@Entity
+@Table(name = "identity_obj_attrs")
+public class JPAIdentityObjectAttribute
+{
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ private String name;
+
+ @CollectionOfElements
+ private Set<String> values = new HashSet<String>();
+
+ public JPAIdentityObjectAttribute()
+ {
+ }
+
+ public JPAIdentityObjectAttribute(String name)
+ {
+ this.name = name;
+ }
+
+ public JPAIdentityObjectAttribute(String name, Set<String> values)
+ {
+ this.name = name;
+ this.values = values;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Set<String> getValues()
+ {
+ return values;
+ }
+
+ public void setValues(Set<String> values)
+ {
+ this.values = values;
+ }
+
+ public void addValue(String val)
+ {
+ getValues().add(val);
+ }
+}
15 years, 9 months
JBoss Identity SVN: r78 - in trunk/identity-impl: src/main/java/org/jboss/identity/impl/model and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-09-11 16:44:54 -0400 (Thu, 11 Sep 2008)
New Revision: 78
Modified:
trunk/identity-impl/pom.xml
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
trunk/identity-impl/src/test/resources/META-INF/persistence.xml
Log:
- some JPA core model impl improvements
Modified: trunk/identity-impl/pom.xml
===================================================================
--- trunk/identity-impl/pom.xml 2008-09-11 20:36:29 UTC (rev 77)
+++ trunk/identity-impl/pom.xml 2008-09-11 20:44:54 UTC (rev 78)
@@ -52,6 +52,11 @@
<artifactId>persistence-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -59,7 +64,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>3.3.1.ga</version>
+ <version>3.3.2.GA</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java 2008-09-11 20:36:29 UTC (rev 77)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java 2008-09-11 20:44:54 UTC (rev 78)
@@ -25,34 +25,41 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
import javax.persistence.Column;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
+import javax.persistence.FetchType;
+import javax.persistence.UniqueConstraint;
+import javax.persistence.JoinColumn;
import org.jboss.identity.exception.PolicyValidationException;
import org.jboss.identity.model.core.IdentityObject;
+import org.hibernate.annotations.CollectionOfElements;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@Entity
-@Table(name = "identity_objects")
+@Table(name = "identity_obj", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "IDENTITY_TYPE"})})
public class JPAIdentityObject implements IdentityObject
{
@Id
@GeneratedValue
private Long id;
- @Column(nullable = false)
+ @Column(name = "NAME", nullable = false)
private String name;
@ManyToOne
+ @JoinColumn(name = "IDENTITY_TYPE")
private JPAIdentityObjectType identityType;
@OneToMany(mappedBy = "fromIdentityObject")
@@ -61,6 +68,8 @@
@OneToMany(mappedBy = "toIdentityObject")
private Set<JPAIdentityObjectRelationship> toRelationships = new HashSet<JPAIdentityObjectRelationship>();
+ @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
+ private Map<String, JPAIdentityObjectAttribute> attributes = new HashMap<String, JPAIdentityObjectAttribute>();
public JPAIdentityObject()
{
@@ -109,9 +118,21 @@
public Map<String, Set<String>> getAttributes()
{
- return null;
+ Map<String, Set<String>> map = new HashMap<String, Set<String>>();
+
+ for (JPAIdentityObjectAttribute attribute : attributes.values())
+ {
+ map.put(attribute.getName(), attribute.getValues());
+ }
+
+ return map;
}
+ public void addAttribute(String name, Set<String> values)
+ {
+ attributes.put(name, new JPAIdentityObjectAttribute(name, values));
+ }
+
public Set<JPAIdentityObjectRelationship> getFromRelationships()
{
return fromRelationships;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java 2008-09-11 20:36:29 UTC (rev 77)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java 2008-09-11 20:44:54 UTC (rev 78)
@@ -35,7 +35,7 @@
* @version : 0.1 $
*/
@Entity
-@Table(name = "identity_objects_types")
+@Table(name = "identity_obj_types")
public class JPAIdentityObjectType implements IdentityObjectType
{
@Id
Modified: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java 2008-09-11 20:36:29 UTC (rev 77)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java 2008-09-11 20:44:54 UTC (rev 78)
@@ -25,6 +25,8 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.logging.Logger;
+import java.util.Set;
+import java.util.HashSet;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
@@ -233,4 +235,136 @@
}
}
+ public void testNameTypeConstraint() throws Exception
+ {
+
+ try
+ {
+ em.getTransaction().begin();
+
+ JPAIdentityObjectType groupType = new JPAIdentityObjectType("Group");
+ em.persist(groupType);
+ JPAIdentityObjectType userType = new JPAIdentityObjectType("User");
+ em.persist(userType);
+
+ JPAIdentityObject user1 = new JPAIdentityObject("user1", userType);
+ em.persist(user1);
+ JPAIdentityObject user2 = new JPAIdentityObject("user2", userType);
+ em.persist(user2);
+
+ em.getTransaction().commit();
+
+ try
+ {
+ em.getTransaction().begin();
+
+ JPAIdentityObject user3 = new JPAIdentityObject("user2", userType);
+ em.persist(user3);
+
+ //em.getTransaction().commit();
+
+ // Should fail
+ fail();
+ }
+ catch (Exception e)
+ {
+ //expected
+ em.getTransaction().rollback();
+ }
+
+
+ em.getTransaction().begin();
+
+
+ JPAIdentityObject user4 = new JPAIdentityObject("group1", userType);
+ em.persist(user4);
+
+
+ JPAIdentityObject group1 = new JPAIdentityObject("group1", groupType);
+ em.persist(group1);
+ JPAIdentityObject group2 = new JPAIdentityObject("group2", groupType);
+ em.persist(group2);
+
+ em.getTransaction().commit();
+
+ try
+ {
+ em.getTransaction().begin();
+
+ JPAIdentityObject group3 = new JPAIdentityObject("group2", groupType);
+ em.persist(group3);
+
+ // Should fail
+ fail();
+ }
+ catch (Exception e)
+ {
+ //expected
+ em.getTransaction().rollback();
+ }
+
+ em.getTransaction().begin();
+
+ JPAIdentityObject group4 = new JPAIdentityObject("user1", groupType);
+ em.persist(group4);
+
+ em.getTransaction().commit();
+
+
+
+ }
+ catch (Exception ex)
+ {
+ em.getTransaction().rollback();
+ ex.printStackTrace();
+ fail("Exception during testPersistence");
+ }
+
+ }
+
+
+ public void testAttributes() throws Exception
+ {
+
+ try
+ {
+ em.getTransaction().begin();
+
+ JPAIdentityObjectType userType = new JPAIdentityObjectType("User");
+ em.persist(userType);
+ JPAIdentityObject user1 = new JPAIdentityObject("user1", userType);
+ em.persist(user1);
+
+ Set<String> values1 = new HashSet<String>();
+ values1.add("Val1");
+ values1.add("Val2");
+ values1.add("Val3");
+
+
+ user1.addAttribute("simple1", values1);
+ user1.addAttribute("simple2", values1);
+
+
+ em.getTransaction().commit();
+
+ em.getTransaction().begin();
+
+
+ user1 = em.find(JPAIdentityObject.class, user1.getId());
+ assertEquals(2, user1.getAttributes().entrySet().size() );
+ assertNotNull(user1.getAttributes().get("simple1"));
+ assertEquals(3, user1.getAttributes().get("simple1").size());
+
+
+ em.getTransaction().commit();
+ }
+ catch (Exception ex)
+ {
+ em.getTransaction().rollback();
+ ex.printStackTrace();
+ fail("Exception during testPersistence");
+ }
+
+ }
+
}
Modified: trunk/identity-impl/src/test/resources/META-INF/persistence.xml
===================================================================
--- trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-09-11 20:36:29 UTC (rev 77)
+++ trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-09-11 20:44:54 UTC (rev 78)
@@ -10,6 +10,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.jboss.identity.impl.model.JPAIdentityObject</class>
+ <class>org.jboss.identity.impl.model.JPAIdentityObjectAttribute</class>
<class>org.jboss.identity.impl.model.JPAIdentityObjectType</class>
<class>org.jboss.identity.impl.model.JPAIdentityObjectRelationship</class>
<class>org.jboss.identity.impl.model.JPAIdentityObjectRelationshipType</class>
15 years, 9 months
JBoss Identity SVN: r77 - trunk/identity-api/src/main/java/org/jboss/identity/api.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 16:36:29 -0400 (Thu, 11 Sep 2008)
New Revision: 77
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/Identity.java
Log:
JBID-29: virtual identity
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Identity.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Identity.java 2008-09-11 18:58:16 UTC (rev 76)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Identity.java 2008-09-11 20:36:29 UTC (rev 77)
@@ -29,5 +29,10 @@
*/
public interface Identity extends IdentityType
{
-
+ /**
+ * Whether this is a virtual
+ * identity (such as a pseudonym)
+ * @return true (virtual identity)
+ */
+ boolean isVirtual();
}
\ No newline at end of file
15 years, 9 months
JBoss Identity SVN: r76 - in trunk: identity-impl and 7 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 14:58:16 -0400 (Thu, 11 Sep 2008)
New Revision: 76
Modified:
trunk/identity-api/.classpath
trunk/identity-impl/.classpath
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/portal/PortalIdentityManager.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
trunk/identity-model/.classpath
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java
Log:
fix eclipse
Modified: trunk/identity-api/.classpath
===================================================================
--- trunk/identity-api/.classpath 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-api/.classpath 2008-09-11 18:58:16 UTC (rev 76)
@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: trunk/identity-impl/.classpath
===================================================================
--- trunk/identity-impl/.classpath 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/.classpath 2008-09-11 18:58:16 UTC (rev 76)
@@ -4,7 +4,10 @@
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-api"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+ <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-spi"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,23 +22,21 @@
package org.jboss.identity.impl.model;
-import org.jboss.identity.model.core.IdentityObject;
-import org.jboss.identity.model.core.IdentityObjectAttribute;
-import org.jboss.identity.exception.PolicyValidationException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.Id;
import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
+import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.HashMap;
+import javax.persistence.Table;
+import org.jboss.identity.exception.PolicyValidationException;
+import org.jboss.identity.model.core.IdentityObject;
+
/**
* @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/model/JPAIdentityObjectRelationship.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,15 +22,15 @@
package org.jboss.identity.impl.model;
-import org.jboss.identity.model.core.IdentityObjectRelationship;
-import org.jboss.identity.model.core.IdentityObjectRelationshipType;
-
import javax.persistence.Entity;
-import javax.persistence.Table;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.jboss.identity.model.core.IdentityObjectRelationship;
+import org.jboss.identity.model.core.IdentityObjectRelationshipType;
+
/**
* @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/model/JPAIdentityObjectRelationshipType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,14 +22,14 @@
package org.jboss.identity.impl.model;
-import org.jboss.identity.model.core.IdentityObjectRelationshipType;
-
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.Table;
-import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
+import org.jboss.identity.model.core.IdentityObjectRelationshipType;
+
/**
* @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/model/JPAIdentityObjectType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,14 +22,14 @@
package org.jboss.identity.impl.model;
-import org.jboss.identity.model.core.IdentityObjectType;
-
+import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
import javax.persistence.Table;
-import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
+import org.jboss.identity.model.core.IdentityObjectType;
+
/**
* @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/FileBasedIdentityStore.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -28,16 +28,13 @@
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.IdentityObjectType;
import org.jboss.identity.model.core.IdentityObject;
import org.jboss.identity.model.core.IdentityObjectRelationshipType;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.spi.store.IdentityStore;
+import org.jboss.identity.model.core.IdentityObjectType;
import org.jboss.identity.spi.store.FeaturesDescription;
-import org.jboss.identity.spi.store.AttributeStore;
+import org.jboss.identity.spi.store.IdentityStore;
/**
* File Based Identity Store
@@ -48,10 +45,8 @@
{
//TODO: Handle file semantics
- private List<IdentityObject> identities = new ArrayList<IdentityObject>();
+ private List<IdentityObject> identities = new ArrayList<IdentityObject>();
- private List<Group> groups = new ArrayList<Group>();
-
public void addAttributes(IdentityObject identity, Map<String, String[]> attributes)
throws IdentityException
{
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -23,15 +23,15 @@
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
+import org.jboss.identity.api.Group;
+import org.jboss.identity.api.Role;
+import org.jboss.identity.exception.PolicyValidationException;
+import org.jboss.identity.model.core.IdentityObject;
import org.jboss.identity.model.core.IdentityObjectAttribute;
-import org.jboss.identity.api.Role;
import org.jboss.identity.model.core.IdentityObjectType;
-import org.jboss.identity.model.core.IdentityObject;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.exception.PolicyValidationException;
/**
Modified: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/portal/PortalIdentityManager.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/portal/PortalIdentityManager.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/portal/PortalIdentityManager.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.identity.impl.portal;
-import java.io.InputStream;
//import org.jboss.identity.api.exception.IdentityException;
//import org.jboss.identity.api.managers.IdentityManager;
Modified: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,20 +22,21 @@
package org.jboss.test.identity.impl.test.portal;
-import junit.framework.TestCase;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.logging.Logger;
+import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.Query;
-import java.util.logging.Logger;
-import java.sql.Connection;
-import java.sql.DriverManager;
+import junit.framework.TestCase;
+
import org.jboss.identity.impl.model.JPAIdentityObject;
+import org.jboss.identity.impl.model.JPAIdentityObjectRelationship;
+import org.jboss.identity.impl.model.JPAIdentityObjectRelationshipType;
import org.jboss.identity.impl.model.JPAIdentityObjectType;
-import org.jboss.identity.impl.model.JPAIdentityObjectRelationshipType;
-import org.jboss.identity.impl.model.JPAIdentityObjectRelationship;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
Modified: trunk/identity-model/.classpath
===================================================================
--- trunk/identity-model/.classpath 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-model/.classpath 2008-09-11 18:58:16 UTC (rev 76)
@@ -5,5 +5,6 @@
<classpathentry kind="src" path="src/main/test/resources"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -22,12 +22,11 @@
package org.jboss.identity.model.core;
-import org.jboss.identity.exception.PolicyValidationException;
-
-import java.util.List;
-import java.util.Set;
import java.util.Map;
+import java.util.Set;
+import org.jboss.identity.exception.PolicyValidationException;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @author Anil.Saldhana(a)redhat.com
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -21,8 +21,6 @@
*/
package org.jboss.identity.model.core;
-import java.util.Set;
-
/**
* An attribute of an identity
* @author Anil.Saldhana(a)redhat.com
@@ -31,5 +29,4 @@
*/
public interface IdentityObjectAttribute
{
-
}
\ No newline at end of file
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java 2008-09-11 18:57:53 UTC (rev 75)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java 2008-09-11 18:58:16 UTC (rev 76)
@@ -21,9 +21,6 @@
*/
package org.jboss.identity.model.core;
-import java.util.List;
-
-
/**
* @author Anil.Saldhana(a)redhat.com
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
15 years, 9 months
JBoss Identity SVN: r75 - in trunk/identity-spi: src/main/java/org/jboss/identity/spi/configuration and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 14:57:53 -0400 (Thu, 11 Sep 2008)
New Revision: 75
Added:
trunk/identity-spi/.classpath
trunk/identity-spi/.project
Modified:
trunk/identity-spi/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
Log:
fix build
Property changes on: trunk/identity-spi
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/identity-spi/.classpath
===================================================================
--- trunk/identity-spi/.classpath (rev 0)
+++ trunk/identity-spi/.classpath 2008-09-11 18:57:53 UTC (rev 75)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
+ <classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>
Added: trunk/identity-spi/.project
===================================================================
--- trunk/identity-spi/.project (rev 0)
+++ trunk/identity-spi/.project 2008-09-11 18:57:53 UTC (rev 75)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>identity-spi</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: 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 2008-09-11 18:57:21 UTC (rev 74)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2008-09-11 18:57:53 UTC (rev 75)
@@ -22,8 +22,6 @@
package org.jboss.identity.spi.configuration;
-import java.util.Set;
-import java.util.Map;
import java.util.Collection;
/**
15 years, 9 months
JBoss Identity SVN: r74 - trunk/identity-common.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-09-11 14:57:21 -0400 (Thu, 11 Sep 2008)
New Revision: 74
Added:
trunk/identity-common/.classpath
trunk/identity-common/.project
Modified:
trunk/identity-common/
Log:
eclipse set
Property changes on: trunk/identity-common
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/identity-common/.classpath
===================================================================
--- trunk/identity-common/.classpath (rev 0)
+++ trunk/identity-common/.classpath 2008-09-11 18:57:21 UTC (rev 74)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>
Added: trunk/identity-common/.project
===================================================================
--- trunk/identity-common/.project (rev 0)
+++ trunk/identity-common/.project 2008-09-11 18:57:21 UTC (rev 74)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>identity-common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
15 years, 9 months
JBoss Identity SVN: r73 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl and 7 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-09-11 03:50:56 -0400 (Thu, 11 Sep 2008)
New Revision: 73
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
trunk/identity-impl/src/test/resources/META-INF/
trunk/identity-impl/src/test/resources/META-INF/persistence.xml
Modified:
trunk/identity-impl/pom.xml
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java
trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/PortalIdentityUnitTestCase.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
Log:
- very simple JPA impl of core model (not complete) with test cases
Modified: trunk/identity-impl/pom.xml
===================================================================
--- trunk/identity-impl/pom.xml 2008-09-10 19:22:59 UTC (rev 72)
+++ trunk/identity-impl/pom.xml 2008-09-11 07:50:56 UTC (rev 73)
@@ -56,5 +56,17 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.3.1.ga</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObject.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -0,0 +1,153 @@
+/*
+* 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.model;
+
+import org.jboss.identity.model.core.IdentityObject;
+import org.jboss.identity.model.core.IdentityObjectAttribute;
+import org.jboss.identity.exception.PolicyValidationException;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@Entity
+@Table(name = "identity_objects")
+public class JPAIdentityObject implements IdentityObject
+{
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column(nullable = false)
+ private String name;
+
+ @ManyToOne
+ private JPAIdentityObjectType identityType;
+
+ @OneToMany(mappedBy = "fromIdentityObject")
+ private Set<JPAIdentityObjectRelationship> fromRelationships = new HashSet<JPAIdentityObjectRelationship>();
+
+ @OneToMany(mappedBy = "toIdentityObject")
+ private Set<JPAIdentityObjectRelationship> toRelationships = new HashSet<JPAIdentityObjectRelationship>();
+
+
+ public JPAIdentityObject()
+ {
+ }
+
+ public JPAIdentityObject(String name, JPAIdentityObjectType identityType)
+ {
+ this.name = name;
+ this.identityType = identityType;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public JPAIdentityObjectType getIdentityType()
+ {
+ return identityType;
+ }
+
+ public void setIdentityType(JPAIdentityObjectType identityType)
+ {
+ this.identityType = identityType;
+ }
+
+ public String getFQDN()
+ {
+ return null;
+ }
+
+ public Map<String, Set<String>> getAttributes()
+ {
+ return null;
+ }
+
+ public Set<JPAIdentityObjectRelationship> getFromRelationships()
+ {
+ return fromRelationships;
+ }
+
+ public void setFromRelationships(Set<JPAIdentityObjectRelationship> fromRelationships)
+ {
+ this.fromRelationships = fromRelationships;
+ }
+
+ public void addFromRelationship(JPAIdentityObjectRelationship fromRelationship)
+ {
+ fromRelationship.setFromIdentityObject(this);
+ fromRelationships.add(fromRelationship);
+ }
+
+ public Set<JPAIdentityObjectRelationship> getToRelationships()
+ {
+ return toRelationships;
+ }
+
+ public void setToRelationships(Set<JPAIdentityObjectRelationship> toRelationships)
+ {
+ this.toRelationships = toRelationships;
+ }
+
+ public void addToRelationship(JPAIdentityObjectRelationship toRelationship)
+ {
+ toRelationship.setToIdentityObject(this);
+ fromRelationships.add(toRelationship);
+ }
+
+ public void validatePolicy() throws PolicyValidationException
+ {
+
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationship.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -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.model;
+
+import org.jboss.identity.model.core.IdentityObjectRelationship;
+import org.jboss.identity.model.core.IdentityObjectRelationshipType;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.ManyToOne;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@Entity
+@Table(name="identity_relationships")
+public class JPAIdentityObjectRelationship implements IdentityObjectRelationship
+{
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @ManyToOne
+ private JPAIdentityObjectRelationshipType type;
+
+ @ManyToOne
+ private JPAIdentityObject fromIdentityObject;
+
+ @ManyToOne
+ private JPAIdentityObject toIdentityObject;
+
+ public JPAIdentityObjectRelationship()
+ {
+ }
+
+ public JPAIdentityObjectRelationship(JPAIdentityObjectRelationshipType type, JPAIdentityObject fromIdentityObject, JPAIdentityObject toIdentityObject)
+ {
+ this.type = type;
+ this.fromIdentityObject = fromIdentityObject;
+ fromIdentityObject.getFromRelationships().add(this);
+ this.toIdentityObject = toIdentityObject;
+ toIdentityObject.getToRelationships().add(this);
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public IdentityObjectRelationshipType getType()
+ {
+ return type;
+ }
+
+ public void setType(JPAIdentityObjectRelationshipType type)
+ {
+ this.type = type;
+ }
+
+ public JPAIdentityObject getFromIdentityObject()
+ {
+ return fromIdentityObject;
+ }
+
+ public void setFromIdentityObject(JPAIdentityObject fromIdentityObject)
+ {
+ this.fromIdentityObject = fromIdentityObject;
+ }
+
+ public JPAIdentityObject getToIdentityObject()
+ {
+ return toIdentityObject;
+ }
+
+ public void setToIdentityObject(JPAIdentityObject toIdentityObject)
+ {
+ this.toIdentityObject = toIdentityObject;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectRelationshipType.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -0,0 +1,77 @@
+/*
+* 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.model;
+
+import org.jboss.identity.model.core.IdentityObjectRelationshipType;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@Entity
+@Table(name = "identity_relationship_types")
+public class JPAIdentityObjectRelationshipType implements IdentityObjectRelationshipType
+{
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column(nullable = false, unique = true)
+ private String name;
+
+ public JPAIdentityObjectRelationshipType()
+ {
+ }
+
+ public JPAIdentityObjectRelationshipType(String name)
+ {
+ this.name = name;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/JPAIdentityObjectType.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -0,0 +1,77 @@
+/*
+* 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.model;
+
+import org.jboss.identity.model.core.IdentityObjectType;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@Entity
+@Table(name = "identity_objects_types")
+public class JPAIdentityObjectType implements IdentityObjectType
+{
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column(nullable = false)
+ private String name;
+
+
+ public JPAIdentityObjectType()
+ {
+ }
+
+ public JPAIdentityObjectType(String name)
+ {
+ this.name = name;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Modified: 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 2008-09-10 19:22:59 UTC (rev 72)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBasedIdentityStore.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -37,6 +37,7 @@
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.FeaturesDescription;
+import org.jboss.identity.spi.store.AttributeStore;
/**
* File Based Identity Store
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java 2008-09-10 19:22:59 UTC (rev 72)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentity.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -23,6 +23,8 @@
import java.util.Collections;
import java.util.List;
+import java.util.Set;
+import java.util.Map;
import org.jboss.identity.model.core.IdentityObjectAttribute;
import org.jboss.identity.api.Role;
@@ -67,9 +69,14 @@
return null;
}
- public List<IdentityObjectAttribute> getAttributes()
+// public List<IdentityObjectAttribute> getAttributes()
+// {
+// return Collections.unmodifiableList(attributes);
+// }
+
+ public Map<String, Set<String>> getAttributes()
{
- return Collections.unmodifiableList(attributes);
+ return null;
}
public List<Group> getGroups()
Added: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java (rev 0)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/JPAModelTestCase.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -0,0 +1,235 @@
+/*
+* 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.test.identity.impl.test.portal;
+
+import junit.framework.TestCase;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+import java.util.logging.Logger;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import org.jboss.identity.impl.model.JPAIdentityObject;
+import org.jboss.identity.impl.model.JPAIdentityObjectType;
+import org.jboss.identity.impl.model.JPAIdentityObjectRelationshipType;
+import org.jboss.identity.impl.model.JPAIdentityObjectRelationship;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class JPAModelTestCase extends TestCase
+{
+ private static Logger logger = Logger.getLogger(JPAModelTestCase.class.getName());
+
+ private EntityManagerFactory emFactory;
+
+ private EntityManager em;
+
+ private Connection connection;
+
+ public JPAModelTestCase(String testName) {
+ super(testName);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ try {
+ logger.info("Starting in-memory HSQL database for unit tests");
+ Class.forName("org.hsqldb.jdbcDriver");
+ connection = DriverManager.getConnection("jdbc:hsqldb:mem:unit-testing-jpa", "sa", "");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ fail("Exception during HSQL database startup.");
+ }
+ try
+ {
+ logger.info("Building JPA EntityManager for unit tests");
+ emFactory = Persistence.createEntityManagerFactory("jboss-identity-model");
+ em = emFactory.createEntityManager();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ fail("Exception during JPA EntityManager instanciation.");
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ logger.info("Shuting down Hibernate JPA layer.");
+ if (em != null)
+ {
+ em.close();
+ }
+ if (emFactory != null)
+ {
+ emFactory.close();
+ }
+ logger.info("Stopping in-memory HSQL database.");
+ try
+ {
+ connection.createStatement().execute("SHUTDOWN");
+ }
+ catch (Exception ex) {}
+ }
+
+ public void testPersistence() {
+ try
+ {
+
+ em.getTransaction().begin();
+
+ //
+
+ JPAIdentityObject io = new JPAIdentityObject();
+ io.setName("John Kowalski");
+
+ em.persist(io);
+ assertTrue(em.contains(io));
+
+ em.remove(io);
+ assertFalse(em.contains(io));
+
+ //
+
+ JPAIdentityObjectType iot = new JPAIdentityObjectType();
+ iot.setName("User");
+
+ em.persist(iot);
+ assertTrue(em.contains(iot));
+
+ em.remove(iot);
+ assertFalse(em.contains(iot));
+
+ //
+
+ JPAIdentityObjectRelationshipType iort = new JPAIdentityObjectRelationshipType();
+ iort.setName("Member");
+
+ em.persist(iort);
+ assertTrue(em.contains(iort));
+
+ //
+
+ JPAIdentityObjectRelationship ior = new JPAIdentityObjectRelationship();
+ ior.setType(iort);
+
+ em.persist(ior);
+ assertTrue(em.contains(ior));
+
+ em.remove(ior);
+ assertFalse(em.contains(ior));
+
+ //
+
+ assertTrue(em.contains(iort));
+
+ em.remove(iort);
+ assertFalse(em.contains(iort));
+
+ em.getTransaction().commit();
+
+ }
+ catch (Exception ex)
+ {
+ em.getTransaction().rollback();
+ ex.printStackTrace();
+ fail("Exception during testPersistence");
+ }
+ }
+
+ public void testRelationships()
+ {
+ try
+ {
+ em.getTransaction().begin();
+
+ JPAIdentityObjectType groupType = new JPAIdentityObjectType("Group");
+ em.persist(groupType);
+ JPAIdentityObjectType userType = new JPAIdentityObjectType("User");
+ em.persist(userType);
+
+ JPAIdentityObject user1 = new JPAIdentityObject("user1", userType);
+ em.persist(user1);
+ JPAIdentityObject user2 = new JPAIdentityObject("user2", userType);
+ em.persist(user2);
+ JPAIdentityObject user3 = new JPAIdentityObject("user3", userType);
+ em.persist(user3);
+
+ JPAIdentityObject group1 = new JPAIdentityObject("group1", groupType);
+ em.persist(group1);
+ JPAIdentityObject group2 = new JPAIdentityObject("group2", groupType);
+ em.persist(group2);
+ JPAIdentityObject group3 = new JPAIdentityObject("group3", groupType);
+ em.persist(group3);
+
+ JPAIdentityObjectRelationshipType memberType = new JPAIdentityObjectRelationshipType("member");
+ em.persist(memberType);
+
+ JPAIdentityObjectRelationship relationship = new JPAIdentityObjectRelationship(memberType, group1, user1);
+ em.persist(relationship);
+ relationship = new JPAIdentityObjectRelationship(memberType, group1, user2);
+ em.persist(relationship);
+ relationship = new JPAIdentityObjectRelationship(memberType, group2, user3);
+ em.persist(relationship);
+ relationship = new JPAIdentityObjectRelationship(memberType, group2, group1);
+ em.persist(relationship);
+
+ em.getTransaction().commit();
+
+ //
+
+ em.getTransaction().begin();
+
+ Query ioQuery = em.createQuery("select o from JPAIdentityObject o where o.name like :name");
+
+ group1 = (JPAIdentityObject)ioQuery.setParameter("name", "group1").getSingleResult();
+ assertEquals(2, group1.getFromRelationships().size());
+ assertEquals(1, group1.getToRelationships().size());
+ group2 = (JPAIdentityObject)ioQuery.setParameter("name", "group2").getSingleResult();
+ assertEquals(2, group2.getFromRelationships().size());
+ assertEquals(0, group2.getToRelationships().size());
+
+ user3 = (JPAIdentityObject)ioQuery.setParameter("name", "user3").getSingleResult();
+ assertEquals(1, user3.getToRelationships().size());
+ assertEquals(0, user3.getFromRelationships().size());
+ assertEquals("group2", user3.getToRelationships().iterator().next().getFromIdentityObject().getName());
+ em.getTransaction().commit();
+ }
+ catch (Exception ex)
+ {
+ em.getTransaction().rollback();
+ ex.printStackTrace();
+ fail("Exception during testPersistence");
+ }
+ }
+
+}
Modified: trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/PortalIdentityUnitTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/PortalIdentityUnitTestCase.java 2008-09-10 19:22:59 UTC (rev 72)
+++ trunk/identity-impl/src/test/java/org/jboss/test/identity/impl/test/portal/PortalIdentityUnitTestCase.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -1,211 +1,211 @@
-/*
- * 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.test.identity.impl.test.portal;
-
-import junit.framework.TestCase;
-
-//import org.jboss.identity.api.managers.IdentityManager;
-//import org.jboss.identity.api.managers.RelationshipManager;
-//import org.jboss.identity.api.store.IdentityStore;
-//import org.jboss.identity.api.store.IdentityStoreRepository;
-//import org.jboss.identity.impl.store.FileBasedIdentityStore;
-//import org.jboss.identity.model.Identity;
-//import org.jboss.identity.model.IdentityType;
-//import org.jboss.identity.model.groups.Group;
-//import org.jboss.identity.model.groups.GroupType;
-//import org.jboss.identity.model.groups.SimpleGroupType;
-//import org.jboss.identity.model.relation.HierarchicalRelationshipType;
-//import org.jboss.identity.model.relation.RelationshipType;
-////import org.jboss.test.identity.impl.portal.PortalIdentityManager;
-//import org.jboss.test.identity.impl.portal.PortalIdentityStoreRepository;
-//import org.jboss.test.identity.impl.portal.PortalRealm;
-//import org.jboss.test.identity.impl.portal.PortalRelationshipManager;
-
-/**
- * Portal identity unit test
- * @author Anil.Saldhana(a)redhat.com
- * @since Jul 22, 2008
- */
-public class PortalIdentityUnitTestCase extends TestCase
-{
-// private IdentityType IDENTITY = IdentityTypeEnum.IDENTITY;
-// private IdentityType GROUP = IdentityTypeEnum.GROUP;
-
-// private RelationshipType hierarchy = new HierarchicalRelationshipType();
-// private RelationshipManager relationshipManager = new PortalRelationshipManager();
-// private IdentityManager identityManager = new PortalIdentityManager();
-// private PortalRealm portalRealm ;
-// private PortalIdentityStoreRepository portalRepository;
-// private IdentityStore portalIdentityStore;
+///*
+// * 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.test.identity.impl.test.portal;
//
-// protected void setUp() throws Exception
-// {
-// portalRealm = (PortalRealm) identityManager.bootstrap("portal");
-// portalRealm.createModelRoots();
-// portalRepository = new PortalIdentityStoreRepository();
-// identityManager.setRepository(portalRealm, portalRepository);
-// portalIdentityStore = new FileBasedIdentityStore();
-//// portalRepository.register(IDENTITY, portalIdentityStore);
-// }
-
- public void testPortalIdentityOrganizationType() throws Exception
- {
- bootstrapOrganizationType();
- searchOrganizationType();
- }
-
- public void testPortalIdentityBusinessType() throws Exception
- {
- bootstrapBusinessType();
- }
-
- /**
- * Bootstrap the organization type system
- */
- private void bootstrapOrganizationType() throws Exception
- {
- //***************************************************
- // Create the Group Model
- //***************************************************
-// GroupType organizationGroupType = new SimpleGroupType("Organization");
-// Group redhatGroup = identityManager.createGroup(portalRealm, "RedHat",
-// organizationGroupType);
+//import junit.framework.TestCase;
//
-// Group jbossGroup = identityManager.createGroup(portalRealm, "JBoss",
-// organizationGroupType);
-// Group rhelGroup = identityManager.createGroup(portalRealm, "RHEL",
-// organizationGroupType);
+////import org.jboss.identity.api.managers.IdentityManager;
+////import org.jboss.identity.api.managers.RelationshipManager;
+////import org.jboss.identity.api.store.IdentityStore;
+////import org.jboss.identity.api.store.IdentityStoreRepository;
+////import org.jboss.identity.impl.store.FileBasedIdentityStore;
+////import org.jboss.identity.model.Identity;
+////import org.jboss.identity.model.IdentityType;
+////import org.jboss.identity.model.groups.Group;
+////import org.jboss.identity.model.groups.GroupType;
+////import org.jboss.identity.model.groups.SimpleGroupType;
+////import org.jboss.identity.model.relation.HierarchicalRelationshipType;
+////import org.jboss.identity.model.relation.RelationshipType;
+//////import org.jboss.test.identity.impl.portal.PortalIdentityManager;
+////import org.jboss.test.identity.impl.portal.PortalIdentityStoreRepository;
+////import org.jboss.test.identity.impl.portal.PortalRealm;
+////import org.jboss.test.identity.impl.portal.PortalRelationshipManager;
//
-// relationshipManager.associate(redhatGroup, jbossGroup, hierarchy);
-// relationshipManager.associate(redhatGroup, rhelGroup, hierarchy);
+///**
+// * Portal identity unit test
+// * @author Anil.Saldhana(a)redhat.com
+// * @since Jul 22, 2008
+// */
+//public class PortalIdentityUnitTestCase extends TestCase
+//{
+//// private IdentityType IDENTITY = IdentityTypeEnum.IDENTITY;
+//// private IdentityType GROUP = IdentityTypeEnum.GROUP;
//
-// Group itGroup = identityManager.createGroup(portalRealm, "IT",
-// organizationGroupType);
-// Group hrGroup = identityManager.createGroup(portalRealm, "HR",
-// organizationGroupType);
+//// private RelationshipType hierarchy = new HierarchicalRelationshipType();
+//// private RelationshipManager relationshipManager = new PortalRelationshipManager();
+//// private IdentityManager identityManager = new PortalIdentityManager();
+//// private PortalRealm portalRealm ;
+//// private PortalIdentityStoreRepository portalRepository;
+//// private IdentityStore portalIdentityStore;
+////
+//// protected void setUp() throws Exception
+//// {
+//// portalRealm = (PortalRealm) identityManager.bootstrap("portal");
+//// portalRealm.createModelRoots();
+//// portalRepository = new PortalIdentityStoreRepository();
+//// identityManager.setRepository(portalRealm, portalRepository);
+//// portalIdentityStore = new FileBasedIdentityStore();
+////// portalRepository.register(IDENTITY, portalIdentityStore);
+//// }
//
-// relationshipManager.associate(jbossGroup, itGroup, hierarchy);
-// relationshipManager.associate(jbossGroup, hrGroup, hierarchy);
+// public void testPortalIdentityOrganizationType() throws Exception
+// {
+// bootstrapOrganizationType();
+// searchOrganizationType();
+// }
//
-// Group projectsGroup = identityManager.createGroup(portalRealm, "Projects",
-// organizationGroupType);
-// Group supportGroup = identityManager.createGroup(portalRealm, "Support",
-// organizationGroupType);
+// public void testPortalIdentityBusinessType() throws Exception
+// {
+// bootstrapBusinessType();
+// }
//
-// relationshipManager.associate(itGroup, projectsGroup, hierarchy);
-// relationshipManager.associate(itGroup, supportGroup, hierarchy);
+// /**
+// * Bootstrap the organization type system
+// */
+// private void bootstrapOrganizationType() throws Exception
+// {
+// //***************************************************
+// // Create the Group Model
+// //***************************************************
+//// GroupType organizationGroupType = new SimpleGroupType("Organization");
+//// Group redhatGroup = identityManager.createGroup(portalRealm, "RedHat",
+//// organizationGroupType);
+////
+//// Group jbossGroup = identityManager.createGroup(portalRealm, "JBoss",
+//// organizationGroupType);
+//// Group rhelGroup = identityManager.createGroup(portalRealm, "RHEL",
+//// organizationGroupType);
+////
+//// relationshipManager.associate(redhatGroup, jbossGroup, hierarchy);
+//// relationshipManager.associate(redhatGroup, rhelGroup, hierarchy);
+////
+//// Group itGroup = identityManager.createGroup(portalRealm, "IT",
+//// organizationGroupType);
+//// Group hrGroup = identityManager.createGroup(portalRealm, "HR",
+//// organizationGroupType);
+////
+//// relationshipManager.associate(jbossGroup, itGroup, hierarchy);
+//// relationshipManager.associate(jbossGroup, hrGroup, hierarchy);
+////
+//// Group projectsGroup = identityManager.createGroup(portalRealm, "Projects",
+//// organizationGroupType);
+//// Group supportGroup = identityManager.createGroup(portalRealm, "Support",
+//// organizationGroupType);
+////
+//// relationshipManager.associate(itGroup, projectsGroup, hierarchy);
+//// relationshipManager.associate(itGroup, supportGroup, hierarchy);
+////
+//// Group portalGroup = identityManager.createGroup(portalRealm, "Portal",
+//// organizationGroupType);
+//// Group jbpmGroup = identityManager.createGroup(portalRealm, "jBPM",
+//// organizationGroupType);
+//// Group soaGroup = identityManager.createGroup(portalRealm, "SOA",
+//// organizationGroupType);
+////
+//// relationshipManager.associate(projectsGroup, portalGroup, hierarchy);
+//// relationshipManager.associate(projectsGroup, jbpmGroup, hierarchy);
+//// relationshipManager.associate(projectsGroup, soaGroup, hierarchy);
//
-// Group portalGroup = identityManager.createGroup(portalRealm, "Portal",
-// organizationGroupType);
-// Group jbpmGroup = identityManager.createGroup(portalRealm, "jBPM",
-// organizationGroupType);
-// Group soaGroup = identityManager.createGroup(portalRealm, "SOA",
-// organizationGroupType);
//
-// relationshipManager.associate(projectsGroup, portalGroup, hierarchy);
-// relationshipManager.associate(projectsGroup, jbpmGroup, hierarchy);
-// relationshipManager.associate(projectsGroup, soaGroup, hierarchy);
-
-
- //***************************************************
- // Create the Identity Model
- //***************************************************
- //Create Identities - julien, theute and associate with portal group
-// Identity julien = identityManager.createIdentity(portalRealm, "julien");
-// Identity theute = identityManager.createIdentity(portalRealm, "theute");
-//
-// relationshipManager.associate(portalRealm, julien, portalGroup);
-// relationshipManager.associate(portalRealm, theute, portalGroup);
- }
-
-
- /**
- * Bootstrap the business type system
- */
- private void bootstrapBusinessType() throws Exception
- {
- //***************************************************
- // Create the Group Model
- //***************************************************
-// GroupType businessGroupType = new SimpleGroupType("Business");
-// Group rolesGroup = identityManager.createGroup(portalRealm, "Roles",
-// businessGroupType);
-//
-// Group developersGroup = identityManager.createGroup(portalRealm,
-// "Developers",
-// businessGroupType);
-// Group managementGroup = identityManager.createGroup(portalRealm,
-// "Management",
-// businessGroupType);
-//
-// relationshipManager.associate(rolesGroup, developersGroup, hierarchy);
-// relationshipManager.associate(rolesGroup, managementGroup, hierarchy);
-//
-// Group portalProjectLeadGroup = identityManager.createGroup(portalRealm,
-// "Portal Project Lead",
-// businessGroupType);
-// Group portalProductLeadGroup = identityManager.createGroup(portalRealm,
-// "Portal Product Lead",
-// businessGroupType);
-//
-// relationshipManager.associate(developersGroup, portalProjectLeadGroup, hierarchy);
-// relationshipManager.associate(developersGroup, portalProductLeadGroup, hierarchy);
-//
-// Group commonFrameworkManagerGroup = identityManager.createGroup(portalRealm,
-// "Common Framework Manager",
-// businessGroupType);
-//
-// relationshipManager.associate(managementGroup,
-// commonFrameworkManagerGroup, hierarchy);
-//
// //***************************************************
// // Create the Identity Model
// //***************************************************
// //Create Identities - julien, theute and associate with portal group
-// Identity julien = identityManager.createIdentity(portalRealm, "julien");
-// Identity theute = identityManager.createIdentity(portalRealm, "theute");
-// //bgeorges for common framework manager group
-// Identity bgeorges = identityManager.createIdentity(portalRealm, "bgeorges");
+//// Identity julien = identityManager.createIdentity(portalRealm, "julien");
+//// Identity theute = identityManager.createIdentity(portalRealm, "theute");
+////
+//// relationshipManager.associate(portalRealm, julien, portalGroup);
+//// relationshipManager.associate(portalRealm, theute, portalGroup);
+// }
//
-// relationshipManager.associate(portalRealm, julien, portalProjectLeadGroup);
-// relationshipManager.associate(portalRealm, theute, portalProductLeadGroup);
-// relationshipManager.associate(portalRealm, bgeorges, commonFrameworkManagerGroup);
//
-// portalIdentityStore.findIdentities(commonFrameworkManagerGroup, hierarchy, true, 0, 0, "", true);
- }
-
- private void searchOrganizationType() throws Exception
- {
-// IdentityStoreRepository repo = identityManager.getRepository(portalRealm);
-// assertEquals(repo, portalRepository);
-// //Get the IdentityStore for identities
-// IdentityStore identityStore = repo.getIdentityStore(IdentityTypeEnum.IDENTITY);
-// assertNotNull("IdentityStore is not null", identityStore);
-// assertEquals("Portal Identity Store",portalIdentityStore,
-// repo.getIdentityStore(IDENTITY));
+// /**
+// * Bootstrap the business type system
+// */
+// private void bootstrapBusinessType() throws Exception
+// {
+// //***************************************************
+// // Create the Group Model
+// //***************************************************
+//// GroupType businessGroupType = new SimpleGroupType("Business");
+//// Group rolesGroup = identityManager.createGroup(portalRealm, "Roles",
+//// businessGroupType);
+////
+//// Group developersGroup = identityManager.createGroup(portalRealm,
+//// "Developers",
+//// businessGroupType);
+//// Group managementGroup = identityManager.createGroup(portalRealm,
+//// "Management",
+//// businessGroupType);
+////
+//// relationshipManager.associate(rolesGroup, developersGroup, hierarchy);
+//// relationshipManager.associate(rolesGroup, managementGroup, hierarchy);
+////
+//// Group portalProjectLeadGroup = identityManager.createGroup(portalRealm,
+//// "Portal Project Lead",
+//// businessGroupType);
+//// Group portalProductLeadGroup = identityManager.createGroup(portalRealm,
+//// "Portal Product Lead",
+//// businessGroupType);
+////
+//// relationshipManager.associate(developersGroup, portalProjectLeadGroup, hierarchy);
+//// relationshipManager.associate(developersGroup, portalProductLeadGroup, hierarchy);
+////
+//// Group commonFrameworkManagerGroup = identityManager.createGroup(portalRealm,
+//// "Common Framework Manager",
+//// businessGroupType);
+////
+//// relationshipManager.associate(managementGroup,
+//// commonFrameworkManagerGroup, hierarchy);
+////
+//// //***************************************************
+//// // Create the Identity Model
+//// //***************************************************
+//// //Create Identities - julien, theute and associate with portal group
+//// Identity julien = identityManager.createIdentity(portalRealm, "julien");
+//// Identity theute = identityManager.createIdentity(portalRealm, "theute");
+//// //bgeorges for common framework manager group
+//// Identity bgeorges = identityManager.createIdentity(portalRealm, "bgeorges");
+////
+//// relationshipManager.associate(portalRealm, julien, portalProjectLeadGroup);
+//// relationshipManager.associate(portalRealm, theute, portalProductLeadGroup);
+//// relationshipManager.associate(portalRealm, bgeorges, commonFrameworkManagerGroup);
+////
+//// portalIdentityStore.findIdentities(commonFrameworkManagerGroup, hierarchy, true, 0, 0, "", true);
+// }
//
-//
-//
-// Identity julien = portalIdentityStore.findIdentity("julien");
-// assertNotNull(julien);
- }
-}
\ No newline at end of file
+// private void searchOrganizationType() throws Exception
+// {
+//// IdentityStoreRepository repo = identityManager.getRepository(portalRealm);
+//// assertEquals(repo, portalRepository);
+//// //Get the IdentityStore for identities
+//// IdentityStore identityStore = repo.getIdentityStore(IdentityTypeEnum.IDENTITY);
+//// assertNotNull("IdentityStore is not null", identityStore);
+//// assertEquals("Portal Identity Store",portalIdentityStore,
+//// repo.getIdentityStore(IDENTITY));
+////
+////
+////
+//// Identity julien = portalIdentityStore.findIdentity("julien");
+//// assertNotNull(julien);
+// }
+//}
\ No newline at end of file
Added: trunk/identity-impl/src/test/resources/META-INF/persistence.xml
===================================================================
--- trunk/identity-impl/src/test/resources/META-INF/persistence.xml (rev 0)
+++ trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-09-11 07:50:56 UTC (rev 73)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+
+ <persistence-unit name="jboss-identity-model" transaction-type="RESOURCE_LOCAL">
+
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+
+ <class>org.jboss.identity.impl.model.JPAIdentityObject</class>
+ <class>org.jboss.identity.impl.model.JPAIdentityObjectType</class>
+ <class>org.jboss.identity.impl.model.JPAIdentityObjectRelationship</class>
+ <class>org.jboss.identity.impl.model.JPAIdentityObjectRelationshipType</class>
+
+
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ </properties>
+
+
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-10 19:22:59 UTC (rev 72)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-11 07:50:56 UTC (rev 73)
@@ -25,6 +25,8 @@
import org.jboss.identity.exception.PolicyValidationException;
import java.util.List;
+import java.util.Set;
+import java.util.Map;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -59,10 +61,10 @@
IdentityObjectType getIdentityType();
/**
- * <p>Return a list of attributes</p>
+ * <p>Return a map of attribute values</p>
* @return
*/
- List<IdentityObjectAttribute> getAttributes();
+ public Map<String, Set<String>> getAttributes();
/**
* Validate configured Policies
15 years, 9 months
JBoss Identity SVN: r72 - in trunk: identity-spi/src/main/java/org/jboss/identity/spi and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-09-10 15:22:59 -0400 (Wed, 10 Sep 2008)
New Revision: 72
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
Modified:
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectRelationshipType.java
trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
Log:
- few more cleanups
- Simple ConfigurationService
- Separate AttributeStore
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObject.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -22,8 +22,6 @@
package org.jboss.identity.model.core;
-import org.jboss.identity.model.core.IdentityObjectType;
-import org.jboss.identity.model.core.IdentityObjectAttribute;
import org.jboss.identity.exception.PolicyValidationException;
import java.util.List;
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectAttribute.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -26,6 +26,7 @@
/**
* An attribute of an identity
* @author Anil.Saldhana(a)redhat.com
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @since Jun 30, 2008
*/
public interface IdentityObjectAttribute
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectRelationshipType.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectRelationshipType.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectRelationshipType.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -22,7 +22,7 @@
package org.jboss.identity.model.core;
/**
- * Defines a <b>relationship</b> between groups, domains etc
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @author Anil.Saldhana(a)redhat.com
* @since Jul 9, 2008
*/
Modified: trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java
===================================================================
--- trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-model/src/main/java/org/jboss/identity/model/core/IdentityObjectType.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -25,8 +25,6 @@
/**
- * Marker Interface representing
- * an object of the Identity Model
* @author Anil.Saldhana(a)redhat.com
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @since Jul 10, 2008
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -22,10 +22,8 @@
package org.jboss.identity.spi.attribute;
import java.util.Date;
-import java.util.Set;
import org.jboss.identity.model.core.IdentityObjectType;
-import org.jboss.identity.model.core.IdentityObjectType;
import org.jboss.identity.model.core.IdentityObjectAttribute;
import org.jboss.identity.spi.policy.PasswordExpirationPolicy;
Added: 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 (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -0,0 +1,59 @@
+/*
+* 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.Set;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ *
+ * Main entry point to grab configuration information
+ *
+ * //TODO: Should this be readonly (bootstrapped once) or expose setters also
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface ConfigurationService
+{
+ /**
+ * @return group of global properties
+ */
+ PropertyGroup getProperties();
+
+ /**
+ * @param groupName
+ * @return group of properties under given namespace
+ */
+ PropertyGroup getProperties(String groupName);
+
+ /**
+ * @return all property groups
+ */
+ Collection<PropertyGroup> getPropertyGroups();
+
+
+
+
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -0,0 +1,41 @@
+/*
+* 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.Set;
+import java.util.Map;
+
+/**
+ * Group of multivalued properties
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface PropertyGroup
+{
+
+ Map<String, Set<String>> getProperties();
+
+ Set<String> getPropertyValues(String name);
+
+}
Added: 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 (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -0,0 +1,88 @@
+/*
+* 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;
+
+import org.jboss.identity.model.core.IdentityObjectType;
+import org.jboss.identity.model.core.IdentityObject;
+import org.jboss.identity.exception.IdentityException;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * Store for identity related attributes. Its separat interface as there is possible need to store profiles in a
+ * distributted way (part in LDAP part in DB).
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface AttributeStore
+{
+
+ /**
+ * @param identityType
+ * @return names of supported attributes
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(T identityType)
+ throws IdentityException;
+
+ /**
+ * Get attributes for the given identity
+ *
+ * @param identity
+ * @return
+ * @throws IdentityException
+ */
+ Map<String, String[]> getAttributes(IdentityObject identity) throws IdentityException;
+
+ /**
+ * Update attributes with new values - previous values will be overwritten
+ * @param identity
+ * @param attributes
+ * @throws IdentityException
+ */
+ void updateAttributes(IdentityObject identity, Map<String, String[]> attributes)
+ throws IdentityException;
+
+ /**
+ * Add new attributes - if attribute with given name already exists the values
+ * will be appended
+ *
+ * @param identity
+ * @param attributes
+ * @throws IdentityException
+ */
+ void addAttributes(IdentityObject identity, Map<String, String[]> attributes)
+ throws IdentityException;
+
+ /**
+ * Remove attributes
+ *
+ * @param identity
+ * @param attributes
+ */
+ void removeAttributes(IdentityObject identity, Set<String> attributes)
+ throws IdentityException;
+
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-09-10 16:04:34 UTC (rev 71)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-09-10 19:22:59 UTC (rev 72)
@@ -37,7 +37,7 @@
* @author Anil.Saldhana(a)redhat.com
* @since Jul 10, 2008
*/
-public interface IdentityStore
+public interface IdentityStore extends AttributeStore
{
/**
* Set up the store
@@ -166,53 +166,9 @@
String orderedByAttributeName,
boolean ascending) throws IdentityException;
- /**
- * @param identityType
- * @return names of supported attributes
- * @throws IdentityException
- */
- <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(T identityType)
- throws IdentityException;
+
/**
- * Get attributes for the given identity
- *
- * @param identity
- * @return
- * @throws IdentityException
- */
- Map<String, String[]> getAttributes(IdentityObject identity) throws IdentityException;
-
- /**
- * Update attributes with new values - previous values will be overwritten
- * @param identity
- * @param attributes
- * @throws IdentityException
- */
- void updateAttributes(IdentityObject identity, Map<String, String[]> attributes)
- throws IdentityException;
-
- /**
- * Add new attributes - if attribute with given name already exists the values
- * will be appended
- *
- * @param identity
- * @param attributes
- * @throws IdentityException
- */
- void addAttributes(IdentityObject identity, Map<String, String[]> attributes)
- throws IdentityException;
-
- /**
- * Remove attributes
- *
- * @param identity
- * @param attributes
- */
- void removeAttributes(IdentityObject identity, Set<String> attributes)
- throws IdentityException;
-
- /**
* Create directional relationship of a given type between identities
*
* @param fromIdentity
15 years, 9 months