Author: bdaw
Date: 2008-06-04 14:41:14 -0400 (Wed, 04 Jun 2008)
New Revision: 10922
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/Group.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/GroupType.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/IdentityModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/RelationType.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/User.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/GroupEntity.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityService.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityStore.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/Relation.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/UserEntity.java
Log:
Playing a bit with the interfaces...
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/Group.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/Group.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/Group.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,111 @@
+/*
+* 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.identity2.api;
+
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Group
+{
+
+ /**
+ * @return group id
+ */
+ public Object getId();
+
+ /**
+ * @return group name
+ */
+ public String getName();
+
+ /**
+ * @return group type
+ */
+ public GroupType getType();
+
+ /**
+ * @return map containing group attributes
+ */
+ public Map<String, String[]> getAttributes();
+
+ /**
+ * Update user attribute values
+ * @param group
+ * @param attrName
+ * @param values
+ * @return
+ */
+ public boolean updateAttribute(Group group, String attrName, String[] values);
+
+ /**
+ * @return id of parent group for the relations of RelationType.HIERARCHICAL. If the
parent id is null, this object
+ * is a child of a root group in the store
+ */
+ public Object getParentId();
+
+ /**
+ * @return set of users assigned to this group
+ */
+ public Set<User> getUsers();
+
+ /**
+ * @return set of groups that are either children of this group or implied for this
group
+ */
+ public 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
+ */
+ public Set<Group> getGroups(RelationType type);
+
+ /**
+ * @param group
+ * @return returns a relation type between this and given group.
+ */
+ public RelationType getRelation(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
+ */
+ public boolean assignGroups(Set<Group> toGroups, RelationType type);
+
+ /**
+ * Assign a set of users to this group. All other user associations will be
overwritten for this group
+ * @param users
+ * @return
+ */
+ public boolean assignUsers(Set<User> users);
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/GroupType.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/GroupType.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/GroupType.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,44 @@
+/*
+* 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.identity2.api;
+
+/**
+ * Type of a group
+ */
+public enum GroupType
+{
+
+ // 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
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/IdentityModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/IdentityModule.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/IdentityModule.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,123 @@
+/*
+* 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.identity2.api;
+
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * IdentityModule exposes operations to creat/destroy/find users and roles. Methods to
manipulate those objects and
+ * their relationships are exposed directly in Group and User classes.
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityModule
+{
+ // Users
+
+ /**
+ * Create new user in the data store
+ * @param userName
+ * @return
+ */
+ public User createUser(String userName);
+
+ /**
+ * Remove user from the the data store
+ * @param user
+ * @return
+ */
+ public boolean removeUser(User user);
+
+ /**
+ * Find user with a given user name
+ * @param userName
+ * @return
+ */
+ public User findUser(String userName);
+
+ /**
+ * Find user with a given id
+ * @param id
+ * @return
+ */
+ public User findUser(Object id);
+
+ /**
+ * Find users with a given properties values
+ * @param properties
+ * @return
+ */
+ public Set<Group> findUsers(Map<String, String[]> properties);
+
+
+ // Groups
+
+ /**
+ * Create new group in the data store
+ * @param groupName
+ * @return
+ */
+ public Group createGroup(String groupName, GroupType type);
+
+ /**
+ * Remove group from the data store
+ * @param group
+ * @return
+ */
+ public boolean removeGroup(Group group);
+
+ /**
+ * Find group with a given name
+ * @param name
+ * @return
+ */
+ public Group findGroup(String name);
+
+ /**
+ * Find Group with a given object id
+ * @param id
+ * @return
+ */
+ public Group findGroup(Object id);
+
+ /**
+ * Find Group with a given group type
+ * @param groupType
+ * @return
+ */
+ public Group findGroup(GroupType groupType);
+
+ /**
+ * Find groups with a given attributes values
+ * @param properties
+ * @return
+ */
+ public Set<Group> findGroups(Map<String, String[]> properties);
+
+
+
+
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/RelationType.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/RelationType.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/RelationType.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,35 @@
+/*
+* 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.identity2.api;
+
+/**
+ * Relation between two groups
+ */
+public enum RelationType
+{
+ // Tree like hierarchy (parent -> children)
+ HIERARCHICAL,
+
+ // Implied
+ IMPLIED
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/User.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/User.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/api/User.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,77 @@
+/*
+* 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.identity2.api;
+
+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 user id
+ */
+ public Object getId();
+
+ /**
+ * @return user name
+ */
+ public String getUserName();
+
+ /**
+ * @return map containing user attributes
+ */
+ public Map<String, String[]> getAttributes();
+
+ /**
+ * Update user attribute values
+ * @param user
+ * @param attrName
+ * @param values
+ * @return
+ */
+ public boolean updateAttribute(User user, String attrName, String[] values);
+
+ /**
+ * @return a set of groups that this user belongs to
+ */
+ public Set<Group> getGroups();
+
+ /**
+ * @param groupType
+ * @return a set of groups with a given groupType that this user belongs to
+ */
+ public Set<Group> getGroups(GroupType groupType);
+
+ /**
+ * Assign a set of groups to this user. All other group associations will be
overwritten
+ * @param groups
+ * @return
+ */
+ public boolean assignGroups(Set<Group> groups);
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/GroupEntity.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/GroupEntity.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/GroupEntity.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,52 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity2.spi;
+
+import org.jboss.portal.identity2.api.GroupType;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface GroupEntity
+{
+ public Object getId();
+
+ public String getName();
+
+ public GroupType getType();
+
+ public Map<String, String[]> getAttributes();
+
+ public Object getParentId();
+
+ public List<Relation> getFromRelations();
+
+ public List<Relation> getToRelations();
+
+ public List<UserEntity> getUserEntities();
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityService.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityService.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityService.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -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.portal.identity2.spi;
+
+import java.util.Set;
+
+/**
+ * IdentityService exposes identity object management operations and act as an entry
point to the 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 IdentityService
+{
+ public Set<IdentityStore> getConfiguredIdentityStores();
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityStore.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityStore.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/IdentityStore.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,48 @@
+/*
+* 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.identity2.spi;
+
+import org.jboss.portal.identity2.api.GroupType;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStore
+{
+
+ public String getIdentityStoreId();
+
+ public Set<GroupType> getSupportedGroupTypes();
+
+ public boolean isUserStore();
+
+
+ // TODO: Set of needed methods
+
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/Relation.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/Relation.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/Relation.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,39 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity2.spi;
+
+import org.jboss.portal.identity2.api.RelationType;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Relation
+{
+ public GroupEntity getFrom();
+
+ public GroupEntity getTo();
+
+ public RelationType getType();
+
+}
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/UserEntity.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/UserEntity.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity2/spi/UserEntity.java 2008-06-04
18:41:14 UTC (rev 10922)
@@ -0,0 +1,43 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.identity2.spi;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface UserEntity
+{
+
+ public Object getId();
+
+ public String getUserName();
+
+ public Map<String, String[]> getAttributes();
+
+ public List<GroupEntity> getGroupEntities();
+
+}