Author: bdaw
Date: 2009-03-17 17:38:45 -0400 (Tue, 17 Mar 2009)
New Revision: 377
Added:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity.cfg.xml
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityConfigurationException.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContext.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityRepositoryConfigurationContext.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityStoreConfigurationContext.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/RealmConfigurationContext.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationContextImpl.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/configuration/IdentityRepositoryConfigurationContextImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityStoreConfigurationContextImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/RealmConfigurationContextImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/helper/CopyOnWriteRegistry.java
Removed:
idm/trunk/example/maven2/src/test/resources/META-INF/
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityConfigurationException.java
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/LDAPTestCase.java
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/MixedTestCase.java
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/TestBase.java
idm/trunk/example/maven2/src/test/resources/example-db-config.xml
idm/trunk/example/maven2/src/test/resources/example-ldap-config.xml
idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml
idm/trunk/example/maven2/src/test/resources/identity-config.xsd
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/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-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.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/model/GroupId.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.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/api/session/managers/RoleManagerImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
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/ldap/LDAPIdentityStoreImpl.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
idm/trunk/idm/src/test/resources/hibernate-jboss-identity.cfg.xml
idm/trunk/idm/src/test/resources/organization-test-config.xml
idm/trunk/idm/src/test/resources/store-test-config.xml
Log:
- A way to inject object instances referenced from xml config. Main use case is to provide
SessionFactory manually
- Additional API changes
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -31,17 +31,15 @@
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Identity;
-import org.jboss.identity.idm.api.GroupType;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.RoleType;
import org.jboss.identity.idm.api.AttributeDescription;
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.IdentitySearchControl;
+import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
-import org.jboss.identity.idm.impl.api.model.SimpleGroupType;
-import org.jboss.identity.idm.p3p.P3PConstants;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
/**
@@ -72,21 +70,22 @@
public void testJBossIdentity() throws Exception
{
- IdentitySessionFactory identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/example-db-config.xml"));
+ IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/example-db-config.xml")).buildIdentitySessionFactory();
IdentitySession identitySession =
identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
identitySession.beginTransaction();
- Collection<Identity> identities = identitySession
+ Collection<User> users = identitySession
.getPersistenceManager()
- .findIdentity((IdentitySearchControl[])null);
+ .findUser((IdentitySearchControl[])null);
- GroupType ORGANIZATION = new SimpleGroupType("ORGANIZATION");
- GroupType GROUP = new SimpleGroupType("GROUP");
+ String ORGANIZATION = "ORGANIZATION";
+ String GROUP = "GROUP";
- Identity johnDoe =
identitySession.getPersistenceManager().createIdentity("John Doe");
- Identity alice =
identitySession.getPersistenceManager().createIdentity("Alice");
- Identity eva =
identitySession.getPersistenceManager().createIdentity("Eva");
+ User johnDoe = identitySession.getPersistenceManager().createUser("John
Doe");
+ User alice =
identitySession.getPersistenceManager().createUser("Alice");
+ User eva = identitySession.getPersistenceManager().createUser("Eva");
Group acmeOrg =
identitySession.getPersistenceManager().createGroup("ACME", ORGANIZATION);
@@ -96,10 +95,10 @@
identitySession.getRelationshipManager().associateGroups(acmeOrg, itGroup);
identitySession.getRelationshipManager().associateGroups(acmeOrg, hrGroup);
- identitySession.getRelationshipManager().associateIdentities(itGroup, johnDoe);
- identitySession.getRelationshipManager().associateIdentities(itGroup, alice);
+ identitySession.getRelationshipManager().associateUsers(itGroup, johnDoe);
+ identitySession.getRelationshipManager().associateUsers(itGroup, alice);
- identitySession.getRelationshipManager().associateIdentities(hrGroup, eva);
+ identitySession.getRelationshipManager().associateUsers(hrGroup, eva);
RoleType managerRT =
identitySession.getRoleManager().createRoleType("manager");
@@ -135,7 +134,7 @@
assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(),
picture));
- Identity xUser =
identitySession.getPersistenceManager().createIdentity("x");
+ User xUser = identitySession.getPersistenceManager().createUser("x");
Group someGroup =
identitySession.getPersistenceManager().createGroup("someGroup", GROUP);
identitySession.getRoleManager().createRole(managerRT, xUser, someGroup);
@@ -146,7 +145,7 @@
Group otherGroup =
identitySession.getPersistenceManager().createGroup("otherGroup", GROUP);
- identitySession.getRelationshipManager().associateIdentities(otherGroup, xUser);
+ identitySession.getRelationshipManager().associateUsers(otherGroup, xUser);
assertEquals(1,
identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP).size());
assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole(xUser,
GROUP, null).size());
Added:
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
(rev 0)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,168 @@
+/*
+* 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.example;
+
+import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.IdentitySession;
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySearchControl;
+import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.AttributeDescription;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.impl.api.SimpleAttribute;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+
+import java.util.logging.Logger;
+import java.util.Collection;
+import java.util.Random;
+import java.util.Map;
+import java.util.Arrays;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class InjectSFTestCase extends TestBase
+{
+ private static Logger logger = Logger.getLogger(InjectSFTestCase.class.getName());
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ startDatabase();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ stopDatabase();
+ }
+
+
+ public void testInjectSessionFactory() throws Exception
+ {
+ IdentityConfiguration identityConfiguration = new IdentityConfigurationImpl().
+ configure(new File("src/test/resources/example-db-config.xml"));
+
+ SessionFactory hibernateSessionFactory = new
AnnotationConfiguration().configure("hibernate-jboss-identity-classes.cfg.xml")
+ .buildSessionFactory();
+
+
identityConfiguration.getIdentityConfigurationRegistry().register(hibernateSessionFactory,
"registeredSessionFactory1");
+
+ IdentitySessionFactory identitySessionFactory =
identityConfiguration.buildIdentitySessionFactory();
+
+ IdentitySession identitySession =
identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
+ identitySession.beginTransaction();
+
+ Collection<User> users = identitySession
+ .getPersistenceManager()
+ .findUser((IdentitySearchControl[])null);
+
+ String ORGANIZATION = "ORGANIZATION";
+ String GROUP = "GROUP";
+
+ // 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 acmeOrgId =
identitySession.getPersistenceManager().createGroup("ACME",
ORGANIZATION).getId();
+
+ String itGroupId =
identitySession.getPersistenceManager().createGroup("IT", GROUP).getId();
+ String hrGroupId =
identitySession.getPersistenceManager().createGroup("HR", GROUP).getId();
+
+ identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId,
itGroupId);
+ identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId,
hrGroupId);
+
+ identitySession.getRelationshipManager().associateUsersByIds(itGroupId,
johnDoeUser);
+ identitySession.getRelationshipManager().associateUsersByIds(itGroupId,
aliceUser);
+
+ identitySession.getRelationshipManager().associateUsersByIds(hrGroupId,
evaUser);
+
+ identitySession.getRoleManager().createRoleType("manager");
+
+ identitySession.getRoleManager().createRole("manager", johnDoeUser,
itGroupId);
+
+ // John belongs to IT and not HR
+ assertTrue(identitySession.getRelationshipManager().isAssociatedByIds(itGroupId,
johnDoeUser));
+
assertFalse(identitySession.getRelationshipManager().isAssociatedByIds(hrGroupId,
johnDoeUser));
+
+ // John is manager of IT and not HR
+ assertTrue(identitySession.getRoleManager().hasRole(johnDoeUser, itGroupId,
"manager"));
+ assertFalse(identitySession.getRoleManager().hasRole(johnDoeUser, hrGroupId,
"manager"));
+
+// Check that binary attribute picture is mapped
+//
+ AttributeDescription attributeDescription =
identitySession.getAttributesManager().getAttributeDescription(johnDoeUser,
"picture");
+ assertNotNull(attributeDescription);
+ assertEquals("binary", attributeDescription.getType());
+
+
+ // Generate random binary data for binary attribute
+ Random random = new Random();
+
+ byte[] picture = new byte[5120];
+ random.nextBytes(picture);
+
+ identitySession.getAttributesManager().addAttributes(johnDoeUser, new
Attribute[] {new SimpleAttribute("picture", new byte[][]{picture})});
+
+ // Assert picture
+
+ Map<String, Attribute> attributes =
identitySession.getAttributesManager().getAttributes(johnDoeUser);
+ assertEquals(1, attributes.keySet().size());
+ assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(),
picture));
+
+
+ String xUser =
identitySession.getPersistenceManager().createUser("x").getName();
+ String someGroupId =
identitySession.getPersistenceManager().createGroup("someGroup",
GROUP).getId();
+
+ identitySession.getRoleManager().createRole("manager", xUser,
someGroupId);
+
+ assertEquals(0,
identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP,
null).size());
+ assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, GROUP, null).size());
+ assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, null).size());
+
+ String otherGroupId =
identitySession.getPersistenceManager().createGroup("otherGroup",
GROUP).getId();
+
+ identitySession.getRelationshipManager().associateUsersByIds(otherGroupId,
xUser);
+
+ assertEquals(1,
identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP,
null).size());
+ assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, GROUP, null).size());
+ assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, null).size());
+
+
+ identitySession.getTransaction().commit();
+ identitySession.close();
+
+
+ }
+
+}
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/LDAPTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/LDAPTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/LDAPTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -30,10 +30,11 @@
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Identity;
import org.jboss.identity.idm.api.Attribute;
+import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
/**
@@ -67,12 +68,13 @@
public void testJBossIdentity() throws Exception
{
- IdentitySessionFactory identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/example-ldap-config.xml"));
+ IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/example-ldap-config.xml")).buildIdentitySessionFactory();
IdentitySession identitySession =
identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
identitySession.beginTransaction();
- Identity johnDoe =
identitySession.getPersistenceManager().createIdentity("John Doe");
+ User johnDoe = identitySession.getPersistenceManager().createUser("John
Doe");
Attribute[] userInfo = new Attribute[] {
new SimpleAttribute("phone", "777 77 77"),
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/MixedTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/MixedTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/MixedTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -24,8 +24,9 @@
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Identity;
+import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.impl.api.IdentitySessionFactoryImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
import java.io.File;
@@ -63,12 +64,13 @@
public void testJBossIdentity() throws Exception
{
- IdentitySessionFactory identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/example-mixed-config.xml"));
+ IdentitySessionFactory identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/example-mixed-config.xml")).buildIdentitySessionFactory();
IdentitySession identitySession =
identitySessionFactory.createIdentitySession("realm://JBossIdentityExample/SampleRealm");
identitySession.getTransaction().start();
- Identity johnDoe =
identitySession.getPersistenceManager().createIdentity("John Doe");
+ User johnDoe = identitySession.getPersistenceManager().createUser("John
Doe");
// Play with the API...
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/TestBase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/TestBase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/TestBase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -70,7 +70,7 @@
connection =
DriverManager.getConnection("jdbc:hsqldb:mem:sample-test-db", "sa",
"");
}
catch (Exception ex)
- {
+ {
ex.printStackTrace();
logger.fine("Exception during HSQL database startup.");
throw ex;
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-17 15:45:09
UTC (rev 376)
+++ idm/trunk/example/maven2/src/test/resources/example-db-config.xml 2009-03-17 21:38:45
UTC (rev 377)
@@ -7,7 +7,7 @@
<id>realm://JBossIdentityExample/SampleRealm</id>
<repository-id-ref>Sample Repository</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <user-mapping>USER</user-mapping>
</identity-type-mappings>
</realm>
</realms>
@@ -33,7 +33,7 @@
</supported-relationship-types>
<supported-identity-object-types>
<identity-object-type>
- <name>IDENTITY</name>
+ <name>USER</name>
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
@@ -64,7 +64,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -80,7 +80,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -94,8 +94,8 @@
</supported-identity-object-types>
<options>
<option>
- <name>persistenceUnit</name>
- <value>sample-persistence-unit</value>
+ <name>hibernateConfiguration</name>
+ <value>hibernate-jboss-identity.cfg.xml</value>
</option>
<option>
<name>populateRelationshipTypes</name>
Copied: idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml (from
rev 367, idm/trunk/example/maven2/src/test/resources/example-db-config.xml)
===================================================================
--- idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml
(rev 0)
+++ idm/trunk/example/maven2/src/test/resources/example-db-inject-sf-config.xml 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_alpha"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_alpha
identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://JBossIdentityExample/SampleRealm</id>
+ <repository-id-ref>Sample Repository</repository-id-ref>
+ <identity-type-mappings>
+ <user-mapping>USER</user-mapping>
+ </identity-type-mappings>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>Sample Repository</id>
+
<class>org.jboss.identity.idm.impl.repository.WrapperIdentityStoreRepository</class>
+ <external-config/>
+ <default-identity-store-id>Sample DB
Store</default-identity-store-id>
+ <default-attribute-store-id>Sample DB
Store</default-attribute-store-id>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Sample DB Store</id>
+
<class>org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
+
<relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <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>
+ </credentials>
+ <attributes>
+ <attribute>
+ <name>picture</name>
+ <mapping>user.picture</mapping>
+ <type>binary</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>false</isReadOnly>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</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>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</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>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <credentials/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>hibernateSessionFactoryRegistryName</name>
+ <value>registeredSessionFactory1</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowNotDefinedAttributes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>isRealmAware</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Modified: idm/trunk/example/maven2/src/test/resources/example-ldap-config.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/example-ldap-config.xml 2009-03-17
15:45:09 UTC (rev 376)
+++ idm/trunk/example/maven2/src/test/resources/example-ldap-config.xml 2009-03-17
21:38:45 UTC (rev 377)
@@ -7,7 +7,7 @@
<id>realm://JBossIdentityExample/SampleRealm</id>
<repository-id-ref>Sample Repository</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <user-mapping>USER</user-mapping>
</identity-type-mappings>
</realm>
</realms>
@@ -32,7 +32,7 @@
</supported-relationship-types>
<supported-identity-object-types>
<identity-object-type>
- <name>IDENTITY</name>
+ <name>USER</name>
<relationships/>
<credentials>
<credential-type>PASSWORD</credential-type>
@@ -94,7 +94,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -148,7 +148,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
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-17
15:45:09 UTC (rev 376)
+++ idm/trunk/example/maven2/src/test/resources/example-mixed-config.xml 2009-03-17
21:38:45 UTC (rev 377)
@@ -7,7 +7,7 @@
<id>realm://JBossIdentityExample/SampleRealm</id>
<repository-id-ref>Sample Repository</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <user-mapping>USER</user-mapping>
</identity-type-mappings>
</realm>
</realms>
@@ -30,7 +30,7 @@
<identity-store-mapping>
<identity-store-id>Sample LDAP Store</identity-store-id>
<identity-object-types>
-
<identity-object-type>IDENTITY</identity-object-type>
+ <identity-object-type>USER</identity-object-type>
</identity-object-types>
<options/>
</identity-store-mapping>
@@ -56,7 +56,7 @@
</supported-relationship-types>
<supported-identity-object-types>
<identity-object-type>
- <name>IDENTITY</name>
+ <name>USER</name>
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_ROLE</relationship-type-ref>
@@ -87,7 +87,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -103,7 +103,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -117,8 +117,8 @@
</supported-identity-object-types>
<options>
<option>
- <name>persistenceUnit</name>
- <value>sample-persistence-unit</value>
+ <name>hibernateConfiguration</name>
+ <value>hibernate-jboss-identity.cfg.xml</value>
</option>
<option>
<name>populateRelationshipTypes</name>
@@ -151,7 +151,7 @@
</supported-relationship-types>
<supported-identity-object-types>
<identity-object-type>
- <name>IDENTITY</name>
+ <name>USER</name>
<relationships/>
<credentials>
<credential-type>PASSWORD</credential-type>
@@ -213,7 +213,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
@@ -267,7 +267,7 @@
<relationships>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
-
<identity-object-type-ref>IDENTITY</identity-object-type-ref>
+
<identity-object-type-ref>USER</identity-object-type-ref>
</relationship>
<relationship>
<relationship-type-ref>JBOSS_IDENTITY_MEMBERSHIP</relationship-type-ref>
Added:
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
(rev 0)
+++
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity-classes.cfg.xml 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,61 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property
name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">false</property>
+
+ <property
name="current_session_context_class">thread</property>
+
+ <!--<property
name="connection.datasource"></property>-->
+
+ <property
name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
+ <property
name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property
name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property
name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property
name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- Mapping classes -->
+ <!-- all nessesary mappings are added programatically to the configuration
-->
+ <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"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>
+ <mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Added: idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity.cfg.xml
===================================================================
--- idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity.cfg.xml
(rev 0)
+++
idm/trunk/example/maven2/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,61 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="show_sql">false</property>
+ <property
name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">false</property>
+
+ <property
name="current_session_context_class">thread</property>
+
+ <!--<property
name="connection.datasource"></property>-->
+
+ <property
name="hibernate.connection.url">jdbc:hsqldb:mem:unit-testing-jpa1</property>
+ <property
name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property
name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property
name="hibernate.hbm2ddl.auto">create-drop</property>
+ <property
name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+
+ <!-- Mapping classes -->
+ <!-- all nessesary mappings are added programatically to the configuration
-->
+ <!--<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"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectCredentialType"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectAttribute"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectTextAttribute"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectBinaryAttribute"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>-->
+ <!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>-->
+
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Modified: idm/trunk/example/maven2/src/test/resources/identity-config.xsd
===================================================================
--- idm/trunk/example/maven2/src/test/resources/identity-config.xsd 2009-03-17 15:45:09
UTC (rev 376)
+++ idm/trunk/example/maven2/src/test/resources/identity-config.xsd 2009-03-17 21:38:45
UTC (rev 377)
@@ -109,7 +109,7 @@
</xs:complexType>
<xs:complexType name="identity-type-mappingsType">
<xs:sequence>
- <xs:element type="xs:string" name="identity-mapping"/>
+ <xs:element type="xs:string" name="user-mapping"/>
<xs:element type="urn:group-type-mappingType"
name="group-type-mapping" maxOccurs="unbounded"
minOccurs="0"
xmlns:urn="urn:jboss:identity:idm:config:v1_0_alpha"/>
</xs:sequence>
</xs:complexType>
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/IdentitySessionFactoryImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -58,121 +58,8 @@
this.realmMap = realmMap;
}
- public IdentitySessionFactoryImpl(IdentityConfigurationMetaData configMD) throws
Exception
- {
- realmMap = createSessionMap(configMD);
- }
+
- public IdentitySessionFactoryImpl(File configFile) throws Exception
- {
- IdentityConfigurationMetaData configMD =
JAXB2IdentityConfiguration.createConfigurationMetaData(configFile);
-
- realmMap = createSessionMap(configMD);
-
- }
-
- public IdentitySessionFactoryImpl(String configResource) throws Exception
- {
- IdentityConfigurationMetaData configMD =
JAXB2IdentityConfiguration.createConfigurationMetaData(configResource);
-
- realmMap = createSessionMap(configMD);
-
- }
-
- private Map<String, IdentitySession>
createSessionMap(IdentityConfigurationMetaData configMD) throws Exception
- {
- //TODO: some validation, sanity checks and error reporting
-
- // IdentityStore
-
- Map<String, IdentityStore> bootstrappedIdentityStores = new
HashMap<String, IdentityStore>();
- Map<String, AttributeStore> bootstrappedAttributeStores = new
HashMap<String, AttributeStore>();
-
- for (IdentityStoreConfigurationMetaData metaData : configMD.getIdentityStores())
- {
- Class storeClass = null;
- try
- {
- storeClass = Class.forName(metaData.getClassName());
- }
- catch (ClassNotFoundException e)
- {
- throw new IdentityException("Cannot instantiate identity store:" +
metaData.getClassName(), e);
- }
- Class partypes[] = new Class[1];
- partypes[0] = String.class;
-
- Constructor ct = storeClass.getConstructor(partypes);
- Object argList[] = new Object[1];
- argList[0] = metaData.getId();
-
- IdentityStore store = (IdentityStore)ct.newInstance(argList);
-
- store.bootstrap(metaData);
-
- bootstrappedIdentityStores.put(store.getId(), store);
- bootstrappedAttributeStores.put(store.getId(), store);
- }
-
- // IdentityRepository
-
- Map<String, IdentityStoreRepository> bootstrappedRepositories = new
HashMap<String, IdentityStoreRepository>();
-
- for (IdentityRepositoryConfigurationMetaData metaData :
configMD.getRepositories())
- {
- Class repoClass = null;
- try
- {
- repoClass = Class.forName(metaData.getClassName());
- }
- catch (ClassNotFoundException e)
- {
- throw new IdentityException("Cannot instantiate identity store:" +
metaData.getClassName(), e);
- }
- Class partypes[] = new Class[1];
- partypes[0] = String.class;
-
- Constructor ct = repoClass.getConstructor(partypes);
- Object argList[] = new Object[1];
- argList[0] = metaData.getId();
-
- IdentityStoreRepository repo =
(IdentityStoreRepository)ct.newInstance(argList);
-
- repo.bootstrap(metaData, bootstrappedIdentityStores,
bootstrappedAttributeStores);
-
- bootstrappedRepositories.put(repo.getId(), repo);
- }
-
- // Realms
-
- Map<String, IdentitySession> sessionMap = new HashMap<String,
IdentitySession>();
-
- for (RealmConfigurationMetaData metaData : configMD.getRealms())
- {
- String realmName = metaData.getId();
-
- IdentityStoreRepository repo =
bootstrappedRepositories.get(metaData.getIdentityRepositoryIdRef());
-
- IdentityObjectTypeMapper mapper = null;
-
- if (metaData.getGroupTypeMappings() == null ||
metaData.getGroupTypeMappings().isEmpty())
- {
- // use direct type mapper
- mapper = new
DirectIdentityObjectTypeMapperImpl(metaData.getIdentityMapping());
- }
- else
- {
- mapper = new IdentityObjectTypeMapperImpl(metaData.getGroupTypeMappings(),
metaData.getIdentityMapping());
- }
-
- IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
-
- sessionMap.put(realmName, session);
- }
-
- return sessionMap;
- }
-
public void close()
{
Modified: idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -28,6 +28,7 @@
*/
public class GroupId
{
+ public static final String PREFIX = "group:/";
private String name;
@@ -57,15 +58,27 @@
String[] parts = id.split("/");
- if (parts == null || parts.length != 2)
+ if (!validateId(id))
{
- throw new IllegalArgumentException("group id not following required format:
type/name: " + id);
+ throw new IllegalArgumentException("group id not following required format:
group/type/name: " + id);
}
- name = parts[1];
- type = parts[0];
+ name = parts[2];
+ type = parts[1];
}
+ public static boolean validateId(String id)
+ {
+ String[] parts = id.split("/");
+
+ if (parts == null || parts.length != 3 || parts[0].equals(PREFIX.substring(0,
PREFIX.length())))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
public String getName()
{
return name;
@@ -78,6 +91,6 @@
public String getId()
{
- return type + "/" + name;
+ return PREFIX + type + "/" + name;
}
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -37,11 +37,12 @@
private final String groupType;
- public SimpleGroup(String name, String id, String groupType)
+ public SimpleGroup(String name, String groupType)
{
this.name = name;
- this.id = id;
this.groupType = groupType;
+ this.id = new GroupId(name, groupType).getId();
+
}
public SimpleGroup(GroupId groupId)
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -95,9 +95,23 @@
protected Group createGroup(IdentityObject identityObject)
{
String groupType =
getSessionContext().getIdentityObjectTypeMapper().getGroupType(identityObject.getIdentityType());
- return new SimpleGroup(identityObject.getName(), identityObject.getId(),
groupType);
+ return new SimpleGroup(identityObject.getName(), groupType);
}
+ protected IdentityType createIdentityTypeFromId(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ GroupId groupId = new GroupId(id);
+
+ return new SimpleGroup(groupId);
+ }
+ else
+ {
+ return new SimpleUser(id);
+ }
+ }
+
protected IdentityObject createIdentityObject(User identity)
{
IdentityObjectType iot =
getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
@@ -143,6 +157,20 @@
}
+ protected IdentityObject createIdentityObject(String id)
+ {
+ if (GroupId.validateId(id))
+ {
+ GroupId groupId = new GroupId(id);
+
+ return createIdentityObjectForGroupId(id);
+ }
+ else
+ {
+ return createIdentityObjectForUserName(id);
+ }
+ }
+
protected Group createGroupFromId(String id)
{
return new SimpleGroup(new GroupId(id));
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -79,6 +79,14 @@
}
+ public AttributeDescription getAttributeDescription(String id, String attributeName)
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ return getAttributeDescription(identityType, attributeName);
+
+ }
+
public Map<String, AttributeDescription>
getSupportedAttributesDescriptions(IdentityType identityType)
{
@@ -105,11 +113,25 @@
return descriptionMap;
}
+ public Map<String, AttributeDescription>
getSupportedAttributesDescriptions(String id)
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ return getSupportedAttributesDescriptions(identityType);
+ }
+
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws
IdentityException
{
return getRepository().getSupportedAttributeNames(getInvocationContext(),
createIdentityObject(identityType).getIdentityType());
}
+ public Set<String> getSupportedAttributeNames(String id) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ return getSupportedAttributeNames(identityType);
+ }
+
public Map<String, Attribute> getAttributes(IdentityType identity) throws
IdentityException
{
Map<String, IdentityObjectAttribute> map =
getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
@@ -123,23 +145,52 @@
return newMap;
}
+ public Map<String, Attribute> getAttributes(String id) throws IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ return getAttributes(identityType);
+ }
+
public void updateAttributes(IdentityType identity, Attribute[] attributes) throws
IdentityException
{
getRepository().updateAttributes(getInvocationContext(),
createIdentityObject(identity), convertAttributes(attributes));
}
+ public void updateAttributes(String id, Attribute[] attributes) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ updateAttributes(identityType, attributes);
+
+ }
+
public Attribute getAttribute(IdentityType identity, String attributeName) throws
IdentityException
{
return getAttributes(identity).get(attributeName);
}
+ public Attribute getAttribute(String id, String attributeName) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ return getAttribute(identityType, attributeName);
+ }
+
public void addAttribute(IdentityType identity, String attributeName, Object[] values)
throws IdentityException
{
Attribute[] attrs = new Attribute[]{new SimpleAttribute(attributeName, values)};
addAttributes(identity, attrs);
+ }
+ public void addAttributes(String id, Attribute[] attributes) throws IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ addAttributes(identityType, attributes);
+
}
public void addAttribute(IdentityType identity, String attributeName, Object value)
throws IdentityException
@@ -151,16 +202,42 @@
}
+ public void addAttribute(String id, String attributeName, Object[] values) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ addAttribute(identityType, attributeName, values);
+
+ }
+
+ public void addAttribute(String id, String attributeName, Object value) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ addAttribute(identityType, attributeName, value);
+
+ }
+
public void addAttributes(IdentityType identity, Attribute[] attributes) throws
IdentityException
{
getRepository().addAttributes(getInvocationContext(),
createIdentityObject(identity), convertAttributes(attributes));
}
+
+
public void removeAttributes(IdentityType identity, String[] attributeNames) throws
IdentityException
{
getRepository().removeAttributes(getInvocationContext(),
createIdentityObject(identity), attributeNames);
}
+ public void removeAttributes(String id, String[] attributeNames) throws
IdentityException
+ {
+ IdentityType identityType = createIdentityTypeFromId(id);
+
+ removeAttributes(identityType, attributeNames);
+
+ }
+
public boolean hasPassword(User identity) throws IdentityException
{
return
getRepository().getSupportedFeatures().isCredentialSupported(createIdentityObject(identity).getIdentityType(),
PasswordCredential.TYPE);
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -34,6 +34,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.List;
@@ -141,6 +142,11 @@
return createGroup(identityObject);
}
+ public String createGroupId(String groupName, String groupType)
+ {
+ return new GroupId(groupName, groupType).getId();
+ }
+
public void removeUser(User identity, boolean force) throws IdentityException
{
getRepository().removeIdentityObject(getInvocationContext(),
createIdentityObject(identity));
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -232,7 +232,7 @@
public void associateUsersByIds(String parentId, String memberId) throws
IdentityException
{
- getRepository().createRelationship(getInvocationContext(),
createIdentityObjectForUserName(parentId), createIdentityObjectForUserName(memberId),
MEMBER, null, true);
+ getRepository().createRelationship(getInvocationContext(),
createIdentityObjectForGroupId(parentId), createIdentityObjectForUserName(memberId),
MEMBER, null, true);
}
@@ -321,6 +321,27 @@
return true;
}
+ public boolean isAssociatedByIds(Collection<String> parents,
Collection<String> members) throws IdentityException
+ {
+ for (Iterator<String> parentsIterator = parents.iterator();
parentsIterator.hasNext();)
+ {
+ String parent = parentsIterator.next();
+
+ for (Iterator<String> membersIterator = members.iterator();
membersIterator.hasNext();)
+ {
+ String member = membersIterator.next();
+
+ Collection<IdentityObjectRelationship> relationships =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent),
createIdentityObject(member), MEMBER);
+
+ if (relationships.size() == 0)
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
public <G extends IdentityType, I extends IdentityType> boolean isAssociated(G
parent, I member) throws IdentityException
{
Set<G> parents = new HashSet<G>();
@@ -331,6 +352,18 @@
return isAssociated(parents, members);
}
+ public boolean isAssociatedByIds(String parent, String member) throws
IdentityException
+ {
+ Collection<IdentityObjectRelationship> relationships =
getRepository().resolveRelationships(getInvocationContext(), createIdentityObject(parent),
createIdentityObject(member), MEMBER);
+
+ if (relationships.size() == 0)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
public Collection<Group> findAssociatedGroups(Group group, String groupType,
boolean parent, boolean inherited, IdentitySearchControl[] controls) throws
IdentityException
{
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -184,12 +184,12 @@
}
- public Role createRole(RoleType roleType, String userName, String groupId) throws
IdentityException
+ public Role createRole(String roleTypeName, String userName, String groupId) throws
IdentityException
{
User user = createUserFromId(userName);
Group group = createGroupFromId(groupId);
- return createRole(roleType, user, group);
+ return createRole(new SimpleRoleType(roleTypeName), user, group);
}
public void removeRole(RoleType roleType, User identity, Group group) throws
IdentityException
@@ -197,12 +197,12 @@
getRepository().removeRelationship(getInvocationContext(),
createIdentityObject(identity), createIdentityObject(group), ROLE, roleType.getName());
}
- public void removeRole(RoleType roleType, String userName, String groupId) throws
IdentityException
+ public void removeRole(String roleTypeName, String userName, String groupId) throws
IdentityException
{
User user = createUserFromId(userName);
Group group = createGroupFromId(groupId);
- removeRole(roleType, user, group);
+ removeRole(new SimpleRoleType(roleTypeName), user, group);
}
public void removeRole(Role role) throws IdentityException
@@ -227,12 +227,12 @@
return false;
}
- public boolean hasRole(String userName, String groupId, RoleType roleType) throws
IdentityException
+ public boolean hasRole(String userName, String groupId, String roleTypeName) throws
IdentityException
{
User user = createUserFromId(userName);
Group group = createGroupFromId(groupId);
- return hasRole(user, group, roleType);
+ return hasRole(user, group, new SimpleRoleType(roleTypeName));
}
public Collection<RoleType> findRoleTypes(User identity, Group group) throws
IdentityException
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -36,6 +36,7 @@
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
@@ -84,9 +85,9 @@
}
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException
{
- identityStore.bootstrap(configurationMD);
+ identityStore.bootstrap(configurationContext);
}
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationContextImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationContextImpl.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationContextImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,54 @@
+/*
+* 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.configuration.IdentityConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityConfigurationContextImpl implements IdentityConfigurationContext
+{
+ private final IdentityConfigurationMetaData configurationMD;
+
+ private final IdentityConfigurationContextRegistry configurationRegistry;
+
+ public IdentityConfigurationContextImpl(IdentityConfigurationMetaData configurationMD,
IdentityConfigurationContextRegistry configurationRegistry)
+ {
+ this.configurationMD = configurationMD;
+ this.configurationRegistry = configurationRegistry;
+ }
+
+ public IdentityConfigurationMetaData getConfigurationMetaData()
+ {
+ return configurationMD;
+ }
+
+ public IdentityConfigurationContextRegistry getConfigurationRegistry()
+ {
+ return configurationRegistry;
+ }
+}
Added:
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
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityConfigurationImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,260 @@
+/*
+* 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.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;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.RealmConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.spi.store.IdentityStore;
+import org.jboss.identity.idm.spi.store.AttributeStore;
+import org.jboss.identity.idm.spi.repository.IdentityStoreRepository;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.util.Map;
+import java.util.HashMap;
+import java.io.File;
+import java.lang.reflect.Constructor;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityConfigurationImpl
+ implements IdentityConfiguration, IdentityConfigurationRegistry,
IdentityConfigurationContextRegistry
+{
+
+ private static final Logger log =
Logger.getLogger(IdentityConfigurationImpl.class.getName());
+
+ private IdentityConfigurationMetaData configMD;
+
+ private final CopyOnWriteRegistry registry;
+
+ public IdentityConfigurationImpl()
+ {
+ registry = new CopyOnWriteRegistry();
+ }
+
+ public void register(Object object, String name) throws IdentityException
+ {
+ if (!registry.register(name, object))
+ {
+ throw new IdentityException("Cannot register object in IdentityContext
with name: " + name);
+ }
+ if (log.isLoggable(Level.FINER)) log.finer("registering object: " + name
+ " ; " + object.getClass());
+ }
+
+ public void unregister(String name)
+ {
+ if (registry.unregister(name) == null)
+ {
+ log.info("Cannot unregister object from IdentityContext with name: "
+ name);
+ }
+ if (log.isLoggable(Level.FINER)) log.finer("unregistering object: " +
name);
+ }
+
+ public Object getObject(String name) throws IdentityException
+ {
+ Object o = registry.getRegistration(name);
+ if (o == null)
+ {
+ throw new IdentityException("No such mapping in IdentityContext: " +
name);
+ }
+ return o;
+ }
+
+ public IdentityConfigurationRegistry getIdentityConfigurationRegistry()
+ {
+ return this;
+ }
+
+ public IdentityConfiguration configure(IdentityConfigurationMetaData configMD)
+ {
+ this.configMD = configMD;
+
+ return this;
+ }
+
+ public IdentityConfiguration configure(File configFile) throws
IdentityConfigurationException
+ {
+ IdentityConfigurationMetaData configMD =
JAXB2IdentityConfiguration.createConfigurationMetaData(configFile);
+
+ this.configMD = configMD;
+
+ return this;
+
+ }
+
+ public IdentityConfiguration configure(String configResource) throws
IdentityConfigurationException
+ {
+ IdentityConfigurationMetaData configMD =
JAXB2IdentityConfiguration.createConfigurationMetaData(configResource);
+
+ this.configMD = configMD;
+
+ return this;
+
+ }
+
+ public IdentitySessionFactory buildIdentitySessionFactory() throws
IdentityConfigurationException
+ {
+ Map<String, IdentitySession> realmMap = null;
+
+ if (configMD == null)
+ {
+ throw new IdentityConfigurationException("Failed to build
IdentitySessionFactory. Configuration not initialized");
+ }
+
+ try
+ {
+ realmMap = createSessionMap(configMD);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityConfigurationException("Failed to build
IdentitySessionFactory", e);
+ }
+
+ return new IdentitySessionFactoryImpl(realmMap);
+ }
+
+ private Map<String, IdentitySession>
createSessionMap(IdentityConfigurationMetaData configMD) throws Exception
+ {
+ //TODO: some validation, sanity checks and error reporting
+
+
+ IdentityConfigurationContext configurationContext = new
IdentityConfigurationContextImpl(configMD, this);
+
+ // IdentityStore
+
+ Map<String, IdentityStore> bootstrappedIdentityStores = new
HashMap<String, IdentityStore>();
+ Map<String, AttributeStore> bootstrappedAttributeStores = new
HashMap<String, AttributeStore>();
+
+ for (IdentityStoreConfigurationMetaData metaData : configMD.getIdentityStores())
+ {
+ Class storeClass = null;
+ try
+ {
+ storeClass = Class.forName(metaData.getClassName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IdentityException("Cannot instantiate identity store:" +
metaData.getClassName(), e);
+ }
+ Class partypes[] = new Class[1];
+ partypes[0] = String.class;
+
+ Constructor ct = storeClass.getConstructor(partypes);
+ Object argList[] = new Object[1];
+ argList[0] = metaData.getId();
+
+ IdentityStore store = (IdentityStore)ct.newInstance(argList);
+
+ IdentityStoreConfigurationContext storeConfigurationCtx =
+ new IdentityStoreConfigurationContextImpl(configMD, this, metaData);
+
+ store.bootstrap(storeConfigurationCtx);
+
+ bootstrappedIdentityStores.put(store.getId(), store);
+ bootstrappedAttributeStores.put(store.getId(), store);
+ }
+
+ // IdentityRepository
+
+ Map<String, IdentityStoreRepository> bootstrappedRepositories = new
HashMap<String, IdentityStoreRepository>();
+
+ for (IdentityRepositoryConfigurationMetaData metaData :
configMD.getRepositories())
+ {
+ Class repoClass = null;
+ try
+ {
+ repoClass = Class.forName(metaData.getClassName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IdentityException("Cannot instantiate identity store:" +
metaData.getClassName(), e);
+ }
+ Class partypes[] = new Class[1];
+ partypes[0] = String.class;
+
+ Constructor ct = repoClass.getConstructor(partypes);
+ Object argList[] = new Object[1];
+ argList[0] = metaData.getId();
+
+ IdentityStoreRepository repo =
(IdentityStoreRepository)ct.newInstance(argList);
+
+ IdentityRepositoryConfigurationContext repoConfigurationContext =
+ new IdentityRepositoryConfigurationContextImpl(configMD, this, metaData);
+
+ repo.bootstrap(repoConfigurationContext, bootstrappedIdentityStores,
bootstrappedAttributeStores);
+
+ bootstrappedRepositories.put(repo.getId(), repo);
+ }
+
+ // Realms
+
+ Map<String, IdentitySession> sessionMap = new HashMap<String,
IdentitySession>();
+
+ for (RealmConfigurationMetaData metaData : configMD.getRealms())
+ {
+ String realmName = metaData.getId();
+
+ IdentityStoreRepository repo =
bootstrappedRepositories.get(metaData.getIdentityRepositoryIdRef());
+
+ IdentityObjectTypeMapper mapper = null;
+
+ if (metaData.getGroupTypeMappings() == null ||
metaData.getGroupTypeMappings().isEmpty())
+ {
+ // use direct type mapper
+ mapper = new
DirectIdentityObjectTypeMapperImpl(metaData.getIdentityMapping());
+ }
+ else
+ {
+ mapper = new IdentityObjectTypeMapperImpl(metaData.getGroupTypeMappings(),
metaData.getIdentityMapping());
+ }
+
+ IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
+
+ sessionMap.put(realmName, session);
+ }
+
+ return sessionMap;
+ }
+
+}
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityRepositoryConfigurationContextImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityRepositoryConfigurationContextImpl.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityRepositoryConfigurationContextImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,50 @@
+/*
+* 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.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityRepositoryConfigurationContextImpl
+ extends IdentityConfigurationContextImpl implements
IdentityRepositoryConfigurationContext
+{
+
+ public IdentityRepositoryConfigurationContextImpl(IdentityConfigurationMetaData
configurationMD, IdentityConfigurationContextRegistry configurationRegistry,
IdentityRepositoryConfigurationMetaData repoMD)
+ {
+ super(configurationMD, configurationRegistry);
+ this.repoMD = repoMD;
+ }
+
+ private final IdentityRepositoryConfigurationMetaData repoMD;
+
+ public IdentityRepositoryConfigurationMetaData getRepositoryConfigurationMetaData()
+ {
+ return repoMD;
+ }
+}
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityStoreConfigurationContextImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityStoreConfigurationContextImpl.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/IdentityStoreConfigurationContextImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,50 @@
+/*
+* 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.configuration.IdentityStoreConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityStoreConfigurationContextImpl
+ extends IdentityConfigurationContextImpl implements IdentityStoreConfigurationContext
+{
+
+ private final IdentityStoreConfigurationMetaData storeMD;
+
+ public IdentityStoreConfigurationContextImpl(IdentityConfigurationMetaData
configurationMD, IdentityConfigurationContextRegistry configurationRegistry,
IdentityStoreConfigurationMetaData storeMD)
+ {
+ super(configurationMD, configurationRegistry);
+ this.storeMD = storeMD;
+ }
+
+ public IdentityStoreConfigurationMetaData getStoreConfigurationMetaData()
+ {
+ return storeMD;
+ }
+}
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/RealmConfigurationContextImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/RealmConfigurationContextImpl.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/RealmConfigurationContextImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,50 @@
+/*
+* 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.configuration.metadata.RealmConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.spi.configuration.RealmConfigurationContext;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RealmConfigurationContextImpl
+ extends IdentityConfigurationContextImpl implements RealmConfigurationContext
+{
+
+ private final RealmConfigurationMetaData realmMD;
+
+ public RealmConfigurationContextImpl(IdentityConfigurationMetaData configurationMD,
IdentityConfigurationContextRegistry configurationRegistry, RealmConfigurationMetaData
realmMD)
+ {
+ super(configurationMD, configurationRegistry);
+ this.realmMD = realmMD;
+ }
+
+ public RealmConfigurationMetaData getRealmConfigurationMetaData()
+ {
+ return realmMD;
+ }
+}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -37,7 +37,7 @@
import org.jboss.identity.idm.spi.configuration.metadata.RelationshipMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
-import org.jboss.identity.idm.spi.exception.IdentityConfigurationException;
+import org.jboss.identity.idm.exception.IdentityConfigurationException;
import org.jboss.identity.idm.impl.api.attribute.IdentityObjectAttributeMetaDataImpl;
import org.jboss.identity.idm.impl.configuration.jaxb2.generated.JbossIdentityType;
import org.jboss.identity.idm.impl.configuration.jaxb2.generated.IdentityStoreType;
Added:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/helper/CopyOnWriteRegistry.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/helper/CopyOnWriteRegistry.java
(rev 0)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/helper/CopyOnWriteRegistry.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,135 @@
+/*
+* 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.helper;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Collections;
+import java.util.Collection;
+
+/**
+ * Implementation of a registry that implements copy on write semantics.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class CopyOnWriteRegistry
+{
+
+ /** . */
+ private volatile Map content;
+
+ public CopyOnWriteRegistry()
+ {
+ content = new HashMap();
+ }
+
+ /**
+ * Register an object.
+ *
+ * @param key the registration key
+ * @param object the registered object
+ * @return true if the registration was made
+ * @throws IllegalArgumentException if the one argument is null
+ */
+ public synchronized boolean register(Object key, Object object) throws
IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null value accepted");
+ }
+ if (content.containsKey(key))
+ {
+ return false;
+ }
+ Map tmp = new HashMap(content);
+ tmp.put(key, object);
+ content = tmp;
+ return true;
+ }
+
+ /**
+ * Unregister an object.
+ *
+ * @param key the registration key
+ * @return true if the unregistration was made
+ * @throws IllegalArgumentException if the key is null
+ */
+ public synchronized Object unregister(Object key) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ if (content.containsKey(key))
+ {
+ Map tmp = new HashMap(content);
+ Object registration = tmp.remove(key);
+ content = tmp;
+ return registration;
+ }
+ return null;
+ }
+
+ /**
+ * Return an unmodifiable set containing the keys.
+ *
+ * @return the keys
+ */
+ public Set getKeys()
+ {
+ return Collections.unmodifiableSet(content.keySet());
+ }
+
+ /**
+ * Return an unmodifable collection containing the registrations.
+ *
+ * @return the registrations
+ */
+ public Collection getRegistrations()
+ {
+ return Collections.unmodifiableCollection(content.values());
+ }
+
+ /**
+ * Return a registration or null if it does not exist.
+ *
+ * @param key the registration key
+ * @return the registeted object
+ * @throws IllegalArgumentException if the key is null
+ */
+ public Object getRegistration(Object key) throws IllegalArgumentException
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException("No null key accepted");
+ }
+ return content.get(key);
+ }
+}
+
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/AbstractIdentityStoreRepository.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -30,6 +30,7 @@
import org.jboss.identity.idm.spi.model.IdentityObject;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreMappingMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.impl.cache.JBossCacheIdentityStoreWrapper;
@@ -60,11 +61,13 @@
public static final String CACHE_CONFIG_FILE_OPTION = "cache.config-file";
- public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
Map<String, IdentityStore> bootstrappedIdentityStores,
Map<String, AttributeStore> bootstrappedAttributeStores)
throws IdentityException
{
+ IdentityRepositoryConfigurationMetaData configurationMD =
configurationContext.getRepositoryConfigurationMetaData();
+
String asId = configurationMD.getDefaultAttributeStoreId();
String isId = configurationMD.getDefaultIdentityStoreId();
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/FallbackIdentityStoreRepository.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -36,6 +36,8 @@
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.model.IdentityObjectCredentialType;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
@@ -94,11 +96,11 @@
}
@Override
- public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
Map<String, IdentityStore> bootstrappedIdentityStores,
Map<String, AttributeStore> bootstrappedAttributeStores)
throws IdentityException
{
- super.bootstrap(configurationMD, bootstrappedIdentityStores,
bootstrappedAttributeStores);
+ super.bootstrap(configurationContext, bootstrappedIdentityStores,
bootstrappedAttributeStores);
// Helper collection to keep all identity stores in use
@@ -109,7 +111,7 @@
- this.configurationMD = configurationMD;
+ this.configurationMD = configurationContext.getRepositoryConfigurationMetaData();
String isId = configurationMD.getDefaultIdentityStoreId();
@@ -261,7 +263,7 @@
}
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException
{
// Nothing
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/repository/WrapperIdentityStoreRepository.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -30,6 +30,8 @@
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
@@ -64,14 +66,14 @@
}
@Override
- public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
Map<String, IdentityStore> bootstrappedIdentityStores,
Map<String, AttributeStore> bootstrappedAttributeStores)
throws IdentityException
{
- super.bootstrap(configurationMD, bootstrappedIdentityStores,
bootstrappedAttributeStores);
+ super.bootstrap(configurationContext, bootstrappedIdentityStores,
bootstrappedAttributeStores);
}
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException
{
//Nothing
}
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -38,10 +38,8 @@
import org.hibernate.Session;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.criterion.Restrictions;
-//import org.hibernate.ejb.HibernateEntityManagerFactory;
import org.jboss.identity.idm.exception.IdentityException;
import org.jboss.identity.idm.impl.api.AttributeFilterSearchControl;
import org.jboss.identity.idm.impl.api.NameFilterSearchControl;
@@ -62,6 +60,7 @@
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
@@ -107,10 +106,12 @@
"(r.fromIdentityObject like :IO1 and r.toIdentityObject like :IO2) or
" +
"(r.fromIdentityObject like :IO2 and r.toIdentityObject like :IO1)";
- public static final String PERSISTENCE_UNIT = "persistenceUnit";
+ public static final String HIBERNATE_SESSION_FACTORY_REGISTRY_NAME =
"hibernateSessionFactoryRegistryName";
public static final String HIBERNATE_CONFIGURATION =
"hibernateConfiguration";
+ public static final String ADD_MAPPED_CLASSES = "addMappedClasses";
+
public static final String HIBERNATE_SESSION_FACTORY_JNDI_NAME =
"hibernateSessionFactoryJNDIName";
public static final String POPULATE_MEMBERSHIP_TYPES =
"populateRelationshipTypes";
@@ -172,9 +173,9 @@
this.id = id;
}
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException
{
- this.configurationMD = configurationMD;
+ this.configurationMD = configurationContext.getStoreConfigurationMetaData();
id = configurationMD.getId();
@@ -184,7 +185,7 @@
String populateMembershipTypes =
configurationMD.getOptionSingleValue(POPULATE_MEMBERSHIP_TYPES);
String populateIdentityObjectTypes =
configurationMD.getOptionSingleValue(POPULATE_IDENTITY_OBJECT_TYPES);
- sessionFactory = bootstrapHibernateSessionFactory(configurationMD);
+ sessionFactory = bootstrapHibernateSessionFactory(configurationContext);
Session hibernateSession = sessionFactory.openSession();
@@ -313,12 +314,17 @@
}
- protected SessionFactory
bootstrapHibernateSessionFactory(IdentityStoreConfigurationMetaData configurationMD)
throws IdentityException
+ protected SessionFactory
bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext)
throws IdentityException
{
- String sfJNDIName =
configurationMD.getOptionSingleValue(HIBERNATE_SESSION_FACTORY_JNDI_NAME);
- String persistenceUnit = configurationMD.getOptionSingleValue(PERSISTENCE_UNIT);
- String hibernateConfiguration =
configurationMD.getOptionSingleValue(HIBERNATE_CONFIGURATION);
+ String sfJNDIName = configurationContext.getStoreConfigurationMetaData().
+ getOptionSingleValue(HIBERNATE_SESSION_FACTORY_JNDI_NAME);
+ String sfRegistryName = configurationContext.getStoreConfigurationMetaData().
+ getOptionSingleValue(HIBERNATE_SESSION_FACTORY_REGISTRY_NAME);
+ String addMappedClasses = configurationContext.getStoreConfigurationMetaData().
+ getOptionSingleValue(ADD_MAPPED_CLASSES);
+ String hibernateConfiguration =
configurationContext.getStoreConfigurationMetaData().
+ getOptionSingleValue(HIBERNATE_CONFIGURATION);
if (sfJNDIName != null)
{
@@ -331,6 +337,25 @@
throw new IdentityException("Cannot obtain hibernate SessionFactory from
provided JNDI name: " + sfJNDIName, e);
}
}
+ else if (sfRegistryName != null)
+ {
+ Object registryObject =
configurationContext.getConfigurationRegistry().getObject(sfRegistryName);
+
+ if (registryObject == null)
+ {
+ throw new IdentityException("Cannot obtain hibernate SessionFactory from
provided registry name: " + sfRegistryName);
+ }
+
+ if (!(registryObject instanceof SessionFactory))
+ {
+ throw new IdentityException("Cannot obtain hibernate SessionFactory from
provided registry name: " + sfRegistryName
+ + "; Registered object is not an instance of SessionFactory: " +
registryObject.getClass().getName());
+ }
+
+ return (SessionFactory)registryObject;
+
+
+ }
else if (hibernateConfiguration != null)
{
@@ -338,19 +363,27 @@
{
AnnotationConfiguration config = new
AnnotationConfiguration().configure(hibernateConfiguration);
- return config.addAnnotatedClass(HibernateIdentityObject.class)
- .addAnnotatedClass(HibernateIdentityObjectAttribute.class)
- .addAnnotatedClass(HibernateIdentityObjectBinaryAttribute.class)
- .addAnnotatedClass(HibernateIdentityObjectTextAttribute.class)
- .addAnnotatedClass(HibernateIdentityObjectCredential.class)
- .addAnnotatedClass(HibernateIdentityObjectCredentialType.class)
- .addAnnotatedClass(HibernateIdentityObjectRelationship.class)
- .addAnnotatedClass(HibernateIdentityObjectRelationshipName.class)
- .addAnnotatedClass(HibernateIdentityObjectRelationshipType.class)
- .addAnnotatedClass(HibernateIdentityObjectType.class)
- .addAnnotatedClass(HibernateRealm.class).buildSessionFactory();
+ //TODO: make it optional to add annotated classes here
-
+ if (addMappedClasses != null &&
addMappedClasses.equals("false"))
+ {
+ return config.buildSessionFactory();
+ }
+ else
+ {
+
+ return config.addAnnotatedClass(HibernateIdentityObject.class)
+ .addAnnotatedClass(HibernateIdentityObjectAttribute.class)
+ .addAnnotatedClass(HibernateIdentityObjectBinaryAttribute.class)
+ .addAnnotatedClass(HibernateIdentityObjectTextAttribute.class)
+ .addAnnotatedClass(HibernateIdentityObjectCredential.class)
+ .addAnnotatedClass(HibernateIdentityObjectCredentialType.class)
+ .addAnnotatedClass(HibernateIdentityObjectRelationship.class)
+ .addAnnotatedClass(HibernateIdentityObjectRelationshipName.class)
+ .addAnnotatedClass(HibernateIdentityObjectRelationshipType.class)
+ .addAnnotatedClass(HibernateIdentityObjectType.class)
+ .addAnnotatedClass(HibernateRealm.class).buildSessionFactory();
+ }
}
catch (Exception e)
{
@@ -358,22 +391,8 @@
}
}
-// else if (persistenceUnit != null)
-// {
-//
-// try
-// {
-// return
((HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit)).getSessionFactory();
-// }
-// catch (Exception e)
-// {
-// throw new IdentityException("Cannot obtain hibernate SessionFactory
using provided persistence unit name: "+ persistenceUnit, e);
-// }
-//
-// }
-
throw new IdentityException("Cannot obtain hibernate SessionFactory. None of
supported options specified: "
- + HIBERNATE_SESSION_FACTORY_JNDI_NAME + ", " + PERSISTENCE_UNIT);
+ + HIBERNATE_SESSION_FACTORY_JNDI_NAME + ", " +
HIBERNATE_SESSION_FACTORY_REGISTRY_NAME + ", " + HIBERNATE_CONFIGURATION);
}
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -70,6 +70,7 @@
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectAttributeMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityObjectTypeMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
@@ -124,14 +125,14 @@
this.id = id;
}
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException
+ public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException
{
- if (configurationMD == null)
+ if (configurationContext == null)
{
- throw new IllegalArgumentException("Configuration is null");
+ throw new IllegalArgumentException("Configuration context is null");
}
- this.configurationMD = configurationMD;
+ this.configurationMD = configurationContext.getStoreConfigurationMetaData();
configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/types/SimpleIdentityObject.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -50,10 +50,6 @@
{
throw new IllegalArgumentException("name is null");
}
- if (id == null)
- {
- throw new IllegalArgumentException("id is null");
- }
if (type == null)
{
throw new IllegalArgumentException("type is null");
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -24,7 +24,9 @@
import junit.framework.TestCase;
import org.jboss.identity.idm.impl.HibernateTestSupport;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
import org.jboss.identity.idm.api.IdentitySessionFactory;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.identity.idm.opends.OpenDSService;
import org.opends.server.tools.LDAPModify;
@@ -92,7 +94,8 @@
public void testDBOrganization() throws Exception
{
- identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/organization-test-config.xml"));
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
orgTest.testRedHatOrganization("realm://RedHat/DB");
}
@@ -100,7 +103,8 @@
public void testDBSamplePortal() throws Exception
{
- identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/organization-test-config.xml"));
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
orgTest.testSamplePortal("realm://portal/SamplePortal/DB");
}
@@ -109,7 +113,8 @@
{
populateClean();
- identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/organization-test-config.xml"));
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
orgTest.testRedHatOrganization("realm://RedHat/DB_LDAP");
@@ -119,7 +124,8 @@
{
populateClean();
- identitySessionFactory = new IdentitySessionFactoryImpl(new
File("src/test/resources/organization-test-config.xml"));
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(new
File("src/test/resources/organization-test-config.xml")).buildIdentitySessionFactory();
orgTest.testSamplePortal("realm://portal/SamplePortal/DB_LDAP");
Modified: idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -34,10 +34,15 @@
public void testGroupId() throws Exception
{
- GroupId id = new GroupId("groupTypeName/groupName");
+
+ GroupId id = new GroupId(GroupId.PREFIX + "groupTypeName/groupName");
assertEquals("groupName", id.getName());
assertEquals("groupTypeName", id.getType());
+ id = new GroupId("groupName", "groupTypeName");
+ assertEquals("groupName", id.getName());
+ assertEquals("groupTypeName", id.getType());
+
}
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -29,14 +29,19 @@
import org.jboss.identity.idm.spi.store.IdentityStoreSession;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
import org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
import org.jboss.identity.idm.impl.store.hibernate.HibernateTestBase;
import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.exception.IdentityException;
+import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -72,6 +77,11 @@
IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
.createConfigurationMetaData(new
File("src/test/resources/store-test-config.xml"));
+ IdentityConfigurationContextRegistry identityConfiguration =
(IdentityConfigurationContextRegistry)
+ new IdentityConfigurationImpl().configure(configurationMD);
+
+
+
IdentityStoreConfigurationMetaData storeMD = null;
for (IdentityStoreConfigurationMetaData metaData :
configurationMD.getIdentityStores())
@@ -83,6 +93,9 @@
}
}
+ IdentityStoreConfigurationContext context =
+ new IdentityStoreConfigurationContextImpl(configurationMD,
identityConfiguration, storeMD);
+
store = new HibernateIdentityStoreImpl("HibernateTestStore")
{
@@ -93,14 +106,14 @@
}
@Override
- protected SessionFactory
bootstrapHibernateSessionFactory(IdentityStoreConfigurationMetaData configurationMD)
throws IdentityException
+ protected SessionFactory
bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext)
throws IdentityException
{
return sessionFactory;
}
};
- store.bootstrap(storeMD);
+ store.bootstrap(context);
ctx = new IdentityStoreInvocationContext()
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -31,10 +31,14 @@
import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.exception.IdentityException;
import org.opends.server.tools.LDAPModify;
@@ -91,6 +95,9 @@
IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
.createConfigurationMetaData(new
File("src/test/resources/store-test-config.xml"));
+ IdentityConfigurationContextRegistry registry =
(IdentityConfigurationContextRegistry) new IdentityConfigurationImpl().
+ configure(configurationMD);
+
IdentityStoreConfigurationMetaData storeMD = null;
for (IdentityStoreConfigurationMetaData metaData :
configurationMD.getIdentityStores())
@@ -102,6 +109,8 @@
}
}
+ IdentityStoreConfigurationContext context = new
IdentityStoreConfigurationContextImpl(configurationMD, registry, storeMD);
+
ctx = new IdentityStoreInvocationContext()
{
public IdentityStoreSession getIdentityStoreSession()
@@ -177,7 +186,7 @@
store = new LDAPIdentityStoreImpl("LDAPTestStore");
- store.bootstrap(storeMD);
+ store.bootstrap(context);
}
protected void tearDown() throws Exception
Modified: idm/trunk/idm/src/test/resources/hibernate-jboss-identity.cfg.xml
===================================================================
--- idm/trunk/idm/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-03-17 15:45:09
UTC (rev 376)
+++ idm/trunk/idm/src/test/resources/hibernate-jboss-identity.cfg.xml 2009-03-17 21:38:45
UTC (rev 377)
@@ -44,7 +44,7 @@
<property name="hibernate.connection.password"></property>
<!-- Mapping classes -->
-
+ <!-- all nessesary mappings are added programatically to the configuration
-->
<!--<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"/>-->
@@ -56,5 +56,6 @@
<!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationship"/>-->
<!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType"/>-->
<!--<mapping
class="org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipName"/>-->
+
</session-factory>
</hibernate-configuration>
\ No newline at end of file
Modified: idm/trunk/idm/src/test/resources/organization-test-config.xml
===================================================================
--- idm/trunk/idm/src/test/resources/organization-test-config.xml 2009-03-17 15:45:09 UTC
(rev 376)
+++ idm/trunk/idm/src/test/resources/organization-test-config.xml 2009-03-17 21:38:45 UTC
(rev 377)
@@ -403,10 +403,6 @@
</identity-object-type>
</supported-identity-object-types>
<options>
- <!--<option>-->
- <!--<name>persistenceUnit</name>-->
- <!--<value>jboss-identity-model1</value>-->
- <!--</option>-->
<option>
<name>hibernateConfiguration</name>
<value>hibernate-jboss-identity.cfg.xml</value>
Modified: idm/trunk/idm/src/test/resources/store-test-config.xml
===================================================================
--- idm/trunk/idm/src/test/resources/store-test-config.xml 2009-03-17 15:45:09 UTC (rev
376)
+++ idm/trunk/idm/src/test/resources/store-test-config.xml 2009-03-17 21:38:45 UTC (rev
377)
@@ -94,10 +94,6 @@
</identity-object-type>
</supported-identity-object-types>
<options>
- <!--<option>-->
- <!--<name>persistenceUnit</name>-->
- <!--<value>jboss-identity-model1</value>-->
- <!--</option>-->
<option>
<name>hibernateConfiguration</name>
<value>hibernate-jboss-identity.cfg.xml</value>
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/AttributesManager.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -51,14 +51,31 @@
AttributeDescription getAttributeDescription(IdentityType identityType, String name);
/**
- * Get AttributeDesciption object for all attributes supported with a given
IdentityType
+ * Get AttributeDesciption object for single attribute supported with a given group id
or userName
*
+ * @param id
+ * @return
+ */
+ AttributeDescription getAttributeDescription(String id, String attributeName);
+
+ /**
+ * Get AttributeDesciption objects for all attributes supported with a given
IdentityType
+ *
* @param identityType
* @return
*/
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)
+ *
+ * @param id
+ * @return
+ */
+ Map<String, AttributeDescription> getSupportedAttributesDescriptions(String
id);
+
+ /**
* @param identityType
* @return names of supported attributes
* @throws org.jboss.identity.idm.exception.IdentityException
@@ -67,6 +84,14 @@
throws IdentityException;
/**
+ * @param id - name of User object or id of a Group
+ * @return names of supported attributes
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Set<String> getSupportedAttributeNames(String id)
+ throws IdentityException;
+
+ /**
* Get attributes for the given IdentityType
*
* @param identity
@@ -76,6 +101,15 @@
Map<String, Attribute> getAttributes(IdentityType identity) throws
IdentityException;
/**
+ * Get attributes for the given IdentityType
+ *
+ * @param id
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Map<String, Attribute> getAttributes(String id) throws IdentityException;
+
+ /**
* Get attribute values for the given IdentityType
*
* @param identity
@@ -86,6 +120,16 @@
Attribute getAttribute(IdentityType identity, String attributeName) throws
IdentityException;
/**
+ * Get attribute values for the given IdentityType
+ *
+ * @param id
+ * @param attributeName
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ Attribute getAttribute(String id, String attributeName) throws IdentityException;
+
+ /**
* 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.
*
@@ -97,6 +141,17 @@
throws IdentityException;
/**
+ * 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.
+ *
+ * @param id
+ * @param attributes
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void updateAttributes(String id, Attribute[] attributes)
+ throws IdentityException;
+
+ /**
* Add new attributes - if attribute with given name already exists the values
* will be appended
*
@@ -108,6 +163,17 @@
throws IdentityException;
/**
+ * Add new attributes - if attribute with given name already exists the values
+ * will be appended
+ *
+ * @param id
+ * @param attributes
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void addAttributes(String id, Attribute[] attributes)
+ throws IdentityException;
+
+ /**
* Add new attribute - if attribute with given name already exists the values
* will be appended
*
@@ -123,6 +189,18 @@
* Add new attribute - if attribute with given name already exists the values
* will be appended
*
+ * @param id
+ * @param attributeName
+ * @param values
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void addAttribute(String id, String attributeName, Object[] values)
+ throws IdentityException;
+
+ /**
+ * Add new attribute - if attribute with given name already exists the values
+ * will be appended
+ *
* @param identity
* @param attributeName
* @param value
@@ -132,6 +210,18 @@
throws IdentityException;
/**
+ * Add new attribute - if attribute with given name already exists the values
+ * will be appended
+ *
+ * @param id
+ * @param attributeName
+ * @param value
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ void addAttribute(String id, String attributeName, Object value)
+ throws IdentityException;
+
+ /**
* Remove attributes
*
* @param identity
@@ -141,6 +231,15 @@
throws IdentityException;
/**
+ * Remove attributes
+ *
+ * @param id
+ * @param attributeNames
+ */
+ void removeAttributes(String id, String[] attributeNames)
+ throws IdentityException;
+
+ /**
* Check if given identity can be protected with text password
*
* @param identity
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -66,6 +66,14 @@
Group createGroup(String groupName, String groupType)
throws IdentityException;
+ /**
+ * <p>Create a group Id</p>
+ * @param groupName
+ * @param groupType
+ * @return
+ */
+ String createGroupId(String groupName, String groupType);
+
// Remove
/**
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-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -167,6 +167,16 @@
/**
* <p>Check if association is present </p>
+ * @param parents
+ * @param members
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ boolean isAssociatedByIds(Collection<String> parents, Collection<String>
members)
+ throws IdentityException;
+
+ /**
+ * <p>Check if association is present </p>
* @param parent
* @param member
* @return
@@ -175,6 +185,16 @@
<G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent,
I member)
throws IdentityException;
+ /**
+ * <p>Check if association is present </p>
+ * @param parent
+ * @param member
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException
+ */
+ boolean isAssociatedByIds(String parent, String member)
+ throws IdentityException;
+
// Resolve relationships
/**
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-17
15:45:09 UTC (rev 376)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -99,13 +99,13 @@
/**
* Create role
- * @param roleType
+ * @param roleTypeName
* @param userName
* @param groupId
* @return
* @throws IdentityException
*/
- Role createRole(RoleType roleType, String userName, String groupId) throws
IdentityException;
+ Role createRole(String roleTypeName, String userName, String groupId) throws
IdentityException;
/**
* Remove Role
@@ -118,12 +118,12 @@
/**
* Remove Role
- * @param roleType
+ * @param roleTypeName
* @param userName
* @param groupId
* @throws IdentityException
*/
- void removeRole(RoleType roleType, String userName, String groupId) throws
IdentityException;
+ void removeRole(String roleTypeName, String userName, String groupId) throws
IdentityException;
/**
* Remove Role
@@ -146,11 +146,11 @@
* Check if Role is present
* @param userName
* @param groupId
- * @param roleType
+ * @param roleTypeName
* @return
* @throws IdentityException
*/
- boolean hasRole(String userName, String groupId, RoleType roleType) throws
IdentityException;
+ boolean hasRole(String userName, String groupId, String roleTypeName) throws
IdentityException;
/**
* Find RoleType objects for roles associated with a given Identity and Group
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfiguration.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,45 @@
+/*
+* 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.api.cfg;
+
+import org.jboss.identity.idm.api.*;
+import org.jboss.identity.idm.exception.IdentityConfigurationException;
+
+import java.io.File;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityConfiguration
+{
+
+ IdentityConfiguration configure(File configFile) throws
IdentityConfigurationException;
+
+ IdentityConfiguration configure(String configResource) throws
IdentityConfigurationException;
+
+ IdentitySessionFactory buildIdentitySessionFactory() throws
IdentityConfigurationException;
+
+ IdentityConfigurationRegistry getIdentityConfigurationRegistry();
+
+}
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,56 @@
+/*
+* 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.api.cfg;
+
+import org.jboss.identity.idm.exception.IdentityException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityConfigurationRegistry
+{
+
+ /**
+ * Retister object in context
+ * @param object representing object
+ * @param name to map object
+ * @throws org.jboss.identity.idm.exception.IdentityException thrown if such object is
already registered or operation fail.
+ */
+ public void register(Object object, String name) throws IdentityException;
+
+ /**
+ * Remove object from context
+ * @param name of identity object
+ */
+ public void unregister(String name);
+
+ /**
+ * Retrieve registered object
+ * @param name
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException thrown if no such object
exists in context
+ */
+ public Object getObject(String name) throws IdentityException;
+
+}
\ No newline at end of file
Copied:
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityConfigurationException.java
(from rev 367,
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityConfigurationException.java)
===================================================================
---
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityConfigurationException.java
(rev 0)
+++
idm/trunk/idm-common/src/main/java/org/jboss/identity/idm/exception/IdentityConfigurationException.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,55 @@
+/*
+* 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.exception;
+
+import org.jboss.identity.idm.exception.IdentityException;
+
+/**
+ * Exception indicating some issue in configuration
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityConfigurationException extends IdentityException
+{
+ private static final long serialVersionUID = 1L;
+
+ public IdentityConfigurationException()
+ {
+ super();
+ }
+
+ public IdentityConfigurationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public IdentityConfigurationException(String msg)
+ {
+ super(msg);
+ }
+
+ public IdentityConfigurationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
\ No newline at end of file
Added:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContext.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContext.java
(rev 0)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContext.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,38 @@
+/*
+* 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.spi.configuration;
+
+import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityConfigurationContext
+{
+
+ IdentityConfigurationMetaData getConfigurationMetaData();
+
+ IdentityConfigurationContextRegistry getConfigurationRegistry();
+
+}
Added:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java
(rev 0)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityConfigurationContextRegistry.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,55 @@
+/*
+* 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.spi.configuration;
+
+import org.jboss.identity.idm.exception.IdentityException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityConfigurationContextRegistry
+{
+
+ /**
+ * Retister object in context
+ * @param object representing object
+ * @param name to map object
+ * @throws org.jboss.identity.idm.exception.IdentityException thrown if such object is
already registered or operation fail.
+ */
+ public void register(Object object, String name) throws IdentityException;
+
+ /**
+ * Remove object from context
+ * @param name of identity object
+ */
+ public void unregister(String name);
+
+ /**
+ * Retrieve registered object
+ * @param name
+ * @return
+ * @throws org.jboss.identity.idm.exception.IdentityException thrown if no such object
exists in context
+ */
+ public Object getObject(String name) throws IdentityException;
+}
Added:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityRepositoryConfigurationContext.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityRepositoryConfigurationContext.java
(rev 0)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityRepositoryConfigurationContext.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,36 @@
+/*
+* 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.spi.configuration;
+
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityRepositoryConfigurationContext extends
IdentityConfigurationContext
+{
+
+ IdentityRepositoryConfigurationMetaData getRepositoryConfigurationMetaData();
+
+}
Added:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityStoreConfigurationContext.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityStoreConfigurationContext.java
(rev 0)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/IdentityStoreConfigurationContext.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -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.identity.idm.spi.configuration;
+
+import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreConfigurationContext extends IdentityConfigurationContext
+{
+ IdentityStoreConfigurationMetaData getStoreConfigurationMetaData();
+
+}
Added:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/RealmConfigurationContext.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/RealmConfigurationContext.java
(rev 0)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/configuration/RealmConfigurationContext.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -0,0 +1,36 @@
+/*
+* 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.spi.configuration;
+
+import org.jboss.identity.idm.spi.configuration.metadata.RealmConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RealmConfigurationContext extends IdentityConfigurationContext
+{
+
+ RealmConfigurationMetaData getRealmConfigurationMetaData();
+
+}
Deleted:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityConfigurationException.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityConfigurationException.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/exception/IdentityConfigurationException.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -1,55 +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.identity.idm.spi.exception;
-
-import org.jboss.identity.idm.exception.IdentityException;
-
-/**
- * Exception indicating some issue in configuration
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityConfigurationException extends IdentityException
-{
- private static final long serialVersionUID = 1L;
-
- public IdentityConfigurationException()
- {
- super();
- }
-
- public IdentityConfigurationException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public IdentityConfigurationException(String msg)
- {
- super(msg);
- }
-
- public IdentityConfigurationException(Throwable cause)
- {
- super(cause);
- }
-}
\ No newline at end of file
Modified:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/repository/IdentityStoreRepository.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -28,6 +28,7 @@
import org.jboss.identity.idm.spi.store.IdentityStore;
import org.jboss.identity.idm.spi.store.AttributeStore;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityRepositoryConfigurationContext;
import org.jboss.identity.idm.exception.IdentityException;
/**
@@ -44,7 +45,7 @@
public interface IdentityStoreRepository extends IdentityStore
{
- public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ public void bootstrap(IdentityRepositoryConfigurationContext configurationContext,
Map<String, IdentityStore> bootstrappedIdentityStores,
Map<String, AttributeStore> bootstrappedAttributeStores)
throws IdentityException;
Modified:
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java
===================================================================
---
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-03-17
15:45:09 UTC (rev 376)
+++
idm/trunk/idm-spi/src/main/java/org/jboss/identity/idm/spi/store/IdentityStore.java 2009-03-17
21:38:45 UTC (rev 377)
@@ -32,6 +32,7 @@
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
import org.jboss.identity.idm.spi.exception.OperationNotSupportedException;
import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
import org.jboss.identity.idm.spi.model.IdentityObjectCredential;
import org.jboss.identity.idm.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.idm.exception.IdentityException;
@@ -49,10 +50,10 @@
/**
* Set up the store
*
- * @param configurationMD
+ * @param configurationContext
* @throws IOException
*/
- void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws
IdentityException;
+ void bootstrap(IdentityStoreConfigurationContext configurationContext) throws
IdentityException;
/**
* @return id of this identity store