From jboss-identity-commits at lists.jboss.org Wed Sep 3 11:44:20 2008 Content-Type: multipart/mixed; boundary="===============6874480613813433133==" MIME-Version: 1.0 From: jboss-identity-commits at lists.jboss.org To: jboss-identity-commits at lists.jboss.org Subject: [jboss-identity-commits] JBoss Identity SVN: r60 - in trunk: identity-api/src/main/java/org/jboss/identity/api/managers and 3 other directories. Date: Wed, 03 Sep 2008 11:44:20 -0400 Message-ID: --===============6874480613813433133== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: bdaw Date: 2008-09-03 11:44:20 -0400 (Wed, 03 Sep 2008) New Revision: 60 Added: trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.java Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Identit= yManager.java trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Persist= enceManager.java trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Relatio= nshipManager.java trunk/identity-api/src/main/java/org/jboss/identity/api/session/Session.= java trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentitySt= ore.java trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentitySt= oreRepository.java trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBase= dIdentityStore.java Log: - Connect Session with a Realm in IdentityManager - Add simple notion of Transaction to Session - In IdentityManager leave only methods managing Realm - Remove references to the IdentityStore and IdentityStoreRepository from m= ain API - IdentityManager - Move all methods managing identity objects (CRUD and relationships) to Se= ssion - Minor improvements in IdentityStore methods - Make IdentityStoreRepository extends IdentityStore so expose all identity= objects management methods to route them to actual store implementations - Comment out RelationshipManager for now Added: trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.jav= a (rev 0) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/Transaction.jav= a 2008-09-03 15:44:20 UTC (rev 60) @@ -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.identity.api; + +/** + * @author Boleslaw D= awidowicz + * @version : 0.1 $ + */ +public interface Transaction +{ + + /** + * Begin new transaction + */ + void start(); + + /** + * Commit transaction - flush associated session + */ + void commit(); + + /** + * Rollback transaction + */ + void rollback(); + + /** + * = + * @return + */ + boolean isActive(); + +} Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/managers/= IdentityManager.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Identi= tyManager.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Identi= tyManager.java 2008-09-03 15:44:20 UTC (rev 60) @@ -44,6 +44,9 @@ */ public interface IdentityManager { + + // Realm operations + /** *

Create a Realm or return an already * created realm. Bootstrapping includes generating @@ -60,61 +63,8 @@ * @return */ Realm bootstrap(String realmName, InputStream config); - = - /** - * Create a Session - * @param sessionType - * @param identityName - * @return - */ - Session createSession(String sessionType, String identityName); - = - /** - *

Return a realm

- * @param realmName = - * @param shouldBootstrap Should we bootstrap if a realm does not exist= ? = - * @return - */ - Realm getRealm(String realmName, boolean shouldBootstrap); - = - /** - *

Create an identity in the realm

- * @param realm - * @param identityName - * @return - */ - Identity createIdentity(Realm realm, String identityName) throws Identi= tyException; - = - /** - *

Create a group in the realm

- * @param realm - * @param groupName - * @return - */ - Group createGroup(Realm realm, String groupName) throws IdentityExcepti= on; - = - /** - * Create a group of a particular type - * @param realm - * @param groupName - * @param groupType - * @return - */ - Group createGroup(Realm realm, String groupName, GroupType groupType) - throws IdentityException; - = - /** - *

Create a role in the realm

- * @param realm - * @param roleName name of role - * @param roleType Type of Role - * @return - */ - Role createRole(Realm realm, String roleName, RoleType roleType) - throws IdentityException; = - - /** + /** *

Associate a relationship between two realms

* @param realmA * @param realmB @@ -144,25 +94,30 @@ RelationshipType getRelationship(Realm fromRealm, Realm toRealm); = /** - *

Returns relationship manager for a given realm

- * @param realm + *

Return a realm

+ * @param realmName + * @param shouldBootstrap Should we bootstrap if a realm does not exist? * @return - * @throws IdentityException */ - RelationshipManager getRelationshipManager(Realm realm) throws Identity= Exception; + Realm getRealm(String realmName, boolean shouldBootstrap); = + + // Session + /** - *

Return the configured PersistenceManager

+ * Create a Session + * @param realm * @return */ - PersistenceManager getPersistenceManager(); - = + Session createSession(Realm realm); + + /** - * Return the IdentityStoreRepository associated with - * a particular realm + * Get current open session associated with a realm * @param realm * @return */ - IdentityStoreRepository getRepository(Realm realm); + Session getCurrentSession(Realm realm); = + = } \ No newline at end of file Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/managers/= PersistenceManager.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Persis= tenceManager.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Persis= tenceManager.java 2008-09-03 15:44:20 UTC (rev 60) @@ -2,7 +2,7 @@ * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. = + * 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 @@ -41,7 +41,7 @@ * @return */ IdentityStoreRepository getIdentityStoreRepository(Realm realm); - = + /** *

Get the Identity Store configured for an identity type * at the realm level

@@ -51,5 +51,5 @@ * @return */ IdentityStore getIdentityStore(Realm realm, IdentityType identityType); - = + } \ No newline at end of file Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/managers/= RelationshipManager.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Relati= onshipManager.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/managers/Relati= onshipManager.java 2008-09-03 15:44:20 UTC (rev 60) @@ -1,181 +1,181 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2008, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. = - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.identity.api.managers; - -import java.util.List; -import java.util.Set; - -import org.jboss.identity.api.exception.PersistenceManagerNotFoundExceptio= n; -import org.jboss.identity.api.exception.SessionNotOpenException; -import org.jboss.identity.model.Identity; -import org.jboss.identity.model.roles.Role; -import org.jboss.identity.model.groups.Group; -import org.jboss.identity.model.relation.RelationshipType; - -/** - *

Manages the relationships between - * roles, groups and identities within a realm

- * @author Anil.Saldhana(a)redhat.com - * @author boleslaw dot dawidowicz at redhat anotherdot com - * @since Jul 10, 2008 - */ -public interface RelationshipManager -{ - /** - *

Associate a relationship between two groups

- * @param groupA - * @param groupB - * @param relationshipType - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void associate(Group groupA, Group groupB, RelationshipType relationshi= pType) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - * Associate a relationship between one group and a list of other groups - * @param groupA - * @param groupB a list of groups which are related to groupA - * @param relationshipType - * @throws PersistenceManagerNotFoundException - * @throws SessionNotOpenException - */ - void associate(Group groupA, List groupB, RelationshipType relat= ionshipType) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - - = - /** - *

Associate a role with an Identity

- * @param identity - * @param aRole - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void associate(Identity identity, Role aRole) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Associate a list of roles with an Identity

- * @param identity - * @param aRoleList - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void associate(Identity identity, List aRoleList) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Associate a group with an identity

- * @param identity - * @param aGroup - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void associate(Identity identity, Group aGroup) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Associate a set of groups with an identity

- * @param identity - * @param aGroupSet - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void associate(Identity identity, Set aGroupSet) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Disassociate a relationship between two groups

- * @param groupA - * @param groupB - * @param relationshipType - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void disassociate(Group groupA, Group groupB, RelationshipType relation= shipType) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - * Disassociate a relationship between one group and a list of other gr= oups - * @param groupA - * @param groupB - * @param relationshipType - * @throws PersistenceManagerNotFoundException - * @throws SessionNotOpenException - */ - void disassociate(Group groupA, List groupB, RelationshipType re= lationshipType) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - = - = - /** - *

Disassociate a role with an Identity

- * @param identity - * @param aRole - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void disassociate(Identity identity, Role aRole) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Disassociate a list of roles with an Identity

- * @param identity - * @param aRoleList - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void disassociate(Identity identity, List aRoleList) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Disassociate a group with an identity

- * @param identity - * @param aGroup - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void disassociate(Identity identity, Group aGroup) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - *

Disassociate a set of groups with an identity

- * @param identity - * @param aGroupSet - * @throws PersistenceManagerNotFoundException PM not set - * @throws SessionNotOpenException session is not open - */ - void disassociate(Identity identity, Set aGroupSet) - throws PersistenceManagerNotFoundException,SessionNotOpenException; - = - /** - * @param fromGroup - * @param toGroup - * @return returns a relationship type between this and given group. - */ - RelationshipType getRelationship(Group fromGroup, Group toGroup); - - - = - = -} \ No newline at end of file +///* +// * JBoss, Home of Professional Open Source. +// * Copyright 2008, Red Hat Middleware LLC, and individual contributors +// * as indicated by the @author tags. See the copyright.txt file in the +// * distribution for a full listing of individual contributors. +// * +// * This is free software; you can redistribute it and/or modify it +// * under the terms of the GNU Lesser General Public License as +// * published by the Free Software Foundation; either version 2.1 of +// * the License, or (at your option) any later version. +// * +// * This software is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// * Lesser General Public License for more details. +// * +// * You should have received a copy of the GNU Lesser General Public +// * License along with this software; if not, write to the Free +// * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +// * 02110-1301 USA, or see the FSF site: http://www.fsf.org. +// */ +//package org.jboss.identity.api.managers; +// +//import java.util.List; +//import java.util.Set; +// +//import org.jboss.identity.api.exception.PersistenceManagerNotFoundExcept= ion; +//import org.jboss.identity.api.exception.SessionNotOpenException; +//import org.jboss.identity.model.Identity; +//import org.jboss.identity.model.roles.Role; +//import org.jboss.identity.model.groups.Group; +//import org.jboss.identity.model.relation.RelationshipType; +// +///** +// *

Manages the relationships between +// * roles, groups and identities within a realm

+// * @author Anil.Saldhana(a)redhat.com +// * @author boleslaw dot dawidowicz at redhat anotherdot com +// * @since Jul 10, 2008 +// */ +//public interface RelationshipManager +//{ +// /** +// *

Associate a relationship between two groups

+// * @param groupA +// * @param groupB +// * @param relationshipType +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void associate(Group groupA, Group groupB, RelationshipType relations= hipType) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// * Associate a relationship between one group and a list of other gro= ups +// * @param groupA +// * @param groupB a list of groups which are related to groupA +// * @param relationshipType +// * @throws PersistenceManagerNotFoundException +// * @throws SessionNotOpenException +// */ +// void associate(Group groupA, List groupB, RelationshipType rel= ationshipType) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// +// +// /** +// *

Associate a role with an Identity

+// * @param identity +// * @param aRole +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void associate(Identity identity, Role aRole) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Associate a list of roles with an Identity

+// * @param identity +// * @param aRoleList +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void associate(Identity identity, List aRoleList) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Associate a group with an identity

+// * @param identity +// * @param aGroup +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void associate(Identity identity, Group aGroup) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Associate a set of groups with an identity

+// * @param identity +// * @param aGroupSet +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void associate(Identity identity, Set aGroupSet) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Disassociate a relationship between two groups

+// * @param groupA +// * @param groupB +// * @param relationshipType +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void disassociate(Group groupA, Group groupB, RelationshipType relati= onshipType) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// * Disassociate a relationship between one group and a list of other = groups +// * @param groupA +// * @param groupB +// * @param relationshipType +// * @throws PersistenceManagerNotFoundException +// * @throws SessionNotOpenException +// */ +// void disassociate(Group groupA, List groupB, RelationshipType = relationshipType) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// +// +// /** +// *

Disassociate a role with an Identity

+// * @param identity +// * @param aRole +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void disassociate(Identity identity, Role aRole) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Disassociate a list of roles with an Identity

+// * @param identity +// * @param aRoleList +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void disassociate(Identity identity, List aRoleList) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Disassociate a group with an identity

+// * @param identity +// * @param aGroup +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void disassociate(Identity identity, Group aGroup) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// *

Disassociate a set of groups with an identity

+// * @param identity +// * @param aGroupSet +// * @throws PersistenceManagerNotFoundException PM not set +// * @throws SessionNotOpenException session is not open +// */ +// void disassociate(Identity identity, Set aGroupSet) +// throws PersistenceManagerNotFoundException,SessionNotOpenException; +// +// /** +// * @param fromGroup +// * @param toGroup +// * @return returns a relationship type between this and given group. +// */ +// RelationshipType getRelationship(Group fromGroup, Group toGroup); +// +// +// +// +//} \ No newline at end of file Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/session/S= ession.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/session/Session= .java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/session/Session= .java 2008-09-03 15:44:20 UTC (rev 60) @@ -22,7 +22,23 @@ package org.jboss.identity.api.session; = import org.jboss.identity.api.exception.IdentityException; +import org.jboss.identity.api.exception.SessionNotOpenException; +import org.jboss.identity.api.Transaction; +import org.jboss.identity.model.Identity; +import org.jboss.identity.model.IdentityObject; +import org.jboss.identity.model.IdentityType; +import org.jboss.identity.model.relation.RelationshipType; +import org.jboss.identity.model.roles.Role; +import org.jboss.identity.model.roles.RoleType; +import org.jboss.identity.model.groups.Group; +import org.jboss.identity.model.groups.GroupType; +import org.jboss.identity.model.domain.Realm; = +import java.util.List; +import java.util.Set; +import java.util.Collection; +import java.util.Map; + /** *

An Identity Session

* @author boleslaw dot dawidowicz at redhat anotherdot com @@ -60,4 +76,375 @@ * @return */ boolean isOpen(); + + /** + * = + * @return + */ + Transaction beginTransaction(); + + /** + * Transaction instance assosiated with this session + * @return + */ + Transaction getTransaction(); + + + // IDM methods + + // Create + + /** + *

Create an identity in the realm

+ * @param identityName + * @return + */ + Identity createIdentity(String identityName) throws IdentityException; + + /** + * Create a group of a particular type + * @param groupName + * @param groupType + * @return + */ + Group createGroup(String groupName, GroupType groupType) + throws IdentityException; + + /** + *

Create a role in the realm

+ * @param roleName name of role + * @param roleType Type of Role + * @return + */ + Role createRole(String roleName, RoleType roleType) + throws IdentityException; + + // Remove + + /** + * Remove given identity + * + * @param identity + * @throws IdentityException + */ + void removeIdentity(IdentityObject identity) throws IdentityException; + + // Realtionships + + /** + *

Associate a relationship between two groups

+ * @param groupA + * @param groupB + * @param relationshipType + * @throws IdentityException + */ + void associate(Group groupA, Group groupB, RelationshipType relationshi= pType) + throws IdentityException; + + /** + * Associate a relationship between one group and a list of other groups + * @param groupA + * @param groupB a list of groups which are related to groupA + * @param relationshipType + * @throws IdentityException + */ + void associate(Group groupA, List groupB, RelationshipType relat= ionshipType) + throws IdentityException; + + + + /** + *

Associate a role with an Identity

+ * @param identity + * @param aRole + * @throws IdentityException + */ + void associate(Identity identity, Role aRole) + throws IdentityException; + + /** + *

Associate a list of roles with an Identity

+ * @param identity + * @param aRoleList + * @throws IdentityException + */ + void associate(Identity identity, List aRoleList) + throws IdentityException; + + /** + *

Associate a group with an identity

+ * @param identity + * @param aGroup + * @throws IdentityException + */ + void associate(Identity identity, Group aGroup) + throws IdentityException; + + /** + *

Associate a set of groups with an identity

+ * @param identity + * @param aGroupSet + * @throws IdentityException + */ + void associate(Identity identity, Set aGroupSet) + throws IdentityException; + + /** + *

Disassociate a relationship between two groups

+ * @param groupA + * @param groupB + * @param relationshipType + * @throws IdentityException + */ + void disassociate(Group groupA, Group groupB, RelationshipType relation= shipType) + throws IdentityException; + + /** + * Disassociate a relationship between one group and a list of other gr= oups + * @param groupA + * @param groupB + * @param relationshipType + * @throws IdentityException + */ + void disassociate(Group groupA, List groupB, RelationshipType re= lationshipType) + throws IdentityException; + + + + /** + *

Disassociate a role with an Identity

+ * @param identity + * @param aRole + * @throws IdentityException + */ + void disassociate(Identity identity, Role aRole) + throws IdentityException; + + /** + *

Disassociate a list of roles with an Identity

+ * @param identity + * @param aRoleList + * @throws IdentityException + */ + void disassociate(Identity identity, List aRoleList) + throws IdentityException; + + /** + *

Disassociate a group with an identity

+ * @param identity + * @param aGroup + * @throws IdentityException + */ + void disassociate(Identity identity, Group aGroup) + throws IdentityException; + + /** + *

Disassociate a set of groups with an identity

+ * @param identity + * @param aGroupSet + * @throws org.jboss.identity.api.exception.PersistenceManagerNotFoundE= xception PM not set + * @throws SessionNotOpenException session is not open + */ + void disassociate(Identity identity, Set aGroupSet) + throws IdentityException; + + /** + * @param fromGroup + * @param toGroup + * @return returns a relationship type between this and given group. + */ + RelationshipType getRelationship(Group fromGroup, Group toGroup); + + // Relationship - abstract methods + + /** + * Create directional relationship of a given type between identities + * + * @param fromIdentity + * @param toIdentity + * @param relationshipType + * @throws IdentityException + */ + void createRelationship(IdentityObject fro= mIdentity, + IdentityObject toIdentity, + R relationshipType) throws IdentityException; + + /** + * Remove relationship between identities. Relationships can be directi= onal so + * order of parameters matters + * + * @param fromIdentity + * @param toIdentity + * @param relationshipType + * @throws IdentityException + */ + void removeRelationship(IdentityObject fro= mIdentity, + IdentityObject toIdentity, + R relationshipType) throws IdentityException; + + /** + * Remove all relationships between identities. Direction of relationsh= ips doesn't + * matter - all active relationships + * will be removed + * + * @param identity1 + * @param identity2 + * @throws IdentityException + */ + void removeRelationships(IdentityObject identity1, IdentityObject ident= ity2) + throws IdentityException; + + /** + * Resolve relationship types between two identities. Relationships can= be directional + * so order of parameters matters + * + * @param fromIdentity + * @param toIdentity + * @return + * @throws IdentityException + */ + Set resolveRelationships(IdentityObject fromIdentity,= IdentityObject toIdentity) + throws IdentityException; + + + // Search operations + + /** + * @param identityType + * @return a number of stored identities with a given type + * @throws IdentityException + */ + int getIdentityTypeCount(T identityType) + throws IdentityException; + + /** + * Find identity with a given name + * + * @param name + * @param identityType + * @return + * @throws IdentityException + */ + IdentityObject findIdentityObject(String name, IdentityType identityTyp= e) throws IdentityException; + + /** + * Find identity with a given id + * + * @param id + * @return + * @throws IdentityException + */ + IdentityObject findIdentityObject(Object id) throws IdentityException; + + /** + * 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 IdentityException + */ + Collection findIdentityObject(= T identityType, + int offset, int limit, + String orderedByAttributeName, + boolean ascending) throws IdentityE= xception; + + /** + * Find identities with a given attributes values. If the paginatedSear= ch 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 IdentityException + */ + Collection findIdentityObject(= T identityType, + Map attributes, + int offset, int limit, + String orderedByAttributeName, bool= ean ascending) throws IdentityException; + + /** + * Find identites that have relationship with given identity. Relations= hips 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 t= he + * 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 IdentityException + */ + Collection findIdentityObje= ct(IdentityObject identity, + R relationshipType, + boolean parent, + int offset, int limit, + String orderedByAttributeName, + boolean ascending) throws Identity= Exception; + + // Attributes + + /** + * @param identityType + * @return names of supported attributes + * @throws IdentityException + */ + Set getSupportedAttributeNames(T ident= ityType) + throws IdentityException; + + /** + * Get attributes for the given identity + * + * @param identity + * @return + * @throws IdentityException + */ + Map getAttributes(IdentityObject identity) throws Ide= ntityException; + + /** + * Update attributes with new values - previous values will be overwrit= ten + * @param identity + * @param attributes + * @throws IdentityException + */ + void updateAttributes(IdentityObject identity, Map at= tributes) + throws IdentityException; + + /** + * Add new attributes - if attribute with given name already exists the= values + * will be appended + * + * @param identity + * @param attributes + * @throws IdentityException + */ + void addAttributes(IdentityObject identity, Map attri= butes) + throws IdentityException; + + /** + * Remove attributes + * + * @param identity + * @param attributes + */ + void removeAttributes(IdentityObject identity, Set attributes) + throws IdentityException; + + } \ No newline at end of file Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/store/Ide= ntityStore.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityS= tore.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityS= tore.java 2008-09-03 15:44:20 UTC (rev 60) @@ -64,10 +64,11 @@ * Create new identity with a given name * * @param name + * @param identityType * @return * @throws IdentityException */ - IdentityObject createIdentity(String name) throws IdentityException; + IdentityObject createIdentity(String name, IdentityType identityType) t= hrows IdentityException; = /** * Remove given identity @@ -89,10 +90,11 @@ * Find identity with a given name * * @param name + * @param identityType * @return * @throws IdentityException */ - IdentityObject findIdentity(String name) throws IdentityException; + IdentityObject findIdentity(String name, IdentityType identityType) thr= ows IdentityException; = /** * Find identity with a given id Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/store/Ide= ntityStoreRepository.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityS= toreRepository.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityS= toreRepository.java 2008-09-03 15:44:20 UTC (rev 60) @@ -35,7 +35,7 @@ * @author Anil.Saldhana(a)redhat.com * @since Jul 10, 2008 */ -public interface IdentityStoreRepository +public interface IdentityStoreRepository extends IdentityStore { /** * @return a set of configured identity stores @@ -53,10 +53,4 @@ */ IdentityStore getIdentityStore(IdentityType identityType); = = - /** - * Register an identity store for a given identity type - * @param identityType - * @param identityStore - */ - void register(IdentityType identityType, IdentityStore identityStore); } \ No newline at end of file Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/F= ileBasedIdentityStore.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBas= edIdentityStore.java 2008-09-03 07:49:37 UTC (rev 59) +++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FileBas= edIdentityStore.java 2008-09-03 15:44:20 UTC (rev 60) @@ -61,14 +61,14 @@ = = = - public IdentityObject createIdentity(String name) throws IdentityExcept= ion + public IdentityObject createIdentity(String name, IdentityType type) th= rows IdentityException { //Is there one already available? IdentityObject identity =3D this.findIdentity(name); if(identity =3D=3D null) { - identity =3D new SimpleIdentity(name); = - identities.add(identity); = + identity =3D new SimpleIdentity(name); + identities.add(identity); } return identity; } @@ -101,13 +101,8 @@ return null; } = - public IdentityObject findIdentity(String name) throws IdentityException + public IdentityObject findIdentity(String name, IdentityType identityTy= pe) throws IdentityException { - for(IdentityObject identity: identities) - { - if(name.equals(identity.getName())) - return identity; - } return null; } = --===============6874480613813433133==--