Author: bdaw
Date: 2008-09-02 14:33:23 -0400 (Tue, 02 Sep 2008)
New Revision: 57
Added:
tags/portalPrototype/idm/
tags/portalPrototype/idm/pom.xml
tags/portalPrototype/idm/src/
tags/portalPrototype/idm/src/main/
tags/portalPrototype/idm/src/main/java/
tags/portalPrototype/idm/src/main/java/org/
tags/portalPrototype/idm/src/main/java/org/jboss/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/FeaturesDescription.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/Identity.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityRepository.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStore.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityType.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/RelationshipType.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/Session.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupEntity.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupIdentityStore.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/Relationship.java
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/UserEntity.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Capabilities.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Group.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Session.java
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/User.java
tags/portalPrototype/idm/src/main/resources/
tags/portalPrototype/idm/src/test/
tags/portalPrototype/idm/src/test/java/
tags/portalPrototype/idm/src/test/resources/
Log:
copy of initial portalPrototype code - does not compile as pom.xml is not updated
Added: tags/portalPrototype/idm/pom.xml
===================================================================
--- tags/portalPrototype/idm/pom.xml (rev 0)
+++ tags/portalPrototype/idm/pom.xml 2008-09-02 18:33:23 UTC (rev 57)
@@ -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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/FeaturesDescription.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/FeaturesDescription.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/FeaturesDescription.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,114 @@
+/*
+* 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.exceptions.IdentityTypeNotSupportedException;
+import org.jboss.idm.exceptions.IdmException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface FeaturesDescription
+{
+ /**
+ * Operations related to the base set of methods in IdentityStore interface
+ */
+ public enum OperationType implements IdentityOperationType
+ {
+
+ // createIdentity
+ create,
+
+ // removeIdentity
+ remove,
+
+ // updateAttribute, updateAttributes, addAttributes
+ updateAttributes,
+
+ // resolveRelationships
+ resolveRelationships,
+
+ // createRelationship
+ modifyRelationships,
+
+ // pagination in findIdentities
+ paginatedSearch,
+
+ // ordering in findIdentities
+ orderedSearch;
+
+
+ public String getName()
+ {
+ return this.name();
+ }
+ }
+
+ /**
+ * @param identityType
+ * @return supported operations for given identity type
+ * @throws org.jboss.idm.exceptions.IdentityTypeNotSupportedException
+ */
+ public Set<IdentityOperationType> getSupportedOperations(IdentityType
identityType) throws IdentityTypeNotSupportedException;
+
+ /**
+ * @param operationType
+ * @param identityType
+ * @return if given operation on given identity type is supported
+ * @throws IdentityTypeNotSupportedException
+ */
+ boolean isOperationSupported(IdentityOperationType operationType, IdentityType
identityType) throws IdentityTypeNotSupportedException;
+
+ /**
+ * @param operationType
+ * @return set of identity types that can be processed with a given operation
+ * @throws org.jboss.idm.exceptions.IdmException
+ */
+ public Set<IdentityType> getSupportedIdentities(IdentityOperationType
operationType);
+
+ /**
+ * @return set of identity types that can be persisted
+ */
+ 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
+ * @throws org.jboss.idm.exceptions.IdmException
+ */
+ boolean isRelationshipSupported(IdentityType fromType, IdentityType toType,
RelationshipType relationshipType) throws IdmException;
+
+
+
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/idm/Identity.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/Identity.java
(rev 0)
+++ tags/portalPrototype/idm/src/main/java/org/jboss/idm/Identity.java 2008-09-02 18:33:23
UTC (rev 57)
@@ -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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityOperationType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,34 @@
+/*
+* 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;
+
+/**
+ * Operation type supported by IdentityStore
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityOperationType
+{
+ String getName();
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityRepository.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityRepository.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityRepository.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.idm;
+
+/**
+ *
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityRepository
+{
+
+ Session createSession();
+
+ FeaturesDescription getSupportedFeatures();
+
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStore.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStore.java
(rev 0)
+++ tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStore.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.idm;
+
+import org.jboss.idm.exceptions.IdmException;
+import org.jboss.idm.exceptions.IdentityTypeNotSupportedException;
+
+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 FeaturesDescription object describing what operation are supported by this
store
+ */
+ FeaturesDescription getSupportedFeatures();
+
+
+ // 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;
+
+ /**
+ * @param identityType
+ * @return a number of stored identities with a given type
+ * @throws IdmException
+ */
+ int getIdentitiesCount(IdentityType identityType) 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 type paginated and ordered. If the paginatedSearch or
orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identityType
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(IdentityType identityType,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * Find identities with a given attributes values. If the paginatedSearch or
orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identityType
+ * @param attributes
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(IdentityType identityType, Map<String,
String[]> attributes,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * Find identites that have relationship with given identity. Relationships are
directional (from parent to child).
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identity
+ * @param relationshipType
+ * @param parent defines if given identity is parent or child side in the relationship
- default is true (parent)
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(Identity identity, RelationshipType
relationshipType, boolean parent,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * @param identityType
+ * @return names of supported attributes
+ * @throws IdmException
+ */
+ Set<String> getSupportedAttributeNames(IdentityType identityType) 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 org.jboss.idm.exceptions.IdmException
+ */
+ void addAttributes(Identity identity, Map<String, String[]> attributes) throws
IdmException;
+
+ /**
+ * Remove attributes
+ *
+ * @param identity
+ * @param attributes
+ */
+ void removeAttributes(Identity identity, Set<String> attributes) throws
IdmException;
+
+ /**
+ * 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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityStoreRepository.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityType.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityType.java
(rev 0)
+++ tags/portalPrototype/idm/src/main/java/org/jboss/idm/IdentityType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/RelationshipType.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/RelationshipType.java
(rev 0)
+++ tags/portalPrototype/idm/src/main/java/org/jboss/idm/RelationshipType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/Session.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/Session.java
(rev 0)
+++ tags/portalPrototype/idm/src/main/java/org/jboss/idm/Session.java 2008-09-02 18:33:23
UTC (rev 57)
@@ -0,0 +1,241 @@
+/*
+* 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.exceptions.IdmException;
+
+import java.util.Collection;
+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 Session
+{
+
+ /**
+ * Close this session
+ */
+ void close() throws IdmException;
+
+ /**
+ * Save all pending changes
+ */
+ void save() throws IdmException;
+
+ /**
+ * Clear this session
+ */
+ void clear() throws IdmException;
+
+ /**
+ * Check if this session is open
+ * @return
+ */
+ boolean isOpen();
+
+ /**
+ * @return IdentityRepository this session was created for
+ */
+ IdentityRepository getRepository();
+
+
+ // Operations
+
+ /**
+ * Create new identity with a given name
+ *
+ * @param name
+ * @return
+ * @throws org.jboss.idm.exceptions.IdmException
+ */
+ Identity createIdentity(String name) throws IdmException;
+
+ /**
+ * Remove given identity
+ *
+ * @param identity
+ * @throws IdmException
+ */
+ void removeIdentity(Identity identity) throws IdmException;
+
+ /**
+ * @param identityType
+ * @return a number of stored identities with a given type
+ * @throws IdmException
+ */
+ int getIdentitiesCount(IdentityType identityType) 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 type paginated and ordered. If the paginatedSearch or
orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identityType
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(IdentityType identityType,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * Find identities with a given attributes values. If the paginatedSearch or
orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identityType
+ * @param attributes
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(IdentityType identityType, Map<String,
String[]> attributes,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * Find identites that have relationship with given identity. Relationships are
directional (from parent to child).
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will take no
effect
+ *
+ * @param identity
+ * @param relationshipType
+ * @param parent defines if given identity is parent or child side in the relationship
- default is true (parent)
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ * @throws IdmException
+ */
+ Collection<Identity> findIdentities(Identity identity, RelationshipType
relationshipType, boolean parent,
+ int offset, int limit,
+ String orderedByAttributeName, boolean ascending)
throws IdmException;
+
+ /**
+ * @param identityType
+ * @return names of supported attributes
+ * @throws IdmException
+ */
+ Set<String> getSupportedAttributeNames(IdentityType identityType) 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 org.jboss.idm.exceptions.IdmException
+ */
+ void addAttributes(Identity identity, Map<String, String[]> attributes) throws
IdmException;
+
+ /**
+ * Remove attributes
+ *
+ * @param identity
+ * @param attributes
+ */
+ void removeAttributes(Identity identity, Set<String> attributes) throws
IdmException;
+
+ /**
+ * 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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.idm.event;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityEvent
+{
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.idm.event;
+
+/**
+ * Interface that allow event firing.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface IdentityEventBroadcaster
+{
+ /**
+ * Fire an event.
+ *
+ * @param event the event to fire
+ */
+ void fireEvent(IdentityEvent event);
+}
\ No newline at end of file
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.idm.event;
+
+/**
+ * Interface that allows registration management of identity event listeners.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface IdentityEventEmitter
+{
+ /**
+ * Add a listener.
+ *
+ * @param listener the listener for all identity events
+ */
+ void addListener(IdentityEventListener listener);
+
+ /**
+ * Remove a listener.
+ *
+ * @param listener the listener
+ */
+ void removeListener(IdentityEventListener listener);
+}
\ No newline at end of file
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.idm.event;
+
+/**
+ * An event listener.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface IdentityEventListener
+{
+ /**
+ * Fire event on the listener.
+ *
+ * @param event the identity event
+ */
+ void onEvent(IdentityEvent event);
+}
\ No newline at end of file
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.idm.exceptions;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityTypeNotSupportedException extends IdmException
+{
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.exceptions;
+
+/**
+ * @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:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,33 @@
+/*
+* 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.exceptions;
+
+import org.jboss.idm.exceptions.IdmException;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OperationNotSupportedException extends IdmException
+{
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.idm.exceptions;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RelationshipNotSupportedException
+{
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericEntityType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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
+{
+ USER,
+
+ 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.USER, 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);
+ }
+
+ // USER or anything else
+
+ return Collections.emptyMap();
+
+ }
+
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/GenericRelationshipType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.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;
+
+ public String getName()
+ {
+ return this.name();
+ }
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupEntity.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupEntity.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupEntity.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,53 @@
+/*
+* 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.model;
+
+import org.jboss.idm.IdentityType;
+import org.jboss.idm.Identity;
+
+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 extends Identity
+{
+ Object getId();
+
+ String getName();
+
+ IdentityType getType();
+
+ Map<String, String[]> getAttributes();
+
+ Object getParentId();
+
+ Collection<Relationship> getFromRelations();
+
+ Collection<Relationship> getToRelations();
+
+ Collection<UserEntity> getUserEntities();
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupIdentityStore.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupIdentityStore.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/GroupIdentityStore.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,42 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.idm.generic.model;
+
+import org.jboss.idm.IdentityStore;
+
+/**
+ * @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
+
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/Relationship.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/Relationship.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/Relationship.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,40 @@
+/*
+* 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.model;
+
+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: tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/UserEntity.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/UserEntity.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/idm/generic/model/UserEntity.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,45 @@
+/*
+* 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.model;
+
+import org.jboss.idm.Identity;
+
+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 extends Identity
+{
+
+ Object getId();
+
+ String getUserName();
+
+ Map<String, String[]> getAttributes();
+
+ Collection<GroupEntity> getGroupEntities();
+
+}
\ No newline at end of file
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/IdentityException.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/IdentityException.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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:
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Capabilities.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Capabilities.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Capabilities.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,78 @@
+/*
+* 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.exceptions.IdentityTypeNotSupportedException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Capabilities
+{
+
+ /**
+ * Operations related to the base set of methods in IdentityStore interface
+ */
+ public enum OperationType
+ {
+
+ create,
+
+ remove,
+
+ updateAttributes,
+
+ modifyRelationships,
+
+ paginatedSearch,
+
+ orderedSearch;
+
+ }
+
+ /**
+ * @param entityType
+ * @return supported operations for given identity type
+ * @throws org.jboss.idm.exceptions.IdentityTypeNotSupportedException
+ */
+ public Set<OperationType> getSupportedOperations(EntityType entityType) throws
IdentityTypeNotSupportedException;
+
+ /**
+ * @param operationType
+ * @param entityType
+ * @return if given operation on given identity type is supported
+ * @throws IdentityTypeNotSupportedException
+ */
+ boolean isOperationSupported(OperationType operationType, EntityType entityType)
throws IdentityTypeNotSupportedException;
+
+ /**
+ * @param operationType
+ * @return set of identity types that can be processed with a given operation
+ * @throws org.jboss.idm.exceptions.IdmException
+ */
+ public Set<EntityType> getSupportedEntities(OperationType operationType);
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/EntityType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,212 @@
+/*
+* 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;
+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
+{
+ // 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<EntityType, Set<GroupRelationshipType>>
administrationRelationships = new HashMap<EntityType,
Set<GroupRelationshipType>>();
+ private final static Map<EntityType, Set<GroupRelationshipType>>
organizationRelationships = new HashMap<EntityType,
Set<GroupRelationshipType>>();
+ private final static Map<EntityType, Set<GroupRelationshipType>>
businessRelationships = new HashMap<EntityType,
Set<GroupRelationshipType>>();
+ private final static Map<EntityType, Set<GroupRelationshipType>>
jeeRelationships = new HashMap<EntityType, Set<GroupRelationshipType>>();
+ private final static Map<EntityType, Set<GroupRelationshipType>>
communityRelationships = new HashMap<EntityType,
Set<GroupRelationshipType>>();
+
+ static
+ {
+
+ Set<GroupRelationshipType> all = new HashSet<GroupRelationshipType>();
+ all.add(GroupRelationshipType.HIERARCHICAL);
+ all.add(GroupRelationshipType.IMPLY);
+
+ Set<GroupRelationshipType> imply = new
HashSet<GroupRelationshipType>();
+ imply.add(GroupRelationshipType.IMPLY);
+
+ Set<GroupRelationshipType> hierarchical = new
HashSet<GroupRelationshipType>();
+ 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(EntityType identityType, GroupRelationshipType
relationshipType)
+ {
+ Set<GroupRelationshipType> relTypes = getRelationships().get(identityType);
+
+ if (relTypes != null && relTypes.contains(relationshipType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Set<EntityType> getSupportedIdentities(GroupRelationshipType
relationshipType)
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<EntityType> getSupportedIdentities()
+ {
+ return getRelationships().keySet();
+ }
+
+ public Set<GroupRelationshipType> getSupportedRelationships(EntityType
identityType)
+ {
+
+ Set types = getRelationships().get(identityType);
+
+ if (types != null)
+ {
+ return types;
+ }
+
+ return Collections.emptySet();
+ }
+
+
+ private Map<EntityType, Set<GroupRelationshipType>> 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: tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Group.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Group.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,81 @@
+/*
+* 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.Map;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Group
+{
+
+ /**
+ * @return id of this identity
+ */
+ Object getId();
+
+ /**
+ * FQDN identifies the context of this object
+ *
+ * @return full qualified domain name for this identity
+ */
+ String getFQDN();
+
+ /**
+ * @return type of this identity
+ */
+ EntityType getType();
+
+ /**
+ * @return name of this identity
+ */
+ String getName();
+
+
+ /**
+ * @return group display name
+ */
+ String getDisplayName();
+
+ /**
+ * @return description
+ */
+ String getDescription();
+
+ /**
+ * @return map containing group attributes
+ */
+ Map<String, String[]> getAttributes();
+
+ /**
+ * @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();
+
+
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/GroupRelationshipType.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,34 @@
+/*
+* 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
+{
+ HIERARCHICAL,
+ IMPLY;
+
+}
Added:
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
===================================================================
---
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -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.api;
+
+/**
+ * IdentityModule
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityModule
+{
+
+ /**
+ * @return Capabilities object describing operations supported by identity module with
current configuration
+ */
+ Capabilities getCapabilities();
+
+ /**
+ * @return new session
+ */
+ Session createSession();
+
+
+
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Session.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Session.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/Session.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,284 @@
+/*
+* 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.portal.identity.IdentityException;
+
+import java.util.Collection;
+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 Session
+{
+ /**
+ * Close this session
+ */
+ void close() throws IdentityException;
+
+ /**
+ * Save all pending changes
+ */
+ void save() throws IdentityException;
+
+ /**
+ * Clear this session
+ */
+ void clear() throws IdentityException;
+
+ /**
+ * Check if this session is open
+ * @return
+ */
+ boolean isOpen();
+
+
+ // 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
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param properties
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ */
+ Collection<Group> findUsers(Map<String, String[]> properties,
+ int offset, int limit, String orderedByAttributeName,
boolean ascending);
+
+
+ /**
+ * Update user attribute values
+ *
+ * @param user
+ * @param attrName
+ * @param values
+ * @return
+ */
+ boolean updateAttribute(User user, String attrName, String[] values);
+
+ /**
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param user
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return a set of groups that this user belongs to
+ */
+ Collection<Group> getGroups(User user, int offset, int limit, String
orderedByAttributeName, boolean ascending);
+
+ /**
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param user
+ * @param entityType
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return a set of groups with a given groupType that this user belongs to
+ */
+ Collection<Group> getGroups(User user, EntityType entityType,
+ int offset, int limit, String orderedByAttributeName,
boolean ascending);
+
+ /**
+ * Assign a set of groups to this user. All other group associations will be
overwritten
+ *
+ * @param user
+ * @param groups
+ * @return
+ */
+ boolean assignGroups(User user, Set<Group> groups);
+
+
+ // 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
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param properties
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return
+ */
+ Collection<Group> findGroups(Map<String, String[]> properties,
+ int offset, int limit, String orderedByAttributeName,
boolean ascending);
+
+ /**
+ * Update user attribute values
+ *
+ * @param attrName
+ * @param values
+ * @return
+ */
+ boolean updateAttribute(Group group, String attrName, String[] values);
+
+ /**
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param group
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return set of users assigned to this group. Depending on the underlaying
implementation and datastore it may
+ * affect performance
+ */
+ Collection<User> getUsers(Group group, int offset, int limit, String
orderedByAttributeName, boolean ascending);
+
+ /**
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param group
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return set of groups that are either children of this group or implied for this
group
+ */
+ Collection<Group> getGroups(Group group, int offset, int limit, String
orderedByAttributeName, boolean ascending);
+
+ /**
+ * If the paginatedSearch or orderedSearch operations are not supported, dedicated
parameters will take no effect
+ *
+ * @param group
+ * @param type of the relation
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByAttributeName can be null
+ * @param ascending default true
+ * @return set of groups that have given relation type with this group and the
direction of the relation is towords
+ * this group
+ */
+ Collection<Group> getGroups(Group group, GroupRelationshipType type,
+ int offset, int limit, String orderedByAttributeName,
boolean ascending);
+
+ /**
+ * @param fromGroup
+ * @param toGroup
+ * @return returns a relationship type between this and given group.
+ */
+ GroupRelationshipType getRelationship(Group fromGroup, Group toGroup);
+
+ /**
+ * Assign a set of groups to this group. All other group associations (with this
relation type) for this group
+ * will be overrwitten
+ *
+ * @param fromGroup
+ * @param toGroups
+ * @param type
+ * @return
+ */
+ boolean assignGroups(Group fromGroup, Set<Group> toGroups, GroupRelationshipType
type);
+
+ /**
+ * Assign a set of users to this group. All other user associations will be
overwritten for this group
+ *
+ * @param group
+ * @param users
+ * @return
+ */
+ boolean assignUsers(Group group, Set<User> users);
+}
Added: tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/User.java
===================================================================
--- tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/User.java
(rev 0)
+++
tags/portalPrototype/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-09-02
18:33:23 UTC (rev 57)
@@ -0,0 +1,64 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.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
+{
+
+ /**
+ * @return id of this identity
+ */
+ Object getId();
+
+ /**
+ * FQDN identifies the context of this object
+ *
+ * @return full qualified domain name for this identity
+ */
+ String getFQDN();
+
+ /**
+ * @return name of this identity
+ */
+ String getName();
+
+ /**
+ * @return user email
+ */
+ String getEmail();
+
+ /**
+ * @return map containing user attributes
+ */
+ Map<String, String[]> getAttributes();
+
+}