Author: bdaw
Date: 2008-06-16 09:54:56 -0400 (Mon, 16 Jun 2008)
New Revision: 11058
Added:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
Removed:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupEntity.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupIdentityStore.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/Relationship.java
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/UserEntity.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
Log:
- some refactorings
- added interfaces for events
- paginated and ordered searches
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityOperationType.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityOperationType.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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();
+}
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java 2008-06-16
13:20:15 UTC (rev 11057)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdentityStore.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -22,6 +22,9 @@
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;
@@ -34,7 +37,40 @@
*/
public interface IdentityStore
{
+ /**
+ * 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();
+ }
+ }
+
// Informations about identity store and its capabilities
/**
@@ -43,6 +79,28 @@
String getId();
/**
+ * @param identityType
+ * @return supported operations for given identity type
+ * @throws 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 by this identity store with a
given operation
+ * @throws IdmException
+ */
+ public Set<IdentityType> getSupportedIdentities(IdentityOperationType
operationType);
+
+ /**
* @return set of identity types that can be persisted in this store
*/
Set<IdentityType> getSupportedIdentities();
@@ -84,6 +142,13 @@
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
@@ -102,27 +167,65 @@
Identity findIdentity(Object id) throws IdmException;
/**
- * Find identities with a given attributes values
+ * 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 findIdentities(Map<String, String[]> attributes) 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 findIdentities(Identity identity, RelationshipType relationshipType,
boolean parent) 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
@@ -144,7 +247,7 @@
*
* @param identity
* @param attributes
- * @throws IdmException
+ * @throws org.jboss.idm.exceptions.IdmException
*/
void addAttributes(Identity identity, Map<String, String[]> attributes) throws
IdmException;
@@ -154,7 +257,7 @@
* @param identity
* @param attributes
*/
- void removeAttributes(Identity identity, Set<String> attributes);
+ void removeAttributes(Identity identity, Set<String> attributes) throws
IdmException;
/**
* Create directional relationship of a given type between identities
@@ -196,4 +299,6 @@
*/
Set<RelationshipType> resolveRelationships(Identity fromIdentity, Identity
toIdentity) throws IdmException;
+
+
}
Deleted: modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java 2008-06-16
13:20:15 UTC (rev 11057)
+++ modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -1,49 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.idm;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdmException extends Exception
-{
- public IdmException()
- {
- }
-
- public IdmException(String message)
- {
- super(message);
- }
-
- public IdmException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public IdmException(Throwable cause)
- {
- super(cause);
- }
-}
Added: modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEvent.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventBroadcaster.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventEmitter.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/event/IdentityEventListener.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdentityTypeNotSupportedException.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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
+{
+}
Copied:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java (from
rev 11052, modules/identity/trunk/idm/src/main/java/org/jboss/idm/IdmException.java)
===================================================================
--- modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/IdmException.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/OperationNotSupportedException.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java
(rev 0)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/exceptions/RelationshipNotSupportedException.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -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
+{
+}
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupEntity.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupEntity.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupEntity.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -23,6 +23,7 @@
package org.jboss.idm.model;
import org.jboss.idm.IdentityType;
+import org.jboss.idm.Identity;
import java.util.Map;
import java.util.Collection;
@@ -31,7 +32,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface GroupEntity
+public interface GroupEntity extends Identity
{
Object getId();
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupIdentityStore.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupIdentityStore.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/GroupIdentityStore.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -41,6 +41,5 @@
// TODO: Set of needed methods
- // TODO: Mechanism for extensions and dynamic discovery of supported extended
operations
}
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/Relationship.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/Relationship.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/Relationship.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -30,6 +30,7 @@
*/
public interface Relationship
{
+
GroupEntity getFrom();
GroupEntity getTo();
Modified: modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/UserEntity.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/UserEntity.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/idm/model/UserEntity.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -22,6 +22,8 @@
package org.jboss.idm.model;
+import org.jboss.idm.Identity;
+
import java.util.Map;
import java.util.Collection;
@@ -29,7 +31,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface UserEntity
+public interface UserEntity extends Identity
{
Object getId();
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/Group.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -38,61 +38,26 @@
EntityType getType();
/**
- * @return map containing group attributes
+ * @return group display name
*/
- Map<String, String[]> getAttributes();
+ String getDisplayName();
/**
- * Update user attribute values
- * @param attrName
- * @param values
- * @return
+ * @return description
*/
- boolean updateAttribute(String attrName, String[] values);
+ 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();
- /**
- * @return set of users assigned to this group
- */
- Set<User> getUsers();
+
- /**
- * @return set of groups that are either children of this group or implied for this
group
- */
- Set<Group> getGroups();
-
- /**
- * @param type of the relation
- * @return set of groups that have given relation type with this group and the
direction of the relation is towords
- * this group
- */
- Set<Group> getGroups(GroupRelationshipType type);
-
- /**
- * @param group
- * @return returns a relationship type between this and given group.
- */
- GroupRelationshipType getRelationship(Group group);
-
- /**
- * Assign a set of groups to this group. All other group associations (with this
relation type) for this group
- * will be overrwitten
- * @param toGroups
- * @param type
- * @return
- */
- boolean assignGroups(Set<Group> toGroups, GroupRelationshipType type);
-
- /**
- * Assign a set of users to this group. All other user associations will be
overwritten for this group
- * @param users
- * @return
- */
- boolean assignUsers(Set<User> users);
-
}
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/IdentityModule.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -22,8 +22,13 @@
package org.jboss.portal.identity.api;
+import org.jboss.idm.exceptions.IdentityTypeNotSupportedException;
+
import java.util.Set;
import java.util.Map;
+import java.util.Collection;
+import org.jboss.idm.exceptions.IdmException;
+import org.jboss.idm.exceptions.IdentityTypeNotSupportedException
/**
* IdentityModule exposes operations to creat/destroy/find users and roles. Methods to
manipulate those objects and
@@ -34,10 +39,54 @@
*/
public interface IdentityModule
{
- // Users
/**
+ * 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 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 by this identity store with a
given operation
+ * @throws IdmException
+ */
+ public Set<EntityType> getSupportedEntities(OperationType operationType);
+
+
+ // Users
+ /**
* Create new user in the data store
+ *
* @param userName
* @return
*/
@@ -45,6 +94,7 @@
/**
* Remove user from the the data store
+ *
* @param user
* @return
*/
@@ -52,6 +102,8 @@
/**
* Find user with a given user name
+ *
+ *
* @param userName
* @return
*/
@@ -66,16 +118,70 @@
/**
* 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
*/
- Set<Group> findUsers(Map<String, String[]> properties);
+ 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
*/
@@ -83,6 +189,7 @@
/**
* Remove group from the data store
+ *
* @param group
* @return
*/
@@ -90,6 +197,7 @@
/**
* Find group with a given name
+ *
* @param name
* @return
*/
@@ -97,6 +205,7 @@
/**
* Find Group with a given object id
+ *
* @param id
* @return
*/
@@ -104,6 +213,7 @@
/**
* Find Group with a given group type
+ *
* @param entityType
* @return
*/
@@ -111,8 +221,91 @@
/**
* 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
*/
- Set<Group> findGroups(Map<String, String[]> properties);
+ 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);
}
Modified:
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java
===================================================================
---
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-06-16
13:20:15 UTC (rev 11057)
+++
modules/identity/trunk/idm/src/main/java/org/jboss/portal/identity/api/User.java 2008-06-16
13:54:56 UTC (rev 11058)
@@ -35,34 +35,13 @@
{
/**
- * @return map containing user attributes
+ * @return user email
*/
- Map<String, String[]> getAttributes();
+ String getEmail();
/**
- * Update user attribute values
- * @param attrName
- * @param values
- * @return
+ * @return map containing user attributes
*/
- boolean updateAttribute(String attrName, String[] values);
+ Map<String, String[]> getAttributes();
- /**
- * @return a set of groups that this user belongs to
- */
- Set<Group> getGroups();
-
- /**
- * @param entityType
- * @return a set of groups with a given groupType that this user belongs to
- */
- Set<Group> getGroups(EntityType entityType);
-
- /**
- * Assign a set of groups to this user. All other group associations will be
overwritten
- * @param groups
- * @return
- */
- boolean assignGroups(Set<Group> groups);
-
}