Author: bdaw
Date: 2009-03-19 15:34:38 -0400 (Thu, 19 Mar 2009)
New Revision: 384
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
Removed:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/GroupType.java
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
idm/trunk/example/maven2/src/test/resources/example-db-config.xml
idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml
idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- Some cleanups
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -90,9 +90,9 @@
// Use username nad group ids instead of objects
- String johnDoeUser =
identitySession.getPersistenceManager().createUser("John Doe").getName();
- String aliceUser =
identitySession.getPersistenceManager().createUser("Alice").getName();
- String evaUser =
identitySession.getPersistenceManager().createUser("Eva").getName();
+ String johnDoeUser =
identitySession.getPersistenceManager().createUser("John Doe").getId();
+ String aliceUser =
identitySession.getPersistenceManager().createUser("Alice").getId();
+ String evaUser =
identitySession.getPersistenceManager().createUser("Eva").getId();
String acmeOrgId =
identitySession.getPersistenceManager().createGroup("ACME",
ORGANIZATION).getId();
@@ -141,7 +141,7 @@
assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(),
picture));
- String xUser =
identitySession.getPersistenceManager().createUser("x").getName();
+ String xUser =
identitySession.getPersistenceManager().createUser("x").getId();
String someGroupId =
identitySession.getPersistenceManager().createGroup("someGroup",
GROUP).getId();
identitySession.getRoleManager().createRole("manager", xUser,
someGroupId);
Modified: idm/trunk/example/maven2/src/test/resources/example-db-config.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/example-db-config.xml 2009-03-19 13:23:38
UTC (rev 383)
+++ idm/trunk/example/maven2/src/test/resources/example-db-config.xml 2009-03-19 19:34:38
UTC (rev 384)
@@ -37,10 +37,6 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
<identity-object-type-ref>GROUP</identity-object-type-ref>
</relationship>
</relationships>
@@ -63,6 +59,10 @@
<name>ORGANIZATION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -79,6 +79,10 @@
<name>GROUP</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
Modified: idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml 2009-03-19
13:23:38 UTC (rev 383)
+++ idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml 2009-03-19
19:34:38 UTC (rev 384)
@@ -35,14 +35,6 @@
<identity-object-type>
<name>USER</name>
<relationships>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
</relationships>
<credentials>
<credential-type>PASSWORD</credential-type>
@@ -63,6 +55,10 @@
<name>ORGANIZATION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -79,6 +75,10 @@
<name>GROUP</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
Modified: idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml 2009-03-19
13:23:38 UTC (rev 383)
+++ idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml 2009-03-19
19:34:38 UTC (rev 384)
@@ -58,14 +58,6 @@
<identity-object-type>
<name>USER</name>
<relationships>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>ORGANIZATION</identity-object-type-ref>
- </relationship>
- <relationship>
-
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
-
<identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
</relationships>
<credentials>
<credential-type>PASSWORD</credential-type>
@@ -86,6 +78,10 @@
<name>ORGANIZATION</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
@@ -102,6 +98,10 @@
<name>GROUP</name>
<relationships>
<relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
+ </relationship>
+ <relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
Modified:
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
===================================================================
---
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-03-19
19:34:38 UTC (rev 384)
@@ -44,7 +44,8 @@
<property name="hibernate.connection.password"></property>
<!-- Mapping classes -->
- <!-- all nessesary mappings are added programatically to the configuration
-->
+ <!-- all nessesary mappings are added programatically to the configuration in
the store-->
+ <!-- this is for manual SF creation-->
<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateRealm"/>
<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObject"/>
<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredential"/>
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -32,6 +32,7 @@
import org.jboss.identity.idm.spi.store.AttributeStore;
import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentitySessionConfigurationContext;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import
org.jboss.identity.idm.impl.api.session.mapper.DirectIdentityObjectTypeMapperImpl;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
@@ -51,18 +52,21 @@
public class IdentitySessionFactoryImpl implements IdentitySessionFactory
{
- private final Map<String, IdentitySession> realmMap;
+ private final Map<String, IdentitySession> realmMap = new HashMap<String,
IdentitySession>();
- public IdentitySessionFactoryImpl(Map<String, IdentitySession> realmMap)
+ private final Map<String, IdentitySessionConfigurationContext>
sessionContextMap;
+
+ public IdentitySessionFactoryImpl(Map<String,
IdentitySessionConfigurationContext> sessionContextMap)
{
- this.realmMap = realmMap;
+ this.sessionContextMap = sessionContextMap;
}
public void close()
{
-
+ //TODO: close all sessions and put closed state?
+ //TODO: should keep map of all bootstrapped stores/repos and cleanup
}
public boolean isClosed()
@@ -70,13 +74,35 @@
return false;
}
- public IdentitySession createIdentitySession(String realmName)
+ public IdentitySession createIdentitySession(String realmName) throws
IdentityException
{
- return realmMap.get(realmName);
+
+ if (!sessionContextMap.containsKey(realmName))
+ {
+ throw new IdentityException("Cannot find configured realm with a given
name: " + realmName);
+ }
+
+ //IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
+ IdentitySessionConfigurationContext sessionConfigCtx =
sessionContextMap.get(realmName);
+
+ IdentitySession newSession =
+ new IdentitySessionImpl(sessionConfigCtx.getRealmName(),
+ sessionConfigCtx.getRepository(), sessionConfigCtx.getTypeMapper());
+
+ realmMap.put(realmName, newSession);
+
+ return newSession;
}
- public IdentitySession getCurrentIdentitySession(String realmName)
+ public IdentitySession getCurrentIdentitySession(String realmName) throws
IdentityException
{
- return realmMap.get(realmName);
+ if (realmMap.containsKey(realmName))
+ {
+ return realmMap.get(realmName);
+ }
+ else
+ {
+ return createIdentitySession(realmName);
+ }
}
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -37,6 +37,7 @@
import org.jboss.identity.idm.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
+import org.jboss.identity.idm.impl.api.model.GroupId;
import java.util.Collection;
import java.util.Iterator;
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -24,14 +24,12 @@
import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.identity.idm.api.cfg.IdentityConfigurationRegistry;
-import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.impl.helper.CopyOnWriteRegistry;
import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
import
org.jboss.identity.idm.impl.api.session.mapper.DirectIdentityObjectTypeMapperImpl;
import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapperImpl;
-import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.exception.IdentityConfigurationException;
@@ -135,7 +133,7 @@
public IdentitySessionFactory buildIdentitySessionFactory() throws
IdentityConfigurationException
{
- Map<String, IdentitySession> realmMap = null;
+ Map<String, IdentitySessionConfigurationContext> realmMap = null;
if (configMD == null)
{
@@ -144,7 +142,7 @@
try
{
- realmMap = createSessionMap(configMD);
+ realmMap = createRealmMap(configMD);
}
catch (Exception e)
{
@@ -154,7 +152,7 @@
return new IdentitySessionFactoryImpl(realmMap);
}
- private Map<String, IdentitySession>
createSessionMap(IdentityConfigurationMetaData configMD) throws Exception
+ private Map<String, IdentitySessionConfigurationContext>
createRealmMap(IdentityConfigurationMetaData configMD) throws Exception
{
//TODO: some validation, sanity checks and error reporting
@@ -229,7 +227,7 @@
// Realms
- Map<String, IdentitySession> sessionMap = new HashMap<String,
IdentitySession>();
+ Map<String, IdentitySessionConfigurationContext> sessionCtxMap = new
HashMap<String, IdentitySessionConfigurationContext>();
for (RealmConfigurationMetaData metaData : configMD.getRealms())
{
@@ -249,12 +247,14 @@
mapper = new IdentityObjectTypeMapperImpl(metaData.getGroupTypeMappings(),
metaData.getIdentityMapping());
}
- IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
+ //IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
+ IdentitySessionConfigurationContext sessionConfigCtx =
+ new IdentitySessionConfigurationContext(realmName, configMD, repo, mapper);
- sessionMap.put(realmName, session);
+ sessionCtxMap.put(realmName, sessionConfigCtx);
}
- return sessionMap;
+ return sessionCtxMap;
}
}
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentitySessionConfigurationContext.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -0,0 +1,70 @@
+/*
+* 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.idm.impl.configuration;
+
+import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.impl.api.session.mapper.IdentityObjectTypeMapper;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentitySessionConfigurationContext
+{
+ private final String realmName;
+ private final IdentityConfigurationMetaData identityConfigurationMetaData;
+ private final IdentityStoreRepository repository;
+ private final IdentityObjectTypeMapper typeMapper;
+
+ public IdentitySessionConfigurationContext(String realmName,
+ IdentityConfigurationMetaData
identityConfigurationMetaData,
+ IdentityStoreRepository repository,
+ IdentityObjectTypeMapper typeMapper)
+ {
+ this.realmName = realmName;
+ this.identityConfigurationMetaData = identityConfigurationMetaData;
+ this.repository = repository;
+ this.typeMapper = typeMapper;
+ }
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
+
+ public IdentityConfigurationMetaData getIdentityConfigurationMetaData()
+ {
+ return identityConfigurationMetaData;
+ }
+
+ public IdentityStoreRepository getRepository()
+ {
+ return repository;
+ }
+
+ public IdentityObjectTypeMapper getTypeMapper()
+ {
+ return typeMapper;
+ }
+}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -406,7 +406,7 @@
}
catch (Exception e)
{
- throw new IdentityException("Failed to obtain
HibernateEntityManager",e);
+ throw new IdentityException("Failed to obtain Hibernate
SessionFactory",e);
}
}
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -51,7 +51,7 @@
AttributeDescription getAttributeDescription(IdentityType identityType, String name);
/**
- * Get AttributeDesciption object for single attribute supported with a given group id
or userName
+ * Get AttributeDesciption object for single attribute supported with a given
IdentityType id
*
* @param id
* @return
@@ -67,8 +67,7 @@
Map<String, AttributeDescription>
getSupportedAttributesDescriptions(IdentityType identityType);
/**
- * Get AttributeDesciption objects for all attributes supported with an IdentityType
object with a given id (for a Group)
- * or username (for User)
+ * Get AttributeDesciption objects for all attributes supported with an IdentityType
object with a given IdentityType id
*
* @param id
* @return
@@ -84,7 +83,7 @@
throws IdentityException;
/**
- * @param id - name of User object or id of a Group
+ * @param id - IdentityType id
* @return names of supported attributes
* @throws org.jboss.identity.idm.exception.IdentityException
*/
@@ -101,7 +100,7 @@
Map<String, Attribute> getAttributes(IdentityType identity) throws
IdentityException;
/**
- * Get attributes for the given IdentityType
+ * Get attributes for the given IdentityType id
*
* @param id
* @return
@@ -120,7 +119,7 @@
Attribute getAttribute(IdentityType identity, String attributeName) throws
IdentityException;
/**
- * Get attribute values for the given IdentityType
+ * Get attribute values for the given IdentityType id
*
* @param id
* @param attributeName
@@ -142,7 +141,7 @@
/**
* Update attributes with new values - previous values will be overwritten. All the
other attributes are not changed -
- * method doesn't overwrite whole attribute set connected with a given
IdentityType object.
+ * method doesn't overwrite whole attribute set connected with a given
IdentityType id.
*
* @param id
* @param attributes
Deleted: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/GroupType.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/GroupType.java 2009-03-19
13:23:38 UTC (rev 383)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/GroupType.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -1,39 +0,0 @@
-///*
-// * 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.idm.api;
-//
-///**
-// * Type of Group
-// *
-// * @author Anil.Saldhana(a)redhat.com
-// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
-// * @since Jul 11, 2008
-// */
-//public interface GroupType
-//{
-//
-// /**
-// * @return group type name
-// */
-// String getName();
-//
-//}
\ No newline at end of file
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySessionFactory.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -22,6 +22,8 @@
package org.jboss.identity.idm.api;
+import org.jboss.identity.idm.exception.IdentityException;
+
/**
* Creates IdentitySession objects for a given Realm.
*
@@ -44,13 +46,13 @@
* Create IdentitySession
* @return
*/
- IdentitySession createIdentitySession(String realmName);
+ IdentitySession createIdentitySession(String realmName) throws IdentityException;
/**
- * Get current open session associated with a realm
+ * Get current open session associated with a realm. If not present, creates one
* @return
*/
- IdentitySession getCurrentIdentitySession(String realmName);
+ IdentitySession getCurrentIdentitySession(String realmName) throws IdentityException;
}
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -51,11 +51,11 @@
/**
* <p>Create User object</p>
- * @param userName
+ * @param id
* @throws IdentityException
* @return
*/
- User createUser(String userName) throws IdentityException;
+ User createUser(String id) throws IdentityException;
/**
* <p>Create a group of a particular type</p>
@@ -67,7 +67,10 @@
throws IdentityException;
/**
- * <p>Create a group Id. Result string can be used in other methods</p>
+ * <p>Create a group Id. Result string can be used in other methods. Group Id
contains encoded group type and
+ * name imformation.
+ * In default implementation it can look as follows:
"group://GROUP_TYPE/GROUP_NAME".
+ * Still prefix and format of Id can change in the future so this method should be
used to create it.</p>
* @param groupName
* @param groupType
* @return
@@ -89,12 +92,12 @@
/**
* Remove given identity
*
- * @param userName
+ * @param id
* @param force - if true all present relationships will be removed, if false any
present relationship will cause
* removal to fail
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- void removeUser(String userName, boolean force) throws IdentityException;
+ void removeUser(String id, boolean force) throws IdentityException;
/**
* Remove given group
@@ -190,6 +193,7 @@
Collection<Group> findGroup(String groupType) throws IdentityException;
+ //TODO: commented out for now as it is not implemented
/**
* Whether Identity is a virtual
* (such as a pseudonym)
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-19
13:23:38 UTC (rev 383)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -149,10 +149,10 @@
/**
* <p>Associate identities to groups</p>
* @param parentGroupId
- * @param memberUserName
+ * @param memberid
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- void associateUsersByIds(String parentGroupId, String memberUserName)
+ void associateUsersByIds(String parentGroupId, String memberid)
throws IdentityException;
/**
@@ -271,9 +271,7 @@
/**
* Find groups that are associated with given group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect. If 'parent' parameter is set to false, all parent group
will be returned. If parent parameter is
+ * If 'parent' parameter is set to false, all parent group will be returned.
If parent parameter is
* set to true and 'inherited' is set to true all nested subgroubs will be
returned.
*
* @param group parent group
@@ -292,9 +290,7 @@
/**
* Find groups that are associated with given group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect. If 'parent' parameter is set to false, all parent group
will be returned. If parent parameter is
+ * If 'parent' parameter is set to false, all parent group will be returned.
If parent parameter is
* set to true and 'inherited' is set to true all nested subgroubs will be
returned.
*
* @param group parent group
@@ -314,9 +310,7 @@
/**
* Find groups that are associated with given group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect. If 'parent' parameter is set to false, all parent group
will be returned. If parent parameter is
+ * If 'parent' parameter is set to false, all parent group will be returned.
If parent parameter is
* set to true and 'inherited' is set to true all nested subgroubs will be
returned.
*
* @param groupId Id of parent group
@@ -346,9 +340,6 @@
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
* @param user child identity
* @param groupType can be null
@@ -361,24 +352,18 @@
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
- * @param userName child identity name
+ * @param userId - id of associated user
* @param groupType can be null
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<Group> findAssociatedGroups(String userName,
+ Collection<Group> findAssociatedGroups(String userId,
String groupType,
IdentitySearchControl[] controls) throws
IdentityException;
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
* @param user child identity
* @return
@@ -389,15 +374,12 @@
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
- * @param userName child identity name
+ * @param userId
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<Group> findAssociatedGroups(String userName,
+ Collection<Group> findAssociatedGroups(String userId,
IdentitySearchControl[] controls) throws
IdentityException;
/**
@@ -411,9 +393,6 @@
/**
* Find identities that have relationship with given parent group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param group parent group
* @param inherited if true also identities from subgroubs will be retrieved. Default
is false
@@ -425,9 +404,6 @@
/**
* Find identities that have relationship with given parent group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param group parent group
* @param inherited if true also identities from subgroubs will be retrieved. Default
is false
@@ -440,9 +416,6 @@
/**
* Find identities that have relationship with given parent group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param groupId parent group id
* @param inherited if true also identities from subgroubs will be retrieved. Default
is false
@@ -456,9 +429,6 @@
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
* @param user child identity
* @param groupType can be null
@@ -471,24 +441,18 @@
/**
* Find all groups that given identity is associated with.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated parameters will
- * take no effect
*
- * @param userName child identity name
+ * @param userId
* @param groupType can be null
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- Collection<Group> findRelatedGroups(String userName,
+ Collection<Group> findRelatedGroups(String userId,
String groupType,
IdentitySearchControl[] controls) throws
IdentityException;
/**
* Find identities that have relationship with given parent group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param group parent group
* @return
@@ -498,10 +462,7 @@
/**
* Find identities that have relationship with given parent group.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
- *
+ *
* @param groupId parent group id
* @return
* @throws org.jboss.identity.idm.exception.IdentityException
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-03-19
13:23:38 UTC (rev 383)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -100,12 +100,12 @@
/**
* Create role
* @param roleTypeName
- * @param userName
+ * @param userId
* @param groupId
* @return
* @throws IdentityException
*/
- Role createRole(String roleTypeName, String userName, String groupId) throws
IdentityException;
+ Role createRole(String roleTypeName, String userId, String groupId) throws
IdentityException;
/**
* Remove Role
@@ -119,11 +119,11 @@
/**
* Remove Role
* @param roleTypeName
- * @param userName
+ * @param userId
* @param groupId
* @throws IdentityException
*/
- void removeRole(String roleTypeName, String userName, String groupId) throws
IdentityException;
+ void removeRole(String roleTypeName, String userId, String groupId) throws
IdentityException;
/**
* Remove Role
@@ -144,16 +144,16 @@
/**
* Check if Role is present
- * @param userName
+ * @param userId
* @param groupId
* @param roleTypeName
* @return
* @throws IdentityException
*/
- boolean hasRole(String userName, String groupId, String roleTypeName) throws
IdentityException;
+ boolean hasRole(String userId, String groupId, String roleTypeName) throws
IdentityException;
/**
- * Find RoleType objects for roles associated with a given Identity and Group
+ * Find RoleType objects for roles associated with a given User and Group
* @param user
* @param group
* @return
@@ -163,17 +163,17 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find RoleType objects for roles associated with a given Identity and Group
- * @param userName
+ * Find RoleType objects for roles associated with a given User and Group
+ * @param userId
* @param groupId
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(String userName, String groupId,
+ Collection<RoleType> findRoleTypes(String userId, String groupId,
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find RoleType objects for roles associated with a given Identity and Group
+ * Find RoleType objects for roles associated with a given User and Group
* @param user
* @param group
* @return
@@ -199,11 +199,11 @@
/**
* Find RoleType objects for roles associated with a given Identity
- * @param userName
+ * @param userId
* @return
* @throws IdentityException
*/
- Collection<RoleType> findUserRoleTypes(String userName, IdentitySearchControl[]
controls) throws IdentityException;
+ Collection<RoleType> findUserRoleTypes(String userId, IdentitySearchControl[]
controls) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given Group
@@ -232,7 +232,7 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find all Groups with which Identity has a Role association
+ * Find all Groups with which User has a Role association
*
* @param user
* @param controls
@@ -243,19 +243,19 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find all Groups with which Identity has a Role association
+ * Find all Groups with which User has a Role association
*
- * @param userName
+ * @param userId
* @param controls
* @return
* @throws IdentityException
*/
- Collection<Group> findGroupsWithRelatedRole(String userName,
+ Collection<Group> findGroupsWithRelatedRole(String userId,
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find all Groups with which Identity has a Role association
+ * Find all Groups with which User has a Role association
*
* @param user
* @param controls
@@ -267,14 +267,14 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find all Groups with which Identity has a Role association
+ * Find all Groups with which User has a Role association
*
- * @param userName
+ * @param userId
* @param controls
* @return
* @throws IdentityException
*/
- Collection<Group> findGroupsWithRelatedRole(String userName,
+ Collection<Group> findGroupsWithRelatedRole(String userId,
String groupType,
IdentitySearchControl[] controls) throws
IdentityException;
@@ -289,7 +289,7 @@
RoleType roleType) throws
IdentityException;
/**
- * Find Role objects with a given RoleType name associated with IdentityType for a
given id (Group) or name (User)
+ * Find Role objects with a given RoleType name associated with IdentityType for a
given id
* @param id
* @param roleTypeName
* @return
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java 2009-03-19
13:23:38 UTC (rev 383)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java 2009-03-19
19:34:38 UTC (rev 384)
@@ -29,7 +29,6 @@
* @since Jun 30, 2008
*/
public interface User extends IdentityType
-{
-
+{
}
\ No newline at end of file