JBoss Identity SVN: r39 - trunk/identity-api/src/main/java/org/jboss/identity/api/store.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-08-30 06:43:38 -0400 (Sat, 30 Aug 2008)
New Revision: 39
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityStore.java
Log:
JBID-17: relationship JBID-23: group related methods
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityStore.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityStore.java 2008-08-30 10:40:59 UTC (rev 38)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/store/IdentityStore.java 2008-08-30 10:43:38 UTC (rev 39)
@@ -21,6 +21,7 @@
*/
package org.jboss.identity.api.store;
+import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
@@ -28,6 +29,7 @@
import org.jboss.identity.api.exception.IdentityException;
import org.jboss.identity.model.Identity;
import org.jboss.identity.model.IdentityType;
+import org.jboss.identity.model.groups.Group;
import org.jboss.identity.model.relation.RelationshipType;
/**
@@ -39,6 +41,11 @@
public interface IdentityStore
{
/**
+ * Set up the store
+ */
+ void bootstrap() throws IOException;
+
+ /**
* @return id of this identity store
*/
String getId();
@@ -75,7 +82,8 @@
* @return a number of stored identities with a given type
* @throws IdentityException
*/
- int getIdentitiesCount(IdentityType identityType) throws IdentityException;
+ <T extends IdentityType> int getIdentitiesCount(T identityType)
+ throws IdentityException;
/**
* Find identity with a given name
@@ -109,13 +117,14 @@
* @return
* @throws IdentityException
*/
- Collection<Identity> findIdentities(IdentityType identityType,
+ <T extends IdentityType> Collection<Identity> findIdentities(T identityType,
int offset, int limit,
String orderedByAttributeName,
boolean ascending) throws IdentityException;
/**
- * Find identities with a given attributes values. If the paginatedSearch or orderedSearch operations
+ * 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
@@ -127,18 +136,21 @@
* @return
* @throws IdentityException
*/
- Collection<Identity> findIdentities(IdentityType identityType, Map<String, String[]> attributes,
+ <T extends IdentityType> Collection<Identity> findIdentities(T identityType,
+ Map<String, String[]> attributes,
int offset, int limit,
String orderedByAttributeName, boolean ascending) throws IdentityException;
/**
* 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
+ * 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 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
@@ -146,19 +158,19 @@
* @return
* @throws IdentityException
*/
- Collection<Identity> findIdentities(Identity identity,
- RelationshipType relationshipType,
+ <R extends RelationshipType> Collection<Identity> findIdentities(Identity identity,
+ R relationshipType,
boolean parent,
int offset, int limit,
- String orderedByAttributeName,
- boolean ascending) throws IdentityException;
+ String orderedByAttributeName,
+ boolean ascending) throws IdentityException;
/**
* @param identityType
* @return names of supported attributes
* @throws IdentityException
*/
- Set<String> getSupportedAttributeNames(IdentityType identityType)
+ <T extends IdentityType> Set<String> getSupportedAttributeNames(T identityType)
throws IdentityException;
/**
@@ -176,16 +188,19 @@
* @param attributes
* @throws IdentityException
*/
- void updateAttributes(Identity identity, Map<String, String[]> attributes) throws IdentityException;
+ void updateAttributes(Identity identity, Map<String, String[]> attributes)
+ throws IdentityException;
/**
- * Add new attributes - if attribute with given name already exists the values will be appended
+ * Add new attributes - if attribute with given name already exists the values
+ * will be appended
*
* @param identity
* @param attributes
* @throws IdentityException
*/
- void addAttributes(Identity identity, Map<String, String[]> attributes) throws IdentityException;
+ void addAttributes(Identity identity, Map<String, String[]> attributes)
+ throws IdentityException;
/**
* Remove attributes
@@ -193,7 +208,8 @@
* @param identity
* @param attributes
*/
- void removeAttributes(Identity identity, Set<String> attributes) throws IdentityException;
+ void removeAttributes(Identity identity, Set<String> attributes)
+ throws IdentityException;
/**
* Create directional relationship of a given type between identities
@@ -203,36 +219,67 @@
* @param relationshipType
* @throws IdentityException
*/
- void createRelationship(Identity fromIdentity, Identity toIdentity, RelationshipType relationshipType) throws IdentityException;
+ <R extends RelationshipType> void createRelationship(Identity fromIdentity,
+ Identity toIdentity,
+ R relationshipType) throws IdentityException;
/**
- * Remove relationship between identities. Relationships can be directional so order of parameters matters
+ * Remove relationship between identities. Relationships can be directional so
+ * order of parameters matters
*
* @param fromIdentity
* @param toIdentity
* @param relationshipType
* @throws IdentityException
*/
- void removeRelationship(Identity fromIdentity, Identity toIdentity, RelationshipType relationshipType) throws IdentityException;
+ <R extends RelationshipType> void removeRelationship(Identity fromIdentity,
+ Identity toIdentity,
+ R relationshipType) throws IdentityException;
/**
- * Remove all relationships between identities. Direction of relationships doesn't matter - all active relationships
+ * Remove all relationships between identities. Direction of relationships doesn't
+ * matter - all active relationships
* will be removed
*
* @param identity1
* @param identity2
* @throws IdentityException
*/
- void removeRelationships(Identity identity1, Identity identity2) throws IdentityException;
+ void removeRelationships(Identity identity1, Identity identity2)
+ throws IdentityException;
/**
- * Resolve relationship types between two identities. Relationships can be directional so order of parameters matters
+ * Resolve relationship types between two identities. Relationships can be directional
+ * so order of parameters matters
*
* @param fromIdentity
* @param toIdentity
* @return
* @throws IdentityException
*/
- Set<RelationshipType> resolveRelationships(Identity fromIdentity, Identity toIdentity) throws IdentityException;
+ Set<RelationshipType> resolveRelationships(Identity fromIdentity, Identity toIdentity)
+ throws IdentityException;
+
+ /**
+ * Create a Group
+ * @param groupName
+ * @return
+ * @throws IdentityException
+ */
+ Group createGroup(String groupName) throws IdentityException;
+
+ /**
+ * Find a group
+ * @param groupName
+ * @return
+ */
+ Group findGroup(String groupName);
+
+ /**
+ * Remove a group
+ * @param group
+ * @throws IdentityException
+ */
+ void removeGroup(Group group) throws IdentityException;
}
\ No newline at end of file