Author: bdaw
Date: 2008-06-11 08:37:53 -0400 (Wed, 11 Jun 2008)
New Revision: 10984
Added:
modules/identity/trunk/idm/
modules/identity/trunk/idm/pom.xml
modules/identity/trunk/idm/src/
modules/identity/trunk/idm/src/main/
modules/identity/trunk/idm/src/main/java/
modules/identity/trunk/idm/src/main/java/org/
modules/identity/trunk/idm/src/main/java/org/jboss/
modules/identity/trunk/idm/src/main/java/org/jboss/idm/
modules/identity/trunk/idm/src/main/java/org/jboss/idm/Identity.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityType.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/RelationshipType.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupEntity.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupIdentityStore.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/Relationship.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/UserEntity.java
modules/identity/trunk/idm/src/main/resources/
modules/identity/trunk/idm/src/test/
modules/identity/trunk/idm/src/test/java/
modules/identity/trunk/idm/src/test/resources/
Log:
another approach to the identity model
Added: modules/identity/trunk/idm/pom.xml
===================================================================
--- modules/identity/trunk/idm/pom.xml (rev 0)
+++ modules/identity/trunk/idm/pom.xml 2008-06-11 12:37:53 UTC (rev 10984)
@@ -0,0 +1,17 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.identity</groupId>
+ <artifactId>module-parent</artifactId>
+ <relativePath>../build/pom.xml</relativePath>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>identity-idm</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal Identity Management</name>
+
+ <build></build>
+
+</project>
+
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/Identity.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/Identity.java
(rev 0)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/Identity.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,58 @@
+/*
+* 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.idm;
+
+import org.jboss.idm.IdentityType;
+
+/**
+ * User, role, group, organization, community or any other kind of identity
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Identity
+{
+
+ /**
+ * @return id of this identity
+ */
+ Object getId();
+
+ /**
+ * FQDN identifies the context of this object - identity store in which it is
persisted and object id in this store
+ *
+ * @return full qualified domain name for this identity
+ */
+ String getFQDN();
+
+ /**
+ * @return type of this identity
+ */
+ IdentityType getType();
+
+ /**
+ * @return name of this identity
+ */
+ String getName();
+
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java
(rev 0)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,199 @@
+/*
+* 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.idm;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Represents identity data store. Expose all needed generic methods to manipulate and
persist identity data.
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStore
+{
+
+ // Informations about identity store and its capabilities
+
+ /**
+ * @return id of this identity store
+ */
+ String getId();
+
+ /**
+ * @return set of identity types that can be persisted in this store
+ */
+ Set<IdentityType> getSupportedIdentities();
+
+ /**
+ * @param identityType
+ * @return boolean describing if given identity type can be persisted or retrieved
using this identity store
+ */
+ boolean isIdentitySupported(IdentityType identityType);
+
+ /**
+ * @param fromType
+ * @param toType
+ * @param relationshipType
+ * @return true is given relationship can be persisted or retrieved using this
identity store
+ * @throws IdmException
+ */
+ boolean isRelationshipSupported(IdentityType fromType, IdentityType toType,
RelationshipType relationshipType) throws IdmException;
+
+
+
+ // Operations
+
+ /**
+ * Create new identity with a given name
+ *
+ * @param name
+ * @return
+ * @throws IdmException
+ */
+ Identity createIdentity(String name) throws IdmException;
+
+ /**
+ * Remove given identity
+ *
+ * @param identity
+ * @throws IdmException
+ */
+ void removeIdentity(Identity identity) throws IdmException;
+
+ /**
+ * Find identity with a given name
+ *
+ * @param name
+ * @return
+ * @throws IdmException
+ */
+ Identity findIdentity(String name) throws IdmException;
+
+ /**
+ * Find identity with a given id
+ *
+ * @param id
+ * @return
+ * @throws IdmException
+ */
+ Identity findIdentity(Object id) throws IdmException;
+
+ /**
+ * Find identities with a given attributes values
+ *
+ * @param attributes
+ * @return
+ * @throws IdmException
+ */
+ Collection findIdentities(Map<String, String[]> attributes) throws
IdmException;
+
+
+ /**
+ * Find identites that have relationship with given identity. Relationships are
directional (from parent to child).
+ *
+ * @param identity
+ * @param relationshipType
+ * @param parent defines if given identity is parent or child side in the relationship
- default is true (parent)
+ * @return
+ * @throws IdmException
+ */
+ Collection findIdentities(Identity identity, RelationshipType relationshipType,
boolean parent) throws IdmException;
+
+ /**
+ * Get attributes for the given identity
+ *
+ * @param identity
+ * @return
+ * @throws IdmException
+ */
+ Map<String, String[]> getAttributes(Identity identity) throws IdmException;
+
+ /**
+ * Update attributes with new values - previous values will be overwritten
+ * @param identity
+ * @param attributes
+ * @throws IdmException
+ */
+ void updateAttributes(Identity identity, Map<String, String[]> attributes)
throws IdmException;
+
+ /**
+ * Add new attributes - if attribute with given name already exists the values will be
appended
+ *
+ * @param identity
+ * @param attributes
+ * @throws IdmException
+ */
+ void addAttributes(Identity identity, Map<String, String[]> attributes) throws
IdmException;
+
+ /**
+ * Remove attributes
+ *
+ * @param identity
+ * @param attributes
+ */
+ void removeAttributes(Identity identity, Set<String> attributes);
+
+ /**
+ * Create directional relationship of a given type between identities
+ *
+ * @param fromIdentity
+ * @param toIdentity
+ * @param relationshipType
+ * @throws IdmException
+ */
+ void createRelationship(Identity fromIdentity, Identity toIdentity, RelationshipType
relationshipType) throws IdmException;
+
+ /**
+ * Remove relationship between identities. Relationships can be directional so order
of parameters matters
+ *
+ * @param fromIdentity
+ * @param toIdentity
+ * @param relationshipType
+ * @throws IdmException
+ */
+ void removeRelationship(Identity fromIdentity, Identity toIdentity, RelationshipType
relationshipType) throws IdmException;
+
+ /**
+ * Remove all relationships between identities. Direction of relationships doesn't
matter - all active relationships
+ * will be removed
+ *
+ * @param identity1
+ * @param identity2
+ * @throws IdmException
+ */
+ void removeRelationships(Identity identity1, Identity identity2) throws IdmException;
+
+ /**
+ * Resolve relationship types between two identities. Relationships can be directional
so order of parameters matters
+ *
+ * @param fromIdentity
+ * @param toIdentity
+ * @return
+ * @throws IdmException
+ */
+ Set<RelationshipType> resolveRelationships(Identity fromIdentity, Identity
toIdentity) throws IdmException;
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,56 @@
+/*
+* 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.idm;
+
+import org.jboss.idm.IdentityStore;
+import org.jboss.idm.IdentityType;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * IdentityStoreRepository exposes identity object management operations and act as an
entry point to many underlaying data stores.
+ * Its responsibility is to map identity objects, their state and relations between them
across different identity stores.
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreRepository extends IdentityStore
+{
+ /**
+ * @return a set of configured identity stores
+ */
+ Set<IdentityStore> getConfiguredIdentityStores();
+
+ /**
+ * @return mapping of IdentityType to the specific idenity store
+ */
+ Map<IdentityType, IdentityStore> getIdentityStoreMappings();
+
+ /**
+ * @param groupType
+ * @return proper identity store to store given identity type
+ */
+ IdentityStore getIdentityStore(IdentityType groupType);
+
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityType.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityType.java
(rev 0)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,69 @@
+/*
+* 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.idm;
+
+import org.jboss.idm.RelationshipType;
+
+import java.util.Set;
+
+/**
+ * Defines type of the identity and possible relationships it can have. Relationships can
be directional - from parent to child -
+ * to map hierarchical structure like trees. Methods in this interface enable to resolve
relationships in which this
+ * identity type can be parent side.
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityType
+{
+
+ /**
+ * @return Name of the IdentityType
+ */
+ String getName();
+
+ /**
+ * @param identityType
+ * @param relationshipType
+ * @return true/false for supported/unsupported relationship with this identity type
on the parent side
+ */
+ boolean isRelationshipSupported(IdentityType identityType, RelationshipType
relationshipType);
+
+ /**
+ * @param relationshipType
+ * @return set of identity types that can have given relationship with this identity
type on the parent side
+ */
+ Set<IdentityType> getSupportedIdentities(RelationshipType relationshipType);
+
+ /**
+ * @return set of identity types that can relationships with this identity type on the
parent side
+ */
+ Set<IdentityType> getSupportedIdentities();
+
+ /**
+ * @param identityType
+ * @return set of relationships supported for the given identity type on the parent
side
+ */
+ Set<RelationshipType> getSupportedRelationships(IdentityType identityType);
+
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java
(rev 0)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,49 @@
+/*
+* 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.idm;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdmException extends Exception
+{
+ public IdmException()
+ {
+ }
+
+ public IdmException(String message)
+ {
+ super(message);
+ }
+
+ public IdmException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public IdmException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/RelationshipType.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/RelationshipType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/RelationshipType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,37 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.idm;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RelationshipType
+{
+
+ /**
+ * @return get unique name identifying this relationship type
+ */
+ String getName();
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,133 @@
+/*
+* 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.idm.generic;
+
+import org.jboss.idm.IdentityType;
+import org.jboss.idm.RelationshipType;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum GenericEntityType implements IdentityType
+{
+ IDENTITY,
+
+ ROLE,
+
+ ROLE_GROUP;
+
+ private final static Map<IdentityType, Set<RelationshipType>>
roleRelationships = new HashMap<IdentityType, Set<RelationshipType>>();
+ private final static Map<IdentityType, Set<RelationshipType>>
roleGroupRelationships = new HashMap<IdentityType, Set<RelationshipType>>();
+
+
+ static
+ {
+
+ Set<RelationshipType> nested = new HashSet<RelationshipType>();
+ nested.add(GenericRelationshipType.NESTED);
+
+ // ROLE
+ // can nest other users
+
+ roleRelationships.put(GenericEntityType.IDENTITY, nested);
+
+
+ // ROLE_GROUP
+ // can nest other roles
+
+ roleGroupRelationships.put(GenericEntityType.ROLE, nested);
+
+
+
+
+ }
+
+
+
+ public String getName()
+ {
+ return this.name();
+ }
+
+ public boolean isRelationshipSupported(IdentityType identityType, RelationshipType
relationshipType)
+ {
+ Set<RelationshipType> relTypes = getRelationships().get(identityType);
+
+ if (relTypes != null && relTypes.contains(relationshipType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Set<IdentityType> getSupportedIdentities(RelationshipType
relationshipType)
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<IdentityType> getSupportedIdentities()
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<RelationshipType> getSupportedRelationships(IdentityType
identityType)
+ {
+
+ Set types = getRelationships().get(identityType);
+
+ if (types != null)
+ {
+ return types;
+ }
+
+ return Collections.emptySet();
+ }
+
+
+ private Map<IdentityType, Set<RelationshipType>> getRelationships()
+ {
+ if (this.getName().equals(ROLE.getName()))
+ {
+ return Collections.unmodifiableMap(roleRelationships);
+ }
+ else if (this.getName().equals(ROLE_GROUP.getName()))
+ {
+ return Collections.unmodifiableMap(roleGroupRelationships);
+ }
+
+ // IDENTITY or anything else
+
+ return Collections.emptyMap();
+
+ }
+
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -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.idm.generic;
+
+import org.jboss.idm.RelationshipType;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum GenericRelationshipType implements RelationshipType
+{
+ NESTED,
+ HIERARCHICAL,
+ CUSTOM;
+
+ public String getName()
+ {
+ return this.name();
+ }
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/IdentityException.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,49 @@
+/*
+* 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.portal.identity;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityException extends Exception
+{
+ public IdentityException()
+ {
+ }
+
+ public IdentityException(String message)
+ {
+ super(message);
+ }
+
+ public IdentityException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public IdentityException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,215 @@
+/*
+* 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.portal.identity.api;
+
+import org.jboss.idm.IdentityType;
+import org.jboss.idm.RelationshipType;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum EntityType implements IdentityType
+{
+ // User
+ USER,
+
+ // Administration group - just to group users for common admin tasks
+ ADMINISTRATION,
+
+ // Organization (location, division, department, team...)
+ ORGANIZATION,
+
+ // Business role (manager, director, leader...)
+ BUSINESS,
+
+ // JEE security role
+ JEE,
+
+ // Community of users
+ COMMUNITY;
+
+ private final static Map<IdentityType, Set<RelationshipType>>
administrationRelationships = new HashMap<IdentityType,
Set<RelationshipType>>();
+ private final static Map<IdentityType, Set<RelationshipType>>
organizationRelationships = new HashMap<IdentityType,
Set<RelationshipType>>();
+ private final static Map<IdentityType, Set<RelationshipType>>
businessRelationships = new HashMap<IdentityType, Set<RelationshipType>>();
+ private final static Map<IdentityType, Set<RelationshipType>>
jeeRelationships = new HashMap<IdentityType, Set<RelationshipType>>();
+ private final static Map<IdentityType, Set<RelationshipType>>
communityRelationships = new HashMap<IdentityType, Set<RelationshipType>>();
+
+ static
+ {
+
+ Set<RelationshipType> all = new HashSet<RelationshipType>();
+ all.add(GroupRelationshipType.HIERARCHICAL);
+ all.add(GroupRelationshipType.IMPLY);
+
+ Set<RelationshipType> imply = new HashSet<RelationshipType>();
+ imply.add(GroupRelationshipType.IMPLY);
+
+ Set<RelationshipType> hierarchical = new HashSet<RelationshipType>();
+ hierarchical.add(GroupRelationshipType.HIERARCHICAL);
+
+ // USER
+ //
+ // Is always child in the relationship so nothing is defined
+
+ // ADMINISTRATION
+ //
+ // Can contain USER and other ADMINISTRATION entities.
+ // Can imply any other identity type
+
+ administrationRelationships.put(EntityType.USER, hierarchical);
+ administrationRelationships.put(EntityType.ADMINISTRATION, all);
+ administrationRelationships.put(EntityType.ORGANIZATION, imply);
+ administrationRelationships.put(EntityType.BUSINESS, imply);
+ administrationRelationships.put(EntityType.JEE, imply);
+ administrationRelationships.put(EntityType.COMMUNITY, imply);
+
+ // ORGANIZATION
+ //
+ // Can contain USER, ORGANIZATION and BUSINESS entities
+ // Can imply any other identity type
+
+ organizationRelationships.put(EntityType.USER, hierarchical);
+ organizationRelationships.put(EntityType.ADMINISTRATION, imply);
+ organizationRelationships.put(EntityType.ORGANIZATION, all);
+ organizationRelationships.put(EntityType.BUSINESS, all);
+ organizationRelationships.put(EntityType.JEE, imply);
+ organizationRelationships.put(EntityType.COMMUNITY, imply);
+
+ // BUSINESS
+ //
+ // Can contain USER and other BUSINESS entities
+ // Can imply any other identity type
+
+ businessRelationships.put(EntityType.USER, hierarchical);
+ businessRelationships.put(EntityType.ADMINISTRATION, imply);
+ businessRelationships.put(EntityType.ORGANIZATION, imply);
+ businessRelationships.put(EntityType.BUSINESS, all);
+ businessRelationships.put(EntityType.JEE, imply);
+ businessRelationships.put(EntityType.COMMUNITY, imply);
+
+ // JEE
+ //
+ // Can contain USER entities
+ // Can imply any other identity type
+
+ jeeRelationships.put(EntityType.USER, hierarchical);
+ jeeRelationships.put(EntityType.ADMINISTRATION, imply);
+ jeeRelationships.put(EntityType.ORGANIZATION, imply);
+ jeeRelationships.put(EntityType.BUSINESS, imply);
+ jeeRelationships.put(EntityType.JEE, imply);
+ jeeRelationships.put(EntityType.COMMUNITY, imply);
+
+
+ // COMMUNITY
+ //
+ // Can contain USER and and other COMMUNITY entities
+ // Can imply any other identity type
+
+ communityRelationships.put(EntityType.USER, hierarchical);
+ communityRelationships.put(EntityType.ADMINISTRATION, imply);
+ communityRelationships.put(EntityType.ORGANIZATION, imply);
+ communityRelationships.put(EntityType.BUSINESS, imply);
+ communityRelationships.put(EntityType.JEE, imply);
+ communityRelationships.put(EntityType.COMMUNITY, all);
+
+ }
+
+
+
+ public String getName()
+ {
+ return this.name();
+ }
+
+ public boolean isRelationshipSupported(IdentityType identityType, RelationshipType
relationshipType)
+ {
+ Set<RelationshipType> relTypes = getRelationships().get(identityType);
+
+ if (relTypes != null && relTypes.contains(relationshipType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Set<IdentityType> getSupportedIdentities(RelationshipType
relationshipType)
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<IdentityType> getSupportedIdentities()
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<RelationshipType> getSupportedRelationships(IdentityType
identityType)
+ {
+
+ Set types = getRelationships().get(identityType);
+
+ if (types != null)
+ {
+ return types;
+ }
+
+ return Collections.emptySet();
+ }
+
+
+ private Map<IdentityType, Set<RelationshipType>> getRelationships()
+ {
+ if (this.getName().equals(ADMINISTRATION.getName()))
+ {
+ return Collections.unmodifiableMap(administrationRelationships);
+ }
+ else if (this.getName().equals(ORGANIZATION.getName()))
+ {
+ return Collections.unmodifiableMap(organizationRelationships);
+ }
+ else if (this.getName().equals(BUSINESS.getName()))
+ {
+ return Collections.unmodifiableMap(businessRelationships);
+ }
+ else if (this.getName().equals(JEE.getName()))
+ {
+ return Collections.unmodifiableMap(jeeRelationships);
+ }
+ else if (this.getName().equals(COMMUNITY.getName()))
+ {
+ return Collections.unmodifiableMap(communityRelationships);
+ }
+
+ // USER or anything else
+
+ return Collections.emptyMap();
+
+ }
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,98 @@
+/*
+* 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.portal.identity.api;
+
+import org.jboss.idm.Identity;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Group extends Identity
+{
+
+ EntityType getType();
+
+ /**
+ * @return map containing group attributes
+ */
+ Map<String, String[]> getAttributes();
+
+ /**
+ * Update user attribute values
+ * @param attrName
+ * @param values
+ * @return
+ */
+ boolean updateAttribute(String attrName, String[] values);
+
+ /**
+ * @return id of parent group for the relations of RelationType.HIERARCHICAL. If the
parent id is null, this object
+ * is a child of a root group in the store
+ */
+ Object getParentId();
+
+ /**
+ * @return set of users assigned to this group
+ */
+ Set<User> getUsers();
+
+ /**
+ * @return set of groups that are either children of this group or implied for this
group
+ */
+ Set<Group> getGroups();
+
+ /**
+ * @param type of the relation
+ * @return set of groups that have given relation type with this group and the
direction of the relation is towords
+ * this group
+ */
+ Set<Group> getGroups(GroupRelationshipType type);
+
+ /**
+ * @param group
+ * @return returns a relationship type between this and given group.
+ */
+ GroupRelationshipType getRelationship(Group group);
+
+ /**
+ * Assign a set of groups to this group. All other group associations (with this
relation type) for this group
+ * will be overrwitten
+ * @param toGroups
+ * @param type
+ * @return
+ */
+ boolean assignGroups(Set<Group> toGroups, GroupRelationshipType type);
+
+ /**
+ * Assign a set of users to this group. All other user associations will be
overwritten for this group
+ * @param users
+ * @return
+ */
+ boolean assignUsers(Set<User> users);
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,38 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity.api;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum GroupRelationshipType implements org.jboss.idm.RelationshipType
+{
+ HIERARCHICAL,
+ IMPLY;
+
+ public String getName()
+ {
+ return this.name();
+ }
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,118 @@
+/*
+* 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.portal.identity.api;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * IdentityModule exposes operations to creat/destroy/find users and roles. Methods to
manipulate those objects and
+ * their relationships are exposed directly in Group and User classes.
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityModule
+{
+ // Users
+
+ /**
+ * Create new user in the data store
+ * @param userName
+ * @return
+ */
+ User createUser(String userName);
+
+ /**
+ * Remove user from the the data store
+ * @param user
+ * @return
+ */
+ boolean removeUser(User user);
+
+ /**
+ * Find user with a given user name
+ * @param userName
+ * @return
+ */
+ User findUser(String userName);
+
+ /**
+ * Find user with a given id
+ * @param id
+ * @return
+ */
+ User findUser(Object id);
+
+ /**
+ * Find users with a given properties values
+ * @param properties
+ * @return
+ */
+ Set<Group> findUsers(Map<String, String[]> properties);
+
+
+ // Groups
+
+ /**
+ * Create new group in the data store
+ * @param groupName
+ * @return
+ */
+ Group createGroup(String groupName, EntityType type);
+
+ /**
+ * Remove group from the data store
+ * @param group
+ * @return
+ */
+ boolean removeGroup(Group group);
+
+ /**
+ * Find group with a given name
+ * @param name
+ * @return
+ */
+ Group findGroup(String name);
+
+ /**
+ * Find Group with a given object id
+ * @param id
+ * @return
+ */
+ Group findGroup(Object id);
+
+ /**
+ * Find Group with a given group type
+ * @param entityType
+ * @return
+ */
+ Group findGroup(EntityType entityType);
+
+ /**
+ * Find groups with a given attributes values
+ * @param properties
+ * @return
+ */
+ Set<Group> findGroups(Map<String, String[]> properties);
+}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,68 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity.api;
+
+import org.jboss.idm.Identity;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface User extends Identity
+{
+
+ /**
+ * @return map containing user attributes
+ */
+ Map<String, String[]> getAttributes();
+
+ /**
+ * Update user attribute values
+ * @param attrName
+ * @param values
+ * @return
+ */
+ boolean updateAttribute(String attrName, String[] values);
+
+ /**
+ * @return a set of groups that this user belongs to
+ */
+ Set<Group> getGroups();
+
+ /**
+ * @param entityType
+ * @return a set of groups with a given groupType that this user belongs to
+ */
+ Set<Group> getGroups(EntityType entityType);
+
+ /**
+ * Assign a set of groups to this user. All other group associations will be
overwritten
+ * @param groups
+ * @return
+ */
+ boolean assignGroups(Set<Group> groups);
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupEntity.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupEntity.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupEntity.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,52 @@
+/*
+* 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.portal.identity.spi;
+
+import org.jboss.portal.identity.api.EntityType;
+
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface GroupEntity
+{
+ Object getId();
+
+ String getName();
+
+ EntityType getType();
+
+ Map<String, String[]> getAttributes();
+
+ Object getParentId();
+
+ Collection<Relationship> getFromRelations();
+
+ Collection<Relationship> getToRelations();
+
+ Collection<UserEntity> getUserEntities();
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupIdentityStore.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupIdentityStore.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/GroupIdentityStore.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,46 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity.spi;
+
+import org.jboss.idm.IdentityStore;
+import org.jboss.idm.IdentityType;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface GroupIdentityStore extends IdentityStore
+{
+
+ boolean isUserStore();
+
+ boolean supportExternalGroupRelationships();
+
+
+ // TODO: Set of needed methods
+
+ // TODO: Mechanism for extensions and dynamic discovery of supported extended
operations
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/Relationship.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/Relationship.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/Relationship.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,39 @@
+/*
+* 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.portal.identity.spi;
+
+import org.jboss.idm.RelationshipType;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Relationship
+{
+ GroupEntity getFrom();
+
+ GroupEntity getTo();
+
+ RelationshipType getType();
+
+}
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/UserEntity.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/UserEntity.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/spi/UserEntity.java 2008-06-11
12:37:53 UTC (rev 10984)
@@ -0,0 +1,43 @@
+/*
+* 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.portal.identity.spi;
+
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface UserEntity
+{
+
+ Object getId();
+
+ String getUserName();
+
+ Map<String, String[]> getAttributes();
+
+ Collection<GroupEntity> getGroupEntities();
+
+}
\ No newline at end of file