JBoss Identity SVN: r123 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2 and 8 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-11-18 16:49:18 -0500 (Tue, 18 Nov 2008)
New Revision: 123
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributeFilterSearchControl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PageSearchControl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SortByNameSearchControl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateRealm.java
Modified:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateTestBase.java
trunk/identity-impl/src/test/resources/META-INF/persistence.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
trunk/parent/pom.xml
Log:
Hibernate store improvements
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributeFilterSearchControl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributeFilterSearchControl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributeFilterSearchControl.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -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.impl.api;
+
+import org.jboss.identity.api.IdentitySearchControl;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class AttributeFilterSearchControl implements IdentitySearchControl, IdentityObjectSearchControl
+{
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PageSearchControl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PageSearchControl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PageSearchControl.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -0,0 +1,63 @@
+/*
+* 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.impl.api;
+
+import org.jboss.identity.api.IdentitySearchControl;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class PageSearchControl implements IdentitySearchControl, IdentityObjectSearchControl
+{
+ private int offset;
+
+ private int limit;
+
+ public PageSearchControl(int offset, int limit)
+ {
+ this.offset = offset;
+ this.limit = limit;
+ }
+
+ public int getOffset()
+ {
+ return offset;
+ }
+
+ public void setOffset(int offset)
+ {
+ this.offset = offset;
+ }
+
+ public int getLimit()
+ {
+ return limit;
+ }
+
+ public void setLimit(int limit)
+ {
+ this.limit = limit;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SortByNameSearchControl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SortByNameSearchControl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SortByNameSearchControl.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -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.impl.api;
+
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.api.IdentitySearchControl;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SortByNameSearchControl implements IdentitySearchControl, IdentityObjectSearchControl
+{
+ private boolean ascending;
+
+ public SortByNameSearchControl(boolean ascending)
+ {
+ this.ascending = ascending;
+ }
+
+ public boolean isAscending()
+ {
+ return ascending;
+ }
+
+ public void setAscending(boolean ascending)
+ {
+ this.ascending = ascending;
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -94,21 +94,36 @@
IdentityConfigurationMetaDataImpl configurationMD = new IdentityConfigurationMetaDataImpl();
- for (IdentityStoreType identityStoreType : identityConfig.getStores().getIdentityStores().getIdentityStore())
+ if (identityConfig.getStores() != null &&
+ identityConfig.getStores().getIdentityStores() != null &&
+ identityConfig.getStores().getIdentityStores().getIdentityStore() != null)
{
- configurationMD.getIdentityStores().add(createIdentityStoreConfigurationMetaData(identityStoreType));
+
+ for (IdentityStoreType identityStoreType : identityConfig.getStores().getIdentityStores().getIdentityStore())
+ {
+ configurationMD.getIdentityStores().add(createIdentityStoreConfigurationMetaData(identityStoreType));
+ }
}
- for (RepositoryType repositoryType : identityConfig.getRepositories().getRepository())
+ if (identityConfig.getRepositories() != null &&
+ identityConfig.getRepositories().getRepository() != null)
{
- configurationMD.getRepositories().add(createIdentityRepositoryConfigurationMetaData(repositoryType));
+
+ for (RepositoryType repositoryType : identityConfig.getRepositories().getRepository())
+ {
+ configurationMD.getRepositories().add(createIdentityRepositoryConfigurationMetaData(repositoryType));
+ }
}
- for (RealmType realmType : identityConfig.getRealms().getRealm())
+ if (identityConfig.getRealms() != null &&
+ identityConfig.getRealms().getRealm() != null)
{
- configurationMD.getRealms().add(createRealmConfigurationMetaData(realmType));
+ for (RealmType realmType : identityConfig.getRealms().getRealm())
+ {
+ configurationMD.getRealms().add(createRealmConfigurationMetaData(realmType));
+ }
}
-
+
return configurationMD;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -28,7 +28,6 @@
import java.util.HashMap;
import java.util.Collections;
import java.util.Arrays;
-import java.util.LinkedList;
import java.util.List;
import javax.persistence.Column;
@@ -47,9 +46,6 @@
import org.jboss.identity.exception.PolicyValidationException;
import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType;
-import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
-import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectAttribute;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -58,19 +54,29 @@
@NamedQueries({
@NamedQuery(
name = "findIdentityObjectByNameAndType",
- query = "select o from HibernateIdentityObject o where o.name like :name and o.identityType.name like :typeName"
+ query = "select o from HibernateIdentityObject o where o.realm like :realm and o.name like :name and o.identityType.name like :typeName"
),
@NamedQuery(
name = "findIdentityObjectsByType",
- query = "select o from HibernateIdentityObject o where o.identityType.name like :typeName"
+ query = "select o from HibernateIdentityObject o where o.realm like :realm and o.identityType.name like :typeName"
),
@NamedQuery(
+ name = "findIdentityObjectsByTypeOrderedByNameAsc",
+ query = "select o from HibernateIdentityObject o where o.realm like :realm and o.identityType.name like :typeName " +
+ "order by o.name asc"
+ ),
+ @NamedQuery(
+ name = "findIdentityObjectsByTypeOrderedByNameDesc",
+ query = "select o from HibernateIdentityObject o where o.realm like :realm and o.identityType.name like :typeName " +
+ "order by o.name desc"
+ ),
+ @NamedQuery(
name = "countIdentityObjectsByType",
- query = "select count(o.id) from HibernateIdentityObject o where o.identityType.name like :typeName"
+ query = "select count(o.id) from HibernateIdentityObject o where o.realm like :realm and o.identityType.name like :typeName"
)
})
@Entity
-@Table(name = "identity_obj", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "IDENTITY_TYPE"})})
+@Table(name = "identity_obj", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "IDENTITY_TYPE", "REALM"})})
public class HibernateIdentityObject implements IdentityObject
{
@Id
@@ -93,14 +99,19 @@
@OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
private Map<String, HibernateIdentityObjectAttribute> attributes = new HashMap<String, HibernateIdentityObjectAttribute>();
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(nullable = false, unique = false, name="REALM")
+ private HibernateRealm realm;
+
public HibernateIdentityObject()
{
}
- public HibernateIdentityObject(String name, HibernateIdentityObjectType identityType)
+ public HibernateIdentityObject(String name, HibernateIdentityObjectType identityType, HibernateRealm realm)
{
this.name = name;
this.identityType = identityType;
+ this.realm = realm;
}
public String getId()
@@ -236,6 +247,16 @@
fromRelationships.add(toRelationship);
}
+ public HibernateRealm getRealm()
+ {
+ return realm;
+ }
+
+ public void setRealm(HibernateRealm realm)
+ {
+ this.realm = realm;
+ }
+
public void validatePolicy() throws PolicyValidationException
{
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipName.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -29,43 +29,73 @@
import javax.persistence.NamedQuery;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
+import javax.persistence.ManyToOne;
+import javax.persistence.JoinColumn;
+import javax.persistence.UniqueConstraint;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
@Entity
-@Table(name="identity_relationship_name")
+@Table(name="identity_relationship_name", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME", "REALM"})})
@NamedQueries({
@NamedQuery(
name = "findIdentityObjectRelationshipNameByName",
- query = "select rn from HibernateIdentityObjectRelationshipName rn where rn.name like :name"
+ query = "select rn from HibernateIdentityObjectRelationshipName rn where rn.name like :name and rn.realm like :realm"
),
@NamedQuery(
name = "findIdentityObjectRelationshipNames",
- query = "select rn.name from HibernateIdentityObjectRelationshipName rn"
+ query = "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.realm like :realm"
),
@NamedQuery(
+ name = "findIdentityObjectRelationshipNamesOrderedByNameAsc",
+ query = "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.realm like :realm " +
+ "order by rn.name asc"
+ ),
+ @NamedQuery(
+ name = "findIdentityObjectRelationshipNamesOrderedByNameDesc",
+ query = "select rn.name from HibernateIdentityObjectRelationshipName rn where rn.realm like :realm " +
+ "order by rn.name desc"
+ ),
+ @NamedQuery(
name = "findIdentityObjectRelationshipNamesForIdentityObject",
- query = "select r.name.name from HibernateIdentityObjectRelationship r where r.fromIdentityObject like :identityObject or r.toIdentityObject like :identityObject"
- )
- })
+ query = "select r.name.name from HibernateIdentityObjectRelationship r where " +
+ "r.fromIdentityObject like :identityObject or r.toIdentityObject like :identityObject"
+ ),
+ @NamedQuery(
+ name = "findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameAsc",
+ query = "select r.name.name from HibernateIdentityObjectRelationship r where " +
+ "r.fromIdentityObject like :identityObject or r.toIdentityObject like :identityObject " +
+ "order by r.name.name asc"
+ ),
+ @NamedQuery(
+ name = "findIdentityObjectRelationshipNamesForIdentityObjectOrdereByNameDesc",
+ query = "select r.name.name from HibernateIdentityObjectRelationship r where " +
+ "r.fromIdentityObject like :identityObject or r.toIdentityObject like :identityObject " +
+ "order by r.name.name desc")
+})
public class HibernateIdentityObjectRelationshipName
{
@Id
@GeneratedValue
- Long id;
+ private Long id;
@Column(nullable = false, unique = true, name = "NAME")
- String name;
+ private String name;
+ @ManyToOne
+ @JoinColumn(nullable = false, name="REALM")
+ private HibernateRealm realm;
+
public HibernateIdentityObjectRelationshipName()
{
}
- public HibernateIdentityObjectRelationshipName(String name)
+ public HibernateIdentityObjectRelationshipName(String name, HibernateRealm realm)
{
this.name = name;
+ this.realm = realm;
}
public Long getId()
@@ -87,4 +117,14 @@
{
this.name = name;
}
+
+ public HibernateRealm getRealm()
+ {
+ return realm;
+ }
+
+ public void setRealm(HibernateRealm realm)
+ {
+ this.realm = realm;
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationshipType.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -29,6 +29,8 @@
import javax.persistence.Table;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.ManyToOne;
+import javax.persistence.JoinColumn;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
@@ -63,7 +65,6 @@
this.name = name;
}
-
public HibernateIdentityObjectRelationshipType(IdentityObjectRelationshipType type)
{
if (type == null)
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateRealm.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateRealm.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateRealm.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -0,0 +1,164 @@
+/*
+* 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.impl.model.hibernate;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.OneToMany;
+import javax.persistence.FetchType;
+import javax.persistence.CascadeType;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@NamedQueries({
+ @NamedQuery(
+ name = "findIRealmByName",
+ query = "select o from HibernateRealm o where o.name like :name"
+ )
+})
+@Entity
+@Table(name = "identity_realm", uniqueConstraints = {@UniqueConstraint(columnNames = {"NAME"})})
+public class HibernateRealm
+{
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column(name = "NAME", nullable = false)
+ private String name;
+
+ @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL})
+ private Map<String, HibernateIdentityObjectAttribute> attributes = new HashMap<String, HibernateIdentityObjectAttribute>();
+
+ public HibernateRealm()
+ {
+ }
+
+ public HibernateRealm(String name)
+ {
+ this.name = name;
+ }
+
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Set<String> getAttribute(String name) {
+ if (attributes.containsKey(name))
+ {
+ return Collections.unmodifiableSet((attributes.get(name)).getValues());
+ }
+ return new HashSet<String>();
+ }
+
+ public Map<String, String[]> getAttributes()
+ {
+ Map<String, String[]> map = new HashMap<String, String[]>();
+
+ for (HibernateIdentityObjectAttribute attribute : attributes.values())
+ {
+ Set<String> values = attribute.getValues();
+ map.put(attribute.getName(),values.toArray(new String[values.size()]));
+ }
+
+ return Collections.unmodifiableMap(map);
+ }
+
+ public void setAttribute(String name, String[] values)
+ {
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
+ }
+
+ public void setAttribute(String name, Set<String> values)
+ {
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
+ }
+
+ public void addAttributeValues(String name, String[] values)
+ {
+ if (!attributes.containsKey(name))
+ {
+ setAttribute(name, values);
+ }
+ else
+ {
+ Set<String> mergedValues = new HashSet<String>((attributes.get(name)).getValues());
+ List<String> list = Arrays.asList(values);
+ mergedValues.addAll(new HashSet<String>(list));
+ setAttribute(name, mergedValues);
+ }
+ }
+
+ public void setAttributes(Map<String, Set<String>> values)
+ {
+ Map<String, HibernateIdentityObjectAttribute> newAttrs= new HashMap<String, HibernateIdentityObjectAttribute>();
+
+ for (String name : values.keySet())
+ {
+
+ newAttrs.put(name, new HibernateIdentityObjectAttribute(name, new HashSet<String>(values.get(name))));
+ }
+ attributes = newAttrs;
+ }
+
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -188,8 +188,13 @@
return targetStore.createIdentityObject(targetCtx, name, identityObjectType);
}
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException
+ {
+ IdentityStore targetStore = resolveIdentityStore(identityObjectType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+ return targetStore.createIdentityObject(targetCtx, name, identityObjectType, attributes);
+ }
-
public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
{
IdentityStore targetStore = resolveIdentityStore(identity);
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -41,11 +41,15 @@
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipName;
+import org.jboss.identity.impl.model.hibernate.HibernateRealm;
import org.jboss.identity.impl.NotYetImplementedException;
+import org.jboss.identity.impl.api.PageSearchControl;
+import org.jboss.identity.impl.api.SortByNameSearchControl;
import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
import org.hibernate.ejb.HibernateEntityManager;
import org.hibernate.ejb.HibernateEntityManagerFactory;
import org.hibernate.criterion.Restrictions;
+import org.hibernate.HibernateException;
import javax.persistence.NoResultException;
import javax.persistence.Query;
@@ -93,6 +97,8 @@
public static final String IS_REALM_AWARE = "isRealmAware";
+ public static final String DEFAULT_REALM_NAME = HibernateIdentityStoreImpl.class.getName() + ".DEFAULT_REALM";
+
private String id;
private FeaturesMetaData supportedFeatures;
@@ -109,8 +115,11 @@
static {
// List all supported controls classes
- //TODO:
- //supportedSearchControls.add()
+ //TODO: attributefilter?
+
+ supportedSearchControls.add(PageSearchControl.class);
+ supportedSearchControls.add(SortByNameSearchControl.class);
+
}
public HibernateIdentityStoreImpl(String id)
@@ -138,6 +147,7 @@
HibernateEntityManager em = (HibernateEntityManager)emFactory.createEntityManager();
+
if (populateMembershipTypes != null && populateMembershipTypes.equalsIgnoreCase("true"))
{
List<String> memberships = new LinkedList<String>();
@@ -179,12 +189,43 @@
}
+ String realmAware = configurationMD.getOptionSingleValue(IS_REALM_AWARE);
+
+ if (realmAware != null && realmAware.equalsIgnoreCase("true"))
+ {
+ this.isRealmAware = true;
+ }
+
+ // Default realm
+
+ HibernateRealm realm = null;
+
+ try
+ {
+
+ em.getTransaction().begin();
+
+ realm = (HibernateRealm)em.getSession().
+ createCriteria(HibernateRealm.class).add(Restrictions.eq("name", DEFAULT_REALM_NAME)).uniqueResult();
+
+ em.getTransaction().commit();
+
+ }
+ catch (HibernateException e)
+ {
+ // Realm does not exist
+ }
+
+ if (realm == null)
+ {
+ addRealm(em, DEFAULT_REALM_NAME);
+ }
+
}
public IdentityStoreSession createIdentityStoreSession() throws IdentityException
{
-
try
{
return new HibernateIdentityStoreSessionImpl((HibernateEntityManager)emFactory.createEntityManager());
@@ -193,7 +234,6 @@
{
throw new IdentityException("Failed to obtain HibernateEntityManager",e);
}
-
}
public String getId()
@@ -211,18 +251,31 @@
return supportedFeatures;
}
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext ctx, String name, IdentityObjectType identityObjectType) throws IdentityException
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
{
+ return createIdentityObject(invocationCtx, name, identityObjectType, null);
+ }
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext ctx,
+ String name,
+ IdentityObjectType identityObjectType,
+ Map<String, String[]> attributes) throws IdentityException
+ {
+
if (name == null)
{
throw new IllegalArgumentException("IdentityObject name is null");
}
-
+
checkIOType(identityObjectType);
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+ HibernateRealm realm = getRealm(em, ctx);
+
// Check if object with a given name and type is not present already
- List results = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectByNameAndType")
+ List results = em.createNamedQuery("findIdentityObjectByNameAndType")
+ .setParameter("realm", realm)
.setParameter("name", name)
.setParameter("typeName", identityObjectType.getName()).getResultList();
@@ -235,8 +288,16 @@
HibernateIdentityObjectType hibernateType = getHibernateIdentityObjectType(ctx, identityObjectType);
- HibernateIdentityObject io = new HibernateIdentityObject(name, hibernateType);
+ HibernateIdentityObject io = new HibernateIdentityObject(name, hibernateType, realm);
+ if (attributes != null)
+ {
+ for (Map.Entry<String, String[]> entry : attributes.entrySet())
+ {
+ io.setAttribute(entry.getKey(), entry.getValue());
+ }
+ }
+
try
{
getHibernateEntityManager(ctx).persist(io);
@@ -272,12 +333,15 @@
HibernateIdentityObjectType jpaType = getHibernateIdentityObjectType(ctx, identityType);
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
int count;
try
{
- count = ((Number)getHibernateEntityManager(ctx)
+ count = ((Number)em
.createNamedQuery("countIdentityObjectsByType")
.setParameter("typeName", jpaType.getName())
+ .setParameter("realm", getRealm(em, ctx))
.getSingleResult()).intValue();
}
catch (Exception e)
@@ -302,9 +366,13 @@
HibernateIdentityObject hibernateObject = null;
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
try
{
- hibernateObject = (HibernateIdentityObject)getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectByNameAndType")
+ hibernateObject = (HibernateIdentityObject)getHibernateEntityManager(ctx).
+ createNamedQuery("findIdentityObjectByNameAndType")
+ .setParameter("realm", getRealm(em, ctx))
.setParameter("name", name)
.setParameter("typeName", hibernateType.getName())
.getSingleResult();
@@ -328,7 +396,7 @@
try
{
- hibernateObject = (HibernateIdentityObject)getHibernateEntityManager(ctx).find(HibernateIdentityObject.class, id);
+ hibernateObject = getHibernateEntityManager(ctx).find(HibernateIdentityObject.class, new Long(id));
}
catch(Exception e)
{
@@ -344,29 +412,68 @@
IdentityObjectType identityType,
IdentityObjectSearchControl[] controls) throws IdentityException
{
- //TODO:OrderBy
- //TODO:Improve pagination
-
checkIOType(identityType);
+ checkControls(controls);
+
+ PageSearchControl pageSearchControl = null;
+ SortByNameSearchControl sortSearchControl = null;
+
+ if (controls != null)
+ {
+ for (IdentityObjectSearchControl control : controls)
+ {
+ if (control instanceof PageSearchControl)
+ {
+ pageSearchControl = (PageSearchControl)control;
+ }
+ else if (control instanceof SortByNameSearchControl)
+ {
+ sortSearchControl = (SortByNameSearchControl)control;
+ }
+ }
+ }
+
HibernateIdentityObjectType hibernateType = getHibernateIdentityObjectType(ctx, identityType);
List<IdentityObject> results;
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
try
{
- Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectsByType")
- .setParameter("typeName", hibernateType.getName());
+ Query q = null;
- //TODO: controls
- //.setFirstResult(offset);
+ if (sortSearchControl != null)
+ {
+ if (sortSearchControl.isAscending())
+ {
+ q = em.createNamedQuery("findIdentityObjectsByTypeOrderedByNameAsc");
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectsByTypeOrderedByNameDesc");
+ }
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectsByType");
+ }
-// if (limit > 0)
-// {
-// q.setMaxResults(limit);
-// }
+ q.setParameter("realm", getRealm(em, ctx))
+ .setParameter("typeName", hibernateType.getName());
+
+ if (pageSearchControl != null)
+ {
+ q.setFirstResult(pageSearchControl.getOffset());
+ if (pageSearchControl.getLimit() > 0)
+ {
+ q.setMaxResults(pageSearchControl.getLimit());
+ }
+ }
+
results = (List<IdentityObject>)q.getResultList();
}
@@ -388,70 +495,94 @@
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, IdentityObjectSearchControl[] controls) throws IdentityException
{
//TODO:test
- //TODO:Improve pagination
HibernateIdentityObject hibernateObject = safeGet(ctx, identity);
List<IdentityObject> results = null;
+ PageSearchControl pageSearchControl = null;
+ SortByNameSearchControl sortSearchControl = null;
+
+ if (controls != null)
+ {
+ for (IdentityObjectSearchControl control : controls)
+ {
+ if (control instanceof PageSearchControl)
+ {
+ pageSearchControl = (PageSearchControl)control;
+ }
+ else if (control instanceof SortByNameSearchControl)
+ {
+ sortSearchControl = (SortByNameSearchControl)control;
+ }
+ }
+ }
+
+ boolean orderByName = false;
+ boolean ascending = true;
+
+ if (sortSearchControl != null)
+ {
+ orderByName = true;
+ ascending = sortSearchControl.isAscending();
+ }
+
try
{
org.hibernate.Query q = null;
StringBuilder hqlString = new StringBuilder("");
- //TODO: controls
-// if (orderByName)
-// {
-// hqlString.append(" orderBy ior.toIdentityObject.name");
-// if (ascending)
-// {
-// hqlString.append(" asc");
-// }
-// }
+ if (orderByName)
+ {
+ hqlString.append(" orderBy ior.toIdentityObject.name");
+ if (ascending)
+ {
+ hqlString.append(" asc");
+ }
+ }
if (parent)
{
hqlString.append("select ior.toIdentityObject from HibernateIdentityObjectRelationship ior where ior.type.name like :relType and ior.fromIdentityObject like :identity");
- //TODO: controls
-// if (orderByName)
-// {
-// hqlString.append(" orderBy ior.toIdentityObject.name");
-// if (ascending)
-// {
-// hqlString.append(" asc");
-// }
-// }
+ if (orderByName)
+ {
+ hqlString.append(" orderBy ior.toIdentityObject.name");
+ if (ascending)
+ {
+ hqlString.append(" asc");
+ }
+ }
}
else
{
hqlString.append("select ior.fromIdentityObject from HibernateIdentityObjectRelationship ior where ior.type.name like :relType and ior.toIdentityObject like :identity");
- //TODO: controls
-// if (orderByName)
-// {
-// hqlString.append(" orderBy ior.toIdentityObject.name");
-// if (ascending)
-// {
-// hqlString.append(" asc");
-// }
-// }
+ if (orderByName)
+ {
+ hqlString.append(" orderBy ior.toIdentityObject.name");
+ if (ascending)
+ {
+ hqlString.append(" asc");
+ }
+ }
}
q = getHibernateEntityManager(ctx).getSession().createQuery(hqlString.toString())
.setParameter("relType", relationshipType.getName())
.setParameter("identity",hibernateObject);
- //TODO: controls
- //.setFirstResult(offset);
+
+ if (pageSearchControl != null)
+ {
+ q.setFirstResult(pageSearchControl.getOffset());
+ if (pageSearchControl.getLimit() > 0)
+ {
+ q.setMaxResults(pageSearchControl.getLimit());
+ }
+ }
- //TODO: controls
-// if (limit > 0)
-// {
-// q.setMaxResults(limit);
-// }
-
results = q.list();
@@ -474,7 +605,7 @@
IdentityObjectRelationshipType relationshipType,
String name, boolean createNames) throws IdentityException
{
- //TODO: name
+ //TODO: check name
if (relationshipType == null)
{
@@ -523,7 +654,7 @@
public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String name) throws IdentityException
{
- //TODO: name
+ //TODO: check name
if (relationshipType == null)
{
@@ -616,17 +747,21 @@
throw new IllegalArgumentException("name is null");
}
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+ HibernateRealm realm = getRealm(em, ctx);
+
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)getHibernateEntityManager(ctx).getSession().createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)em.getSession().createCriteria(HibernateIdentityObjectRelationshipName.class)
+ .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", realm)).uniqueResult();
if (hiorn != null)
{
throw new IdentityException("Relationship name already exists");
}
- hiorn = new HibernateIdentityObjectRelationshipName(name);
+ hiorn = new HibernateIdentityObjectRelationshipName(name, realm);
getHibernateEntityManager(ctx).persist(hiorn);
}
@@ -646,10 +781,13 @@
throw new IllegalArgumentException("name is null");
}
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+
try
{
- HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)getHibernateEntityManager(ctx).getSession().createCriteria(HibernateIdentityObjectRelationshipName.class)
- .add(Restrictions.eq("name", name)).uniqueResult();
+ HibernateIdentityObjectRelationshipName hiorn = (HibernateIdentityObjectRelationshipName)em.getSession().createCriteria(HibernateIdentityObjectRelationshipName.class)
+ .add(Restrictions.eq("name", name)).add(Restrictions.eq("realm", getRealm(em, ctx))).uniqueResult();
if (hiorn == null)
{
@@ -671,22 +809,60 @@
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
{
- //TODO: orderByName
-
Set<String> names = new HashSet<String>();
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+ PageSearchControl pageSearchControl = null;
+ SortByNameSearchControl sortSearchControl = null;
+
+ if (controls != null)
+ {
+ for (IdentityObjectSearchControl control : controls)
+ {
+ if (control instanceof PageSearchControl)
+ {
+ pageSearchControl = (PageSearchControl)control;
+ }
+ else if (control instanceof SortByNameSearchControl)
+ {
+ sortSearchControl = (SortByNameSearchControl)control;
+ }
+ }
+ }
+
+
try
{
- Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNames");
- //TODO: controls
- // .setFirstResult(offset);
+ Query q = null;
- //TODO: controls
-// if(limit > 0)
-// {
-// q.setMaxResults(limit);
-// }
+ if (sortSearchControl != null)
+ {
+ if (sortSearchControl.isAscending())
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNamesOrderedByNameAsc");
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNamesOrderedByNameDesc");
+ }
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNames");
+ }
+ q.setParameter("realm", getRealm(em, ctx));
+
+ if (pageSearchControl != null)
+ {
+ q.setFirstResult(pageSearchControl.getOffset());
+ if (pageSearchControl.getLimit() > 0)
+ {
+ q.setMaxResults(pageSearchControl.getLimit());
+ }
+ }
+
List<String> results = (List<String>)q.getResultList();
names = new HashSet<String>(results);
@@ -705,31 +881,64 @@
return getRelationshipNames(ctx, new IdentityObjectSearchControl[]{});
}
-
-
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
{
- //TODO: NYI
- //TODO: orderByName
-
Set<String> names;
HibernateIdentityObject hibernateObject = safeGet(ctx, identity);
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+ PageSearchControl pageSearchControl = null;
+ SortByNameSearchControl sortSearchControl = null;
+
+ if (controls != null)
+ {
+ for (IdentityObjectSearchControl control : controls)
+ {
+ if (control instanceof PageSearchControl)
+ {
+ pageSearchControl = (PageSearchControl)control;
+ }
+ else if (control instanceof SortByNameSearchControl)
+ {
+ sortSearchControl = (SortByNameSearchControl)control;
+ }
+ }
+ }
+
try
{
- Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObject")
- .setParameter("identityObject", hibernateObject);
- //TODO: controls
-// .setFirstResult(offset);
+ Query q = null;
- //TODO: controls
-// if(limit > 0)
-// {
-// q.setMaxResults(limit);
-// }
+ if (sortSearchControl != null)
+ {
+ if (sortSearchControl.isAscending())
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameAsc");
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameDesc");
+ }
+ }
+ else
+ {
+ q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObject");
+ }
+ q.setParameter("identityObject", hibernateObject);
+
+ if (pageSearchControl != null)
+ {
+ q.setFirstResult(pageSearchControl.getOffset());
+ if (pageSearchControl.getLimit() > 0)
+ {
+ q.setMaxResults(pageSearchControl.getLimit());
+ }
+ }
+
List<String> results = (List<String>)q.getResultList();
names = new HashSet<String>(results);
@@ -814,18 +1023,12 @@
}
}
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
throw new NotYetImplementedException();
}
- public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
@@ -902,9 +1105,12 @@
HibernateIdentityObjectType hibernateType = null;
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+
try
{
- hibernateType = (HibernateIdentityObjectType)getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectTypeByName")
+ hibernateType = (HibernateIdentityObjectType)em.createNamedQuery("findIdentityObjectTypeByName")
.setParameter("name", type.getName())
.getSingleResult() ;
}
@@ -921,16 +1127,20 @@
HibernateIdentityObject hibernateObject = null;
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
+
try
{
- hibernateObject = (HibernateIdentityObject)getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectByNameAndType")
+ hibernateObject = (HibernateIdentityObject)em.createNamedQuery("findIdentityObjectByNameAndType")
.setParameter("name", io.getName())
.setParameter("typeName", io.getIdentityType().getName())
+ .setParameter("realm", getRealm(em, ctx))
.getSingleResult();
}
catch (Exception e)
{
- throw new IdentityException("IdentityObject[ " + io.getName() + " | " + io.getIdentityType().getName() + "] not present in the store.");
+ throw new IdentityException("IdentityObject[ " + io.getName() + " | " + io.getIdentityType().getName() + "] not present in the store.", e);
}
return hibernateObject;
@@ -941,9 +1151,11 @@
HibernateIdentityObjectRelationshipType relationshipType = null;
+ HibernateEntityManager em = getHibernateEntityManager(ctx);
+
try
{
- relationshipType = (HibernateIdentityObjectRelationshipType)getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipTypeByName")
+ relationshipType = (HibernateIdentityObjectRelationshipType)em.createNamedQuery("findIdentityObjectRelationshipTypeByName")
.setParameter("name", iot.getName())
.getSingleResult();
}
@@ -1001,6 +1213,77 @@
em.getTransaction().commit();
}
+ public void addRealm(HibernateEntityManager em, String realmName) throws IdentityException
+ {
+ try
+ {
+ em.getTransaction().begin();
+ HibernateRealm realm = new HibernateRealm(realmName);
+ em.persist(realm);
+
+ em.getTransaction().commit();
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to create store realm", e);
+ }
+ }
+
+
+ public HibernateRealm getRealm(HibernateEntityManager em, IdentityStoreInvocationContext ctx) throws IdentityException
+ {
+ if (ctx.getRealmId() == null)
+ {
+ throw new IllegalStateException("Realm Id not present");
+ }
+
+ HibernateRealm realm = null;
+
+ // If store is not realm aware return null to create/get objects accessible from other realms
+ if (!isRealmAware())
+ {
+ realm = (HibernateRealm)em.getSession().
+ createCriteria(HibernateRealm.class).add(Restrictions.eq("name", DEFAULT_REALM_NAME)).uniqueResult();
+
+ if (realm == null)
+ {
+ throw new IllegalStateException("Default store realm is not present: " + DEFAULT_REALM_NAME);
+ }
+
+ }
+ else
+ {
+ realm = (HibernateRealm)em.getSession().
+ createCriteria(HibernateRealm.class).add(Restrictions.eq("name", ctx.getRealmId())).uniqueResult();
+ }
+
+
+
+ return realm;
+ }
+
+ private boolean isRealmAware()
+ {
+ return isRealmAware;
+ }
+
+ private void checkControls(IdentityObjectSearchControl[] controls) throws IdentityException
+ {
+ if (controls != null)
+ {
+ for (IdentityObjectSearchControl control : controls)
+ {
+ if (!supportedSearchControls.contains(control.getClass()))
+ {
+ throw new IdentityException("IdentityObjectSearchControl not supported by this IdentityStore: " + control.getClass());
+ }
+ }
+ }
+ }
+
+
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -63,6 +63,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Arrays;
+import java.util.Collections;
import java.util.logging.Logger;
import java.util.logging.Level;
@@ -124,8 +125,16 @@
return supportedFeatures;
}
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType type) throws IdentityException
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
{
+ return createIdentityObject(invocationCtx, name, identityObjectType, null);
+ }
+
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx,
+ String name,
+ IdentityObjectType type,
+ Map<String, String[]> attributes) throws IdentityException
+ {
if (name == null)
{
throw new IdentityException("Name cannot be null");
@@ -152,6 +161,31 @@
//create attribute using provided configuration
Map<String, String[]> attributesToAdd = getTypeConfiguration(invocationCtx, type).getCreateEntryAttributeValues();
+ //merge
+ if (attributes != null)
+ {
+ for (Map.Entry<String, String[]> entry : attributes.entrySet())
+ {
+
+ if (!attributesToAdd.containsKey(entry.getKey()))
+ {
+ attributesToAdd.put(entry.getKey(), entry.getValue());
+ }
+ else
+ {
+ List<String> list1 = Arrays.asList(attributesToAdd.get(entry.getKey()));
+ List<String> list2 = Arrays.asList(entry.getValue());
+
+ list1.addAll(list2);
+
+ String[] vals = list1.toArray(new String[list1.size()]);
+
+ attributesToAdd.put(entry.getKey(), vals);
+
+ }
+ }
+ }
+
//attributes
for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
{
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -23,14 +23,23 @@
package org.jboss.identity.impl.store.hibernate;
import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.store.IdentityStore;
+import org.jboss.identity.spi.store.FeaturesMetaData;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.spi.credential.IdentityObjectCredentialType;
import org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl;
import org.jboss.identity.impl.store.hibernate.HibernateTestBase;
import org.jboss.identity.impl.store.RelationshipTypeEnum;
import org.jboss.identity.impl.store.IdentityTypeEnum;
import org.jboss.identity.impl.store.CommonIdentityStoreTest;
import org.jboss.identity.impl.store.IdentityStoreTestContext;
+import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
+import org.jboss.identity.impl.model.hibernate.HibernateRealm;
+import org.jboss.identity.exception.IdentityException;
import org.hibernate.ejb.HibernateEntityManager;
import java.util.Collection;
@@ -48,6 +57,8 @@
protected HibernateIdentityStoreImpl store;
+ protected IdentityStoreInvocationContext ctx;
+
protected CommonIdentityStoreTest commonTest;
public HibernateIdentityStoreTestCase(String testName)
@@ -56,6 +67,8 @@
commonTest = new CommonIdentityStoreTest(this);
}
+
+
@Override
protected void setUp() throws Exception
{
@@ -68,11 +81,74 @@
{
return em;
}
+
+ @Override
+ public FeaturesMetaData getSupportedFeatures()
+ {
+ return new FeaturesMetaData()
+ {
+ public boolean isControlSupported(IdentityObjectType identityObjectType, IdentityObjectSearchControl control)
+ {
+ return true;
+ }
+
+ public boolean isControlSupported(IdentityObjectType identityObjectType, Class controlClazz)
+ {
+ return true;
+ }
+
+ public Set<String> getSupportedIdentityObjectTypes()
+ {
+ return null;
+ }
+
+ public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
+ {
+ return true;
+ }
+
+ public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException
+ {
+ return true;
+ }
+
+ public Set<String> getSupportedRelationshipTypes()
+ {
+ return null;
+ }
+
+ public boolean isCredentialSupported(IdentityObjectType identityObjectType, IdentityObjectCredentialType credentialType)
+ {
+ return true;
+ }
+ };
+ }
};
+ ctx = new IdentityStoreInvocationContext()
+ {
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return null;
+ }
+
+ public String getRealmId()
+ {
+ return "testRealm";
+ }
+ };
+
populateIdentityTypes();
populateRelationshipTypes();
+ em.getTransaction().begin();
+
+ HibernateRealm realm = new HibernateRealm(HibernateIdentityStoreImpl.DEFAULT_REALM_NAME);
+ em.persist(realm);
+
+ em.getTransaction().commit();
+
+
}
private void populateRelationshipTypes() throws Exception
@@ -85,7 +161,7 @@
for (int i = 0; i < types.length; i++)
{
RelationshipTypeEnum type = types[i];
- store.addIdentityObjectRelationshipType(null, type);
+ store.addIdentityObjectRelationshipType(ctx, type);
}
em.getTransaction().commit();
@@ -101,7 +177,7 @@
for (int i = 0; i < types.length; i++)
{
IdentityTypeEnum type = types[i];
- store.addIdentityObjectType(null, type);
+ store.addIdentityObjectType(ctx, type);
}
em.getTransaction().commit();
@@ -130,7 +206,7 @@
public IdentityStoreInvocationContext getCtx()
{
- return null;
+ return ctx;
}
// Tests
@@ -154,8 +230,8 @@
em.getTransaction().begin();
- IdentityObject user1 = store.createIdentityObject(null, "Adam", IdentityTypeEnum.USER);
- IdentityObject user2 = store.createIdentityObject(null, "Eva", IdentityTypeEnum.USER);
+ IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+ IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
em.flush();
@@ -164,11 +240,11 @@
attrs.put("key1", new String[]{"val1", "val2", "val3"});
attrs.put("key2", new String[]{"val1", "val2", "val3", "val4"});
- store.addAttributes(null, user1, attrs);
+ store.addAttributes(ctx, user1, attrs);
em.flush();
- Map<String, String[]> persistedAttrs = store.getAttributes(null, user1);
+ Map<String, String[]> persistedAttrs = store.getAttributes(ctx, user1);
assertEquals(2, persistedAttrs.keySet().size());
@@ -184,11 +260,11 @@
attrs.put("key3", new String[]{"val1"});
- store.addAttributes(null, user1, attrs);
+ store.addAttributes(ctx, user1, attrs);
em.flush();
- persistedAttrs = store.getAttributes(null, user1);
+ persistedAttrs = store.getAttributes(ctx, user1);
assertEquals(3, persistedAttrs.keySet().size());
@@ -205,11 +281,11 @@
attrs.put("key3", new String[]{"val2"});
- store.addAttributes(null, user1, attrs);
+ store.addAttributes(ctx, user1, attrs);
em.flush();
- persistedAttrs = store.getAttributes(null, user1);
+ persistedAttrs = store.getAttributes(ctx, user1);
assertEquals(3, persistedAttrs.keySet().size());
@@ -218,11 +294,11 @@
em.flush();
- store.updateAttributes(null, user1, attrs);
+ store.updateAttributes(ctx, user1, attrs);
em.flush();
- persistedAttrs = store.getAttributes(null, user1);
+ persistedAttrs = store.getAttributes(ctx, user1);
assertEquals(3, persistedAttrs.keySet().size());
@@ -233,11 +309,11 @@
Set<String> names = new HashSet<String>();
names.add("key3");
- store.removeAttributes(null, user1, new String[] {"key3"});
+ store.removeAttributes(ctx, user1, new String[] {"key3"});
em.flush();
- persistedAttrs = store.getAttributes(null, user1);
+ persistedAttrs = store.getAttributes(ctx, user1);
assertEquals(2, persistedAttrs.keySet().size());
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -32,6 +32,7 @@
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
+import org.jboss.identity.impl.model.hibernate.HibernateRealm;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -48,6 +49,8 @@
em.getTransaction().begin();
+ HibernateRealm realm = new HibernateRealm("default");
+ em.persist(realm);
//
@@ -60,6 +63,7 @@
HibernateIdentityObject io = new HibernateIdentityObject();
io.setName("John Kowalski");
+ io.setRealm(realm);
io.setIdentityType(iot);
em.persist(io);
@@ -108,23 +112,26 @@
em.getTransaction().begin();
+ HibernateRealm realm = new HibernateRealm("default");
+ em.persist(realm);
+
HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
em.persist(groupType);
HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
em.persist(userType);
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
em.persist(user1);
- HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
em.persist(user2);
- HibernateIdentityObject user3 = new HibernateIdentityObject("user3", userType);
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user3", userType, realm);
em.persist(user3);
- HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType);
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
em.persist(group1);
- HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
em.persist(group2);
- HibernateIdentityObject group3 = new HibernateIdentityObject("group3", groupType);
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group3", groupType, realm);
em.persist(group3);
HibernateIdentityObjectRelationshipType memberType = new HibernateIdentityObjectRelationshipType("member");
@@ -167,14 +174,17 @@
em.getTransaction().begin();
+ HibernateRealm realm = new HibernateRealm("default");
+ em.persist(realm);
+
HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
em.persist(groupType);
HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
em.persist(userType);
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
em.persist(user1);
- HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
em.persist(user2);
em.getTransaction().commit();
@@ -183,7 +193,7 @@
try
{
- HibernateIdentityObject user3 = new HibernateIdentityObject("user2", userType);
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user2", userType, realm);
em.persist(user3);
// Should fail
@@ -199,13 +209,13 @@
em.getTransaction().begin();
- HibernateIdentityObject user4 = new HibernateIdentityObject("group1", userType);
+ HibernateIdentityObject user4 = new HibernateIdentityObject("group1", userType, realm);
em.persist(user4);
- HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType);
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
em.persist(group1);
- HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
em.persist(group2);
em.flush();
@@ -213,7 +223,7 @@
try
{
- HibernateIdentityObject group3 = new HibernateIdentityObject("group2", groupType);
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group2", groupType, realm);
em.persist(group3);
// Should fail
@@ -227,7 +237,7 @@
em.getTransaction().begin();
- HibernateIdentityObject group4 = new HibernateIdentityObject("user1", groupType);
+ HibernateIdentityObject group4 = new HibernateIdentityObject("user1", groupType, realm);
em.persist(group4);
em.getTransaction().commit();
@@ -244,9 +254,12 @@
em.getTransaction().begin();
+ HibernateRealm realm = new HibernateRealm("default");
+ em.persist(realm);
+
HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
em.persist(userType);
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
em.persist(user1);
Set<String> values1 = new HashSet<String>();
@@ -264,7 +277,7 @@
em.getTransaction().begin();
- user1 = em.find(HibernateIdentityObject.class, user1.getId());
+ user1 = em.find(HibernateIdentityObject.class, new Long(user1.getId()));
assertEquals(2, user1.getAttributes().entrySet().size() );
assertNotNull(user1.getAttributes().get("simple1"));
assertEquals(3, user1.getAttributes().get("simple1").length);
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateTestBase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateTestBase.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateTestBase.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -42,7 +42,7 @@
{
private static Logger logger = Logger.getLogger(HibernateModelTestCase.class.getName());
- private HibernateTestSupport hibernateSupport = new HibernateTestSupport("unit-testing-jpa", "jboss-identity-model");
+ private HibernateTestSupport hibernateSupport = new HibernateTestSupport("unit-testing-jpa", "jboss-identity-model1");
protected HibernateEntityManager em;
Modified: trunk/identity-impl/src/test/resources/META-INF/persistence.xml
===================================================================
--- trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-11-18 21:49:18 UTC (rev 123)
@@ -9,6 +9,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateRealm</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObject</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectAttribute</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType</class>
@@ -22,7 +23,7 @@
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa1"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
- <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
</properties>
@@ -34,6 +35,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateRealm</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObject</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectAttribute</class>
<class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType</class>
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-18 21:49:18 UTC (rev 123)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Collection;
import java.util.Set;
+import java.util.Map;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -76,10 +77,25 @@
* @return
* @throws IdentityException
*/
- IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException;
+ IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx,
+ String name,
+ IdentityObjectType identityObjectType) throws IdentityException;
+ /**
+ * Create new identity with a given name
+ *
+ * @param invocationCtx
+ * @param name
+ * @param identityObjectType
+ * @return
+ * @throws IdentityException
+ */
+ IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx,
+ String name,
+ IdentityObjectType identityObjectType,
+ Map<String, String[]> attributes) throws IdentityException;
- //TODO: create method with a set of attributes (for required attrs)
+
/**
Modified: trunk/parent/pom.xml
===================================================================
--- trunk/parent/pom.xml 2008-11-12 14:36:05 UTC (rev 122)
+++ trunk/parent/pom.xml 2008-11-18 21:49:18 UTC (rev 123)
@@ -45,7 +45,7 @@
<disableXmlReport>false</disableXmlReport>
<testFailureIgnore>false</testFailureIgnore>
<includes>
- <include>**/APITestCase.java</include>
+ <include>**/*TestCase.java</include>
</includes>
<forkMode>pertest</forkMode>
<argLine>${surefire.jvm.args}</argLine>
15 years, 5 months
JBoss Identity SVN: r122 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/api and 18 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-11-12 09:36:05 -0500 (Wed, 12 Nov 2008)
New Revision: 122
Added:
trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java
Removed:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
trunk/identity-impl/src/test/resources/identity-config.xml
trunk/identity-impl/src/test/resources/identity-config.xsd
trunk/identity-impl/src/test/resources/organization-test-config.xml
trunk/identity-impl/src/test/resources/test-config.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
Log:
another code backup
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -124,7 +124,7 @@
*
* @param identity
* @param attributeName
- * @param values
+ * @param value
* @throws org.jboss.identity.exception.IdentityException
*/
void addAttribute(IdentityType identity, String attributeName, String value)
@@ -136,7 +136,7 @@
* @param identity
* @param attributes
*/
- void removeAttributes(IdentityType identity, Set<String> attributes)
+ void removeAttributes(IdentityType identity, String[] attributes)
throws IdentityException;
/**
@@ -162,5 +162,27 @@
* @throws IdentityException
*/
void updatePasswordAttribute(Identity identity, String password) throws IdentityException;
-
+
+ /**
+ *
+ * @param identity
+ * @param credentialType
+ */
+ void hasCredential(Identity identity, CredentialType credentialType);
+
+ /**
+ *
+ * @param identity
+ * @param credentials
+ * @return
+ */
+ boolean validateCredentials(Identity identity, Credential[] credentials);
+
+ /**
+ *
+ * @param identity
+ * @param credential
+ */
+ void updateCredential(Identity identity, Credential credential);
+
}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Credential.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -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.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Credential
+{
+ /**
+ *
+ * @return
+ */
+ CredentialType getType();
+}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/CredentialType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -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.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface CredentialType
+{
+ /**
+ *
+ * @return
+ */
+ String getName();
+}
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySearchControl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentitySearchControl
+{
+}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentityType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -36,7 +36,7 @@
/**
* @return id of this IdentityType object
*/
- Object getId();
+ String getId();
/**
* @return the name of the IdentityType
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -122,43 +122,25 @@
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
- Identity findIdentity(Object id) throws IdentityException;
+ Identity findIdentityById(String id) throws IdentityException;
- /**
- * Find identities with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated
- * parameters will take no effect
- *
- * @param filterName can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
- * @return
- * @throws org.jboss.identity.exception.IdentityException
- */
- Collection<Identity> findIdentity(String filterName, int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ //Collection<Identity> findIdentity(String filterName, int offset, int limit,
+// boolean orderedByName,
+// boolean ascending) throws IdentityException;
+
+// Collection<Identity> findIdentity(String filterName, Map<String, String[]> attributes,
+// int offset, int limit,
+// boolean orderedByName, boolean ascending) throws IdentityException;
+
+
/**
- * Find identities with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported, dedicated parameters will take no effect
*
- * @param filterName can be null
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
+ * @param controls
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Identity> findIdentity(String filterName, Map<String, String[]> attributes,
- int offset, int limit,
- boolean orderedByName, boolean ascending) throws IdentityException;
+ Collection<Identity> findIdentity(IdentitySearchControl[] controls) throws IdentityException;
// Search Groups
@@ -179,46 +161,36 @@
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
- Group findGroup(Object id) throws IdentityException;
+ Group findGroupById(String id) throws IdentityException;
+
/**
- * Find group with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported, dedicated
- * parameters will take no effect
*
* @param groupType
- * @param filterName can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName can be null
- * @param ascending
+ * @param controls
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Group> findGroup(GroupType groupType, String filterName,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[] controls) throws IdentityException;
/**
- * Find group with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported, dedicated parameters will take no effect
- *
+ *
* @param groupType
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName can be null
- * @param ascending
* @return
- * @throws org.jboss.identity.exception.IdentityException
+ * @throws IdentityException
*/
- Collection<Group> findGroup(GroupType groupType, Map<String, String[]> attributes,
- int offset, int limit,
- boolean orderedByName, boolean ascending) throws IdentityException;
+ Collection<Group> findGroup(GroupType groupType) throws IdentityException;
+
+// Collection<Group> findGroup(GroupType groupType, String filterName,
+// int offset, int limit,
+// boolean orderedByName,
+// boolean ascending) throws IdentityException;
+
+// Collection<Group> findGroup(GroupType groupType, Map<String, String[]> attributes,
+// int offset, int limit,
+// boolean orderedByName, boolean ascending) throws IdentityException;
+
/**
* Whether Identity is a virtual
* (such as a pseudonym)
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -136,21 +136,50 @@
* relationship - default is true (parent)
* @param inherited if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
* Default is false
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Group group,
GroupType groupType,
boolean parent,
+ boolean inherited) throws IdentityException;
+
+ /**
+ * Find groups that are associated with given group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect. If 'parent' parameter is set to false, all parent group will be returned. If parent parameter is
+ * set to true and 'inherited' is set to true all nested subgroubs will be returned.
+ *
+ * @param group parent group
+ * @param groupType can be null
+ * @param parent defines if given identity is parent or child side in the
+ * relationship - default is true (parent)
+ * @param inherited if true also identities from subgroubs will be retreived. Matters only when parent is set to true.
+ * Default is false
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Group group,
+ GroupType groupType,
+ boolean parent,
boolean inherited,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws IdentityException;
+ /**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param identity child identity
+ * @param groupType can be null
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Identity identity,
+ GroupType groupType) throws IdentityException;
+
/**
* Find all groups that given identity is associated with.
* If the paginatedSearch or orderedSearch operations
@@ -159,18 +188,12 @@
*
* @param identity child identity
* @param groupType can be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Identity identity,
- GroupType groupType,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ GroupType groupType,
+ IdentitySearchControl[] controls) throws IdentityException;
/**
* Find all groups that given identity is associated with.
@@ -179,19 +202,25 @@
* take no effect
*
* @param identity child identity
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Group> findAssociatedGroups(Identity identity,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws IdentityException;
/**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param identity child identity
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Identity identity) throws IdentityException;
+
+ /**
* Find identities that have relationship with given parent group.
* If the paginatedSearch or orderedSearch operations
* are not supported in this store implementation, dedicated parameters will
@@ -199,18 +228,26 @@
*
* @param group parent group
* @param inherited if true also identities from subgroubs will be retrieved. Default is false
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderedByName
- * @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
*/
Collection<Identity> findAssociatedIdentities(Group group,
+ boolean inherited) throws IdentityException;
+
+ /**
+ * Find identities that have relationship with given parent group.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported in this store implementation, dedicated parameters will
+ * take no effect
+ *
+ * @param group parent group
+ * @param inherited if true also identities from subgroubs will be retrieved. Default is false
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Identity> findAssociatedIdentities(Group group,
boolean inherited,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws IdentityException;
}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -82,16 +82,10 @@
/**
* Find all RoleType objects stored
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls) throws IdentityException;
// Role
@@ -137,63 +131,73 @@
* Find RoleType objects for roles associated with a given Identity and Group
* @param identity
* @param group
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
Collection<RoleType> findRoleTypes(Identity identity, Group group,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws IdentityException;
/**
+ * Find RoleType objects for roles associated with a given Identity and Group
+ * @param identity
+ * @param group
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findRoleTypes(Identity identity, Group group) throws IdentityException;
+
+ /**
* Find RoleType objects for roles associated with a given Identity
* @param identity
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
- Collection<RoleType> findIdentityRoleTypes(Identity identity,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ Collection<RoleType> findIdentityRoleTypes(Identity identity) throws IdentityException;
+ /**
+ * Find RoleType objects for roles associated with a given Identity
+ * @param identity
+ * @return
+ * @throws IdentityException
+ */
+ Collection<RoleType> findIdentityRoleTypes(Identity identity, IdentitySearchControl[] controls) throws IdentityException;
+
/**
* Find RoleType objects for roles associated with a given Group
* @param group
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
+ Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException;
+
+ /**
+ * Find RoleType objects for roles associated with a given Group
+ * @param group
+ * @return
+ * @throws IdentityException
+ */
Collection<RoleType> findGroupRoleTypes(Group group,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
-
+ IdentitySearchControl[] controls) throws IdentityException;
+
/**
* Find Role objects with a given RoleType associated with a given IdentityType
* @param identityType
* @param roleType
- * @param offset
- * @param limit
- * @param orderedByName
- * @param ascending
* @return
* @throws IdentityException
*/
<T extends IdentityType> Collection<Role> findRoles(T identityType,
+ RoleType roleType) throws IdentityException;
+
+ /**
+ * Find Role objects with a given RoleType associated with a given IdentityType
+ * @param identityType
+ * @param roleType
+ * @return
+ * @throws IdentityException
+ */
+ <T extends IdentityType> Collection<Role> findRoles(T identityType,
RoleType roleType,
- int offset, int limit,
- boolean orderedByName,
- boolean ascending) throws IdentityException;
+ IdentitySearchControl[] controls) throws IdentityException;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AbstractManager.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -27,12 +27,17 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.GroupType;
import org.jboss.identity.api.IdentityType;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.spi.repository.IdentityStoreRepository;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.impl.types.SimpleIdentityObject;
+import java.util.List;
+import java.util.LinkedList;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
@@ -110,6 +115,33 @@
}
+ protected IdentityObjectSearchControl[] convertSearchControls(IdentitySearchControl[] controls)
+ {
+ if (controls == null)
+ {
+ return null;
+ }
+
+ //TODO: simples check
+ List<IdentityObjectSearchControl> result = new LinkedList<IdentityObjectSearchControl>();
+
+ for (IdentitySearchControl control : controls)
+ {
+ if (control instanceof IdentityObjectSearchControl)
+ {
+ result.add((IdentityObjectSearchControl)control);
+ }
+ }
+
+ if (result.size() == 0)
+ {
+ return null;
+ }
+
+ return result.toArray(new IdentityObjectSearchControl[result.size()]);
+
+ }
+
protected IdentityObjectType getIdentityObjectType()
{
return getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -27,13 +27,14 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.Identity;
import org.jboss.identity.api.AttributeDescription;
+import org.jboss.identity.api.CredentialType;
+import org.jboss.identity.api.Credential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.NotYetImplementedException;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
-import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -56,8 +57,6 @@
return null;
}
- //TODO: fix to have similar signatures in API/SPI for String[] and avoid unnesesary iterations
-
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException
{
return getRepository().getSupportedAttributeNames(getInvocationContext(), createIdentityObject(identityType).getIdentityType());
@@ -65,35 +64,13 @@
public Map<String, String[]> getAttributes(IdentityType identity) throws IdentityException
{
- Map<String, Set<String>> attributes = getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
-
- Map<String, String[]> attrs = new HashMap<String, String[]>();
-
- for (Map.Entry<String, Set<String>> entry : attributes.entrySet())
- {
- attrs.put(entry.getKey(), entry.getValue().toArray(new String[entry.getValue().size()]));
- }
-
- return attrs;
+ return getRepository().getAttributes(getInvocationContext(), createIdentityObject(identity));
}
public void updateAttributes(IdentityType identity, Map<String, String[]> attributes) throws IdentityException
{
- Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
+ getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), attributes);
- for (Map.Entry<String, String[]> entry : attributes.entrySet())
- {
- Set<String> vals = new HashSet<String>();
- for (String s : entry.getValue())
- {
- vals.add(s);
- }
-
- attrs.put(entry.getKey(),vals);
- }
-
- getRepository().updateAttributes(getInvocationContext(), createIdentityObject(identity), attrs);
-
}
public String[] getAttributeValues(IdentityType identity, String attributeName) throws IdentityException
@@ -121,23 +98,10 @@
public void addAttributes(IdentityType identity, Map<String, String[]> attributes) throws IdentityException
{
- Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
-
- for (Map.Entry<String, String[]> entry : attributes.entrySet())
- {
- Set<String> vals = new HashSet<String>();
- for (String s : entry.getValue())
- {
- vals.add(s);
- }
-
- attrs.put(entry.getKey(),vals);
- }
-
- getRepository().addAttributes(getInvocationContext(), createIdentityObject(identity), attrs);
+ getRepository().addAttributes(getInvocationContext(), createIdentityObject(identity), attributes);
}
- public void removeAttributes(IdentityType identity, Set<String> attributes) throws IdentityException
+ public void removeAttributes(IdentityType identity, String[] attributes) throws IdentityException
{
getRepository().removeAttributes(getInvocationContext(), createIdentityObject(identity), attributes);
@@ -160,4 +124,22 @@
//TODO:NYI
throw new NotYetImplementedException();
}
+
+ public void hasCredential(Identity identity, CredentialType credentialType)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
+
+ public boolean validateCredentials(Identity identity, Credential[] credentials)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
+
+ public void updateCredential(Identity identity, Credential credential)
+ {
+ //TODO:NYI
+ throw new NotYetImplementedException();
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -29,6 +29,7 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.IdentitySession;
import org.jboss.identity.api.PersistenceManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObject;
@@ -110,29 +111,16 @@
return createIdentity(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType()));
}
- public Identity findIdentity(Object id) throws IdentityException
+ public Identity findIdentityById(String id) throws IdentityException
{
return createIdentity(getRepository().findIdentityObject(getInvocationContext(), id));
}
- public Collection<Identity> findIdentity(String filterName, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Identity> findIdentity(IdentitySearchControl[] controls) throws IdentityException
{
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(), filterName, offset, limit, orderedByName, ascending);
- List<Identity> identities = new LinkedList<Identity>();
- for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- identities.add(createIdentity(identityObject));
- }
- return identities;
-
- }
-
- public Collection<Identity> findIdentity(String filterName, Map<String, String[]> attributes, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
- {
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(), attributes, offset, limit, orderedByName, ascending);
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(), convertSearchControls(controls));
List<Identity> identities = new LinkedList<Identity>();
for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
@@ -149,14 +137,14 @@
return createGroup(getRepository().findIdentityObject(getInvocationContext(), name, getIdentityObjectType(groupType)));
}
- public Group findGroup(Object id) throws IdentityException
+ public Group findGroupById(String id) throws IdentityException
{
return createGroup(getRepository().findIdentityObject(getInvocationContext(), id));
}
- public Collection<Group> findGroup(GroupType groupType, String filterName, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findGroup(GroupType groupType, IdentitySearchControl[] controls) throws IdentityException
{
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), filterName, offset, limit, orderedByName, ascending);
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), convertSearchControls(controls));
List<Group> groups = new LinkedList<Group>();
for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
@@ -168,18 +156,9 @@
return groups;
}
- public Collection<Group> findGroup(GroupType groupType, Map<String, String[]> attributes, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findGroup(GroupType groupType) throws IdentityException
{
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), getIdentityObjectType(groupType), attributes, offset, limit, orderedByName, ascending);
- List<Group> groups = new LinkedList<Group>();
-
- for (Iterator<IdentityObject> iterator = ios.iterator(); iterator.hasNext();)
- {
- IdentityObject identityObject = iterator.next();
- groups.add(createGroup(identityObject));
- }
-
- return groups;
+ return findGroup(groupType, null);
}
public boolean isVirtual(Identity identity)
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -29,6 +29,7 @@
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.GroupType;
import org.jboss.identity.api.RelationshipManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -184,15 +185,17 @@
return isAssociated(parents, members);
}
- public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited, IdentitySearchControl[] controls) throws IdentityException
{
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = getIdentityObjectType(groupType);
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, offset, limit, false, false);
+ //TODO inherited
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, parent, convertSearchControls(controls));
+
for (IdentityObject io : ios)
{
if (io.getIdentityType().getName().equals(iot.getName()))
@@ -205,13 +208,18 @@
}
- public Collection<Group> findAssociatedGroups(Identity identity, GroupType groupType, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited) throws IdentityException
{
+ return findAssociatedGroups(group, groupType, parent, inherited, null);
+ }
+
+ public Collection<Group> findAssociatedGroups(Identity identity, GroupType groupType, IdentitySearchControl[] controls) throws IdentityException
+ {
List<Group> identities = new LinkedList<Group>();
IdentityObjectType iot = getIdentityObjectType(groupType);
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, offset, limit, false, false);
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -224,11 +232,16 @@
return identities;
}
- public Collection<Group> findAssociatedGroups(Identity identity, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Identity identity, GroupType groupType) throws IdentityException
{
+ return findAssociatedGroups(identity, groupType, null);
+ }
+
+ public Collection<Group> findAssociatedGroups(Identity identity, IdentitySearchControl[] controls) throws IdentityException
+ {
List<Group> identities = new LinkedList<Group>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, offset, limit, false, false);
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, convertSearchControls(controls));
for (IdentityObject io : ios)
{
@@ -238,14 +251,19 @@
return identities;
}
+ public Collection<Group> findAssociatedGroups(Identity identity) throws IdentityException
+ {
+ return findAssociatedGroups(identity, new IdentitySearchControl[] {});
+ }
-
- public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, IdentitySearchControl[] controls) throws IdentityException
{
List<Identity> identities = new LinkedList<Identity>();
- Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, offset, limit, false, false);
+ //TODO inherited
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, convertSearchControls(controls));
+
for (IdentityObject io : ios)
{
identities.add(createIdentity(io));
@@ -253,4 +271,9 @@
return identities;
}
+
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited) throws IdentityException
+ {
+ return findAssociatedIdentities(group, inherited, null);
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -30,6 +30,7 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.RoleManagerFeaturesDescription;
+import org.jboss.identity.api.IdentitySearchControl;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -101,7 +102,7 @@
{
try
{
- Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), 0, 0, false, false);
+ Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), null);
if (names.contains(name))
{
return new SimpleRoleType(name);
@@ -115,12 +116,12 @@
return null;
}
- public Collection<RoleType> findRoleTypes(int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findRoleTypes(IdentitySearchControl[] controls) throws IdentityException
{
try
{
- Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), offset, limit, orderedByName, ascending);
+ Set<String> names = getRepository().getRelationshipNames(getInvocationContext(), convertSearchControls(controls));
Set<RoleType> types = new HashSet<RoleType>();
for (String name : names)
@@ -175,8 +176,13 @@
return false;
}
- public Collection<RoleType> findRoleTypes(Identity identity, Group group, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findRoleTypes(Identity identity, Group group) throws IdentityException
{
+ return findRoleTypes(identity, group, null);
+ }
+
+ public Collection<RoleType> findRoleTypes(Identity identity, Group group, IdentitySearchControl[] controls) throws IdentityException
+ {
//TODO: improve IdentityStore SPI....
@@ -196,13 +202,18 @@
}
- public Collection<RoleType> findIdentityRoleTypes(Identity identity, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findIdentityRoleTypes(Identity identity) throws IdentityException
{
+ return findIdentityRoleTypes(identity, null);
+ }
+
+ public Collection<RoleType> findIdentityRoleTypes(Identity identity, IdentitySearchControl[] controls) throws IdentityException
+ {
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(identity), offset, limit, orderedByName, ascending);
+ Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(identity), convertSearchControls(controls));
for (String name : names)
{
@@ -217,18 +228,20 @@
throw new IdentityException("Role management not supported");
}
+ }
-
-
+ public Collection<RoleType> findGroupRoleTypes(Group group) throws IdentityException
+ {
+ return findGroupRoleTypes(group, null);
}
- public Collection<RoleType> findGroupRoleTypes(Group group, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public Collection<RoleType> findGroupRoleTypes(Group group, IdentitySearchControl[] controls) throws IdentityException
{
Set<RoleType> types = new HashSet<RoleType>();
try
{
- Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group), offset, limit, orderedByName, ascending);
+ Collection<String> names = getRepository().getRelationshipNames(getInvocationContext(), createIdentityObject(group), convertSearchControls(controls));
for (String name : names)
{
@@ -245,8 +258,13 @@
}
- public <T extends IdentityType> Collection<Role> findRoles(T identityType, RoleType roleType, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ public <T extends IdentityType> Collection<Role> findRoles(T identityType, RoleType roleType) throws IdentityException
{
+ return findRoles(identityType, roleType, null);
+ }
+
+ public <T extends IdentityType> Collection<Role> findRoles(T identityType, RoleType roleType, IdentitySearchControl[] controls) throws IdentityException
+ {
throw new NotYetImplementedException();
}
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -24,7 +24,6 @@
import org.jboss.identity.api.Group;
import org.jboss.identity.api.GroupType;
-import org.jboss.identity.spi.model.IdentityObject;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -34,11 +33,11 @@
{
private final String name;
- private final Object id;
+ private final String id;
private final GroupType groupType;
- public SimpleGroupImpl(String name, Object id, GroupType groupType)
+ public SimpleGroupImpl(String name, String id, GroupType groupType)
{
this.name = name;
this.id = id;
@@ -55,7 +54,7 @@
return groupType;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -32,10 +32,10 @@
{
private final String name;
- private final Object id;
+ private final String id;
- public SimpleIdentityImpl(String name, Object id)
+ public SimpleIdentityImpl(String name, String id)
{
this.name = name;
this.id = id;
@@ -51,7 +51,7 @@
return false;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -64,7 +64,7 @@
public abstract class JAXB2IdentityConfiguration
{
- //TODO: check if configuration is consistent
+ //TODO: check if configuration is consistent. Part of constraints should be checked by schema. Test cases needed :)
public static IdentityConfigurationMetaData createConfigurationMetaData(File xmlConfig) throws IdentityConfigurationException
@@ -118,17 +118,17 @@
RealmConfigurationMetaDataImpl realmMD = new RealmConfigurationMetaDataImpl();
realmMD.setId(realmType.getId());
- if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ if (realmType.getIdentityTypeMappings() != null)
{
- realmMD.setIdentityMapping(realmType.getRealmConfiguration().getIdentityTypeMappings().getIdentityMapping());
+ realmMD.setIdentityMapping(realmType.getIdentityTypeMappings().getIdentityMapping());
}
realmMD.setIdentityRepositoryIdRef(realmType.getRepositoryIdRef());
Map<String, String> groupMappings = new HashMap<String, String>();
- if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ if (realmType.getIdentityTypeMappings() != null)
{
- for (GroupTypeMappingType groupTypeMappingType : realmType.getRealmConfiguration().getIdentityTypeMappings().getGroupTypeMapping())
+ for (GroupTypeMappingType groupTypeMappingType : realmType.getIdentityTypeMappings().getGroupTypeMapping())
{
groupMappings.put(groupTypeMappingType.getGroupTypeName(), groupTypeMappingType.getIdentityObjectTypeName());
}
@@ -136,7 +136,7 @@
realmMD.setGroupTypeMappings(groupMappings);
- realmMD.setOptions(createOptions(realmType.getRealmConfiguration().getOptions()));
+ realmMD.setOptions(createOptions(realmType.getOptions()));
return realmMD;
@@ -149,16 +149,16 @@
repoMD.setId(repositoryType.getId());
repoMD.setClassName(repositoryType.getClazz());
- if (repositoryType.getRepositoryConfiguration().getExternalConfig() != null)
+ if (repositoryType.getExternalConfig() != null)
{
- repoMD.setExternalConfig(repositoryType.getRepositoryConfiguration().getExternalConfig().getValue());
+ repoMD.setExternalConfig(repositoryType.getExternalConfig().getValue());
}
- repoMD.setDefaultAttributeStroeId(repositoryType.getRepositoryConfiguration().getDefaultAttributeStoreId());
- repoMD.setDefaultIdentityStoreId(repositoryType.getRepositoryConfiguration().getDefaultIdentityStoreId());
+ repoMD.setDefaultAttributeStroeId(repositoryType.getDefaultAttributeStoreId());
+ repoMD.setDefaultIdentityStoreId(repositoryType.getDefaultIdentityStoreId());
List<IdentityStoreMappingMetaData> storeMappings = new LinkedList<IdentityStoreMappingMetaData>();
- for (IdentityStoreMappingType identityStoreMappingType : repositoryType.getRepositoryConfiguration().getIdentityStoreMappings().getIdentityStoreMapping())
+ for (IdentityStoreMappingType identityStoreMappingType : repositoryType.getIdentityStoreMappings().getIdentityStoreMapping())
{
IdentityStoreMappingMetaDataImpl mapping = new IdentityStoreMappingMetaDataImpl();
@@ -171,7 +171,7 @@
repoMD.setIdentityStoreToIdentityObjectTypeMappings(storeMappings);
- repoMD.setOptions(createOptions(repositoryType.getRepositoryConfiguration().getOptions()));
+ repoMD.setOptions(createOptions(repositoryType.getOptions()));
return repoMD;
@@ -184,14 +184,14 @@
storeMD.setId(identityStoreType.getId());
storeMD.setClassName(identityStoreType.getClazz());
- if (identityStoreType.getIdentityStoreConfiguration().getExternalConfig() != null)
+ if (identityStoreType.getExternalConfig() != null)
{
- storeMD.setExternalConfig(identityStoreType.getIdentityStoreConfiguration().getExternalConfig().getValue());
+ storeMD.setExternalConfig(identityStoreType.getExternalConfig().getValue());
}
- storeMD.setSupportedRelationshipTypes(identityStoreType.getIdentityStoreConfiguration().getSupportedRelationshipTypes().getRelationshipType());
+ storeMD.setSupportedRelationshipTypes(identityStoreType.getSupportedRelationshipTypes().getRelationshipType());
- for (IdentityObjectTypeType identityObjectTypeType : identityStoreType.getIdentityStoreConfiguration().getSupportedIdentityObjectTypes().getIdentityObjectType())
+ for (IdentityObjectTypeType identityObjectTypeType : identityStoreType.getSupportedIdentityObjectTypes().getIdentityObjectType())
{
IdentityObjectTypeMetaDataImpl identityObjectTypeMD = new IdentityObjectTypeMetaDataImpl();
@@ -246,7 +246,7 @@
Map<String, List<String>> options = new HashMap<String, List<String>>();
- for (OptionType optionType : identityStoreType.getIdentityStoreConfiguration().getOptions().getOption())
+ for (OptionType optionType : identityStoreType.getOptions().getOption())
{
options.put(optionType.getName(), optionType.getValue());
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -1,224 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for identity-store-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="identity-store-configurationType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType"/>
- * <element name="supported-relationship-types" type="{urn:jboss:identity:config:v0_1}supported-relationship-typesType"/>
- * <element name="supported-identity-object-types" type="{urn:jboss:identity:config:v0_1}supported-identity-object-typesType"/>
- * <element name="options">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "identity-store-configurationType", propOrder = {
- "externalConfig",
- "supportedRelationshipTypes",
- "supportedIdentityObjectTypes",
- "options"
-})
-public class IdentityStoreConfigurationType {
-
- @XmlElement(name = "external-config", required = true)
- protected ExternalConfigType externalConfig;
- @XmlElement(name = "supported-relationship-types", required = true)
- protected SupportedRelationshipTypesType supportedRelationshipTypes;
- @XmlElement(name = "supported-identity-object-types", required = true)
- protected SupportedIdentityObjectTypesType supportedIdentityObjectTypes;
- @XmlElement(required = true)
- protected IdentityStoreConfigurationType.Options options;
-
- /**
- * Gets the value of the externalConfig property.
- *
- * @return
- * possible object is
- * {@link ExternalConfigType }
- *
- */
- public ExternalConfigType getExternalConfig() {
- return externalConfig;
- }
-
- /**
- * Sets the value of the externalConfig property.
- *
- * @param value
- * allowed object is
- * {@link ExternalConfigType }
- *
- */
- public void setExternalConfig(ExternalConfigType value) {
- this.externalConfig = value;
- }
-
- /**
- * Gets the value of the supportedRelationshipTypes property.
- *
- * @return
- * possible object is
- * {@link SupportedRelationshipTypesType }
- *
- */
- public SupportedRelationshipTypesType getSupportedRelationshipTypes() {
- return supportedRelationshipTypes;
- }
-
- /**
- * Sets the value of the supportedRelationshipTypes property.
- *
- * @param value
- * allowed object is
- * {@link SupportedRelationshipTypesType }
- *
- */
- public void setSupportedRelationshipTypes(SupportedRelationshipTypesType value) {
- this.supportedRelationshipTypes = value;
- }
-
- /**
- * Gets the value of the supportedIdentityObjectTypes property.
- *
- * @return
- * possible object is
- * {@link SupportedIdentityObjectTypesType }
- *
- */
- public SupportedIdentityObjectTypesType getSupportedIdentityObjectTypes() {
- return supportedIdentityObjectTypes;
- }
-
- /**
- * Sets the value of the supportedIdentityObjectTypes property.
- *
- * @param value
- * allowed object is
- * {@link SupportedIdentityObjectTypesType }
- *
- */
- public void setSupportedIdentityObjectTypes(SupportedIdentityObjectTypesType value) {
- this.supportedIdentityObjectTypes = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link IdentityStoreConfigurationType.Options }
- *
- */
- public IdentityStoreConfigurationType.Options getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link IdentityStoreConfigurationType.Options }
- *
- */
- public void setOptions(IdentityStoreConfigurationType.Options value) {
- this.options = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "option"
- })
- public static class Options {
-
- protected List<OptionType> option;
-
- /**
- * Gets the value of the option property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the option property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getOption().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link OptionType }
- *
- *
- */
- public List<OptionType> getOption() {
- if (option == null) {
- option = new ArrayList<OptionType>();
- }
- return this.option;
- }
-
- }
-
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,12 +2,14 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
package org.jboss.identity.impl.configuration.jaxb2.generated;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -26,7 +28,20 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="identity-store-configuration" type="{urn:jboss:identity:config:v0_1}identity-store-configurationType"/>
+ * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType"/>
+ * <element name="supported-relationship-types" type="{urn:jboss:identity:config:v0_1}supported-relationship-typesType"/>
+ * <element name="supported-identity-object-types" type="{urn:jboss:identity:config:v0_1}supported-identity-object-typesType"/>
+ * <element name="options">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +54,10 @@
@XmlType(name = "identity-storeType", propOrder = {
"id",
"clazz",
- "identityStoreConfiguration"
+ "externalConfig",
+ "supportedRelationshipTypes",
+ "supportedIdentityObjectTypes",
+ "options"
})
public class IdentityStoreType {
@@ -47,8 +65,14 @@
protected String id;
@XmlElement(name = "class", required = true)
protected String clazz;
- @XmlElement(name = "identity-store-configuration", required = true)
- protected IdentityStoreConfigurationType identityStoreConfiguration;
+ @XmlElement(name = "external-config", required = true)
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "supported-relationship-types", required = true)
+ protected SupportedRelationshipTypesType supportedRelationshipTypes;
+ @XmlElement(name = "supported-identity-object-types", required = true)
+ protected SupportedIdentityObjectTypesType supportedIdentityObjectTypes;
+ @XmlElement(required = true)
+ protected IdentityStoreType.Options options;
/**
* Gets the value of the id property.
@@ -99,27 +123,158 @@
}
/**
- * Gets the value of the identityStoreConfiguration property.
+ * Gets the value of the externalConfig property.
*
* @return
* possible object is
- * {@link IdentityStoreConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public IdentityStoreConfigurationType getIdentityStoreConfiguration() {
- return identityStoreConfiguration;
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
}
/**
- * Sets the value of the identityStoreConfiguration property.
+ * Sets the value of the externalConfig property.
*
* @param value
* allowed object is
- * {@link IdentityStoreConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public void setIdentityStoreConfiguration(IdentityStoreConfigurationType value) {
- this.identityStoreConfiguration = value;
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
}
+ /**
+ * Gets the value of the supportedRelationshipTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public SupportedRelationshipTypesType getSupportedRelationshipTypes() {
+ return supportedRelationshipTypes;
+ }
+
+ /**
+ * Sets the value of the supportedRelationshipTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public void setSupportedRelationshipTypes(SupportedRelationshipTypesType value) {
+ this.supportedRelationshipTypes = value;
+ }
+
+ /**
+ * Gets the value of the supportedIdentityObjectTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public SupportedIdentityObjectTypesType getSupportedIdentityObjectTypes() {
+ return supportedIdentityObjectTypes;
+ }
+
+ /**
+ * Sets the value of the supportedIdentityObjectTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public void setSupportedIdentityObjectTypes(SupportedIdentityObjectTypesType value) {
+ this.supportedIdentityObjectTypes = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreType.Options }
+ *
+ */
+ public IdentityStoreType.Options getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreType.Options }
+ *
+ */
+ public void setOptions(IdentityStoreType.Options value) {
+ this.options = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "option"
+ })
+ public static class Options {
+
+ protected List<OptionType> option;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link OptionType }
+ *
+ *
+ */
+ public List<OptionType> getOption() {
+ if (option == null) {
+ option = new ArrayList<OptionType>();
+ }
+ return this.option;
+ }
+
+ }
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -41,19 +41,19 @@
}
/**
- * Create an instance of {@link IdentityStoreMappingType }
+ * Create an instance of {@link RelationshipsType }
*
*/
- public IdentityStoreMappingType createIdentityStoreMappingType() {
- return new IdentityStoreMappingType();
+ public RelationshipsType createRelationshipsType() {
+ return new RelationshipsType();
}
/**
- * Create an instance of {@link IdentityStoreType }
+ * Create an instance of {@link IdentityObjectTypeType }
*
*/
- public IdentityStoreType createIdentityStoreType() {
- return new IdentityStoreType();
+ public IdentityObjectTypeType createIdentityObjectTypeType() {
+ return new IdentityObjectTypeType();
}
/**
@@ -65,78 +65,86 @@
}
/**
- * Create an instance of {@link OptionType }
+ * Create an instance of {@link OptionsType }
*
*/
- public OptionType createOptionType() {
- return new OptionType();
+ public OptionsType createOptionsType() {
+ return new OptionsType();
}
/**
- * Create an instance of {@link AttributeType }
+ * Create an instance of {@link IdentityObjectTypeType.Options }
*
*/
- public AttributeType createAttributeType() {
- return new AttributeType();
+ public IdentityObjectTypeType.Options createIdentityObjectTypeTypeOptions() {
+ return new IdentityObjectTypeType.Options();
}
/**
- * Create an instance of {@link RepositoryType }
+ * Create an instance of {@link RepositoriesType }
*
*/
- public RepositoryType createRepositoryType() {
- return new RepositoryType();
+ public RepositoriesType createRepositoriesType() {
+ return new RepositoriesType();
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Options }
+ * Create an instance of {@link IdentityObjectTypesType }
*
*/
- public IdentityObjectTypeType.Options createIdentityObjectTypeTypeOptions() {
- return new IdentityObjectTypeType.Options();
+ public IdentityObjectTypesType createIdentityObjectTypesType() {
+ return new IdentityObjectTypesType();
}
/**
- * Create an instance of {@link IdentityObjectTypesType }
+ * Create an instance of {@link SupportedRelationshipTypesType }
*
*/
- public IdentityObjectTypesType createIdentityObjectTypesType() {
- return new IdentityObjectTypesType();
+ public SupportedRelationshipTypesType createSupportedRelationshipTypesType() {
+ return new SupportedRelationshipTypesType();
}
/**
- * Create an instance of {@link StoresType }
+ * Create an instance of {@link ExternalConfigType }
*
*/
- public StoresType createStoresType() {
- return new StoresType();
+ public ExternalConfigType createExternalConfigType() {
+ return new ExternalConfigType();
}
/**
- * Create an instance of {@link RealmConfigurationType }
+ * Create an instance of {@link AttributeType }
*
*/
- public RealmConfigurationType createRealmConfigurationType() {
- return new RealmConfigurationType();
+ public AttributeType createAttributeType() {
+ return new AttributeType();
}
/**
- * Create an instance of {@link OptionsType }
+ * Create an instance of {@link RealmsType }
*
*/
- public OptionsType createOptionsType() {
- return new OptionsType();
+ public RealmsType createRealmsType() {
+ return new RealmsType();
}
/**
- * Create an instance of {@link RealmType }
+ * Create an instance of {@link AttributesType }
*
*/
- public RealmType createRealmType() {
- return new RealmType();
+ public AttributesType createAttributesType() {
+ return new AttributesType();
}
/**
+ * Create an instance of {@link IdentityObjectTypeType.Attributes }
+ *
+ */
+ public IdentityObjectTypeType.Attributes createIdentityObjectTypeTypeAttributes() {
+ return new IdentityObjectTypeType.Attributes();
+ }
+
+ /**
* Create an instance of {@link RelationshipType }
*
*/
@@ -145,51 +153,51 @@
}
/**
- * Create an instance of {@link IdentityStoreConfigurationType }
+ * Create an instance of {@link IdentityStoreType.Options }
*
*/
- public IdentityStoreConfigurationType createIdentityStoreConfigurationType() {
- return new IdentityStoreConfigurationType();
+ public IdentityStoreType.Options createIdentityStoreTypeOptions() {
+ return new IdentityStoreType.Options();
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Relationships }
+ * Create an instance of {@link IdentityStoreType }
*
*/
- public IdentityObjectTypeType.Relationships createIdentityObjectTypeTypeRelationships() {
- return new IdentityObjectTypeType.Relationships();
+ public IdentityStoreType createIdentityStoreType() {
+ return new IdentityStoreType();
}
/**
- * Create an instance of {@link AttributesType }
+ * Create an instance of {@link StoresType }
*
*/
- public AttributesType createAttributesType() {
- return new AttributesType();
+ public StoresType createStoresType() {
+ return new StoresType();
}
/**
- * Create an instance of {@link IdentityObjectTypeType }
+ * Create an instance of {@link IdentityStoreMappingType }
*
*/
- public IdentityObjectTypeType createIdentityObjectTypeType() {
- return new IdentityObjectTypeType();
+ public IdentityStoreMappingType createIdentityStoreMappingType() {
+ return new IdentityStoreMappingType();
}
/**
- * Create an instance of {@link RealmsType }
+ * Create an instance of {@link IdentityObjectTypeType.Relationships }
*
*/
- public RealmsType createRealmsType() {
- return new RealmsType();
+ public IdentityObjectTypeType.Relationships createIdentityObjectTypeTypeRelationships() {
+ return new IdentityObjectTypeType.Relationships();
}
/**
- * Create an instance of {@link SupportedIdentityObjectTypesType }
+ * Create an instance of {@link OptionType }
*
*/
- public SupportedIdentityObjectTypesType createSupportedIdentityObjectTypesType() {
- return new SupportedIdentityObjectTypesType();
+ public OptionType createOptionType() {
+ return new OptionType();
}
/**
@@ -201,19 +209,19 @@
}
/**
- * Create an instance of {@link SupportedRelationshipTypesType }
+ * Create an instance of {@link GroupTypeMappingType }
*
*/
- public SupportedRelationshipTypesType createSupportedRelationshipTypesType() {
- return new SupportedRelationshipTypesType();
+ public GroupTypeMappingType createGroupTypeMappingType() {
+ return new GroupTypeMappingType();
}
/**
- * Create an instance of {@link GroupTypeMappingType }
+ * Create an instance of {@link SupportedIdentityObjectTypesType }
*
*/
- public GroupTypeMappingType createGroupTypeMappingType() {
- return new GroupTypeMappingType();
+ public SupportedIdentityObjectTypesType createSupportedIdentityObjectTypesType() {
+ return new SupportedIdentityObjectTypesType();
}
/**
@@ -225,30 +233,14 @@
}
/**
- * Create an instance of {@link IdentityObjectTypeType.Attributes }
+ * Create an instance of {@link RealmType }
*
*/
- public IdentityObjectTypeType.Attributes createIdentityObjectTypeTypeAttributes() {
- return new IdentityObjectTypeType.Attributes();
+ public RealmType createRealmType() {
+ return new RealmType();
}
/**
- * Create an instance of {@link RelationshipsType }
- *
- */
- public RelationshipsType createRelationshipsType() {
- return new RelationshipsType();
- }
-
- /**
- * Create an instance of {@link RepositoriesType }
- *
- */
- public RepositoriesType createRepositoriesType() {
- return new RepositoriesType();
- }
-
- /**
* Create an instance of {@link IdentityStoreMappingsType }
*
*/
@@ -257,30 +249,14 @@
}
/**
- * Create an instance of {@link RepositoryConfigurationType }
+ * Create an instance of {@link RepositoryType }
*
*/
- public RepositoryConfigurationType createRepositoryConfigurationType() {
- return new RepositoryConfigurationType();
+ public RepositoryType createRepositoryType() {
+ return new RepositoryType();
}
/**
- * Create an instance of {@link IdentityStoreConfigurationType.Options }
- *
- */
- public IdentityStoreConfigurationType.Options createIdentityStoreConfigurationTypeOptions() {
- return new IdentityStoreConfigurationType.Options();
- }
-
- /**
- * Create an instance of {@link ExternalConfigType }
- *
- */
- public ExternalConfigType createExternalConfigType() {
- return new ExternalConfigType();
- }
-
- /**
* Create an instance of {@link JAXBElement }{@code <}{@link JbossIdentityType }{@code >}}
*
*/
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -1,96 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for realm-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="realm-configurationType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="identity-type-mappings" type="{urn:jboss:identity:config:v0_1}identity-type-mappingsType" minOccurs="0"/>
- * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "realm-configurationType", propOrder = {
- "identityTypeMappings",
- "options"
-})
-public class RealmConfigurationType {
-
- @XmlElement(name = "identity-type-mappings")
- protected IdentityTypeMappingsType identityTypeMappings;
- protected OptionsType options;
-
- /**
- * Gets the value of the identityTypeMappings property.
- *
- * @return
- * possible object is
- * {@link IdentityTypeMappingsType }
- *
- */
- public IdentityTypeMappingsType getIdentityTypeMappings() {
- return identityTypeMappings;
- }
-
- /**
- * Sets the value of the identityTypeMappings property.
- *
- * @param value
- * allowed object is
- * {@link IdentityTypeMappingsType }
- *
- */
- public void setIdentityTypeMappings(IdentityTypeMappingsType value) {
- this.identityTypeMappings = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link OptionsType }
- *
- */
- public OptionsType getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link OptionsType }
- *
- */
- public void setOptions(OptionsType value) {
- this.options = value;
- }
-
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -26,7 +26,8 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="repository-id-ref" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="realm-configuration" type="{urn:jboss:identity:config:v0_1}realm-configurationType"/>
+ * <element name="identity-type-mappings" type="{urn:jboss:identity:config:v0_1}identity-type-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +40,8 @@
@XmlType(name = "realmType", propOrder = {
"id",
"repositoryIdRef",
- "realmConfiguration"
+ "identityTypeMappings",
+ "options"
})
public class RealmType {
@@ -47,8 +49,9 @@
protected String id;
@XmlElement(name = "repository-id-ref", required = true)
protected String repositoryIdRef;
- @XmlElement(name = "realm-configuration", required = true)
- protected RealmConfigurationType realmConfiguration;
+ @XmlElement(name = "identity-type-mappings")
+ protected IdentityTypeMappingsType identityTypeMappings;
+ protected OptionsType options;
/**
* Gets the value of the id property.
@@ -99,27 +102,51 @@
}
/**
- * Gets the value of the realmConfiguration property.
+ * Gets the value of the identityTypeMappings property.
*
* @return
* possible object is
- * {@link RealmConfigurationType }
+ * {@link IdentityTypeMappingsType }
*
*/
- public RealmConfigurationType getRealmConfiguration() {
- return realmConfiguration;
+ public IdentityTypeMappingsType getIdentityTypeMappings() {
+ return identityTypeMappings;
}
/**
- * Sets the value of the realmConfiguration property.
+ * Sets the value of the identityTypeMappings property.
*
* @param value
* allowed object is
- * {@link RealmConfigurationType }
+ * {@link IdentityTypeMappingsType }
*
*/
- public void setRealmConfiguration(RealmConfigurationType value) {
- this.realmConfiguration = value;
+ public void setIdentityTypeMappings(IdentityTypeMappingsType value) {
+ this.identityTypeMappings = value;
}
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -1,180 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
-//
-
-
-package org.jboss.identity.impl.configuration.jaxb2.generated;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for repository-configurationType complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="repository-configurationType">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType" minOccurs="0"/>
- * <element name="default-identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="default-attribute-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="identity-store-mappings" type="{urn:jboss:identity:config:v0_1}identity-store-mappingsType" minOccurs="0"/>
- * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-(a)XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "repository-configurationType", propOrder = {
- "externalConfig",
- "defaultIdentityStoreId",
- "defaultAttributeStoreId",
- "identityStoreMappings",
- "options"
-})
-public class RepositoryConfigurationType {
-
- @XmlElement(name = "external-config")
- protected ExternalConfigType externalConfig;
- @XmlElement(name = "default-identity-store-id")
- protected String defaultIdentityStoreId;
- @XmlElement(name = "default-attribute-store-id")
- protected String defaultAttributeStoreId;
- @XmlElement(name = "identity-store-mappings")
- protected IdentityStoreMappingsType identityStoreMappings;
- protected OptionsType options;
-
- /**
- * Gets the value of the externalConfig property.
- *
- * @return
- * possible object is
- * {@link ExternalConfigType }
- *
- */
- public ExternalConfigType getExternalConfig() {
- return externalConfig;
- }
-
- /**
- * Sets the value of the externalConfig property.
- *
- * @param value
- * allowed object is
- * {@link ExternalConfigType }
- *
- */
- public void setExternalConfig(ExternalConfigType value) {
- this.externalConfig = value;
- }
-
- /**
- * Gets the value of the defaultIdentityStoreId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDefaultIdentityStoreId() {
- return defaultIdentityStoreId;
- }
-
- /**
- * Sets the value of the defaultIdentityStoreId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDefaultIdentityStoreId(String value) {
- this.defaultIdentityStoreId = value;
- }
-
- /**
- * Gets the value of the defaultAttributeStoreId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDefaultAttributeStoreId() {
- return defaultAttributeStoreId;
- }
-
- /**
- * Sets the value of the defaultAttributeStoreId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDefaultAttributeStoreId(String value) {
- this.defaultAttributeStoreId = value;
- }
-
- /**
- * Gets the value of the identityStoreMappings property.
- *
- * @return
- * possible object is
- * {@link IdentityStoreMappingsType }
- *
- */
- public IdentityStoreMappingsType getIdentityStoreMappings() {
- return identityStoreMappings;
- }
-
- /**
- * Sets the value of the identityStoreMappings property.
- *
- * @param value
- * allowed object is
- * {@link IdentityStoreMappingsType }
- *
- */
- public void setIdentityStoreMappings(IdentityStoreMappingsType value) {
- this.identityStoreMappings = value;
- }
-
- /**
- * Gets the value of the options property.
- *
- * @return
- * possible object is
- * {@link OptionsType }
- *
- */
- public OptionsType getOptions() {
- return options;
- }
-
- /**
- * Sets the value of the options property.
- *
- * @param value
- * allowed object is
- * {@link OptionsType }
- *
- */
- public void setOptions(OptionsType value) {
- this.options = value;
- }
-
-}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@@ -26,7 +26,11 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="repository-configuration" type="{urn:jboss:identity:config:v0_1}repository-configurationType"/>
+ * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType" minOccurs="0"/>
+ * <element name="default-identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="default-attribute-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="identity-store-mappings" type="{urn:jboss:identity:config:v0_1}identity-store-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -39,7 +43,11 @@
@XmlType(name = "repositoryType", propOrder = {
"id",
"clazz",
- "repositoryConfiguration"
+ "externalConfig",
+ "defaultIdentityStoreId",
+ "defaultAttributeStoreId",
+ "identityStoreMappings",
+ "options"
})
public class RepositoryType {
@@ -47,8 +55,15 @@
protected String id;
@XmlElement(name = "class", required = true)
protected String clazz;
- @XmlElement(name = "repository-configuration", required = true)
- protected RepositoryConfigurationType repositoryConfiguration;
+ @XmlElement(name = "external-config")
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "default-identity-store-id")
+ protected String defaultIdentityStoreId;
+ @XmlElement(name = "default-attribute-store-id")
+ protected String defaultAttributeStoreId;
+ @XmlElement(name = "identity-store-mappings")
+ protected IdentityStoreMappingsType identityStoreMappings;
+ protected OptionsType options;
/**
* Gets the value of the id property.
@@ -99,27 +114,123 @@
}
/**
- * Gets the value of the repositoryConfiguration property.
+ * Gets the value of the externalConfig property.
*
* @return
* possible object is
- * {@link RepositoryConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public RepositoryConfigurationType getRepositoryConfiguration() {
- return repositoryConfiguration;
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
}
/**
- * Sets the value of the repositoryConfiguration property.
+ * Sets the value of the externalConfig property.
*
* @param value
* allowed object is
- * {@link RepositoryConfigurationType }
+ * {@link ExternalConfigType }
*
*/
- public void setRepositoryConfiguration(RepositoryConfigurationType value) {
- this.repositoryConfiguration = value;
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
}
+ /**
+ * Gets the value of the defaultIdentityStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultIdentityStoreId() {
+ return defaultIdentityStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultIdentityStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultIdentityStoreId(String value) {
+ this.defaultIdentityStoreId = value;
+ }
+
+ /**
+ * Gets the value of the defaultAttributeStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultAttributeStoreId() {
+ return defaultAttributeStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultAttributeStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultAttributeStoreId(String value) {
+ this.defaultAttributeStoreId = value;
+ }
+
+ /**
+ * Gets the value of the identityStoreMappings property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public IdentityStoreMappingsType getIdentityStoreMappings() {
+ return identityStoreMappings;
+ }
+
+ /**
+ * Sets the value of the identityStoreMappings property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public void setIdentityStoreMappings(IdentityStoreMappingsType value) {
+ this.identityStoreMappings = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2008.11.06 at 01:23:39 PM CET
+// Generated on: 2008.11.12 at 03:13:41 PM CET
//
@javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity:config:v0_1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObject.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -27,6 +27,9 @@
import java.util.Set;
import java.util.HashMap;
import java.util.Collections;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.CascadeType;
@@ -100,14 +103,14 @@
this.identityType = identityType;
}
- public Long getId()
+ public String getId()
{
- return id;
+ return id.toString();
}
- public void setId(Long id)
+ public void setId(String id)
{
- this.id = id;
+ this.id = Long.valueOf(id);
}
public String getName()
@@ -144,24 +147,32 @@
return new HashSet<String>();
}
- public Map<String, Set<String>> getAttributes()
+ public Map<String, String[]> getAttributes()
{
- Map<String, Set<String>> map = new HashMap<String, Set<String>>();
+ Map<String, String[]> map = new HashMap<String, String[]>();
for (HibernateIdentityObjectAttribute attribute : attributes.values())
{
- map.put(attribute.getName(), Collections.unmodifiableSet(attribute.getValues()));
+ Set<String> values = attribute.getValues();
+ map.put(attribute.getName(),values.toArray(new String[values.size()]));
}
return Collections.unmodifiableMap(map);
}
+ public void setAttribute(String name, String[] values)
+ {
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
+ }
+
public void setAttribute(String name, Set<String> values)
{
- attributes.put(name, new HibernateIdentityObjectAttribute(name, new HashSet<String>(values)));
+
+ attributes.put(name, new HibernateIdentityObjectAttribute(name, values));
}
- public void addAttributeValues(String name, Set<String> values)
+ public void addAttributeValues(String name, String[] values)
{
if (!attributes.containsKey(name))
{
@@ -170,7 +181,8 @@
else
{
Set<String> mergedValues = new HashSet<String>((attributes.get(name)).getValues());
- mergedValues.addAll(values);
+ List<String> list = Arrays.asList(values);
+ mergedValues.addAll(new HashSet<String>(list));
setAttribute(name, mergedValues);
}
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -33,6 +33,8 @@
import javax.persistence.Embedded;
import java.util.Set;
import java.util.HashSet;
+import java.util.List;
+import java.util.Arrays;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -66,6 +68,13 @@
this.values = values;
}
+ public HibernateIdentityObjectAttribute(String name, String[] values)
+ {
+ List<String> list = Arrays.asList(values);
+ this.name = name;
+ this.values = new HashSet<String>(list);
+ }
+
public Long getId()
{
return id;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/ldap/LDAPIdentityObjectImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -25,7 +25,6 @@
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.exception.PolicyValidationException;
-import org.jboss.identity.impl.types.SimpleIdentityObjectType;
import java.util.Set;
import java.util.Map;
@@ -49,7 +48,7 @@
this.type = type;
}
- public Object getId()
+ public String getId()
{
return dn;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -27,6 +27,7 @@
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
@@ -34,6 +35,7 @@
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
@@ -41,7 +43,6 @@
import java.util.Collection;
import java.util.Set;
import java.util.HashMap;
-import java.io.IOException;
/**
* LADP + DB
@@ -130,6 +131,7 @@
public FeaturesMetaData getSupportedFeatures()
{
+ //TODO: a wrapper around all stores metadata
return null;
}
@@ -212,7 +214,7 @@
return targetStore.findIdentityObject(targetCtx, name, identityObjectType);
}
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, Object id) throws IdentityException
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id) throws IdentityException
{
//TODO: store
@@ -230,32 +232,24 @@
return defaultIdentityStore.findIdentityObject(invocationContext, id);
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, IdentityObjectSearchControl[] controls) throws IdentityException
{
IdentityStore targetStore = resolveIdentityStore(identityType);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
- return targetStore.findIdentityObject(targetCtx, identityType, nameFilter, offset, limit, orderByName, ascending);
+ return targetStore.findIdentityObject(targetCtx, identityType, controls);
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- IdentityStore targetStore = resolveIdentityStore(identityType);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
-
- return targetStore.findIdentityObject(targetCtx, identityType, attributes, offset, limit, orderByName, ascending);
- }
-
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
IdentityObject identity,
IdentityObjectRelationshipType relationshipType,
boolean parent,
- int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+ IdentityObjectSearchControl[] controls) throws IdentityException
{
//TODO:
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
- return defaultIdentityStore.findIdentityObject(targetCtx, identity, relationshipType, parent, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.findIdentityObject(targetCtx, identity, relationshipType, parent, controls);
}
@@ -393,46 +387,38 @@
return defaultIdentityStore.removeRelationshipName(defaultCtx, name);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
{
IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(defaultCtx, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, controls);
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
{
IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, controls);
}
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
- IdentityStore toStore = resolveIdentityStore(type);
- IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
-
- return toStore.hasPasswordAttribute(targetCtx, type);
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
- {
IdentityStore toStore = resolveIdentityStore(identityObject);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- return toStore.validatePassword(targetCtx, identityObject, password);
+ return toStore.validateCredential(targetCtx, identityObject, credential);
}
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
IdentityStore toStore = resolveIdentityStore(identityObject);
IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
- toStore.updatePassword(targetCtx, identityObject, password);
+ toStore.updateCredential(targetCtx, identityObject, credential);
}
@@ -446,7 +432,7 @@
//return resolveIdentityStore(identityType).getSupportedAttributeNames(invocationContext, identityType);
}
- public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
@@ -456,7 +442,7 @@
//return resolveIdentityStore(identity).getAttributes(invocationContext, identity);
}
- public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
@@ -466,7 +452,7 @@
//resolveIdentityStore(identity).updateAttributes(invocationCtx, identity, attributes);
}
- public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
@@ -476,7 +462,7 @@
//resolveIdentityStore(identity).addAttributes(invocationCtx, identity, attributes);
}
- public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Set<String> attributes) throws IdentityException
+ public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, String[] attributes) throws IdentityException
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -46,160 +46,160 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public class WrapperIdentityStoreRepository extends AbstractIdentityStoreRepository
-{
-
- private final IdentityStore identityStore;
-
- private final AttributeStore attributeStore;
-
- public WrapperIdentityStoreRepository(IdentityStore identityStore, AttributeStore attributeStore,
- Map<String, IdentityStore> identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
- {
-// super(identityStoreMappings, attributeStoreMappings);
+//public class WrapperIdentityStoreRepository extends AbstractIdentityStoreRepository
+//{
//
- this.identityStore = identityStore;
- this.attributeStore = attributeStore;
- }
-
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
- {
- //TODO
- }
-
- public IdentityStoreSession createIdentityStoreSession()
- {
- //TODO
- return null;
- }
-
- public String getId()
- {
- return null;
- }
-
- public FeaturesMetaData getSupportedFeatures()
- {
- return null;
- }
-
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
- {
- return identityStore.createIdentityObject(invocationCtx, name, identityObjectType);
- }
-
- public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
- {
- identityStore.removeIdentityObject(invocationCtx, identity);
- }
-
- public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType) throws IdentityException
- {
- return identityStore.getIdentityObjectsCount(invocationCtx, identityType);
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationContext, name, identityObjectType);
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, Object id) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationContext, id);
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCtx, identityType, nameFilter, offset, limit, orderByName, ascending);
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCtx, identityType, attributes, offset, limit, orderByName, ascending);
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- return identityStore.findIdentityObject(invocationCxt, identity, relationshipType, parent, offset, limit, orderByName, ascending);
- }
-
- public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException
- {
- return identityStore.createRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
- }
-
- public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName) throws IdentityException
- {
- identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
- }
-
- public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
- {
- identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
- }
-
- public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity) throws IdentityException
- {
- return identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity);
- }
-
- public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
- {
- return identityStore.createRelationshipName(ctx, name);
- }
-
- public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
- {
- return identityStore.removeRelationshipName(ctx, name);
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
- {
- return identityStore.getRelationshipNames(ctx, offset, limit, orderByName, ascending);
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
- {
- return identityStore.getRelationshipNames(ctx, identity, offset, limit, orderByName, ascending);
- }
-
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
- {
- return identityStore.hasPasswordAttribute(ctx, type);
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
- {
- return identityStore.validatePassword(ctx, identityObject, password);
- }
-
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
- {
- identityStore.updatePassword(ctx, identityObject, password);
- }
-
- public <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, T identityType) throws IdentityException
- {
- return attributeStore.getSupportedAttributeNames(invocationContext, identityType);
- }
-
- public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
- {
- return attributeStore.getAttributes(invocationContext, identity);
- }
-
- public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
- {
- attributeStore.updateAttributes(invocationCtx, identity, attributes);
- }
-
- public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
- {
- attributeStore.addAttributes(invocationCtx, identity, attributes);
- }
-
- public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Set<String> attributes) throws IdentityException
- {
- attributeStore.removeAttributes(invocationCtx, identity, attributes);
- }
-}
+// private final IdentityStore identityStore;
+//
+// private final AttributeStore attributeStore;
+//
+// public WrapperIdentityStoreRepository(IdentityStore identityStore, AttributeStore attributeStore,
+// Map<String, IdentityStore> identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
+// {
+//// super(identityStoreMappings, attributeStoreMappings);
+////
+// this.identityStore = identityStore;
+// this.attributeStore = attributeStore;
+// }
+//
+// public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
+// {
+// //TODO
+// }
+//
+// public IdentityStoreSession createIdentityStoreSession()
+// {
+// //TODO
+// return null;
+// }
+//
+// public String getId()
+// {
+// return null;
+// }
+//
+// public FeaturesMetaData getSupportedFeatures()
+// {
+// return null;
+// }
+//
+// public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
+// {
+// return identityStore.createIdentityObject(invocationCtx, name, identityObjectType);
+// }
+//
+// public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
+// {
+// identityStore.removeIdentityObject(invocationCtx, identity);
+// }
+//
+// public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType) throws IdentityException
+// {
+// return identityStore.getIdentityObjectsCount(invocationCtx, identityType);
+// }
+//
+// public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationContext, name, identityObjectType);
+// }
+//
+// public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, Object id) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationContext, id);
+// }
+//
+// public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCtx, identityType, nameFilter, offset, limit, orderByName, ascending);
+// }
+//
+// public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCtx, identityType, attributes, offset, limit, orderByName, ascending);
+// }
+//
+// public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+// {
+// return identityStore.findIdentityObject(invocationCxt, identity, relationshipType, parent, offset, limit, orderByName, ascending);
+// }
+//
+// public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException
+// {
+// return identityStore.createRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+// }
+//
+// public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName) throws IdentityException
+// {
+// identityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
+// }
+//
+// public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
+// {
+// identityStore.removeRelationships(invocationCtx, identity1, identity2, named);
+// }
+//
+// public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity) throws IdentityException
+// {
+// return identityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity);
+// }
+//
+// public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.createRelationshipName(ctx, name);
+// }
+//
+// public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.removeRelationshipName(ctx, name);
+// }
+//
+// public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.getRelationshipNames(ctx, offset, limit, orderByName, ascending);
+// }
+//
+// public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+// {
+// return identityStore.getRelationshipNames(ctx, identity, offset, limit, orderByName, ascending);
+// }
+//
+// public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
+// {
+// return identityStore.hasPasswordAttribute(ctx, type);
+// }
+//
+// public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
+// {
+// return identityStore.validatePassword(ctx, identityObject, password);
+// }
+//
+// public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
+// {
+// identityStore.updatePassword(ctx, identityObject, password);
+// }
+//
+// public <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, T identityType) throws IdentityException
+// {
+// return attributeStore.getSupportedAttributeNames(invocationContext, identityType);
+// }
+//
+// public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
+// {
+// return attributeStore.getAttributes(invocationContext, identity);
+// }
+//
+// public void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+// {
+// attributeStore.updateAttributes(invocationCtx, identity, attributes);
+// }
+//
+// public void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+// {
+// attributeStore.addAttributes(invocationCtx, identity, attributes);
+// }
+//
+// public void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Set<String> attributes) throws IdentityException
+// {
+// attributeStore.removeAttributes(invocationCtx, identity, attributes);
+// }
+//}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -23,14 +23,22 @@
package org.jboss.identity.impl.store;
import org.jboss.identity.spi.store.FeaturesMetaData;
-import org.jboss.identity.spi.store.OperationType;
-import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.spi.credential.IdentityObjectCredentialType;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
import org.jboss.identity.exception.IdentityException;
import java.util.Set;
import java.util.Map;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.HashSet;
+import java.util.Collections;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -38,43 +46,145 @@
*/
public class FeaturesMetaDataImpl implements FeaturesMetaData
{
- public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
+ private Set<String> supportedTypeNames = new HashSet<String>();
+
+ private final Set<Class> supportedSearchControls;
+
+ private final Map<String, Set<String>> supportedCredentials;
+
+ private Map<String, Map<String, Set<String>>> supportedRelationshipMappings = new HashMap<String, Map<String, Set<String>>>();
+
+
+ public FeaturesMetaDataImpl(IdentityStoreConfigurationMetaData configurationMD,
+ Set<Class> supportedControls,
+ Map<String, Set<String>> supportedCredentials)
{
- return null;
+ for (IdentityObjectTypeMetaData typeMetaData : configurationMD.getSupportedIdentityTypes())
+ {
+ supportedTypeNames.add(typeMetaData.getName());
+ }
+
+ supportedTypeNames = Collections.unmodifiableSet(supportedTypeNames);
+
+ this.supportedSearchControls = Collections.unmodifiableSet(supportedControls);
+
+ this.supportedCredentials = Collections.unmodifiableMap(supportedCredentials);
+
+
+ // Supported relationships
+
+ List<String> relationshipNames = configurationMD.getSupportedRelationshipTypes();
+
+ for (IdentityObjectTypeMetaData identityObjectTypeMetaData : configurationMD.getSupportedIdentityTypes())
+ {
+ String fromTypeName = identityObjectTypeMetaData.getName();
+
+ if (identityObjectTypeMetaData.getRelationships() == null)
+ {
+ continue;
+ }
+
+ for (RelationshipMetaData relationshipMetaData : identityObjectTypeMetaData.getRelationships())
+ {
+ String relationshipName = relationshipMetaData.getRelationshipTypeRef();
+ String toTypeName = relationshipMetaData.getIdentityObjectTypeRef();
+
+ // Check if metadata info is consistent
+ if (relationshipNames.contains(relationshipName))
+ {
+ // Populate
+
+ Map<String, Set<String>> mappings = null;
+
+ if (supportedRelationshipMappings.containsKey(relationshipName))
+ {
+ mappings = supportedRelationshipMappings.get(relationshipName);
+
+ }
+ else
+ {
+ mappings = new HashMap<String, Set<String>>();
+ supportedRelationshipMappings.put(relationshipName, mappings);
+ }
+
+ Set<String> toTypes = null;
+ if (mappings.containsKey(fromTypeName))
+ {
+ toTypes = mappings.get(fromTypeName);
+ }
+ else
+ {
+ toTypes = new HashSet<String>();
+ mappings.put(fromTypeName, toTypes);
+ }
+
+ toTypes.add(toTypeName);
+
+ }
+ }
+ }
+
+
+
}
- public boolean isOperationSupported(OperationType operationType, IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
+ public boolean isControlSupported(IdentityObjectType identityObjectType, IdentityObjectSearchControl control)
{
- return true;
+ if (supportedSearchControls.contains(control.getClass()))
+ {
+ return true;
+ }
+ return false;
}
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType)
+ public boolean isControlSupported(IdentityObjectType identityObjectType, Class controlClazz)
{
- return null;
+ if (supportedSearchControls.contains(controlClazz))
+ {
+ return true;
+ }
+ return false;
}
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes()
+ public Set<String> getSupportedIdentityObjectTypes()
{
- return null;
+ return supportedTypeNames;
}
public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
{
- return true;
+ if (supportedTypeNames.contains(identityObjectType.getName()))
+ {
+ return true;
+ }
+ return false;
}
public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException
{
- return true;
+ Map<String, Set<String>> mappings = supportedRelationshipMappings.get(relationshipType.getName());
+ if (mappings != null && mappings.containsKey(fromType.getName()))
+ {
+ if (mappings.get(fromType.getName()).contains(toType.getName()))
+ {
+ return true;
+ }
+ }
+ return false;
}
- public Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes()
+ public Set<String> getSupportedRelationshipTypes()
{
- return null;
+ return supportedRelationshipMappings.keySet();
}
- public Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings()
+ public boolean isCredentialSupported(IdentityObjectType identityObjectType, IdentityObjectCredentialType credentialType)
{
- return null;
+ Set<String> types = supportedCredentials.get(identityObjectType.getName());
+ if (types != null && types.contains(credentialType))
+ {
+ return true;
+ }
+ return false;
}
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -26,6 +26,7 @@
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -33,6 +34,7 @@
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
@@ -55,6 +57,7 @@
import java.util.Iterator;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -101,12 +104,17 @@
// TODO: rewrite this into some more handy object
private IdentityStoreConfigurationMetaData configurationMD;
+ private static Set<Class> supportedSearchControls = new HashSet<Class>();
+
+ static {
+ // List all supported controls classes
+
+ //TODO:
+ //supportedSearchControls.add()
+ }
+
public HibernateIdentityStoreImpl(String id)
{
- // For now just dummy impl
- //TODO: initialize with configuration
- supportedFeatures = new FeaturesMetaDataImpl();
-
this.id = id;
}
@@ -114,7 +122,7 @@
{
this.configurationMD = configurationMD;
- //TODO: bootstrap supportedFeatures from configMD
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchControls, new HashMap<String, Set<String>>());
String persistenceUnit = configurationMD.getOptionSingleValue(PERSISTENCE_UNIT);
@@ -171,7 +179,6 @@
}
-
}
@@ -310,7 +317,7 @@
return hibernateObject;
}
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, Object id) throws IdentityException
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, String id) throws IdentityException
{
if (id == null)
{
@@ -331,9 +338,12 @@
return hibernateObject;
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType, String nameFilter, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx,
+ IdentityObjectType identityType,
+ IdentityObjectSearchControl[] controls) throws IdentityException
{
-
//TODO:OrderBy
//TODO:Improve pagination
@@ -347,14 +357,16 @@
{
Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectsByType")
- .setParameter("typeName", hibernateType.getName())
- .setFirstResult(offset);
+ .setParameter("typeName", hibernateType.getName());
- if (limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+ //.setFirstResult(offset);
+// if (limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
+
results = (List<IdentityObject>)q.getResultList();
}
@@ -366,13 +378,14 @@
return results;
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObjectType identityType) throws IdentityException
{
- //TODO: NYI
- throw new NotYetImplementedException();
+ return findIdentityObject(ctx, identityType, null);
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, IdentityObjectSearchControl[] controls) throws IdentityException
{
//TODO:test
//TODO:Improve pagination
@@ -387,51 +400,57 @@
StringBuilder hqlString = new StringBuilder("");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
if (parent)
{
hqlString.append("select ior.toIdentityObject from HibernateIdentityObjectRelationship ior where ior.type.name like :relType and ior.fromIdentityObject like :identity");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
}
else
{
hqlString.append("select ior.fromIdentityObject from HibernateIdentityObjectRelationship ior where ior.type.name like :relType and ior.toIdentityObject like :identity");
- if (orderByName)
- {
- hqlString.append(" orderBy ior.toIdentityObject.name");
- if (ascending)
- {
- hqlString.append(" asc");
- }
- }
+
+ //TODO: controls
+// if (orderByName)
+// {
+// hqlString.append(" orderBy ior.toIdentityObject.name");
+// if (ascending)
+// {
+// hqlString.append(" asc");
+// }
+// }
}
q = getHibernateEntityManager(ctx).getSession().createQuery(hqlString.toString())
.setParameter("relType", relationshipType.getName())
- .setParameter("identity",hibernateObject)
- .setFirstResult(offset);
+ .setParameter("identity",hibernateObject);
+ //TODO: controls
+ //.setFirstResult(offset);
- if (limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if (limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
results = q.list();
@@ -445,6 +464,12 @@
return results;
}
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent) throws IdentityException
+ {
+
+ return findIdentityObject(ctx, identity, relationshipType, parent, null);
+ }
+
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType,
String name, boolean createNames) throws IdentityException
@@ -545,6 +570,8 @@
}
+
+
public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
{
//TODO: named
@@ -641,7 +668,7 @@
return name;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
{
//TODO: orderByName
@@ -650,13 +677,15 @@
try
{
- Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNames")
- .setFirstResult(offset);
+ Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNames");
+ //TODO: controls
+ // .setFirstResult(offset);
- if(limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if(limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
List<String> results = (List<String>)q.getResultList();
@@ -671,8 +700,15 @@
return names;
}
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx) throws IdentityException, OperationNotSupportedException
{
+ return getRelationshipNames(ctx, new IdentityObjectSearchControl[]{});
+ }
+
+
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
+ {
//TODO: NYI
//TODO: orderByName
@@ -684,13 +720,15 @@
try
{
Query q = getHibernateEntityManager(ctx).createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObject")
- .setParameter("identityObject", hibernateObject)
- .setFirstResult(offset);
+ .setParameter("identityObject", hibernateObject);
+ //TODO: controls
+// .setFirstResult(offset);
- if(limit > 0)
- {
- q.setMaxResults(limit);
- }
+ //TODO: controls
+// if(limit > 0)
+// {
+// q.setMaxResults(limit);
+// }
List<String> results = (List<String>)q.getResultList();
@@ -705,6 +743,11 @@
return names;
}
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException, OperationNotSupportedException
+ {
+ return getRelationshipNames(ctx, identity, null);
+ }
+
// Attribute store
public <T extends IdentityObjectType> Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext ctx, T identityType) throws IdentityException
@@ -713,7 +756,7 @@
throw new NotYetImplementedException();
}
- public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
{
HibernateIdentityObject hibernateObject = safeGet(ctx, identity);
@@ -722,7 +765,7 @@
}
- public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
{
if (attributes == null)
@@ -739,7 +782,7 @@
}
- public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
+ public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
{
if (attributes == null)
@@ -755,7 +798,7 @@
}
}
- public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Set<String> attributes) throws IdentityException
+ public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, String[] attributes) throws IdentityException
{
if (attributes == null)
@@ -777,13 +820,13 @@
throw new NotYetImplementedException();
}
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
throw new NotYetImplementedException();
}
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
{
//TODO: NYI
throw new NotYetImplementedException();
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -1,1446 +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.impl.store.ldap;
-
-import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.FeaturesMetaData;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.spi.store.IdentityStoreSession;
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.spi.model.IdentityObjectRelationship;
-import org.jboss.identity.spi.exception.OperationNotSupportedException;
-import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
-import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
-import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
-import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectRelationshipImpl;
-import org.jboss.identity.impl.helper.Tools;
-import org.jboss.identity.impl.NotYetImplementedException;
-
-import javax.naming.ldap.LdapContext;
-import javax.naming.ldap.LdapName;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.DirContext;
-import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Context;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Arrays;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPIdentityStore implements IdentityStore
-{
-
- private static Logger log = Logger.getLogger(LDAPIdentityStore.class.getName());
-
- private final String id;
-
- private FeaturesMetaData supportedFeatures;
-
- LDAPIdentityStoreConfiguration configuration;
-
- public LDAPIdentityStore(String id)
- {
- this.id = id;
- }
-
- public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
- {
- configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
-
- //TODO: populate with configuration
- supportedFeatures = new FeaturesMetaDataImpl();
-
- }
-
- public IdentityStoreSession createIdentityStoreSession()
- {
-
- return new LDAPIdentityStoreSessionImpl(
- "com.sun.jndi.ldap.LdapCtxFactory",
- configuration.getProviderURL(),
- "simple",
- configuration.getAdminDN(),
- configuration.getAdminPassword());
-
- }
-
- public String getId()
- {
- return id;
- }
-
- public FeaturesMetaData getSupportedFeatures()
- {
- return supportedFeatures;
- }
-
- public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType type) throws IdentityException
- {
- if (name == null)
- {
- throw new IdentityException("Name cannot be null");
- }
-
- checkIOType(type);
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".createIdentityObject with name: " + name + " and type: " + type.getName());
- }
-
- LdapContext ldapContext = getLDAPContext(invocationCtx);
-
- try
- {
- // If there are many contexts specified in the configuration the first one is used
- LdapContext ctx = (LdapContext)ldapContext.lookup(getTypeConfiguration(invocationCtx, type).getCtxDNs()[0]);
-
- //We store new entry using set of attributes. This should give more flexibility then
- //extending identity object from ContextDir - configure what objectClass place there
- Attributes attrs = new BasicAttributes(true);
-
- //create attribute using provided configuration
- Map<String, String[]> attributesToAdd = getTypeConfiguration(invocationCtx, type).getCreateEntryAttributeValues();
-
- //attributes
- for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
- {
- String attributeName = (String)it1.next();
-
-
- Attribute attr = new BasicAttribute(attributeName);
- String[] attributeValues = attributesToAdd.get(attributeName);
-
- //values
-
- for (String attrValue : attributeValues)
- {
- attr.add(attrValue);
- }
-
- attrs.put(attr);
- }
-
- // Make it RFC 2253 compliant
- LdapName validLDAPName = new LdapName(getTypeConfiguration(invocationCtx, type).getIdAttributeName().concat("=").concat(name));
-
- log.finer("creating ldap entry for: " + validLDAPName + "; " + attrs);
- ctx.createSubcontext(validLDAPName, attrs);
- }
- catch (Exception e)
- {
- throw new IdentityException("Failed to create identity object", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return findIdentityObject(invocationCtx, name, type);
-
- }
-
- public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeIdentityObject: " + identity);
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(invocationCtx, identity);
-
- String dn = ldapIdentity.getDn();
-
- if (dn == null)
- {
- throw new IdentityException("Cannot obtain DN of identity");
- }
-
- LdapContext ldapContext = getLDAPContext(invocationCtx);
-
- try
- {
- log.finer("removing entry: " + dn);
- ldapContext.unbind(dn);
- }
- catch (Exception e)
- {
- throw new IdentityException("Failed to remove identity: ", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- }
-
- public int getIdentityObjectsCount(IdentityStoreInvocationContext ctx, IdentityObjectType identityType) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getIdentityObjectsCount for type: " + identityType);
- }
-
- checkIOType(identityType);
-
- try
- {
- String filter = getTypeConfiguration(ctx, identityType).getEntrySearchFilter();
-
- if (filter != null && filter.length() > 0)
- {
- //* chars are escaped in filterArgs so we must replace it manually
- filter = filter.replaceAll("\\{0\\}", "*");
- }
- else
- {
- //search all entries
- filter = "(".concat(getTypeConfiguration(ctx, identityType).getIdAttributeName()).concat("=").concat("*").concat(")");
- }
-
- //log.debug("Search filter: " + filter);
- List sr = searchIdentityObjects(ctx, identityType, filter, null, new String[]{getTypeConfiguration(ctx, identityType).getIdAttributeName()});
-
- return sr.size();
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found", e);
- }
- catch (Exception e)
- {
- throw new IdentityException("User search failed.", e);
- }
- return 0;
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType type) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with name: " + name + "; and type: " + type);
- }
-
- Context ctx = null;
- checkIOType(type);
- try
- {
- //log.debug("name = " + name);
-
- if (name == null)
- {
- throw new IdentityException("Identity object name canot be null");
- }
-
- String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
- List sr = null;
-
- if (filter != null && filter.length() > 0)
- {
- Object[] filterArgs = {name};
- sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- //search all entries
- filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat(name).concat(")");
- sr = searchIdentityObjects(invocationCtx, type, filter, null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
-
- //log.debug("Search filter: " + filter);
-
- if (sr.size() > 1)
- {
- throw new IdentityException("Found more than one identity object with name: " + name +
- "; Posible data inconsistency");
- }
- SearchResult res = (SearchResult)sr.iterator().next();
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- IdentityObject io = createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn);
- ctx.close();
- return io;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return null;
- }
-
- public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, Object id) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with id: " + id);
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- if (id == null)
- {
- throw new IdentityException("identity id cannot be null");
- }
-
- if (!(id instanceof String))
- {
- throw new IdentityException("identity id must be String object");
- }
-
- String dn = id.toString();
-
- IdentityObjectType type = null;
-
- //Recognize the type by ctx DN
-
- IdentityObjectType[] possibleTypes = getConfiguration(ctx).getConfiguredTypes();
-
- for (IdentityObjectType possibleType : possibleTypes)
- {
- String[] typeCtxs = getTypeConfiguration(ctx, possibleType).getCtxDNs();
-
- for (String typeCtx : typeCtxs)
- {
- if (dn.endsWith(typeCtx))
- {
- type = possibleType;
- break;
- }
- }
- if (type != null)
- {
- break;
- }
- }
-
- if (type == null)
- {
- throw new IdentityException("Cannot recognize identity object type by its DN: " + dn);
- }
-
- // Grab entry
-
- Attributes attrs = ldapContext.getAttributes(dn);
-
- if (attrs == null)
- {
- throw new IdentityException("Can't find identity entry with DN: " + dn);
- }
-
- return createIdentityObjectInstance(ctx, type, attrs, dn);
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with dn: " + dn, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Identity object search failed.", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return null;
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type, String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with type: " + type
- + "; nameFilter: " + nameFilter
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- //TODO: handle paged results and sort
-
- Context ctx = getLDAPContext(invocationCtx);
- checkIOType(type);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
- String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
- List<SearchResult> sr = null;
-
- if (filter != null && filter.length() > 0)
- {
-
- Object[] filterArgs = {nameFilter};
- sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat(nameFilter).concat(")");
- sr = searchIdentityObjects(invocationCtx, type, filter, null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
-
-
- for (SearchResult res : sr)
- {
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- objects.add(createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn));
- }
-
- ctx.close();
- return objects;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return objects;
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- //TODO: handle paged results and sort
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with type: " + type
- + "; attributes: " + attributes
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- Context ctx = getLDAPContext(invocationCtx);
- checkIOType(type);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
- String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
- List<SearchResult> sr = null;
-
- //TODO: if no search filter is present just use search method with matchingAttributes from DirContext instead of
- //TODO: concatenating filter
-
- StringBuilder af = new StringBuilder("(&");
-
- for (Map.Entry<String, String[]> stringEntry : attributes.entrySet())
- {
- for (String value : stringEntry.getValue())
- {
- af.append("(")
- .append(stringEntry.getKey())
- .append("=")
- .append(value)
- .append(")");
- }
- }
-
- af.append(")");
-
- if (filter != null && filter.length() > 0)
- {
- // chars are escaped in filterArgs so we must replace it manually
- filter = filter.replaceAll("\\{0\\}", "*");
-
- Object[] filterArgs = {};
- sr = searchIdentityObjects(invocationCtx, type, "&(" + filter + ")" + af.toString(), filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
- else
- {
- filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat("*").concat(")");
- sr = searchIdentityObjects(invocationCtx, type, "&(" + filter + ")" + af.toString(), null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
- }
-
-
- for (SearchResult res : sr)
- {
- ctx = (Context)res.getObject();
- String dn = ctx.getNameInNamespace();
- objects.add(createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn));
- }
-
- ctx.close();
- return objects;
-
- }
- catch (NoSuchElementException e)
- {
- //log.debug("No identity object found with name: " + name, e);
- }
- catch (NamingException e)
- {
- throw new IdentityException("IdentityObject search failed.", e);
- }
- finally
- {
- try
- {
- if (ctx != null)
- {
- ctx.close();
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return objects;
- }
-
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".findIdentityObject with identity: " + identity
- + "; relationshipType: " + relationshipType
- + "; offset: " + offset
- + "; limit: " + limit
- + "; orderByName: " + orderByName
- + "; ascending: " + ascending
- );
- }
-
- //TODO: handle paged results and sort
-
- Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, identity);
-
- LDAPIdentityObjectTypeConfiguration typeConfig = getTypeConfiguration(ctx, identity.getIdentityType());
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- List<IdentityObject> objects = new LinkedList<IdentityObject>();
-
- try
- {
-
- // If parent simply look for all its members
- if (parent)
- {
- Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
- Attribute member = attrs.get(typeConfig.getMembershipAttributeName());
-
- if (member != null)
- {
- NamingEnumeration memberValues = member.getAll();
- while (memberValues.hasMoreElements())
- {
- String memberRef = memberValues.nextElement().toString();
-
- if (typeConfig.isMembershipAttributeDN())
- {
- //TODO: improve
- objects.add(findIdentityObject(ctx, memberRef));
- }
- else
- {
- //TODO:
- throw new NotYetImplementedException();
- }
- break;
- }
- }
- }
-
- // if not parent all parent entries need to be found
- else
- {
- //TODO:
- throw new NotYetImplementedException();
- }
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to resolve relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return objects;
- }
-
- public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
- IdentityObjectRelationshipType relationshipType,
- String name, boolean createNames) throws IdentityException
- {
-
- //TODO: relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".createRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
- }
-
- LDAPIdentityObjectRelationshipImpl relationship = null;
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
-
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- // Check posibilities
- //TODO: Supported features should handle information from type configurations
-
- if (!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(), toIdentity.getIdentityType(), relationshipType))
- {
- throw new IdentityException("Relationship not supported");
- }
-
- try
- {
- //construct new member attribute values
- Attributes attrs = new BasicAttributes(true);
-
- Attribute member = new BasicAttribute(fromTypeConfig.getMembershipAttributeName());
-
- if (fromTypeConfig.isMembershipAttributeDN())
- {
- member.add(ldapToIO.getDn());
- }
- else
- {
- member.add(toIdentity.getName());
- }
-
- attrs.put(member);
-
- ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REPLACE_ATTRIBUTE, attrs);
-
- relationship = new LDAPIdentityObjectRelationshipImpl(name, ldapFromIO, ldapToIO);
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to create relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
-
- return relationship;
- }
-
- public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String name) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeRelationship with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- + "; relationshipType: " + relationshipType
- );
- }
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
-
- // If relationship is not allowed simply return
- //TODO: use features description instead
- if (!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
- {
- return;
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- // Check posibilities
- //TODO: Supported features should handle information from type configurations
-
- if (!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(), toIdentity.getIdentityType(), relationshipType))
- {
- throw new IdentityException("Relationship not supported");
- }
-
- try
- {
- //construct new member attribute values
- Attributes attrs = new BasicAttributes(true);
-
- Attribute member = new BasicAttribute(fromTypeConfig.getMembershipAttributeName());
-
- if (fromTypeConfig.isMembershipAttributeDN())
- {
- member.add(ldapToIO.getDn());
- }
- else
- {
- member.add(toIdentity.getName());
- }
-
- attrs.put(member);
-
- ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REMOVE_ATTRIBUTE, attrs);
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to remove relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeRelationships with "
- + "identity1: " + identity1
- + "; identity2: " + identity2
- );
- }
-
- // as relationship type is ignored in this impl for now...
- removeRelationship(ctx, identity1, identity2, null, null);
- removeRelationship(ctx, identity2, identity1, null, null);
-
- }
-
- public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity) throws IdentityException
- {
- // relationshipType is ignored for now
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".resolveRelationships with "
- + "fromIdentity: " + fromIdentity
- + "; toIdentity: " + toIdentity
- );
- }
-
- Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
-
- LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
- LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
-
- LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
-
- // If relationship is not allowed return empty set
- //TODO: use features description instead
- if (!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
- {
- return relationships;
- }
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
- Attribute member = attrs.get(fromTypeConfig.getMembershipAttributeName());
-
- if (member != null)
- {
- NamingEnumeration memberValues = member.getAll();
- while (memberValues.hasMoreElements())
- {
- String memberRef = memberValues.nextElement().toString();
-
- if ((fromTypeConfig.isMembershipAttributeDN() && memberRef.equals(ldapToIO.getDn())) ||
- (!fromTypeConfig.isMembershipAttributeDN() && memberRef.equals(ldapToIO.getName())))
- {
- //TODO: impl lacks support for rel type
- relationships.add(new LDAPIdentityObjectRelationshipImpl(null, ldapFromIO, ldapToIO));
- }
- break;
- }
- }
-
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to resolve relationship", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- return relationships;
- }
-
- public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
- }
-
- public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
-
- }
-
- public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
- {
- throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
-
- }
-
- public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
- public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
- public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
- {
- //TODO: NYI
- throw new NotYetImplementedException();
- }
-
-
- // Attributes
-
- public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType) throws IdentityException
- {
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getSupportedAttributeNames with "
- + "identityType: " + identityType
- );
- }
-
- checkIOType(identityType);
-
- return getTypeConfiguration(invocationContext, identityType).getMappedAttributesNames();
- }
-
-
- public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".getAttributes with "
- + "identity: " + identity
- );
- }
-
- Map<String, Set<String>> attrsMap = new HashMap<String, Set<String>>();
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- Set<String> mappedNames = getTypeConfiguration(ctx, identity.getIdentityType()).getMappedAttributesNames();
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- Attributes attrs = ldapContext.getAttributes(dn);
-
- for (Iterator iterator = mappedNames.iterator(); iterator.hasNext();)
- {
- String name = (String)iterator.next();
- String attrName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
- Attribute attr = attrs.get(attrName);
-
- if (attr != null)
- {
- NamingEnumeration values = attr.getAll();
-
- Set<String> attrValues = new HashSet<String>();
-
- while (values.hasMoreElements())
- {
- String value = values.nextElement().toString();
- attrValues.add(value);
- }
-
- attrsMap.put(name, attrValues);
- }
- else
- {
- log.fine("No such attribute ('" + attrName + "') in entry: " + dn);
- }
- }
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot get attributes value.", e);
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
-
- return attrsMap;
-
- }
-
- public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".updateAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
-
- for (String name : attributes.keySet())
- {
- String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
-
- Set<String> values = attributes.get(name);
-
-
- if (values != null)
- {
- for (String value : values)
- {
- attr.add(value);
- }
-
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.REPLACE_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot add attribute", e);
- }
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, Set<String>> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".addAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- for (String name : attributes.keySet())
- {
- String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
-
- Set<String> values = attributes.get(name);
-
-
- if (values != null)
- {
- for (String value : values)
- {
- attr.add(value);
- }
-
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot add attribute", e);
- }
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Set<String> attributes) throws IdentityException
- {
-
- if (log.isLoggable(Level.FINER))
- {
- log.finer(toString() + ".removeAttributes with "
- + "identity: " + identity
- + "attributes: " + attributes
- );
- }
-
- if (attributes == null)
- {
- throw new IllegalArgumentException("attributes is null");
- }
-
- LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
-
- // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
-
- String dn = ldapIdentity.getDn();
-
- LdapContext ldapContext = getLDAPContext(ctx);
-
- try
- {
- for (String name : attributes)
- {
- String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
-
- if (attributeName == null)
- {
- log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
- continue;
- }
-
- //TODO: maybe perform a schema check if this attribute is not required
-
- Attributes attrs = new BasicAttributes(true);
- Attribute attr = new BasicAttribute(attributeName);
- attrs.put(attr);
-
- try
- {
- ldapContext.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);
- }
- catch (NamingException e)
- {
- throw new IdentityException("Cannot remove attribute", e);
- }
-
- }
- }
- finally
- {
- try
- {
- ldapContext.close();
- }
- catch (NamingException e)
- {
- throw new IdentityException("Failed to close LDAP connection", e);
- }
- }
- }
-
- //Internal
-
- public LDAPIdentityObjectImpl createIdentityObjectInstance(IdentityStoreInvocationContext ctx, IdentityObjectType type, Attributes attrs, String dn) throws IdentityException
- {
- LDAPIdentityObjectImpl ldapio = null;
- try
- {
- String idAttrName = getTypeConfiguration(ctx, type).getIdAttributeName();
-
- Attribute ida = attrs.get(idAttrName);
- if (ida == null)
- {
- throw new IdentityException("LDAP entry doesn't contain proper attribute:" + idAttrName);
- }
-
- //make DN as user ID
- ldapio = new LDAPIdentityObjectImpl(dn, ida.get().toString(), type);
-
- }
- catch (Exception e)
- {
- throw new IdentityException("Couldn't create LDAPIdentityObjectImpl object from ldap entry (SearchResult)", e);
- }
-
- return ldapio;
- }
-
- public List<SearchResult> searchIdentityObjects(IdentityStoreInvocationContext ctx, IdentityObjectType type, String filter, Object[] filterArgs, String[] returningAttributes) throws NamingException, IdentityException
- {
-
- LdapContext ldapContext = getLDAPContext(ctx);
- NamingEnumeration results = null;
-
- try
- {
-
- SearchControls controls = new SearchControls();
- controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
- controls.setReturningObjFlag(true);
- controls.setTimeLimit(getConfiguration(ctx).getSearchTimeLimit());
-
-
- if (returningAttributes != null)
- {
- controls.setReturningAttributes(returningAttributes);
- }
-
-
- String[] entryCtxs = getTypeConfiguration(ctx, type).getCtxDNs();
-
- if (entryCtxs.length == 1)
- {
- if (filterArgs == null)
- {
- results = ldapContext.search(entryCtxs[0], filter, controls);
- }
- else
- {
- results = ldapContext.search(entryCtxs[0], filter, filterArgs, controls);
- }
- return Tools.toList(results);
-
-
- }
- else
- {
- List<SearchResult> merged = new LinkedList();
-
- for (String entryCtx : entryCtxs)
- {
- if (filterArgs == null)
- {
- results = ldapContext.search(entryCtx, filter, controls);
- }
- else
- {
- results = ldapContext.search(entryCtx, filter, filterArgs, controls);
- }
- merged.addAll(Tools.toList(results));
- results.close();
- }
-
- return merged;
- }
- }
- finally
- {
- if (results != null)
- {
- results.close();
- }
- ldapContext.close();
- }
- }
-
- // HELPER
-
- private LDAPIdentityObjectImpl getSafeLDAPIO(IdentityStoreInvocationContext ctx, IdentityObject io) throws IdentityException
- {
- if (io == null)
- {
- throw new IllegalArgumentException("IdentityObject is null");
- }
-
- if (io instanceof LDAPIdentityObjectImpl)
- {
- return (LDAPIdentityObjectImpl)io;
- }
- else
- {
- try
- {
- return (LDAPIdentityObjectImpl)findIdentityObject(ctx, io.getName(), io.getIdentityType());
- }
- catch (IdentityException e)
- {
- throw new IdentityException("Provided IdentityObject is not present in the store. Cannot operate on not stored objects.", e);
- }
- }
-
- }
-
- private void checkIOType(IdentityObjectType iot) throws IdentityException
- {
- if (iot == null)
- {
- throw new IllegalArgumentException("IdentityObjectType is null");
- }
-
- if (!getSupportedFeatures().isIdentityObjectTypeSupported(iot))
- {
- throw new IdentityException("IdentityType not supported by this IdentityStore implementation: " + iot);
- }
- }
-
-
- private LdapContext getLDAPContext(IdentityStoreInvocationContext ctx) throws IdentityException
- {
- try
- {
- return (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
- }
- catch (Exception e)
- {
- throw new IdentityException("Could not obtain LDAP connection: ", e);
- }
- }
-
- private LDAPIdentityStoreConfiguration getConfiguration(IdentityStoreInvocationContext ctx) throws IdentityException
- {
- return configuration;
- }
-
- private LDAPIdentityObjectTypeConfiguration getTypeConfiguration(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
- {
- return getConfiguration(ctx).getTypeConfiguration(type.getName());
- }
-
- public String toString()
- {
- return this.getClass().getName() + "[" + getId() +"]";
- }
-
-
-}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java (from rev 120, trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreImpl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -0,0 +1,1474 @@
+/*
+* 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.impl.store.ldap;
+
+import org.jboss.identity.spi.store.IdentityStore;
+import org.jboss.identity.spi.store.FeaturesMetaData;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
+import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
+import org.jboss.identity.exception.IdentityException;
+import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
+import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
+import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectRelationshipImpl;
+import org.jboss.identity.impl.helper.Tools;
+import org.jboss.identity.impl.NotYetImplementedException;
+
+import javax.naming.ldap.LdapContext;
+import javax.naming.ldap.LdapName;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.DirContext;
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
+import javax.naming.Context;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Arrays;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPIdentityStoreImpl implements IdentityStore
+{
+
+ private static Logger log = Logger.getLogger(LDAPIdentityStoreImpl.class.getName());
+
+ private final String id;
+
+ private FeaturesMetaData supportedFeatures;
+
+ LDAPIdentityStoreConfiguration configuration;
+
+ private static Set<Class> supportedSearchControls = new HashSet<Class>();
+
+ static {
+ // List all supported controls classes
+
+ //TODO:
+ //supportedSearchControls.add()
+ }
+
+ public LDAPIdentityStoreImpl(String id)
+ {
+ this.id = id;
+ }
+
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
+ {
+ configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
+
+ supportedFeatures = new FeaturesMetaDataImpl(configurationMD, supportedSearchControls, new HashMap<String, Set<String>>());
+ }
+
+ public IdentityStoreSession createIdentityStoreSession()
+ {
+
+ return new LDAPIdentityStoreSessionImpl(
+ "com.sun.jndi.ldap.LdapCtxFactory",
+ configuration.getProviderURL(),
+ "simple",
+ configuration.getAdminDN(),
+ configuration.getAdminPassword());
+
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public FeaturesMetaData getSupportedFeatures()
+ {
+ return supportedFeatures;
+ }
+
+ public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType type) throws IdentityException
+ {
+ if (name == null)
+ {
+ throw new IdentityException("Name cannot be null");
+ }
+
+ checkIOType(type);
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".createIdentityObject with name: " + name + " and type: " + type.getName());
+ }
+
+ LdapContext ldapContext = getLDAPContext(invocationCtx);
+
+ try
+ {
+ // If there are many contexts specified in the configuration the first one is used
+ LdapContext ctx = (LdapContext)ldapContext.lookup(getTypeConfiguration(invocationCtx, type).getCtxDNs()[0]);
+
+ //We store new entry using set of attributes. This should give more flexibility then
+ //extending identity object from ContextDir - configure what objectClass place there
+ Attributes attrs = new BasicAttributes(true);
+
+ //create attribute using provided configuration
+ Map<String, String[]> attributesToAdd = getTypeConfiguration(invocationCtx, type).getCreateEntryAttributeValues();
+
+ //attributes
+ for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
+ {
+ String attributeName = (String)it1.next();
+
+
+ Attribute attr = new BasicAttribute(attributeName);
+ String[] attributeValues = attributesToAdd.get(attributeName);
+
+ //values
+
+ for (String attrValue : attributeValues)
+ {
+ attr.add(attrValue);
+ }
+
+ attrs.put(attr);
+ }
+
+ // Make it RFC 2253 compliant
+ LdapName validLDAPName = new LdapName(getTypeConfiguration(invocationCtx, type).getIdAttributeName().concat("=").concat(name));
+
+ log.finer("creating ldap entry for: " + validLDAPName + "; " + attrs);
+ ctx.createSubcontext(validLDAPName, attrs);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to create identity object", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return findIdentityObject(invocationCtx, name, type);
+
+ }
+
+ public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeIdentityObject: " + identity);
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(invocationCtx, identity);
+
+ String dn = ldapIdentity.getDn();
+
+ if (dn == null)
+ {
+ throw new IdentityException("Cannot obtain DN of identity");
+ }
+
+ LdapContext ldapContext = getLDAPContext(invocationCtx);
+
+ try
+ {
+ log.finer("removing entry: " + dn);
+ ldapContext.unbind(dn);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to remove identity: ", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ }
+
+ public int getIdentityObjectsCount(IdentityStoreInvocationContext ctx, IdentityObjectType identityType) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getIdentityObjectsCount for type: " + identityType);
+ }
+
+ checkIOType(identityType);
+
+ try
+ {
+ String filter = getTypeConfiguration(ctx, identityType).getEntrySearchFilter();
+
+ if (filter != null && filter.length() > 0)
+ {
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ }
+ else
+ {
+ //search all entries
+ filter = "(".concat(getTypeConfiguration(ctx, identityType).getIdAttributeName()).concat("=").concat("*").concat(")");
+ }
+
+ //log.debug("Search filter: " + filter);
+ List sr = searchIdentityObjects(ctx, identityType, filter, null, new String[]{getTypeConfiguration(ctx, identityType).getIdAttributeName()});
+
+ return sr.size();
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return 0;
+ }
+
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType type) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".findIdentityObject with name: " + name + "; and type: " + type);
+ }
+
+ Context ctx = null;
+ checkIOType(type);
+ try
+ {
+ //log.debug("name = " + name);
+
+ if (name == null)
+ {
+ throw new IdentityException("Identity object name canot be null");
+ }
+
+ String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
+ List sr = null;
+
+ if (filter != null && filter.length() > 0)
+ {
+ Object[] filterArgs = {name};
+ sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+ else
+ {
+ //search all entries
+ filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat(name).concat(")");
+ sr = searchIdentityObjects(invocationCtx, type, filter, null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+
+ //log.debug("Search filter: " + filter);
+
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one identity object with name: " + name +
+ "; Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ IdentityObject io = createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn);
+ ctx.close();
+ return io;
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("IdentityObject search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return null;
+ }
+
+ public IdentityObject findIdentityObject(IdentityStoreInvocationContext ctx, String id) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".findIdentityObject with id: " + id);
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ if (id == null)
+ {
+ throw new IdentityException("identity id cannot be null");
+ }
+
+ String dn = id;
+
+ IdentityObjectType type = null;
+
+ //Recognize the type by ctx DN
+
+ IdentityObjectType[] possibleTypes = getConfiguration(ctx).getConfiguredTypes();
+
+ for (IdentityObjectType possibleType : possibleTypes)
+ {
+ String[] typeCtxs = getTypeConfiguration(ctx, possibleType).getCtxDNs();
+
+ for (String typeCtx : typeCtxs)
+ {
+ if (dn.endsWith(typeCtx))
+ {
+ type = possibleType;
+ break;
+ }
+ }
+ if (type != null)
+ {
+ break;
+ }
+ }
+
+ if (type == null)
+ {
+ throw new IdentityException("Cannot recognize identity object type by its DN: " + dn);
+ }
+
+ // Grab entry
+
+ Attributes attrs = ldapContext.getAttributes(dn);
+
+ if (attrs == null)
+ {
+ throw new IdentityException("Can't find identity entry with DN: " + dn);
+ }
+
+ return createIdentityObjectInstance(ctx, type, attrs, dn);
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with dn: " + dn, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Identity object search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return null;
+ }
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type, IdentityObjectSearchControl[] controls) throws IdentityException
+ {
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with type: " + type
+// + "; nameFilter: " + nameFilter
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+
+ //TODO: controls (name filter)
+ String nameFilter = "*";
+
+ //TODO: handle paged results and sort
+
+ Context ctx = getLDAPContext(invocationCtx);
+ checkIOType(type);
+
+ List<IdentityObject> objects = new LinkedList<IdentityObject>();
+
+ try
+ {
+ String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
+ List<SearchResult> sr = null;
+
+ if (filter != null && filter.length() > 0)
+ {
+
+ Object[] filterArgs = {nameFilter};
+ sr = searchIdentityObjects(invocationCtx, type, filter, filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+ else
+ {
+ filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat(nameFilter).concat(")");
+ sr = searchIdentityObjects(invocationCtx, type, filter, null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+ }
+
+
+ for (SearchResult res : sr)
+ {
+ ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ objects.add(createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn));
+ }
+
+ ctx.close();
+ return objects;
+
+ }
+ catch (NoSuchElementException e)
+ {
+ //log.debug("No identity object found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("IdentityObject search failed.", e);
+ }
+ finally
+ {
+ try
+ {
+ if (ctx != null)
+ {
+ ctx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return objects;
+ }
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type) throws IdentityException
+ {
+ return findIdentityObject(invocationCtx, type, null);
+ }
+
+// public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType type, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+// {
+// //TODO: handle paged results and sort
+//
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with type: " + type
+// + "; attributes: " + attributes
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+//
+// Context ctx = getLDAPContext(invocationCtx);
+// checkIOType(type);
+//
+// List<IdentityObject> objects = new LinkedList<IdentityObject>();
+//
+// try
+// {
+// String filter = getTypeConfiguration(invocationCtx, type).getEntrySearchFilter();
+// List<SearchResult> sr = null;
+//
+// //TODO: if no search filter is present just use search method with matchingAttributes from DirContext instead of
+// //TODO: concatenating filter
+//
+// StringBuilder af = new StringBuilder("(&");
+//
+// for (Map.Entry<String, String[]> stringEntry : attributes.entrySet())
+// {
+// for (String value : stringEntry.getValue())
+// {
+// af.append("(")
+// .append(stringEntry.getKey())
+// .append("=")
+// .append(value)
+// .append(")");
+// }
+// }
+//
+// af.append(")");
+//
+// if (filter != null && filter.length() > 0)
+// {
+// // chars are escaped in filterArgs so we must replace it manually
+// filter = filter.replaceAll("\\{0\\}", "*");
+//
+// Object[] filterArgs = {};
+// sr = searchIdentityObjects(invocationCtx, type, "&(" + filter + ")" + af.toString(), filterArgs, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+// }
+// else
+// {
+// filter = "(".concat(getTypeConfiguration(invocationCtx, type).getIdAttributeName()).concat("=").concat("*").concat(")");
+// sr = searchIdentityObjects(invocationCtx, type, "&(" + filter + ")" + af.toString(), null, new String[]{getTypeConfiguration(invocationCtx, type).getIdAttributeName()});
+// }
+//
+//
+// for (SearchResult res : sr)
+// {
+// ctx = (Context)res.getObject();
+// String dn = ctx.getNameInNamespace();
+// objects.add(createIdentityObjectInstance(invocationCtx, type, res.getAttributes(), dn));
+// }
+//
+// ctx.close();
+// return objects;
+//
+// }
+// catch (NoSuchElementException e)
+// {
+// //log.debug("No identity object found with name: " + name, e);
+// }
+// catch (NamingException e)
+// {
+// throw new IdentityException("IdentityObject search failed.", e);
+// }
+// finally
+// {
+// try
+// {
+// if (ctx != null)
+// {
+// ctx.close();
+// }
+// }
+// catch (NamingException e)
+// {
+// throw new IdentityException("Failed to close LDAP connection", e);
+// }
+// }
+//
+// return objects;
+// }
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, IdentityObjectSearchControl[] controls) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+// if (log.isLoggable(Level.FINER))
+// {
+// log.finer(toString() + ".findIdentityObject with identity: " + identity
+// + "; relationshipType: " + relationshipType
+// + "; offset: " + offset
+// + "; limit: " + limit
+// + "; orderByName: " + orderByName
+// + "; ascending: " + ascending
+// );
+// }
+
+ //TODO: handle paged results and sort
+
+ Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, identity);
+
+ LDAPIdentityObjectTypeConfiguration typeConfig = getTypeConfiguration(ctx, identity.getIdentityType());
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ List<IdentityObject> objects = new LinkedList<IdentityObject>();
+
+ try
+ {
+
+ // If parent simply look for all its members
+ if (parent)
+ {
+ Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
+ Attribute member = attrs.get(typeConfig.getMembershipAttributeName());
+
+ if (member != null)
+ {
+ NamingEnumeration memberValues = member.getAll();
+ while (memberValues.hasMoreElements())
+ {
+ String memberRef = memberValues.nextElement().toString();
+
+ if (typeConfig.isMembershipAttributeDN())
+ {
+ //TODO: improve
+ objects.add(findIdentityObject(ctx, memberRef));
+ }
+ else
+ {
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+ break;
+ }
+ }
+ }
+
+ // if not parent all parent entries need to be found
+ else
+ {
+ //TODO:
+ throw new NotYetImplementedException();
+ }
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to resolve relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return objects;
+ }
+
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent) throws IdentityException
+ {
+ return findIdentityObject(ctx, identity, relationshipType, parent, null);
+ }
+
+ public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity,
+ IdentityObjectRelationshipType relationshipType,
+ String name, boolean createNames) throws IdentityException
+ {
+
+ //TODO: relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".createRelationship with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ + "; relationshipType: " + relationshipType
+ );
+ }
+
+ LDAPIdentityObjectRelationshipImpl relationship = null;
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ // Check posibilities
+ //TODO: Supported features should handle information from type configurations
+
+ if (!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(), toIdentity.getIdentityType(), relationshipType))
+ {
+ throw new IdentityException("Relationship not supported");
+ }
+
+ try
+ {
+ //construct new member attribute values
+ Attributes attrs = new BasicAttributes(true);
+
+ Attribute member = new BasicAttribute(fromTypeConfig.getMembershipAttributeName());
+
+ if (fromTypeConfig.isMembershipAttributeDN())
+ {
+ member.add(ldapToIO.getDn());
+ }
+ else
+ {
+ member.add(toIdentity.getName());
+ }
+
+ attrs.put(member);
+
+ ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REPLACE_ATTRIBUTE, attrs);
+
+ relationship = new LDAPIdentityObjectRelationshipImpl(name, ldapFromIO, ldapToIO);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to create relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+
+ return relationship;
+ }
+
+ public void removeRelationship(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String name) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeRelationship with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ + "; relationshipType: " + relationshipType
+ );
+ }
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
+
+ // If relationship is not allowed simply return
+ //TODO: use features description instead
+ if (!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
+ {
+ return;
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ // Check posibilities
+ //TODO: Supported features should handle information from type configurations
+
+ if (!getSupportedFeatures().isRelationshipTypeSupported(fromIdentity.getIdentityType(), toIdentity.getIdentityType(), relationshipType))
+ {
+ throw new IdentityException("Relationship not supported");
+ }
+
+ try
+ {
+ //construct new member attribute values
+ Attributes attrs = new BasicAttributes(true);
+
+ Attribute member = new BasicAttribute(fromTypeConfig.getMembershipAttributeName());
+
+ if (fromTypeConfig.isMembershipAttributeDN())
+ {
+ member.add(ldapToIO.getDn());
+ }
+ else
+ {
+ member.add(toIdentity.getName());
+ }
+
+ attrs.put(member);
+
+ ldapContext.modifyAttributes(ldapFromIO.getDn(), DirContext.REMOVE_ATTRIBUTE, attrs);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to remove relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void removeRelationships(IdentityStoreInvocationContext ctx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeRelationships with "
+ + "identity1: " + identity1
+ + "; identity2: " + identity2
+ );
+ }
+
+ // as relationship type is ignored in this impl for now...
+ removeRelationship(ctx, identity1, identity2, null, null);
+ removeRelationship(ctx, identity2, identity1, null, null);
+
+ }
+
+ public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext ctx, IdentityObject fromIdentity, IdentityObject toIdentity) throws IdentityException
+ {
+ // relationshipType is ignored for now
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".resolveRelationships with "
+ + "fromIdentity: " + fromIdentity
+ + "; toIdentity: " + toIdentity
+ );
+ }
+
+ Set<IdentityObjectRelationship> relationships = new HashSet<IdentityObjectRelationship>();
+
+ LDAPIdentityObjectImpl ldapFromIO = getSafeLDAPIO(ctx, fromIdentity);
+ LDAPIdentityObjectImpl ldapToIO = getSafeLDAPIO(ctx, toIdentity);
+
+ LDAPIdentityObjectTypeConfiguration fromTypeConfig = getTypeConfiguration(ctx, fromIdentity.getIdentityType());
+
+ // If relationship is not allowed return empty set
+ //TODO: use features description instead
+ if (!Arrays.asList(fromTypeConfig.getAllowedMembershipTypes()).contains(ldapToIO.getIdentityType().getName()))
+ {
+ return relationships;
+ }
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ Attributes attrs = ldapContext.getAttributes(ldapFromIO.getDn());
+ Attribute member = attrs.get(fromTypeConfig.getMembershipAttributeName());
+
+ if (member != null)
+ {
+ NamingEnumeration memberValues = member.getAll();
+ while (memberValues.hasMoreElements())
+ {
+ String memberRef = memberValues.nextElement().toString();
+
+ if ((fromTypeConfig.isMembershipAttributeDN() && memberRef.equals(ldapToIO.getDn())) ||
+ (!fromTypeConfig.isMembershipAttributeDN() && memberRef.equals(ldapToIO.getName())))
+ {
+ //TODO: impl lacks support for rel type
+ relationships.add(new LDAPIdentityObjectRelationshipImpl(null, ldapFromIO, ldapToIO));
+ }
+ break;
+ }
+ }
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to resolve relationship", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ return relationships;
+ }
+
+ public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+ }
+
+ public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+
+ }
+
+ public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException, OperationNotSupportedException
+ {
+ throw new OperationNotSupportedException("Named relationships are not supported by this implementation of LDAP IdentityStore");
+ }
+
+ public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+ public boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+ public void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException
+ {
+ //TODO: NYI
+ throw new NotYetImplementedException();
+ }
+
+
+ // Attributes
+
+ public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType) throws IdentityException
+ {
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getSupportedAttributeNames with "
+ + "identityType: " + identityType
+ );
+ }
+
+ checkIOType(identityType);
+
+ return getTypeConfiguration(invocationContext, identityType).getMappedAttributesNames();
+ }
+
+
+ public Map<String, String[]> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".getAttributes with "
+ + "identity: " + identity
+ );
+ }
+
+ Map<String, String[]> attrsMap = new HashMap<String, String[]>();
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ Set<String> mappedNames = getTypeConfiguration(ctx, identity.getIdentityType()).getMappedAttributesNames();
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ Attributes attrs = ldapContext.getAttributes(dn);
+
+ for (Iterator iterator = mappedNames.iterator(); iterator.hasNext();)
+ {
+ String name = (String)iterator.next();
+ String attrName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
+ Attribute attr = attrs.get(attrName);
+
+ if (attr != null)
+ {
+ NamingEnumeration values = attr.getAll();
+
+ Set<String> attrValues = new HashSet<String>();
+
+ while (values.hasMoreElements())
+ {
+ String value = values.nextElement().toString();
+ attrValues.add(value);
+ }
+
+ attrsMap.put(name, attrValues.toArray(new String[attrValues.size()]));
+ }
+ else
+ {
+ log.fine("No such attribute ('" + attrName + "') in entry: " + dn);
+ }
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot get attributes value.", e);
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+
+ return attrsMap;
+
+ }
+
+ public void updateAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".updateAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+
+ for (String name : attributes.keySet())
+ {
+ String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+
+ String[] values = attributes.get(name);
+
+
+ if (values != null)
+ {
+ for (String value : values)
+ {
+ attr.add(value);
+ }
+
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.REPLACE_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot add attribute", e);
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void addAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, Map<String, String[]> attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".addAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ for (String name : attributes.keySet())
+ {
+ String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+
+ String[] values = attributes.get(name);
+
+
+ if (values != null)
+ {
+ for (String value : values)
+ {
+ attr.add(value);
+ }
+
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.ADD_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot add attribute", e);
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ public void removeAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity, String[] attributes) throws IdentityException
+ {
+
+ if (log.isLoggable(Level.FINER))
+ {
+ log.finer(toString() + ".removeAttributes with "
+ + "identity: " + identity
+ + "attributes: " + attributes
+ );
+ }
+
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException("attributes is null");
+ }
+
+ LDAPIdentityObjectImpl ldapIdentity = getSafeLDAPIO(ctx, identity);
+
+ // as this is valid LDAPIdentityObjectImpl DN is obtained from the Id
+
+ String dn = ldapIdentity.getDn();
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+
+ try
+ {
+ for (String name : attributes)
+ {
+ String attributeName = getTypeConfiguration(ctx, identity.getIdentityType()).getAttributeMapping(name);
+
+ if (attributeName == null)
+ {
+ log.fine("Proper LDAP attribute mapping not found for such property name: " + name);
+ continue;
+ }
+
+ //TODO: maybe perform a schema check if this attribute is not required
+
+ Attributes attrs = new BasicAttributes(true);
+ Attribute attr = new BasicAttribute(attributeName);
+ attrs.put(attr);
+
+ try
+ {
+ ldapContext.modifyAttributes(dn, DirContext.REMOVE_ATTRIBUTE, attrs);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Cannot remove attribute", e);
+ }
+
+ }
+ }
+ finally
+ {
+ try
+ {
+ ldapContext.close();
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Failed to close LDAP connection", e);
+ }
+ }
+ }
+
+ //Internal
+
+ public LDAPIdentityObjectImpl createIdentityObjectInstance(IdentityStoreInvocationContext ctx, IdentityObjectType type, Attributes attrs, String dn) throws IdentityException
+ {
+ LDAPIdentityObjectImpl ldapio = null;
+ try
+ {
+ String idAttrName = getTypeConfiguration(ctx, type).getIdAttributeName();
+
+ Attribute ida = attrs.get(idAttrName);
+ if (ida == null)
+ {
+ throw new IdentityException("LDAP entry doesn't contain proper attribute:" + idAttrName);
+ }
+
+ //make DN as user ID
+ ldapio = new LDAPIdentityObjectImpl(dn, ida.get().toString(), type);
+
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Couldn't create LDAPIdentityObjectImpl object from ldap entry (SearchResult)", e);
+ }
+
+ return ldapio;
+ }
+
+ public List<SearchResult> searchIdentityObjects(IdentityStoreInvocationContext ctx, IdentityObjectType type, String filter, Object[] filterArgs, String[] returningAttributes) throws NamingException, IdentityException
+ {
+
+ LdapContext ldapContext = getLDAPContext(ctx);
+ NamingEnumeration results = null;
+
+ try
+ {
+
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getConfiguration(ctx).getSearchTimeLimit());
+
+
+ if (returningAttributes != null)
+ {
+ controls.setReturningAttributes(returningAttributes);
+ }
+
+
+ String[] entryCtxs = getTypeConfiguration(ctx, type).getCtxDNs();
+
+ if (entryCtxs.length == 1)
+ {
+ if (filterArgs == null)
+ {
+ results = ldapContext.search(entryCtxs[0], filter, controls);
+ }
+ else
+ {
+ results = ldapContext.search(entryCtxs[0], filter, filterArgs, controls);
+ }
+ return Tools.toList(results);
+
+
+ }
+ else
+ {
+ List<SearchResult> merged = new LinkedList();
+
+ for (String entryCtx : entryCtxs)
+ {
+ if (filterArgs == null)
+ {
+ results = ldapContext.search(entryCtx, filter, controls);
+ }
+ else
+ {
+ results = ldapContext.search(entryCtx, filter, filterArgs, controls);
+ }
+ merged.addAll(Tools.toList(results));
+ results.close();
+ }
+
+ return merged;
+ }
+ }
+ finally
+ {
+ if (results != null)
+ {
+ results.close();
+ }
+ ldapContext.close();
+ }
+ }
+
+ // HELPER
+
+ private LDAPIdentityObjectImpl getSafeLDAPIO(IdentityStoreInvocationContext ctx, IdentityObject io) throws IdentityException
+ {
+ if (io == null)
+ {
+ throw new IllegalArgumentException("IdentityObject is null");
+ }
+
+ if (io instanceof LDAPIdentityObjectImpl)
+ {
+ return (LDAPIdentityObjectImpl)io;
+ }
+ else
+ {
+ try
+ {
+ return (LDAPIdentityObjectImpl)findIdentityObject(ctx, io.getName(), io.getIdentityType());
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("Provided IdentityObject is not present in the store. Cannot operate on not stored objects.", e);
+ }
+ }
+
+ }
+
+ private void checkIOType(IdentityObjectType iot) throws IdentityException
+ {
+ if (iot == null)
+ {
+ throw new IllegalArgumentException("IdentityObjectType is null");
+ }
+
+ if (!getSupportedFeatures().isIdentityObjectTypeSupported(iot))
+ {
+ throw new IdentityException("IdentityType not supported by this IdentityStore implementation: " + iot);
+ }
+ }
+
+
+ private LdapContext getLDAPContext(IdentityStoreInvocationContext ctx) throws IdentityException
+ {
+ try
+ {
+ return (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Could not obtain LDAP connection: ", e);
+ }
+ }
+
+ private LDAPIdentityStoreConfiguration getConfiguration(IdentityStoreInvocationContext ctx) throws IdentityException
+ {
+ return configuration;
+ }
+
+ private LDAPIdentityObjectTypeConfiguration getTypeConfiguration(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
+ {
+ return getConfiguration(ctx).getTypeConfiguration(type.getName());
+ }
+
+ public String toString()
+ {
+ return this.getClass().getName() + "[" + getId() +"]";
+ }
+
+
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleGroup.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -39,7 +39,7 @@
this.name = name;
}
- public Object getId()
+ public String getId()
{
return null;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/types/SimpleIdentityObject.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -21,17 +21,9 @@
*/
package org.jboss.identity.impl.types;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.jboss.identity.exception.PolicyValidationException;
import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.spi.model.IdentityObjectAttribute;
import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.api.Group;
-import org.jboss.identity.api.Role;
/**
@@ -46,11 +38,11 @@
private final String name;
- private final Object id;
+ private final String id;
private final IdentityObjectType type;
- public SimpleIdentityObject(String name, Object id, IdentityObjectType type)
+ public SimpleIdentityObject(String name, String id, IdentityObjectType type)
{
this.name = name;
this.id = id;
@@ -62,7 +54,7 @@
return name;
}
- public Object getId()
+ public String getId()
{
return id;
}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -205,7 +205,7 @@
// Check what RoleTypes has user theute
- Collection<RoleType> roleTypes = session.getRoleManager().findIdentityRoleTypes(theuteUser, 0, 0, false, false);
+ Collection<RoleType> roleTypes = session.getRoleManager().findIdentityRoleTypes(theuteUser);
assertEquals(3, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
assertTrue(roleTypes.contains(leadDeveloperRT));
@@ -218,16 +218,16 @@
// Check where anil is Lead Developer and where Developer
- roleTypes = session.getRoleManager().findIdentityRoleTypes(asaldhanaUser, 0, 0, false, false);
+ roleTypes = session.getRoleManager().findIdentityRoleTypes(asaldhanaUser);
assertEquals(2, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
assertTrue(roleTypes.contains(leadDeveloperRT));
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject, 0, 0, false, false);
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject);
assertEquals(2, roleTypes.size());
assertTrue(roleTypes.contains(leadDeveloperRT));
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject, 0, 0, false, false);
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject);
assertEquals(1, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
@@ -236,7 +236,7 @@
// Assert relationships
- Collection<Identity> identities = session.getRelationshipManager().findAssociatedIdentities(portalTeamGroup, false, 0, 0, false, false);
+ Collection<Identity> identities = session.getRelationshipManager().findAssociatedIdentities(portalTeamGroup, false);
assertEquals(5, identities.size());
assertTrue(identities.contains(claprunUser));
assertTrue(identities.contains(mwringeUser));
@@ -244,16 +244,16 @@
assertTrue(identities.contains(whalesUser));
assertTrue(identities.contains(bdawidowUser));
- Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false, 0, 0, false, false);
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false);
assertEquals(0, groups.size());
// Check to which group Anil belongs
- groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE, 0, 0, false, false);
+ groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE);
assertEquals(1, groups.size());
assertTrue(groups.contains(employeesGroup));
// Now check sshah
- groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE, 0, 0, false, false);
+ groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE);
assertEquals(2, groups.size());
assertTrue(groups.contains(employeesGroup));
assertTrue(groups.contains(portalTeamGroup));
@@ -467,9 +467,9 @@
// Some assertions
// How many users do we have in whole acme org and how many people in paris and london offices
- assertEquals(11, session.getRelationshipManager().findAssociatedIdentities(usersROOTGroup, false, 0, 0, false, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(parisOffice, false, 0, 0, false, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(londonOffice, false, 0, 0, false, false).size());
+ assertEquals(11, session.getRelationshipManager().findAssociatedIdentities(usersROOTGroup, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(parisOffice, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(londonOffice, false).size());
// Is anne geeks community owner?
@@ -479,7 +479,7 @@
assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup, anneUser));
// Check all groups that anna belongs to
- Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser, 0, 0, false, false );
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser);
assertEquals(3, groups.size());
assertTrue(groups.contains(usersROOTGroup));
assertTrue(groups.contains(parisOffice));
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/CommonIdentityStoreTest.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -116,13 +116,13 @@
xx = testContext.getStore().findIdentityObject(testContext.getCtx(), user2.getId());
assertEquals(xx.getId(), user2.getId());
- Collection results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, "*", 0, 0, true, true);
+ Collection results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, null);
assertEquals(2, results.size());
- results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.ORGANIZATION, "*", 0, 0, true, true);
+ results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.ORGANIZATION, null);
assertEquals(4, results.size());
- results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.ROLE, "*", 0, 0, true, true);
+ results = testContext.getStore().findIdentityObject(testContext.getCtx(), IdentityTypeEnum.ROLE, null);
assertEquals(0, results.size());
@@ -140,42 +140,32 @@
testContext.flush();
- Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
- HashSet<String> vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
- attrs.put("key1", vals);
+ attrs.put("key1", new String[]{"val1", "val2", "val3"});
- vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
- vals.add("val4");
- attrs.put("key2", vals);
+ attrs.put("key2", new String[]{"val1", "val2", "val3", "val4"});
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
testContext.flush();
- Map<String, Set<String>> persistedAttrs = testContext.getStore().getAttributes(testContext.getCtx(), user1);
+ Map<String, String[]> persistedAttrs = testContext.getStore().getAttributes(testContext.getCtx(), user1);
assertEquals(2, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
testContext.flush();
- attrs = new HashMap<String, Set<String>>();
- vals = new HashSet<String>();
- vals.add("val1");
- attrs.put("key3", vals);
+ attrs = new HashMap<String, String[]>();
+ attrs.put("key3", new String[]{"val1"});
+
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
testContext.flush();
@@ -185,19 +175,17 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
testContext.flush();
- vals = new HashSet<String>();
- vals.add("val2");
- attrs.put("key3", vals);
+ attrs.put("key3", new String[]{"val2"});
testContext.getStore().addAttributes(testContext.getCtx(), user1, attrs);
@@ -208,7 +196,7 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").size());
+ assertEquals(2, persistedAttrs.get("key3").length);
testContext.flush();
@@ -221,13 +209,11 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
testContext.flush();
- Set<String> names = new HashSet<String>();
- names.add("key3");
- testContext.getStore().removeAttributes(testContext.getCtx(), user1, names);
+ testContext.getStore().removeAttributes(testContext.getCtx(), user1, new String[] {"key3"});
testContext.flush();
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -159,42 +159,31 @@
em.flush();
- Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
- HashSet<String> vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
- attrs.put("key1", vals);
+ attrs.put("key1", new String[]{"val1", "val2", "val3"});
+ attrs.put("key2", new String[]{"val1", "val2", "val3", "val4"});
- vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
- vals.add("val4");
- attrs.put("key2", vals);
-
store.addAttributes(null, user1, attrs);
em.flush();
- Map<String, Set<String>> persistedAttrs = store.getAttributes(null, user1);
+ Map<String, String[]> persistedAttrs = store.getAttributes(null, user1);
assertEquals(2, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
em.flush();
- attrs = new HashMap<String, Set<String>>();
- vals = new HashSet<String>();
- vals.add("val1");
- attrs.put("key3", vals);
+ attrs = new HashMap<String, String[]>();
+ attrs.put("key3", new String[]{"val1"});
+
store.addAttributes(null, user1, attrs);
em.flush();
@@ -204,19 +193,17 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").size());
+ assertEquals(3, persistedAttrs.get("key1").length);
assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").size());
+ assertEquals(4, persistedAttrs.get("key2").length);
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
em.flush();
- vals = new HashSet<String>();
- vals.add("val2");
- attrs.put("key3", vals);
+ attrs.put("key3", new String[]{"val2"});
store.addAttributes(null, user1, attrs);
@@ -227,7 +214,7 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").size());
+ assertEquals(2, persistedAttrs.get("key3").length);
em.flush();
@@ -240,13 +227,13 @@
assertEquals(3, persistedAttrs.keySet().size());
assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").size());
+ assertEquals(1, persistedAttrs.get("key3").length);
em.flush();
Set<String> names = new HashSet<String>();
names.add("key3");
- store.removeAttributes(null, user1, names);
+ store.removeAttributes(null, user1, new String[] {"key3"});
em.flush();
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateModelTestCase.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -267,12 +267,11 @@
user1 = em.find(HibernateIdentityObject.class, user1.getId());
assertEquals(2, user1.getAttributes().entrySet().size() );
assertNotNull(user1.getAttributes().get("simple1"));
- assertEquals(3, user1.getAttributes().get("simple1").size());
+ assertEquals(3, user1.getAttributes().get("simple1").length);
em.getTransaction().commit();
-
}
}
Modified: trunk/identity-impl/src/test/resources/identity-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xml 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/resources/identity-config.xml 2008-11-12 14:36:05 UTC (rev 122)
@@ -12,241 +12,231 @@
<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
- <realms>
- <realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration>
+ <realms>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
<identity-type-mappings>
- <identity-mapping></identity-mapping>
- <group-type-mapping>
- <group-type-name></group-type-name>
- <identity-object-type-name></identity-object-type-name>
- </group-type-mapping>
- <group-type-mapping>
- <group-type-name></group-type-name>
- <identity-object-type-name></identity-object-type-name>
- </group-type-mapping>
+ <identity-mapping></identity-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
</identity-type-mappings>
<options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
</options>
- </realm-configuration>
- </realm>
- <realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration/>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id></id>
- <class></class>
- <repository-configuration>
+ </realm>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id></id>
+ <class></class>
<external-config override="true"></external-config>
<default-identity-store-id></default-identity-store-id>
<default-attribute-store-id></default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id></identity-store-id>
- <identity-object-types>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- <identity-object-type></identity-object-type>
- </identity-object-types>
- <options>
- <option>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </repository>
+ <repository>
+ <id></id>
+ <class></class>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <external-config override="false"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
<name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
<name></name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ </identity-store>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <external-config override="true"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name></name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping></mapping>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name></name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>true</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name></name>
<value></value>
<value></value>
<value></value>
<value></value>
- </option>
- </options>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id></identity-store-id>
- <identity-object-types>
- <identity-object-type></identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- </identity-store-mappings>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </repository-configuration>
- </repository>
- <repository>
- <id></id>
- <class></class>
- <repository-configuration/>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id></id>
- <class></class>
- <identity-store-configuration>
- <external-config override="false"></external-config>
- <supported-relationship-types>
- <relationship-type></relationship-type>
- <relationship-type></relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name></name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name></name>
- <relationships>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
- <identity-object-type-ref></identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id></id>
- <class></class>
- <identity-store-configuration>
- <external-config override="true"></external-config>
- <supported-relationship-types>
- <relationship-type></relationship-type>
- <relationship-type></relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name></name>
- <relationships/>
- <attributes>
- <attribute>
- <name></name>
- <mapping></mapping>
- <isRequired></isRequired>
- <isMultivalued></isMultivalued>
- <isReadOnly></isReadOnly>
- </attribute>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired></isRequired>
- <isMultivalued></isMultivalued>
- <isReadOnly></isReadOnly>
- </attribute>
- </attributes>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name></name>
- <relationships>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
- <identity-object-type-ref></identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref></relationship-type-ref>
- <identity-object-type-ref></identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired>true</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name></name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>false</isMultivalued>
- </attribute>
- </attributes>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name></name>
- <value></value>
- <value></value>
- <value></value>
- <value></value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Modified: trunk/identity-impl/src/test/resources/identity-config.xsd
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xsd 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/resources/identity-config.xsd 2008-11-12 14:36:05 UTC (rev 122)
@@ -5,15 +5,26 @@
<xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:config:v0_1"xmlns="urn:jboss:identity:config:v0_1"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:config:v0_1"></xs:documentation>
</xs:annotation>
</xs:element>
+ <xs:complexType name="identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="repositoryType">
<xs:sequence>
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
- <xs:element type="urn:repository-configurationType" name="repository-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:external-configType" name="external-config" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
+ <xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
+ <xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="identity-store-configurationType">
+ <xs:complexType name="identity-storeType">
<xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType" name="external-config" xmlns:urn="urn:jboss:identity:config:v0_1"/>
<xs:element type="urn:supported-relationship-typesType" name="supported-relationship-types" xmlns:urn="urn:jboss:identity:config:v0_1"/>
<xs:element type="urn:supported-identity-object-typesType" name="supported-identity-object-types" xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -38,6 +49,12 @@
<xs:element type="urn:identity-store-mappingType" name="identity-store-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="storesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="attribute-stores"/>
+ <xs:element type="urn:identity-storesType" name="identity-stores" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="jboss-identityType">
<xs:sequence>
<xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -45,12 +62,41 @@
<xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="supported-identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="optionType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="group-type-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="group-type-name"/>
+ <xs:element type="xs:string" name="identity-object-type-name"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repositoriesType">
+ <xs:sequence>
+ <xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="repository-id-ref"/>
+ <xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipsType">
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="realmsType">
<xs:sequence>
<xs:element type="urn:realmType" name="realm" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
@@ -62,11 +108,21 @@
<xs:element type="urn:group-type-mappingType" name="group-type-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="supported-relationship-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="identity-storesType">
<xs:sequence>
<xs:element type="urn:identity-storeType" name="identity-store" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="attributesType">
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="identity-store-mappingType">
<xs:sequence>
<xs:element type="xs:string" name="identity-store-id"/>
@@ -74,26 +130,17 @@
<xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="attributesType">
+ <xs:complexType name="relationshipType">
<xs:sequence>
- <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="xs:string" name="relationship-type-ref"/>
+ <xs:element type="xs:string" name="identity-object-type-ref"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="realm-configurationType">
+ <xs:complexType name="optionsType">
<xs:sequence>
- <xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="repository-configurationType">
- <xs:sequence>
- <xs:element type="urn:external-configType" name="external-config" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
- <xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
- <xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="identity-object-typeType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
@@ -120,68 +167,6 @@
</xs:element>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="identity-object-typesType">
- <xs:sequence>
- <xs:element type="xs:string" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="identity-storeType">
- <xs:sequence>
- <xs:element type="xs:string" name="id"/>
- <xs:element type="xs:string" name="class"/>
- <xs:element type="urn:identity-store-configurationType" name="identity-store-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="storesType">
- <xs:sequence>
- <xs:element type="xs:string" name="attribute-stores"/>
- <xs:element type="urn:identity-storesType" name="identity-stores" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="supported-identity-object-typesType">
- <xs:sequence>
- <xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="group-type-mappingType">
- <xs:sequence>
- <xs:element type="xs:string" name="group-type-name"/>
- <xs:element type="xs:string" name="identity-object-type-name"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="repositoriesType">
- <xs:sequence>
- <xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="realmType">
- <xs:sequence>
- <xs:element type="xs:string" name="id"/>
- <xs:element type="xs:string" name="repository-id-ref"/>
- <xs:element type="urn:realm-configurationType" name="realm-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="relationshipsType">
- <xs:sequence>
- <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="supported-relationship-typesType">
- <xs:sequence>
- <xs:element type="xs:string" name="relationship-type" maxOccurs="unbounded" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="optionsType">
- <xs:sequence>
- <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="relationshipType">
- <xs:sequence>
- <xs:element type="xs:string" name="relationship-type-ref"/>
- <xs:element type="xs:string" name="identity-object-type-ref"/>
- </xs:sequence>
- </xs:complexType>
<xs:complexType name="attributeType">
<xs:sequence>
<xs:element type="xs:string" name="name"/>
Modified: trunk/identity-impl/src/test/resources/organization-test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/organization-test-config.xml 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/resources/organization-test-config.xml 2008-11-12 14:36:05 UTC (rev 122)
@@ -2,438 +2,418 @@
<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
- <realms>
- <realm>
- <id>realm://RedHat/DB</id>
- <repository-id-ref>RedHat Repository DB</repository-id-ref>
- <realm-configuration>
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB</id>
- <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://RedHat/DB_LDAP</id>
- <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- <realm>
- <id>realm://portal/SamplePortal/DB_LDAP</id>
- <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
- <realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
<identity-type-mappings>
- <identity-mapping>IDENTITY</identity-mapping>
+ <identity-mapping>IDENTITY</identity-mapping>
</identity-type-mappings>
- </realm-configuration>
- </realm>
- </realms>
- <repositories>
- <repository>
- <id>RedHat Repository DB</id>
- <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>Sample Portal Repository DB</id>
- <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
- <identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>RedHat Repository DB+LDAP</id>
- <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>PROJECT</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
<identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- <repository>
- <id>Sample Portal Repository DB+LDAP</id>
- <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config/>
<default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>SYSTEM</identity-object-type>
- <identity-object-type>ADMINISTRATION</identity-object-type>
- <identity-object-type>COMMUNITY</identity-object-type>
- <identity-object-type>ORGANIZATION</identity-object-type>
- <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>OFFICE</identity-object-type>
- <identity-object-type>DIVISION</identity-object-type>
- <identity-object-type>DEPARTMENT</identity-object-type>
- <identity-object-type>SECURITY</identity-object-type>
- <identity-object-type>PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
- <identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>IDENTITY</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
- </repository-configuration>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
- <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <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>IDENTITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ORGANIZATION_UNIT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DIVISION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>DEPARTMENT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PROJECT</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>PEOPLE</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>ADMINISTRATION</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>COMMUNITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>OFFICE</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SECURITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>SYSTEM</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>persistenceUnit</name>
- <value>jboss-identity-model1</value>
- </option>
- <option>
- <name>populateRelationshipTypes</name>
- <value>true</value>
- </option>
- <option>
- <name>populateIdentityObjectTypes</name>
- <value>true</value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
- <class>org.jboss.identity.impl.store.ldap.LDAPIdentityStore</class>
- <identity-store-configuration>
- <external-config/>
- <supported-relationship-types/>
- <supported-identity-object-types>
- <identity-object-type>
- <name>IDENTITY</name>
- <relationships/>
- <attributes>
- <attribute>
- <name>phone</name>
- <mapping>telephoneNumber</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>description</name>
- <mapping>description</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- <attribute>
- <name>carLicense</name>
- <mapping>carLicense</mapping>
- <isRequired/>
- <isMultivalued/>
- <isReadOnly/>
- </attribute>
- </attributes>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>uid</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=inetOrgPerson</value>
- <value>sn= </value>
- <value>cn= </value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>GROUP</name>
- <relationships>
- <relationship>
- <relationship-type-ref/>
- <identity-object-type-ref>IDENTITY</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref/>
- <identity-object-type-ref>ROLE</identity-object-type-ref>
- </relationship>
- <relationship>
- <relationship-type-ref/>
- <identity-object-type-ref>GROUP</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- <identity-object-type>
- <name>ROLE</name>
- <relationships>
- <relationship>
- <relationship-type-ref/>
- <identity-object-type-ref>IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options>
- <option>
- <name>idAttributeName</name>
- <value>cn</value>
- </option>
- <option>
- <name>ctxDNs</name>
- <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- <!--<option>-->
- <!--<name>entrySearchFilter</name>-->
- <!--<value></value>-->
- <!--</option>-->
- <option>
- <name>allowCreateEntry</name>
- <value>true</value>
- </option>
- <option>
- <name>membershipAttributeName</name>
- <value>member</value>
- </option>
- <option>
- <name>isMembershipAttributeDN</name>
- <value>true</value>
- </option>
- <option>
- <name>allowEmptyMemberships</name>
- <value>true</value>
- </option>
- <option>
- <name>createEntryAttributeValues</name>
- <value>objectClass=top</value>
- <value>objectClass=groupOfNames</value>
- </option>
- </options>
- </identity-object-type>
- </supported-identity-object-types>
- <options>
- <option>
- <name>providerURL</name>
- <value>ldap://localhost:10389</value>
- </option>
- <option>
- <name>adminDN</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>adminPassword</name>
- <value>password</value>
- </option>
- <option>
- <name>searchTimeLimit</name>
- <value>10000</value>
- </option>
- </options>
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.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>IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>persistenceUnit</name>
+ <value>jboss-identity-model1</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.impl.store.ldap.LDAPIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types/>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Modified: trunk/identity-impl/src/test/resources/test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/test-config.xml 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-impl/src/test/resources/test-config.xml 2008-11-12 14:36:05 UTC (rev 122)
@@ -4,51 +4,50 @@
xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
<realms>
<realm>
- <id></id>
- <repository-id-ref></repository-id-ref>
- <realm-configuration>
- <!--Use direct type mappper when not specified-->
- <!--<identity-type-mappings>-->
- <!--<identity-mapping>JBOSS_IDENTITY_IDENTITY</identity-mapping>-->
- <!--<group-type-mapping>-->
- <!--<group-type-name>ORGANIZATION</group-type-name>-->
- <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type-name>-->
- <!--</group-type-mapping>-->
- <!--<group-type-mapping>-->
- <!--<group-type-name>ORGANIZATION_UNIT</group-type-name>-->
- <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type-name>-->
- <!--</group-type-mapping>-->
- <!--</identity-type-mappings>-->
- </realm-configuration>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ <realm-configuration>
+ <!--Use direct type mappper when not specified-->
+ <!--<identity-type-mappings>-->
+ <!--<identity-mapping>JBOSS_IDENTITY_IDENTITY</identity-mapping>-->
+ <!--<group-type-mapping>-->
+ <!--<group-type-name>ORGANIZATION</group-type-name>-->
+ <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--<group-type-mapping>-->
+ <!--<group-type-name>ORGANIZATION_UNIT</group-type-name>-->
+ <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--</identity-type-mappings>-->
+ </realm-configuration>
</realm>
</realms>
- <repositories>
- <repository>
- <id>Fallback Repository - ACME</id>
- <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
- <repository-configuration>
+ <repositories>
+ <repository>
+ <id>Fallback Repository - ACME</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
<external-config override="false">path/to/file.xml</external-config>
<default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
<default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
<identity-store-mappings>
- <identity-store-mapping>
- <identity-store-id>Hibernate Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type>
- <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type>
- <identity-object-type>JBOSS_IDENTITY_GROUP_DIVISION</identity-object-type>
- <identity-object-type>JBOSS_IDENTITY_GROUP_DEPARTMENT</identity-object-type>
- <identity-object-type>JBOSS_IDENTITY_GROUP_PROJECT</identity-object-type>
- </identity-object-types>
- <options/>
- </identity-store-mapping>
<identity-store-mapping>
- <identity-store-id>LDAP Identity Store</identity-store-id>
- <identity-object-types>
- <identity-object-type>JBOSS_IDENTITY_GROUP_PEOPLE</identity-object-type>
- </identity-object-types>
- <options/>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_DIVISION</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_DEPARTMENT</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_PROJECT</identity-object-type>
+ </identity-object-types>
+ <options/>
</identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
</identity-store-mappings>
<!--<option-groups>-->
<!--<option-group>-->
@@ -63,109 +62,104 @@
<!--</options>-->
<!--</option-group>-->
<!--</option-groups>-->
- </repository-configuration>
- </repository>
- </repositories>
- <stores>
- <attribute-stores/>
- <identity-stores>
- <identity-store>
- <id>Hibernate Identity Store</id>
- <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <external-config/>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
- <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>JBOSS_IDENTITY_IDENTITY</name>
- <relationships/>
- <attributes/>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>JBOSS_IDENTITY_GROUP</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes/>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
- </identity-store-configuration>
- </identity-store>
- <identity-store>
- <id>LDAP Identity Store</id>
- <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
- <identity-store-configuration>
- <external-config override="false">path/to/file.xml</external-config>
- <supported-relationship-types>
- <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
- <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
- </supported-relationship-types>
- <supported-identity-object-types>
- <identity-object-type>
- <name>JBOSS_IDENTITY_IDENTITY</name>
- <relationships/>
- <attributes>
- <attribute>
- <name>user.name.given</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name>user.name.family</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- <identity-object-type>
- <name>JBOSS_IDENTITY_GROUP_ORGANIZATION</name>
- <relationships>
- <relationship>
- <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
- <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
- </relationship>
- </relationships>
- <attributes>
- <attribute>
- <name>user.name.given</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- <attribute>
- <name>user.name.family</name>
- <mapping/>
- <isRequired>false</isRequired>
- <isMultivalued>true</isMultivalued>
- </attribute>
- </attributes>
- <options/>
- </identity-object-type>
- </supported-identity-object-types>
- <options/>
- <!--<options>-->
- <!--<option>-->
- <!--<name></name>-->
- <!--<values>-->
- <!--<value></value>-->
- <!--</values>-->
- <!--</option>-->
- <!--</options>-->
- </identity-store-configuration>
- </identity-store>
- </identity-stores>
- </stores>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <external-config override="false">path/to/file.xml</external-config>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP_ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ <!--<options>-->
+ <!--<option>-->
+ <!--<name></name>-->
+ <!--<values>-->
+ <!--<value></value>-->
+ <!--</values>-->
+ <!--</option>-->
+ <!--</options>-->
+ </identity-store>
+ </identity-stores>
+ </stores>
</jboss-identity>
\ No newline at end of file
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredential.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -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.spi.credential;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectCredential
+{
+
+ /**
+ *
+ * @return
+ */
+ IdentityObjectCredentialType getType();
+
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/credential/IdentityObjectCredentialType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -0,0 +1,37 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.credential;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectCredentialType
+{
+
+ /**
+ *
+ * @return
+ */
+ String getName();
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/model/IdentityObject.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -38,7 +38,7 @@
/**
* @return id of this identity object
*/
- Object getId();
+ String getId();
/**
* FQDN identifies the context of this object - realm, identity store in which it is persisted and object id in this store
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/searchcontrol/IdentityObjectSearchControl.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.searchcontrol;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectSearchControl
+{
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -61,18 +61,17 @@
* Get attributes for the given identity
*
* @param invocationContext
- *@param identity @return
- * @throws IdentityException
+ *@param identity @return @throws IdentityException
*/
- Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException;
+ Map<String, String[]> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException;
/**
* Update attributes with new values - previous values will be overwritten. Attributes not specified in the map are not changed.
* @param invocationCtx
- *@param identity
+ * @param identity
* @param attributes @throws IdentityException
*/
- void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes)
+ void updateAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, String[]> attributes)
throws IdentityException;
/**
@@ -80,10 +79,10 @@
* will be appended
*
* @param invocationCtx
- *@param identity
+ * @param identity
* @param attributes @throws IdentityException
*/
- void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, Set<String>> attributes)
+ void addAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Map<String, String[]> attributes)
throws IdentityException;
/**
@@ -93,7 +92,7 @@
* @param identity
* @param attributes
*/
- void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, Set<String> attributes)
+ void removeAttributes(IdentityStoreInvocationContext invocationCtx, IdentityObject identity, String[] attributes)
throws IdentityException;
}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -27,6 +27,8 @@
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
+import org.jboss.identity.spi.credential.IdentityObjectCredentialType;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.exception.IdentityException;
/**
@@ -37,39 +39,27 @@
*/
public interface FeaturesMetaData
{
-
- //TODO: change supported operations to isControlSupported(IdentitySearchControl)
-
/**
- * Get the supported operations
- * @param identityObjectType a type representing identity, role, group
- * @return supported operations for given identity type
- * @throws org.jboss.identity.spi.exception.IdentityTypeNotSupportedException
+ *
+ * @param identityObjectType
+ * @param control
+ * @return
*/
- public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType)
- throws IdentityTypeNotSupportedException;
+ boolean isControlSupported(IdentityObjectType identityObjectType, IdentityObjectSearchControl control);
/**
- * @param operationType
+ *
* @param identityObjectType
- * @return if given operation on given identity type is supported
- * @throws IdentityTypeNotSupportedException
+ * @param controlClazz
+ * @return
*/
- boolean isOperationSupported(OperationType operationType,
- IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException;
+ boolean isControlSupported(IdentityObjectType identityObjectType, Class controlClazz);
-
- /**
- * @param operationType
- * @return set of identity types that can be processed with a given operation
- * @throws org.jboss.identity.exception.IdentityException
- */
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType);
/**
* @return set of identity types that can be persisted
*/
- Set<IdentityObjectType> getSupportedIdentityObjectTypes();
+ Set<String> getSupportedIdentityObjectTypes();
/**
* @param identityObjectType
@@ -89,13 +79,16 @@
throws IdentityException;
/**
- * @return Set of RelationshipType supported in this store
+ * @return Set of relationship type names supported in this store
*/
- Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes();
+ Set<String> getSupportedRelationshipTypes();
/**
- * @return A mapping of RelationshipType and IdentityType objects that can have such relationship in this store
+ *
+ * @param identityObjectType
+ * @param credentialType
+ * @return
*/
- Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings();
+ boolean isCredentialSupported(IdentityObjectType identityObjectType, IdentityObjectCredentialType credentialType);
}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.util.Collection;
-import java.util.Map;
import java.util.Set;
import org.jboss.identity.spi.model.IdentityObject;
@@ -32,6 +31,8 @@
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.credential.IdentityObjectCredential;
+import org.jboss.identity.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.exception.IdentityException;
/**
@@ -119,76 +120,40 @@
* @return
* @throws IdentityException
*/
- IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, Object id) throws IdentityException;
+ IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String id) throws IdentityException;
- /**
- * Find identities with a given type paginated and ordered.
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated
- * parameters will take no effect
- *
- * @param invocationCtx
- * @param identityType
- * @param nameFilter may be null
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending default true
- * @return
- * @throws IdentityException
- */
- Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType,
- String nameFilter,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws IdentityException;
/**
- * Find identities with a given attributes values. If the paginatedSearch or
- * orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will take no effect
- *
+ * Find identities with a given type
+ *
* @param invocationCtx
* @param identityType
- * @param attributes
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
*/
- Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType,
- Map<String, String[]> attributes,
- int offset, int limit,
- boolean orderByName, boolean ascending) throws IdentityException;
-
+ Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx,
+ IdentityObjectType identityType,
+ IdentityObjectSearchControl[] controls) throws IdentityException;
/**
* Find identites that have relationship with given identity. Relationships are directional (from parent to child).
- * If the paginatedSearch or orderedSearch operations
- * are not supported in this store implementation, dedicated parameters will
- * take no effect
*
* @param invocationCxt
* @param identity
* @param relationshipType
- * @param parent defines if given identity is parent or child side in the
+ * @param parent defines if given identity is parent or child side in the
* relationship - default is true (parent)
- * @param offset
- * @param limit 0 means unlimited page size
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
*/
Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity,
- IdentityObjectRelationshipType relationshipType,
- boolean parent,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws IdentityException;
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ IdentityObjectSearchControl[] controls) throws IdentityException;
+
/**
* Create directional relationship of a given type between identities
*
@@ -201,7 +166,6 @@
* @throws IdentityException
*/
IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity,
-
IdentityObject toIdentity,
IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException;
@@ -268,66 +232,52 @@
String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException;
+
/**
*
* @param ctx
- * @param offset
- * @param limit
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
+ * @throws OperationNotSupportedException
*/
Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws IdentityException, OperationNotSupportedException;
+ IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException;
+
/**
- *
+ *
* @param ctx
* @param identity
- * @param offset
- * @param limit
- * @param orderByName
- * @param ascending
+ * @param controls
* @return
* @throws IdentityException
+ * @throws OperationNotSupportedException
*/
- Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity,
- int offset, int limit,
- boolean orderByName,
- boolean ascending) throws IdentityException, OperationNotSupportedException;
+ Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx,
+ IdentityObject identity,
+ IdentityObjectSearchControl[] controls) throws IdentityException, OperationNotSupportedException;
- // Passwords
+ // Credentials
/**
*
* @param ctx
- * @param type
- * @return
- * @throws IdentityException
- */
- boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException;
-
- /**
- *
- * @param ctx
* @param identityObject
- * @param password
+ * @param credential
* @return
* @throws IdentityException
*/
- boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException;
+ boolean validateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException;
/**
*
* @param ctx
* @param identityObject
- * @param password
+ * @param credential
* @throws IdentityException
*/
- void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException;
+ void updateCredential(IdentityStoreInvocationContext ctx, IdentityObject identityObject, IdentityObjectCredential credential) throws IdentityException;
}
\ No newline at end of file
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java 2008-11-06 23:37:49 UTC (rev 121)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/OperationType.java 2008-11-12 14:36:05 UTC (rev 122)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.identity.spi.store;
-
-/**
- * Operations supported by the Identity Stores
- * @author boleslaw dot dawidowicz at redhat anotherdot com
- * @author Anil.Saldhana(a)redhat.com
- * @since Jul 10, 2008
- */
-public enum OperationType
-{
- // createIdentity
- create,
-
- // removeIdentity
- remove,
-
- // updateAttribute, updateAttributes, addAttributes
- updateAttributes,
-
- // resolveRelationships
- resolveRelationships,
-
- // createRelationship
- modifyRelationships,
-
- // pagination in findIdentities
- paginatedSearch,
-
- // ordering in findIdentities
- orderedSearch,
-
- // names of relationships;
- namedRelationships;
-
-
- public String getName()
- {
- return this.name();
- }
-}
\ No newline at end of file
15 years, 5 months
JBoss Identity SVN: r121 - trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-11-06 18:37:49 -0500 (Thu, 06 Nov 2008)
New Revision: 121
Removed:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
Log:
cleanup
Deleted: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java 2008-11-06 23:36:08 UTC (rev 120)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java 2008-11-06 23:37:49 UTC (rev 121)
@@ -1,186 +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.impl.store.ldap;
-
-import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleLDAPIdentityObjectTypeConfiguration implements LDAPIdentityObjectTypeConfiguration
-{
- private String idAttributeName;
-
- private String[] ctxDNs;
-
- private String entrySearchFilter;
-
- private boolean allowCreateEntry;
-
- private Map<String, String[]> createEntryAttributeValues;
-
- private String[] allowedMembershipTypes;
-
- private String membershipAttributeName;
-
- private boolean isMembershipAttributeDN;
-
- private boolean allowEmptyMemberships;
-
- private Map<String, String> attributeNames;
-
- public SimpleLDAPIdentityObjectTypeConfiguration()
- {
- }
-
- public SimpleLDAPIdentityObjectTypeConfiguration(String idAttributeName,
- String[] ctxDNs,
- String entrySearchFilter,
- boolean allowCreateEntry,
- Map<String, String[]> createEntryAttributeValues,
- String[] allowedMembershipTypes,
- String membershipAttributeName,
- boolean membershipAttributeDN,
- boolean allowEmptyMemberships,
- Map<String, String> attributeNames)
- {
- this.idAttributeName = idAttributeName;
- this.ctxDNs = ctxDNs;
- this.entrySearchFilter = entrySearchFilter;
- this.allowCreateEntry = allowCreateEntry;
- this.createEntryAttributeValues = createEntryAttributeValues;
- this.allowedMembershipTypes = allowedMembershipTypes;
- this.membershipAttributeName = membershipAttributeName;
- isMembershipAttributeDN = membershipAttributeDN;
- this.allowEmptyMemberships = allowEmptyMemberships;
- this.attributeNames = attributeNames;
- }
-
- public String getIdAttributeName()
- {
- return idAttributeName;
- }
-
- public String[] getCtxDNs()
- {
- return ctxDNs;
- }
-
- public String getEntrySearchFilter()
- {
- return entrySearchFilter;
- }
-
- public boolean isAllowCreateEntry()
- {
- return allowCreateEntry;
- }
-
- public Map<String, String[]> getCreateEntryAttributeValues()
- {
- return createEntryAttributeValues;
- }
-
- public String[] getAllowedMembershipTypes()
- {
- return allowedMembershipTypes;
- }
-
- public String getMembershipAttributeName()
- {
- return membershipAttributeName;
- }
-
- public boolean isMembershipAttributeDN()
- {
- return isMembershipAttributeDN;
- }
-
- public boolean allowEmptyMemberships()
- {
- return allowEmptyMemberships;
- }
-
- public String getAttributeMapping(String name)
- {
- return attributeNames.get(name);
- }
-
- public void setIdAttributeName(String idAttributeName)
- {
- this.idAttributeName = idAttributeName;
- }
-
- public void setCtxDNs(String[] ctxDNs)
- {
- this.ctxDNs = ctxDNs;
- }
-
- public void setEntrySearchFilter(String entrySearchFilter)
- {
- this.entrySearchFilter = entrySearchFilter;
- }
-
- public void setAllowCreateEntry(boolean allowCreateEntry)
- {
- this.allowCreateEntry = allowCreateEntry;
- }
-
- public void setCreateEntryAttributeValues(Map<String, String[]> createEntryAttributeValues)
- {
- this.createEntryAttributeValues = createEntryAttributeValues;
- }
-
- public void setAllowedMembershipTypes(String[] allowedMembershipTypes)
- {
- this.allowedMembershipTypes = allowedMembershipTypes;
- }
-
- public void setMembershipAttributeName(String membershipAttributeName)
- {
- this.membershipAttributeName = membershipAttributeName;
- }
-
- public void setMembershipAttributeDN(boolean membershipAttributeDN)
- {
- isMembershipAttributeDN = membershipAttributeDN;
- }
-
- public void setAllowEmptyMemberships(boolean allowEmptyMemberships)
- {
- this.allowEmptyMemberships = allowEmptyMemberships;
- }
-
- public void setAttributeNames(Map<String, String> attributeNames)
- {
- this.attributeNames = attributeNames;
- }
-
- public Set<String> getMappedAttributesNames()
- {
- return Collections.unmodifiableSet(attributeNames.keySet());
- }
-}
Deleted: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2008-11-06 23:36:08 UTC (rev 120)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2008-11-06 23:37:49 UTC (rev 121)
@@ -1,94 +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.impl.store.ldap;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.impl.types.SimpleIdentityObjectType;
-
-import java.util.Map;
-import java.util.Arrays;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleLDAPIdentityStoreConfiguration implements LDAPIdentityStoreConfiguration
-{
- private String providerURL;
-
- private String adminDN;
-
- private String adminPassword;
-
- private int searchTimeLimit;
-
- private Map<String, LDAPIdentityObjectTypeConfiguration> typesConfiguration;
-
- public SimpleLDAPIdentityStoreConfiguration(String providerURL, String adminDN, String adminPassword, int searchTimeLimit, Map<String, LDAPIdentityObjectTypeConfiguration> typesConfiguration)
- {
- this.providerURL = providerURL;
- this.adminDN = adminDN;
- this.adminPassword = adminPassword;
- this.searchTimeLimit = searchTimeLimit;
- this.typesConfiguration = typesConfiguration;
- }
-
- public String getProviderURL()
- {
- return providerURL;
- }
-
- public String getAdminDN()
- {
- return adminDN;
- }
-
- public String getAdminPassword()
- {
- return adminPassword;
- }
-
- public int getSearchTimeLimit()
- {
- return searchTimeLimit;
- }
-
- public LDAPIdentityObjectTypeConfiguration getTypeConfiguration(String typeName)
- {
- return typesConfiguration.get(typeName);
- }
-
- public IdentityObjectType[] getConfiguredTypes()
- {
- IdentityObjectType[] types = new IdentityObjectType[typesConfiguration.size()];
- Object[] names = typesConfiguration.keySet().toArray();
-
- for (int i = 0; i < names.length; i++)
- {
- String name = names[i].toString();
- types[i] = new SimpleIdentityObjectType(name);
- }
-
- return types;
- }
-}
15 years, 6 months
JBoss Identity SVN: r120 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl and 23 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-11-06 18:36:08 -0500 (Thu, 06 Nov 2008)
New Revision: 120
Added:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityConfigurationMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityRepositoryConfigurationMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreConfigurationMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreMappingMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RealmConfigurationMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RelationshipMetaDataImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/SimpleIdentityStoreInvocationContext.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/configuration/
trunk/identity-impl/src/test/java/org/jboss/identity/impl/configuration/ConfigurationTestCase.java
trunk/identity-impl/src/test/resources/identity-config.xml
trunk/identity-impl/src/test/resources/identity-config.xsd
trunk/identity-impl/src/test/resources/organization-test-config.xml
trunk/identity-impl/src/test/resources/test-config.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaDataImpl.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/exception/IdentityConfigurationException.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSessionFactory.java
Removed:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java
Modified:
trunk/identity-impl/pom.xml
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreInvocationContext.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/HibernateTestSupport.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreInvocationContext.java
trunk/identity-impl/src/test/resources/META-INF/persistence.xml
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/repository/IdentityStoreRepository.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreInvocationContext.java
trunk/parent/pom.xml
Log:
just some code backup
Modified: trunk/identity-impl/pom.xml
===================================================================
--- trunk/identity-impl/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/pom.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -80,5 +80,20 @@
<version>3.2.76</version>
<scope>test</scope>
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>sun-jaxb</groupId>-->
+ <!--<artifactId>jaxb-impl</artifactId>-->
+ <!--<version>2.1.4</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>sun-jaxb</groupId>-->
+ <!--<artifactId>jaxb-api</artifactId>-->
+ <!--<version>2.1.4</version>-->
+ <!--</dependency>-->
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.8</version>
+ </dependency>
</dependencies>
</project>
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -37,5 +37,5 @@
IdentityObjectTypeMapper getIdentityObjectTypeMapper();
IdentityStoreInvocationContext resolveStoreInvocationContext();
-
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionFactoryImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -24,8 +24,19 @@
import org.jboss.identity.api.IdentitySessionFactory;
import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.RealmConfigurationMetaData;
+import org.jboss.identity.spi.store.IdentityStore;
+import org.jboss.identity.spi.store.AttributeStore;
+import org.jboss.identity.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
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>
@@ -34,13 +45,95 @@
public class IdentitySessionFactoryImpl implements IdentitySessionFactory
{
- private Map<String, IdentitySession> realmMap;
+ private final Map<String, IdentitySession> realmMap;
public IdentitySessionFactoryImpl(Map<String, IdentitySession> realmMap)
{
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);
+
+ }
+
+ 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 = Class.forName(metaData.getClassName());
+ 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 = Class.forName(metaData.getClassName());
+ 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());
+
+ //TODO: for now we just use direct type mapper and ignore group type mappings config
+ IdentityObjectTypeMapper mapper = new DirectIdentityObjectTypeMapperImpl(metaData.getIdentityMapping());
+
+ IdentitySession session = new IdentitySessionImpl(realmName, repo, mapper);
+
+ sessionMap.put(realmName, session);
+ }
+
+ return sessionMap;
+ }
+
public void close()
{
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -29,6 +29,10 @@
import org.jboss.identity.api.AttributesManager;
import org.jboss.identity.api.RoleManager;
import org.jboss.identity.exception.IdentityException;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.repository.IdentityStoreRepository;
+import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
import java.util.Set;
@@ -50,27 +54,41 @@
private final RoleManager roleManager;
- private final Set<SessionWrapper> sessionWrappers;
-
public IdentitySessionContext getSessionContext()
{
return sessionContext;
}
- public IdentitySessionImpl(String realmName, IdentitySessionContext sessionContext,
- Set<SessionWrapper> sessionWrappers)
+ public IdentitySessionImpl(String realmName,
+ IdentityStoreRepository repository,
+ IdentityObjectTypeMapper typeMapper) throws IdentityException
{
this.realmName = realmName;
- this.sessionContext = sessionContext;
- this.sessionWrappers = sessionWrappers;
+
+ IdentityStoreSession storeSession = repository.createIdentityStoreSession();
+ final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName);
+
+ IdentityStoreInvocationContextResolver resolver = new IdentityStoreInvocationContextResolver()
+ {
+ public IdentityStoreInvocationContext resolveInvocationContext()
+ {
+ return invocationCtx;
+ }
+ };
+
+ sessionContext = new IdentitySessionContextImpl(repository, typeMapper, resolver);
+
this.persistenceManager = new PersistenceManagerImpl(this);
this.relationshipManager = new RelationshipManagerImpl(this);
this.profileManager = new AttributesManagerImpl(this);
this.roleManager = new RoleManagerImpl(this);
-
}
+
+
+
+
public String getRealmName()
{
return realmName;
@@ -78,50 +96,33 @@
public void close() throws IdentityException
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.close();
- }
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().close();
}
public void save() throws IdentityException
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.save();
- }
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().save();
}
public void clear() throws IdentityException
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.clear();
- }
+ sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().clear();
}
public boolean isOpen()
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- if (sessionWrapper.isOpen())
- {
- return true;
- }
- }
-
- return false;
+ return sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().isOpen();
}
public Transaction beginTransaction()
{
- return new SimpleTransactionImpl(sessionWrappers);
+ return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
}
public Transaction getTransaction()
{
- return new SimpleTransactionImpl(sessionWrappers);
+ return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession());
}
public PersistenceManager getPersistenceManager()
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleTransactionImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -23,57 +23,43 @@
package org.jboss.identity.impl.api;
import org.jboss.identity.api.Transaction;
+import org.jboss.identity.spi.store.IdentityStoreSession;
-import java.util.Set;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public class SimpleTransactionImpl implements Transaction
{
- private final Set<SessionWrapper> sessionWrappers;
+ private final IdentityStoreSession sessionWrapper;
- public SimpleTransactionImpl(Set<SessionWrapper> sessionWrappers)
+ public SimpleTransactionImpl(IdentityStoreSession sessionWrapper)
{
- this.sessionWrappers = sessionWrappers;
+ this.sessionWrapper = sessionWrapper;
}
public void start()
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.startTransaction();
- }
+ sessionWrapper.startTransaction();
}
public void commit()
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.commitTransaction();
- }
+
+ sessionWrapper.commitTransaction();
+
}
public void rollback()
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- sessionWrapper.rollbackTransaction();
- }
+
+ sessionWrapper.rollbackTransaction();
+
}
public boolean isActive()
{
- for (SessionWrapper sessionWrapper : sessionWrappers)
- {
- if (sessionWrapper.isTransactionActive())
- {
- return true;
- }
- }
-
- return false;
+ return sessionWrapper.isTransactionActive();
}
}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,274 @@
+/*
+* 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.impl.configuration.jaxb2;
+
+import org.jboss.identity.impl.configuration.metadata.IdentityConfigurationMetaDataImpl;
+import org.jboss.identity.impl.configuration.metadata.IdentityObjectTypeMetaDataImpl;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.RealmConfigurationMetaData;
+import org.jboss.identity.impl.configuration.metadata.RealmConfigurationMetaDataImpl;
+import org.jboss.identity.impl.configuration.metadata.IdentityRepositoryConfigurationMetaDataImpl;
+import org.jboss.identity.impl.configuration.metadata.IdentityStoreConfigurationMetaDataImpl;
+import org.jboss.identity.impl.configuration.metadata.IdentityStoreMappingMetaDataImpl;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreMappingMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.spi.exception.IdentityConfigurationException;
+import org.jboss.identity.spi.attribute.AttributeMetaData;
+import org.jboss.identity.spi.attribute.AttributeMetaDataImpl;
+import org.jboss.identity.impl.configuration.jaxb2.generated.JbossIdentityType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.IdentityStoreType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.RepositoryType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.RealmType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.GroupTypeMappingType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.OptionType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.OptionsType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.IdentityStoreMappingType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.IdentityObjectTypeType;
+import org.jboss.identity.impl.configuration.jaxb2.generated.AttributeType;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class JAXB2IdentityConfiguration
+{
+
+ //TODO: check if configuration is consistent
+
+
+ public static IdentityConfigurationMetaData createConfigurationMetaData(File xmlConfig) throws IdentityConfigurationException
+ {
+
+ if (xmlConfig == null || !xmlConfig.exists())
+ {
+ throw new IllegalArgumentException("File does not exist");
+ }
+
+ JAXBElement<JbossIdentityType> jiElement = null;
+
+ Object o = null;
+ try
+ {
+ JAXBContext jaxbContext = JAXBContext.newInstance("org.jboss.identity.impl.configuration.jaxb2.generated");
+ Unmarshaller unMarshaller = jaxbContext.createUnmarshaller();
+
+ jiElement = (JAXBElement<JbossIdentityType>)unMarshaller.unmarshal(xmlConfig);
+ }
+ catch (JAXBException e)
+ {
+ throw new IdentityConfigurationException("Cannot unmarshal xml configuration: ", e);
+ }
+
+ JbossIdentityType identityConfig = jiElement.getValue();
+
+ IdentityConfigurationMetaDataImpl configurationMD = new IdentityConfigurationMetaDataImpl();
+
+ for (IdentityStoreType identityStoreType : identityConfig.getStores().getIdentityStores().getIdentityStore())
+ {
+ configurationMD.getIdentityStores().add(createIdentityStoreConfigurationMetaData(identityStoreType));
+ }
+
+ for (RepositoryType repositoryType : identityConfig.getRepositories().getRepository())
+ {
+ configurationMD.getRepositories().add(createIdentityRepositoryConfigurationMetaData(repositoryType));
+ }
+
+ for (RealmType realmType : identityConfig.getRealms().getRealm())
+ {
+ configurationMD.getRealms().add(createRealmConfigurationMetaData(realmType));
+ }
+
+ return configurationMD;
+
+ }
+
+ private static RealmConfigurationMetaData createRealmConfigurationMetaData(RealmType realmType)
+ {
+ RealmConfigurationMetaDataImpl realmMD = new RealmConfigurationMetaDataImpl();
+
+ realmMD.setId(realmType.getId());
+ if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ {
+ realmMD.setIdentityMapping(realmType.getRealmConfiguration().getIdentityTypeMappings().getIdentityMapping());
+ }
+ realmMD.setIdentityRepositoryIdRef(realmType.getRepositoryIdRef());
+
+ Map<String, String> groupMappings = new HashMap<String, String>();
+
+ if (realmType.getRealmConfiguration().getIdentityTypeMappings() != null)
+ {
+ for (GroupTypeMappingType groupTypeMappingType : realmType.getRealmConfiguration().getIdentityTypeMappings().getGroupTypeMapping())
+ {
+ groupMappings.put(groupTypeMappingType.getGroupTypeName(), groupTypeMappingType.getIdentityObjectTypeName());
+ }
+ }
+
+ realmMD.setGroupTypeMappings(groupMappings);
+
+ realmMD.setOptions(createOptions(realmType.getRealmConfiguration().getOptions()));
+
+
+ return realmMD;
+ }
+
+
+ private static IdentityRepositoryConfigurationMetaData createIdentityRepositoryConfigurationMetaData(RepositoryType repositoryType)
+ {
+ IdentityRepositoryConfigurationMetaDataImpl repoMD = new IdentityRepositoryConfigurationMetaDataImpl();
+
+ repoMD.setId(repositoryType.getId());
+ repoMD.setClassName(repositoryType.getClazz());
+ if (repositoryType.getRepositoryConfiguration().getExternalConfig() != null)
+ {
+ repoMD.setExternalConfig(repositoryType.getRepositoryConfiguration().getExternalConfig().getValue());
+ }
+ repoMD.setDefaultAttributeStroeId(repositoryType.getRepositoryConfiguration().getDefaultAttributeStoreId());
+ repoMD.setDefaultIdentityStoreId(repositoryType.getRepositoryConfiguration().getDefaultIdentityStoreId());
+
+ List<IdentityStoreMappingMetaData> storeMappings = new LinkedList<IdentityStoreMappingMetaData>();
+
+ for (IdentityStoreMappingType identityStoreMappingType : repositoryType.getRepositoryConfiguration().getIdentityStoreMappings().getIdentityStoreMapping())
+ {
+ IdentityStoreMappingMetaDataImpl mapping = new IdentityStoreMappingMetaDataImpl();
+
+ mapping.setIdentityStoreId(identityStoreMappingType.getIdentityStoreId());
+ mapping.setIdentityObjectTypeMappings(identityStoreMappingType.getIdentityObjectTypes().getIdentityObjectType());
+ mapping.setOptions(createOptions(identityStoreMappingType.getOptions()));
+
+ storeMappings.add(mapping);
+ }
+
+ repoMD.setIdentityStoreToIdentityObjectTypeMappings(storeMappings);
+
+ repoMD.setOptions(createOptions(repositoryType.getRepositoryConfiguration().getOptions()));
+
+
+ return repoMD;
+ }
+
+ private static IdentityStoreConfigurationMetaData createIdentityStoreConfigurationMetaData(IdentityStoreType identityStoreType)
+ {
+ IdentityStoreConfigurationMetaDataImpl storeMD = new IdentityStoreConfigurationMetaDataImpl();
+
+ storeMD.setId(identityStoreType.getId());
+ storeMD.setClassName(identityStoreType.getClazz());
+
+ if (identityStoreType.getIdentityStoreConfiguration().getExternalConfig() != null)
+ {
+ storeMD.setExternalConfig(identityStoreType.getIdentityStoreConfiguration().getExternalConfig().getValue());
+ }
+
+ storeMD.setSupportedRelationshipTypes(identityStoreType.getIdentityStoreConfiguration().getSupportedRelationshipTypes().getRelationshipType());
+
+ for (IdentityObjectTypeType identityObjectTypeType : identityStoreType.getIdentityStoreConfiguration().getSupportedIdentityObjectTypes().getIdentityObjectType())
+ {
+ IdentityObjectTypeMetaDataImpl identityObjectTypeMD = new IdentityObjectTypeMetaDataImpl();
+
+ identityObjectTypeMD.setName(identityObjectTypeType.getName());
+
+ List<AttributeMetaData> attributes = new LinkedList<AttributeMetaData>();
+
+ for (AttributeType attributeType : identityObjectTypeType.getAttributes().getAttribute())
+ {
+ AttributeMetaDataImpl attributeMD = new AttributeMetaDataImpl();
+
+ attributeMD.setName(attributeType.getName());
+ attributeMD.setStoreMapping(attributeType.getMapping());
+
+ String readonly = attributeType.getIsReadOnly();
+ if (readonly != null && readonly.equalsIgnoreCase("true"))
+ {
+ attributeMD.setReadonly(true);
+ }
+
+ String multivalued = attributeType.getIsMultivalued();
+ if (multivalued != null && multivalued.equalsIgnoreCase("true"))
+ {
+ attributeMD.setMultivalued(true);
+ }
+
+ String required = attributeType.getIsRequired();
+ if (required != null && required.equalsIgnoreCase("true"))
+ {
+ attributeMD.setRequired(true);
+ }
+
+ attributes.add(attributeMD);
+ }
+
+ identityObjectTypeMD.setAttributes(attributes);
+
+
+ Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+ for (OptionType optionType : identityObjectTypeType.getOptions().getOption())
+ {
+ options.put(optionType.getName(), optionType.getValue());
+ }
+
+ identityObjectTypeMD.setOptions(options);
+
+ storeMD.getSupportedIdentityTypes().add(identityObjectTypeMD);
+ }
+
+
+
+ Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+ for (OptionType optionType : identityStoreType.getIdentityStoreConfiguration().getOptions().getOption())
+ {
+ options.put(optionType.getName(), optionType.getValue());
+ }
+
+ storeMD.setOptions(options);
+
+ return storeMD;
+ }
+
+ private static Map<String, List<String>> createOptions(OptionsType optionsType)
+ {
+ Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+ if (optionsType != null)
+ {
+ for (OptionType optionType : optionsType.getOption())
+ {
+ options.put(optionType.getName(), optionType.getValue());
+ }
+ }
+
+ return options;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributeType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,180 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for attributeType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="attributeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="mapping" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="isRequired" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="isMultivalued" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="isReadOnly" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "attributeType", propOrder = {
+ "name",
+ "mapping",
+ "isRequired",
+ "isMultivalued",
+ "isReadOnly"
+})
+public class AttributeType {
+
+ @XmlElement(required = true)
+ protected String name;
+ @XmlElement(required = true)
+ protected String mapping;
+ @XmlElement(required = true)
+ protected String isRequired;
+ @XmlElement(required = true)
+ protected String isMultivalued;
+ protected String isReadOnly;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the mapping property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMapping() {
+ return mapping;
+ }
+
+ /**
+ * Sets the value of the mapping property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMapping(String value) {
+ this.mapping = value;
+ }
+
+ /**
+ * Gets the value of the isRequired property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsRequired() {
+ return isRequired;
+ }
+
+ /**
+ * Sets the value of the isRequired property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsRequired(String value) {
+ this.isRequired = value;
+ }
+
+ /**
+ * Gets the value of the isMultivalued property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsMultivalued() {
+ return isMultivalued;
+ }
+
+ /**
+ * Sets the value of the isMultivalued property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsMultivalued(String value) {
+ this.isMultivalued = value;
+ }
+
+ /**
+ * Gets the value of the isReadOnly property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIsReadOnly() {
+ return isReadOnly;
+ }
+
+ /**
+ * Sets the value of the isReadOnly property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIsReadOnly(String value) {
+ this.isReadOnly = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/AttributesType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for attributesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="attributesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="attribute" type="{urn:jboss:identity:config:v0_1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "attributesType", propOrder = {
+ "attribute"
+})
+public class AttributesType {
+
+ protected List<AttributeType> attribute;
+
+ /**
+ * Gets the value of the attribute property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the attribute property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getAttribute().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link AttributeType }
+ *
+ *
+ */
+ public List<AttributeType> getAttribute() {
+ if (attribute == null) {
+ attribute = new ArrayList<AttributeType>();
+ }
+ return this.attribute;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ExternalConfigType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,94 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+
+/**
+ * <p>Java class for external-configType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="external-configType">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ * <attribute name="override" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "external-configType", propOrder = {
+ "value"
+})
+public class ExternalConfigType {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute
+ protected String override;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the override property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getOverride() {
+ return override;
+ }
+
+ /**
+ * Sets the value of the override property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setOverride(String value) {
+ this.override = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/GroupTypeMappingType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for group-type-mappingType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="group-type-mappingType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="group-type-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="identity-object-type-name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "group-type-mappingType", propOrder = {
+ "groupTypeName",
+ "identityObjectTypeName"
+})
+public class GroupTypeMappingType {
+
+ @XmlElement(name = "group-type-name", required = true)
+ protected String groupTypeName;
+ @XmlElement(name = "identity-object-type-name", required = true)
+ protected String identityObjectTypeName;
+
+ /**
+ * Gets the value of the groupTypeName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getGroupTypeName() {
+ return groupTypeName;
+ }
+
+ /**
+ * Sets the value of the groupTypeName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setGroupTypeName(String value) {
+ this.groupTypeName = value;
+ }
+
+ /**
+ * Gets the value of the identityObjectTypeName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIdentityObjectTypeName() {
+ return identityObjectTypeName;
+ }
+
+ /**
+ * Sets the value of the identityObjectTypeName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIdentityObjectTypeName(String value) {
+ this.identityObjectTypeName = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,362 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-object-typeType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-object-typeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="relationships">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="relationship" type="{urn:jboss:identity:config:v0_1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="attributes">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="attribute" type="{urn:jboss:identity:config:v0_1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="options">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-object-typeType", propOrder = {
+ "name",
+ "relationships",
+ "attributes",
+ "options"
+})
+public class IdentityObjectTypeType {
+
+ @XmlElement(required = true)
+ protected String name;
+ @XmlElement(required = true)
+ protected IdentityObjectTypeType.Relationships relationships;
+ @XmlElement(required = true)
+ protected IdentityObjectTypeType.Attributes attributes;
+ @XmlElement(required = true)
+ protected IdentityObjectTypeType.Options options;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the relationships property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityObjectTypeType.Relationships }
+ *
+ */
+ public IdentityObjectTypeType.Relationships getRelationships() {
+ return relationships;
+ }
+
+ /**
+ * Sets the value of the relationships property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityObjectTypeType.Relationships }
+ *
+ */
+ public void setRelationships(IdentityObjectTypeType.Relationships value) {
+ this.relationships = value;
+ }
+
+ /**
+ * Gets the value of the attributes property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityObjectTypeType.Attributes }
+ *
+ */
+ public IdentityObjectTypeType.Attributes getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * Sets the value of the attributes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityObjectTypeType.Attributes }
+ *
+ */
+ public void setAttributes(IdentityObjectTypeType.Attributes value) {
+ this.attributes = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityObjectTypeType.Options }
+ *
+ */
+ public IdentityObjectTypeType.Options getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityObjectTypeType.Options }
+ *
+ */
+ public void setOptions(IdentityObjectTypeType.Options value) {
+ this.options = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="attribute" type="{urn:jboss:identity:config:v0_1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "attribute"
+ })
+ public static class Attributes {
+
+ protected List<AttributeType> attribute;
+
+ /**
+ * Gets the value of the attribute property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the attribute property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getAttribute().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link AttributeType }
+ *
+ *
+ */
+ public List<AttributeType> getAttribute() {
+ if (attribute == null) {
+ attribute = new ArrayList<AttributeType>();
+ }
+ return this.attribute;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "option"
+ })
+ public static class Options {
+
+ protected List<OptionType> option;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link OptionType }
+ *
+ *
+ */
+ public List<OptionType> getOption() {
+ if (option == null) {
+ option = new ArrayList<OptionType>();
+ }
+ return this.option;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="relationship" type="{urn:jboss:identity:config:v0_1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "relationship"
+ })
+ public static class Relationships {
+
+ protected List<RelationshipType> relationship;
+
+ /**
+ * Gets the value of the relationship property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the relationship property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRelationship().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link RelationshipType }
+ *
+ *
+ */
+ public List<RelationshipType> getRelationship() {
+ if (relationship == null) {
+ relationship = new ArrayList<RelationshipType>();
+ }
+ return this.relationship;
+ }
+
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityObjectTypesType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-object-typesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-object-typesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-object-type" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-object-typesType", propOrder = {
+ "identityObjectType"
+})
+public class IdentityObjectTypesType {
+
+ @XmlElement(name = "identity-object-type")
+ protected List<String> identityObjectType;
+
+ /**
+ * Gets the value of the identityObjectType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the identityObjectType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getIdentityObjectType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getIdentityObjectType() {
+ if (identityObjectType == null) {
+ identityObjectType = new ArrayList<String>();
+ }
+ return this.identityObjectType;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreConfigurationType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,224 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-store-configurationType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-store-configurationType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType"/>
+ * <element name="supported-relationship-types" type="{urn:jboss:identity:config:v0_1}supported-relationship-typesType"/>
+ * <element name="supported-identity-object-types" type="{urn:jboss:identity:config:v0_1}supported-identity-object-typesType"/>
+ * <element name="options">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-store-configurationType", propOrder = {
+ "externalConfig",
+ "supportedRelationshipTypes",
+ "supportedIdentityObjectTypes",
+ "options"
+})
+public class IdentityStoreConfigurationType {
+
+ @XmlElement(name = "external-config", required = true)
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "supported-relationship-types", required = true)
+ protected SupportedRelationshipTypesType supportedRelationshipTypes;
+ @XmlElement(name = "supported-identity-object-types", required = true)
+ protected SupportedIdentityObjectTypesType supportedIdentityObjectTypes;
+ @XmlElement(required = true)
+ protected IdentityStoreConfigurationType.Options options;
+
+ /**
+ * Gets the value of the externalConfig property.
+ *
+ * @return
+ * possible object is
+ * {@link ExternalConfigType }
+ *
+ */
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
+ }
+
+ /**
+ * Sets the value of the externalConfig property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ExternalConfigType }
+ *
+ */
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
+ }
+
+ /**
+ * Gets the value of the supportedRelationshipTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public SupportedRelationshipTypesType getSupportedRelationshipTypes() {
+ return supportedRelationshipTypes;
+ }
+
+ /**
+ * Sets the value of the supportedRelationshipTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedRelationshipTypesType }
+ *
+ */
+ public void setSupportedRelationshipTypes(SupportedRelationshipTypesType value) {
+ this.supportedRelationshipTypes = value;
+ }
+
+ /**
+ * Gets the value of the supportedIdentityObjectTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public SupportedIdentityObjectTypesType getSupportedIdentityObjectTypes() {
+ return supportedIdentityObjectTypes;
+ }
+
+ /**
+ * Sets the value of the supportedIdentityObjectTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public void setSupportedIdentityObjectTypes(SupportedIdentityObjectTypesType value) {
+ this.supportedIdentityObjectTypes = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreConfigurationType.Options }
+ *
+ */
+ public IdentityStoreConfigurationType.Options getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreConfigurationType.Options }
+ *
+ */
+ public void setOptions(IdentityStoreConfigurationType.Options value) {
+ this.options = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "option"
+ })
+ public static class Options {
+
+ protected List<OptionType> option;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link OptionType }
+ *
+ *
+ */
+ public List<OptionType> getOption() {
+ if (option == null) {
+ option = new ArrayList<OptionType>();
+ }
+ return this.option;
+ }
+
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,125 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-store-mappingType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-store-mappingType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="identity-object-types" type="{urn:jboss:identity:config:v0_1}identity-object-typesType"/>
+ * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-store-mappingType", propOrder = {
+ "identityStoreId",
+ "identityObjectTypes",
+ "options"
+})
+public class IdentityStoreMappingType {
+
+ @XmlElement(name = "identity-store-id", required = true)
+ protected String identityStoreId;
+ @XmlElement(name = "identity-object-types", required = true)
+ protected IdentityObjectTypesType identityObjectTypes;
+ @XmlElement(required = true)
+ protected OptionsType options;
+
+ /**
+ * Gets the value of the identityStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIdentityStoreId() {
+ return identityStoreId;
+ }
+
+ /**
+ * Sets the value of the identityStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIdentityStoreId(String value) {
+ this.identityStoreId = value;
+ }
+
+ /**
+ * Gets the value of the identityObjectTypes property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityObjectTypesType }
+ *
+ */
+ public IdentityObjectTypesType getIdentityObjectTypes() {
+ return identityObjectTypes;
+ }
+
+ /**
+ * Sets the value of the identityObjectTypes property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityObjectTypesType }
+ *
+ */
+ public void setIdentityObjectTypes(IdentityObjectTypesType value) {
+ this.identityObjectTypes = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-store-mappingsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-store-mappingsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-store-mapping" type="{urn:jboss:identity:config:v0_1}identity-store-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-store-mappingsType", propOrder = {
+ "identityStoreMapping"
+})
+public class IdentityStoreMappingsType {
+
+ @XmlElement(name = "identity-store-mapping")
+ protected List<IdentityStoreMappingType> identityStoreMapping;
+
+ /**
+ * Gets the value of the identityStoreMapping property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the identityStoreMapping property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getIdentityStoreMapping().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link IdentityStoreMappingType }
+ *
+ *
+ */
+ public List<IdentityStoreMappingType> getIdentityStoreMapping() {
+ if (identityStoreMapping == null) {
+ identityStoreMapping = new ArrayList<IdentityStoreMappingType>();
+ }
+ return this.identityStoreMapping;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoreType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,125 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-storeType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-storeType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="identity-store-configuration" type="{urn:jboss:identity:config:v0_1}identity-store-configurationType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-storeType", propOrder = {
+ "id",
+ "clazz",
+ "identityStoreConfiguration"
+})
+public class IdentityStoreType {
+
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(name = "class", required = true)
+ protected String clazz;
+ @XmlElement(name = "identity-store-configuration", required = true)
+ protected IdentityStoreConfigurationType identityStoreConfiguration;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the clazz property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getClazz() {
+ return clazz;
+ }
+
+ /**
+ * Sets the value of the clazz property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setClazz(String value) {
+ this.clazz = value;
+ }
+
+ /**
+ * Gets the value of the identityStoreConfiguration property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreConfigurationType }
+ *
+ */
+ public IdentityStoreConfigurationType getIdentityStoreConfiguration() {
+ return identityStoreConfiguration;
+ }
+
+ /**
+ * Sets the value of the identityStoreConfiguration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreConfigurationType }
+ *
+ */
+ public void setIdentityStoreConfiguration(IdentityStoreConfigurationType value) {
+ this.identityStoreConfiguration = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityStoresType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-storesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-storesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-store" type="{urn:jboss:identity:config:v0_1}identity-storeType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-storesType", propOrder = {
+ "identityStore"
+})
+public class IdentityStoresType {
+
+ @XmlElement(name = "identity-store")
+ protected List<IdentityStoreType> identityStore;
+
+ /**
+ * Gets the value of the identityStore property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the identityStore property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getIdentityStore().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link IdentityStoreType }
+ *
+ *
+ */
+ public List<IdentityStoreType> getIdentityStore() {
+ if (identityStore == null) {
+ identityStore = new ArrayList<IdentityStoreType>();
+ }
+ return this.identityStore;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,104 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for identity-type-mappingsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="identity-type-mappingsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-mapping" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="group-type-mapping" type="{urn:jboss:identity:config:v0_1}group-type-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "identity-type-mappingsType", propOrder = {
+ "identityMapping",
+ "groupTypeMapping"
+})
+public class IdentityTypeMappingsType {
+
+ @XmlElement(name = "identity-mapping", required = true)
+ protected String identityMapping;
+ @XmlElement(name = "group-type-mapping")
+ protected List<GroupTypeMappingType> groupTypeMapping;
+
+ /**
+ * Gets the value of the identityMapping property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIdentityMapping() {
+ return identityMapping;
+ }
+
+ /**
+ * Sets the value of the identityMapping property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIdentityMapping(String value) {
+ this.identityMapping = value;
+ }
+
+ /**
+ * Gets the value of the groupTypeMapping property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the groupTypeMapping property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getGroupTypeMapping().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link GroupTypeMappingType }
+ *
+ *
+ */
+ public List<GroupTypeMappingType> getGroupTypeMapping() {
+ if (groupTypeMapping == null) {
+ groupTypeMapping = new ArrayList<GroupTypeMappingType>();
+ }
+ return this.groupTypeMapping;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/JbossIdentityType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,125 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for jboss-identityType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="jboss-identityType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="realms" type="{urn:jboss:identity:config:v0_1}realmsType"/>
+ * <element name="repositories" type="{urn:jboss:identity:config:v0_1}repositoriesType"/>
+ * <element name="stores" type="{urn:jboss:identity:config:v0_1}storesType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "jboss-identityType", propOrder = {
+ "realms",
+ "repositories",
+ "stores"
+})
+public class JbossIdentityType {
+
+ @XmlElement(required = true)
+ protected RealmsType realms;
+ @XmlElement(required = true)
+ protected RepositoriesType repositories;
+ @XmlElement(required = true)
+ protected StoresType stores;
+
+ /**
+ * Gets the value of the realms property.
+ *
+ * @return
+ * possible object is
+ * {@link RealmsType }
+ *
+ */
+ public RealmsType getRealms() {
+ return realms;
+ }
+
+ /**
+ * Sets the value of the realms property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RealmsType }
+ *
+ */
+ public void setRealms(RealmsType value) {
+ this.realms = value;
+ }
+
+ /**
+ * Gets the value of the repositories property.
+ *
+ * @return
+ * possible object is
+ * {@link RepositoriesType }
+ *
+ */
+ public RepositoriesType getRepositories() {
+ return repositories;
+ }
+
+ /**
+ * Sets the value of the repositories property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RepositoriesType }
+ *
+ */
+ public void setRepositories(RepositoriesType value) {
+ this.repositories = value;
+ }
+
+ /**
+ * Gets the value of the stores property.
+ *
+ * @return
+ * possible object is
+ * {@link StoresType }
+ *
+ */
+ public StoresType getStores() {
+ return stores;
+ }
+
+ /**
+ * Sets the value of the stores property.
+ *
+ * @param value
+ * allowed object is
+ * {@link StoresType }
+ *
+ */
+ public void setStores(StoresType value) {
+ this.stores = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/ObjectFactory.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,292 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.identity.impl.configuration.jaxb2.generated package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _JbossIdentity_QNAME = new QName("urn:jboss:identity:config:v0_1", "jboss-identity");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.identity.impl.configuration.jaxb2.generated
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoreMappingType }
+ *
+ */
+ public IdentityStoreMappingType createIdentityStoreMappingType() {
+ return new IdentityStoreMappingType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoreType }
+ *
+ */
+ public IdentityStoreType createIdentityStoreType() {
+ return new IdentityStoreType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityTypeMappingsType }
+ *
+ */
+ public IdentityTypeMappingsType createIdentityTypeMappingsType() {
+ return new IdentityTypeMappingsType();
+ }
+
+ /**
+ * Create an instance of {@link OptionType }
+ *
+ */
+ public OptionType createOptionType() {
+ return new OptionType();
+ }
+
+ /**
+ * Create an instance of {@link AttributeType }
+ *
+ */
+ public AttributeType createAttributeType() {
+ return new AttributeType();
+ }
+
+ /**
+ * Create an instance of {@link RepositoryType }
+ *
+ */
+ public RepositoryType createRepositoryType() {
+ return new RepositoryType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityObjectTypeType.Options }
+ *
+ */
+ public IdentityObjectTypeType.Options createIdentityObjectTypeTypeOptions() {
+ return new IdentityObjectTypeType.Options();
+ }
+
+ /**
+ * Create an instance of {@link IdentityObjectTypesType }
+ *
+ */
+ public IdentityObjectTypesType createIdentityObjectTypesType() {
+ return new IdentityObjectTypesType();
+ }
+
+ /**
+ * Create an instance of {@link StoresType }
+ *
+ */
+ public StoresType createStoresType() {
+ return new StoresType();
+ }
+
+ /**
+ * Create an instance of {@link RealmConfigurationType }
+ *
+ */
+ public RealmConfigurationType createRealmConfigurationType() {
+ return new RealmConfigurationType();
+ }
+
+ /**
+ * Create an instance of {@link OptionsType }
+ *
+ */
+ public OptionsType createOptionsType() {
+ return new OptionsType();
+ }
+
+ /**
+ * Create an instance of {@link RealmType }
+ *
+ */
+ public RealmType createRealmType() {
+ return new RealmType();
+ }
+
+ /**
+ * Create an instance of {@link RelationshipType }
+ *
+ */
+ public RelationshipType createRelationshipType() {
+ return new RelationshipType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoreConfigurationType }
+ *
+ */
+ public IdentityStoreConfigurationType createIdentityStoreConfigurationType() {
+ return new IdentityStoreConfigurationType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityObjectTypeType.Relationships }
+ *
+ */
+ public IdentityObjectTypeType.Relationships createIdentityObjectTypeTypeRelationships() {
+ return new IdentityObjectTypeType.Relationships();
+ }
+
+ /**
+ * Create an instance of {@link AttributesType }
+ *
+ */
+ public AttributesType createAttributesType() {
+ return new AttributesType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityObjectTypeType }
+ *
+ */
+ public IdentityObjectTypeType createIdentityObjectTypeType() {
+ return new IdentityObjectTypeType();
+ }
+
+ /**
+ * Create an instance of {@link RealmsType }
+ *
+ */
+ public RealmsType createRealmsType() {
+ return new RealmsType();
+ }
+
+ /**
+ * Create an instance of {@link SupportedIdentityObjectTypesType }
+ *
+ */
+ public SupportedIdentityObjectTypesType createSupportedIdentityObjectTypesType() {
+ return new SupportedIdentityObjectTypesType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoresType }
+ *
+ */
+ public IdentityStoresType createIdentityStoresType() {
+ return new IdentityStoresType();
+ }
+
+ /**
+ * Create an instance of {@link SupportedRelationshipTypesType }
+ *
+ */
+ public SupportedRelationshipTypesType createSupportedRelationshipTypesType() {
+ return new SupportedRelationshipTypesType();
+ }
+
+ /**
+ * Create an instance of {@link GroupTypeMappingType }
+ *
+ */
+ public GroupTypeMappingType createGroupTypeMappingType() {
+ return new GroupTypeMappingType();
+ }
+
+ /**
+ * Create an instance of {@link JbossIdentityType }
+ *
+ */
+ public JbossIdentityType createJbossIdentityType() {
+ return new JbossIdentityType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityObjectTypeType.Attributes }
+ *
+ */
+ public IdentityObjectTypeType.Attributes createIdentityObjectTypeTypeAttributes() {
+ return new IdentityObjectTypeType.Attributes();
+ }
+
+ /**
+ * Create an instance of {@link RelationshipsType }
+ *
+ */
+ public RelationshipsType createRelationshipsType() {
+ return new RelationshipsType();
+ }
+
+ /**
+ * Create an instance of {@link RepositoriesType }
+ *
+ */
+ public RepositoriesType createRepositoriesType() {
+ return new RepositoriesType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoreMappingsType }
+ *
+ */
+ public IdentityStoreMappingsType createIdentityStoreMappingsType() {
+ return new IdentityStoreMappingsType();
+ }
+
+ /**
+ * Create an instance of {@link RepositoryConfigurationType }
+ *
+ */
+ public RepositoryConfigurationType createRepositoryConfigurationType() {
+ return new RepositoryConfigurationType();
+ }
+
+ /**
+ * Create an instance of {@link IdentityStoreConfigurationType.Options }
+ *
+ */
+ public IdentityStoreConfigurationType.Options createIdentityStoreConfigurationTypeOptions() {
+ return new IdentityStoreConfigurationType.Options();
+ }
+
+ /**
+ * Create an instance of {@link ExternalConfigType }
+ *
+ */
+ public ExternalConfigType createExternalConfigType() {
+ return new ExternalConfigType();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link JbossIdentityType }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "urn:jboss:identity:config:v0_1", name = "jboss-identity")
+ public JAXBElement<JbossIdentityType> createJbossIdentity(JbossIdentityType value) {
+ return new JAXBElement<JbossIdentityType>(_JbossIdentity_QNAME, JbossIdentityType.class, null, value);
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,103 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for optionType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="optionType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "optionType", propOrder = {
+ "name",
+ "value"
+})
+public class OptionType {
+
+ @XmlElement(required = true)
+ protected String name;
+ protected List<String> value;
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the value property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getValue().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getValue() {
+ if (value == null) {
+ value = new ArrayList<String>();
+ }
+ return this.value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/OptionsType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for optionsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="optionsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="option" type="{urn:jboss:identity:config:v0_1}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "optionsType", propOrder = {
+ "option"
+})
+public class OptionsType {
+
+ protected List<OptionType> option;
+
+ /**
+ * Gets the value of the option property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the option property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getOption().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link OptionType }
+ *
+ *
+ */
+ public List<OptionType> getOption() {
+ if (option == null) {
+ option = new ArrayList<OptionType>();
+ }
+ return this.option;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmConfigurationType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,96 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for realm-configurationType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="realm-configurationType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-type-mappings" type="{urn:jboss:identity:config:v0_1}identity-type-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "realm-configurationType", propOrder = {
+ "identityTypeMappings",
+ "options"
+})
+public class RealmConfigurationType {
+
+ @XmlElement(name = "identity-type-mappings")
+ protected IdentityTypeMappingsType identityTypeMappings;
+ protected OptionsType options;
+
+ /**
+ * Gets the value of the identityTypeMappings property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityTypeMappingsType }
+ *
+ */
+ public IdentityTypeMappingsType getIdentityTypeMappings() {
+ return identityTypeMappings;
+ }
+
+ /**
+ * Sets the value of the identityTypeMappings property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityTypeMappingsType }
+ *
+ */
+ public void setIdentityTypeMappings(IdentityTypeMappingsType value) {
+ this.identityTypeMappings = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,125 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for realmType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="realmType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="repository-id-ref" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="realm-configuration" type="{urn:jboss:identity:config:v0_1}realm-configurationType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "realmType", propOrder = {
+ "id",
+ "repositoryIdRef",
+ "realmConfiguration"
+})
+public class RealmType {
+
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(name = "repository-id-ref", required = true)
+ protected String repositoryIdRef;
+ @XmlElement(name = "realm-configuration", required = true)
+ protected RealmConfigurationType realmConfiguration;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the repositoryIdRef property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRepositoryIdRef() {
+ return repositoryIdRef;
+ }
+
+ /**
+ * Sets the value of the repositoryIdRef property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRepositoryIdRef(String value) {
+ this.repositoryIdRef = value;
+ }
+
+ /**
+ * Gets the value of the realmConfiguration property.
+ *
+ * @return
+ * possible object is
+ * {@link RealmConfigurationType }
+ *
+ */
+ public RealmConfigurationType getRealmConfiguration() {
+ return realmConfiguration;
+ }
+
+ /**
+ * Sets the value of the realmConfiguration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RealmConfigurationType }
+ *
+ */
+ public void setRealmConfiguration(RealmConfigurationType value) {
+ this.realmConfiguration = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RealmsType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for realmsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="realmsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="realm" type="{urn:jboss:identity:config:v0_1}realmType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "realmsType", propOrder = {
+ "realm"
+})
+public class RealmsType {
+
+ protected List<RealmType> realm;
+
+ /**
+ * Gets the value of the realm property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the realm property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRealm().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link RealmType }
+ *
+ *
+ */
+ public List<RealmType> getRealm() {
+ if (realm == null) {
+ realm = new ArrayList<RealmType>();
+ }
+ return this.realm;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for relationshipType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="relationshipType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="relationship-type-ref" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="identity-object-type-ref" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "relationshipType", propOrder = {
+ "relationshipTypeRef",
+ "identityObjectTypeRef"
+})
+public class RelationshipType {
+
+ @XmlElement(name = "relationship-type-ref", required = true)
+ protected String relationshipTypeRef;
+ @XmlElement(name = "identity-object-type-ref", required = true)
+ protected String identityObjectTypeRef;
+
+ /**
+ * Gets the value of the relationshipTypeRef property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRelationshipTypeRef() {
+ return relationshipTypeRef;
+ }
+
+ /**
+ * Sets the value of the relationshipTypeRef property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRelationshipTypeRef(String value) {
+ this.relationshipTypeRef = value;
+ }
+
+ /**
+ * Gets the value of the identityObjectTypeRef property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIdentityObjectTypeRef() {
+ return identityObjectTypeRef;
+ }
+
+ /**
+ * Sets the value of the identityObjectTypeRef property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIdentityObjectTypeRef(String value) {
+ this.identityObjectTypeRef = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RelationshipsType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for relationshipsType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="relationshipsType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="relationship" type="{urn:jboss:identity:config:v0_1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "relationshipsType", propOrder = {
+ "relationship"
+})
+public class RelationshipsType {
+
+ protected List<RelationshipType> relationship;
+
+ /**
+ * Gets the value of the relationship property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the relationship property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRelationship().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link RelationshipType }
+ *
+ *
+ */
+ public List<RelationshipType> getRelationship() {
+ if (relationship == null) {
+ relationship = new ArrayList<RelationshipType>();
+ }
+ return this.relationship;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoriesType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for repositoriesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="repositoriesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="repository" type="{urn:jboss:identity:config:v0_1}repositoryType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "repositoriesType", propOrder = {
+ "repository"
+})
+public class RepositoriesType {
+
+ protected List<RepositoryType> repository;
+
+ /**
+ * Gets the value of the repository property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the repository property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRepository().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link RepositoryType }
+ *
+ *
+ */
+ public List<RepositoryType> getRepository() {
+ if (repository == null) {
+ repository = new ArrayList<RepositoryType>();
+ }
+ return this.repository;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryConfigurationType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,180 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for repository-configurationType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="repository-configurationType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="external-config" type="{urn:jboss:identity:config:v0_1}external-configType" minOccurs="0"/>
+ * <element name="default-identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="default-attribute-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="identity-store-mappings" type="{urn:jboss:identity:config:v0_1}identity-store-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:config:v0_1}optionsType" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "repository-configurationType", propOrder = {
+ "externalConfig",
+ "defaultIdentityStoreId",
+ "defaultAttributeStoreId",
+ "identityStoreMappings",
+ "options"
+})
+public class RepositoryConfigurationType {
+
+ @XmlElement(name = "external-config")
+ protected ExternalConfigType externalConfig;
+ @XmlElement(name = "default-identity-store-id")
+ protected String defaultIdentityStoreId;
+ @XmlElement(name = "default-attribute-store-id")
+ protected String defaultAttributeStoreId;
+ @XmlElement(name = "identity-store-mappings")
+ protected IdentityStoreMappingsType identityStoreMappings;
+ protected OptionsType options;
+
+ /**
+ * Gets the value of the externalConfig property.
+ *
+ * @return
+ * possible object is
+ * {@link ExternalConfigType }
+ *
+ */
+ public ExternalConfigType getExternalConfig() {
+ return externalConfig;
+ }
+
+ /**
+ * Sets the value of the externalConfig property.
+ *
+ * @param value
+ * allowed object is
+ * {@link ExternalConfigType }
+ *
+ */
+ public void setExternalConfig(ExternalConfigType value) {
+ this.externalConfig = value;
+ }
+
+ /**
+ * Gets the value of the defaultIdentityStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultIdentityStoreId() {
+ return defaultIdentityStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultIdentityStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultIdentityStoreId(String value) {
+ this.defaultIdentityStoreId = value;
+ }
+
+ /**
+ * Gets the value of the defaultAttributeStoreId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDefaultAttributeStoreId() {
+ return defaultAttributeStoreId;
+ }
+
+ /**
+ * Sets the value of the defaultAttributeStoreId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDefaultAttributeStoreId(String value) {
+ this.defaultAttributeStoreId = value;
+ }
+
+ /**
+ * Gets the value of the identityStoreMappings property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public IdentityStoreMappingsType getIdentityStoreMappings() {
+ return identityStoreMappings;
+ }
+
+ /**
+ * Sets the value of the identityStoreMappings property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoreMappingsType }
+ *
+ */
+ public void setIdentityStoreMappings(IdentityStoreMappingsType value) {
+ this.identityStoreMappings = value;
+ }
+
+ /**
+ * Gets the value of the options property.
+ *
+ * @return
+ * possible object is
+ * {@link OptionsType }
+ *
+ */
+ public OptionsType getOptions() {
+ return options;
+ }
+
+ /**
+ * Sets the value of the options property.
+ *
+ * @param value
+ * allowed object is
+ * {@link OptionsType }
+ *
+ */
+ public void setOptions(OptionsType value) {
+ this.options = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/RepositoryType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,125 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for repositoryType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="repositoryType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="repository-configuration" type="{urn:jboss:identity:config:v0_1}repository-configurationType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "repositoryType", propOrder = {
+ "id",
+ "clazz",
+ "repositoryConfiguration"
+})
+public class RepositoryType {
+
+ @XmlElement(required = true)
+ protected String id;
+ @XmlElement(name = "class", required = true)
+ protected String clazz;
+ @XmlElement(name = "repository-configuration", required = true)
+ protected RepositoryConfigurationType repositoryConfiguration;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the clazz property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getClazz() {
+ return clazz;
+ }
+
+ /**
+ * Sets the value of the clazz property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setClazz(String value) {
+ this.clazz = value;
+ }
+
+ /**
+ * Gets the value of the repositoryConfiguration property.
+ *
+ * @return
+ * possible object is
+ * {@link RepositoryConfigurationType }
+ *
+ */
+ public RepositoryConfigurationType getRepositoryConfiguration() {
+ return repositoryConfiguration;
+ }
+
+ /**
+ * Sets the value of the repositoryConfiguration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RepositoryConfigurationType }
+ *
+ */
+ public void setRepositoryConfiguration(RepositoryConfigurationType value) {
+ this.repositoryConfiguration = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/StoresType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for storesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="storesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="attribute-stores" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="identity-stores" type="{urn:jboss:identity:config:v0_1}identity-storesType"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "storesType", propOrder = {
+ "attributeStores",
+ "identityStores"
+})
+public class StoresType {
+
+ @XmlElement(name = "attribute-stores", required = true)
+ protected String attributeStores;
+ @XmlElement(name = "identity-stores", required = true)
+ protected IdentityStoresType identityStores;
+
+ /**
+ * Gets the value of the attributeStores property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getAttributeStores() {
+ return attributeStores;
+ }
+
+ /**
+ * Sets the value of the attributeStores property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setAttributeStores(String value) {
+ this.attributeStores = value;
+ }
+
+ /**
+ * Gets the value of the identityStores property.
+ *
+ * @return
+ * possible object is
+ * {@link IdentityStoresType }
+ *
+ */
+ public IdentityStoresType getIdentityStores() {
+ return identityStores;
+ }
+
+ /**
+ * Sets the value of the identityStores property.
+ *
+ * @param value
+ * allowed object is
+ * {@link IdentityStoresType }
+ *
+ */
+ public void setIdentityStores(IdentityStoresType value) {
+ this.identityStores = value;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for supported-identity-object-typesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="supported-identity-object-typesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="identity-object-type" type="{urn:jboss:identity:config:v0_1}identity-object-typeType" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "supported-identity-object-typesType", propOrder = {
+ "identityObjectType"
+})
+public class SupportedIdentityObjectTypesType {
+
+ @XmlElement(name = "identity-object-type")
+ protected List<IdentityObjectTypeType> identityObjectType;
+
+ /**
+ * Gets the value of the identityObjectType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the identityObjectType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getIdentityObjectType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link IdentityObjectTypeType }
+ *
+ *
+ */
+ public List<IdentityObjectTypeType> getIdentityObjectType() {
+ if (identityObjectType == null) {
+ identityObjectType = new ArrayList<IdentityObjectTypeType>();
+ }
+ return this.identityObjectType;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/SupportedRelationshipTypesType.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+
+package org.jboss.identity.impl.configuration.jaxb2.generated;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for supported-relationship-typesType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="supported-relationship-typesType">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="relationship-type" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "supported-relationship-typesType", propOrder = {
+ "relationshipType"
+})
+public class SupportedRelationshipTypesType {
+
+ @XmlElement(name = "relationship-type")
+ protected List<String> relationshipType;
+
+ /**
+ * Gets the value of the relationshipType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the relationshipType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getRelationshipType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getRelationshipType() {
+ if (relationshipType == null) {
+ relationshipType = new ArrayList<String>();
+ }
+ return this.relationshipType;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/jaxb2/generated/package-info.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2008.11.06 at 01:23:39 PM CET
+//
+
+(a)javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity:config:v0_1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.jboss.identity.impl.configuration.jaxb2.generated;
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityConfigurationMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityConfigurationMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityConfigurationMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,115 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.RealmConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+
+import java.util.List;
+import java.util.Map;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityConfigurationMetaDataImpl implements IdentityConfigurationMetaData
+{
+
+ private List<RealmConfigurationMetaData> realms = new LinkedList<RealmConfigurationMetaData>();
+
+ private List<IdentityRepositoryConfigurationMetaData> repositories = new LinkedList<IdentityRepositoryConfigurationMetaData>();
+
+ private List<IdentityStoreConfigurationMetaData> identityStores = new LinkedList<IdentityStoreConfigurationMetaData>();
+
+ private Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+ public IdentityConfigurationMetaDataImpl()
+ {
+ }
+
+ public List<RealmConfigurationMetaData> getRealms()
+ {
+ return realms;
+ }
+
+ public void setRealms(List<RealmConfigurationMetaData> realms)
+ {
+ this.realms = realms;
+ }
+
+ public List<IdentityRepositoryConfigurationMetaData> getRepositories()
+ {
+ return repositories;
+ }
+
+ public void setRepositories(List<IdentityRepositoryConfigurationMetaData> repositories)
+ {
+ this.repositories = repositories;
+ }
+
+ public List<IdentityStoreConfigurationMetaData> getIdentityStores()
+ {
+ return identityStores;
+ }
+
+ public void setIdentityStores(List<IdentityStoreConfigurationMetaData> identityStores)
+ {
+ this.identityStores = identityStores;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityObjectTypeMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,112 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.attribute.AttributeMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityObjectTypeMetaDataImpl implements IdentityObjectTypeMetaData
+{
+
+ private String name;
+
+ private List<RelationshipMetaData> relationships;
+
+ private List<AttributeMetaData> attributes;
+
+ private Map<String, List<String>> options;
+
+ public IdentityObjectTypeMetaDataImpl()
+ {
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public List<RelationshipMetaData> getRelationships()
+ {
+ return relationships;
+ }
+
+ public void setRelationships(List<RelationshipMetaData> relationships)
+ {
+ this.relationships = relationships;
+ }
+
+ public List<AttributeMetaData> getAttributes()
+ {
+ return attributes;
+ }
+
+ public void setAttributes(List<AttributeMetaData> attributes)
+ {
+ this.attributes = attributes;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ public List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ public String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityRepositoryConfigurationMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityRepositoryConfigurationMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityRepositoryConfigurationMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,149 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreMappingMetaData;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityRepositoryConfigurationMetaDataImpl implements IdentityRepositoryConfigurationMetaData
+{
+
+ private String id;
+
+ private String className;
+
+ private String externalConfig;
+
+ private String defaultIdentityStoreId;
+
+ private String defaultAttributeStroeId;
+
+ private List<IdentityStoreMappingMetaData> identityStoreToIdentityObjectTypeMappings;
+
+ private Map<String, List<String>> options;
+
+
+ public IdentityRepositoryConfigurationMetaDataImpl()
+ {
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ public String getExternalConfig()
+ {
+ return externalConfig;
+ }
+
+ public void setExternalConfig(String externalConfig)
+ {
+ this.externalConfig = externalConfig;
+ }
+
+ public String getDefaultIdentityStoreId()
+ {
+ return defaultIdentityStoreId;
+ }
+
+ public void setDefaultIdentityStoreId(String defaultIdentityStoreId)
+ {
+ this.defaultIdentityStoreId = defaultIdentityStoreId;
+ }
+
+ public String getDefaultAttributeStroeId()
+ {
+ return defaultAttributeStroeId;
+ }
+
+ public void setDefaultAttributeStroeId(String defaultAttributeStroeId)
+ {
+ this.defaultAttributeStroeId = defaultAttributeStroeId;
+ }
+
+ public List<IdentityStoreMappingMetaData> getIdentityStoreToIdentityObjectTypeMappings()
+ {
+ return identityStoreToIdentityObjectTypeMappings;
+ }
+
+ public void setIdentityStoreToIdentityObjectTypeMappings(List<IdentityStoreMappingMetaData> identityStoreToIdentityObjectTypeMappings)
+ {
+ this.identityStoreToIdentityObjectTypeMappings = identityStoreToIdentityObjectTypeMappings;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ public List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ public String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreConfigurationMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreConfigurationMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreConfigurationMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,139 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+
+import java.util.List;
+import java.util.Map;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityStoreConfigurationMetaDataImpl implements IdentityStoreConfigurationMetaData
+{
+
+ private String id;
+
+ private String className;
+
+ private String externalConfig;
+
+ private List<String> supportedRelationshipTypes = new LinkedList<String>();
+
+ private List<IdentityObjectTypeMetaData> supportedIdentityTypes = new LinkedList<IdentityObjectTypeMetaData>();
+
+ private Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+
+ public IdentityStoreConfigurationMetaDataImpl()
+ {
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ public String getExternalConfig()
+ {
+ return externalConfig;
+ }
+
+ public void setExternalConfig(String externalConfig)
+ {
+ this.externalConfig = externalConfig;
+ }
+
+ public List<String> getSupportedRelationshipTypes()
+ {
+ return supportedRelationshipTypes;
+ }
+
+ public void setSupportedRelationshipTypes(List<String> supportedRelationshipTypes)
+ {
+ this.supportedRelationshipTypes = supportedRelationshipTypes;
+ }
+
+ public List<IdentityObjectTypeMetaData> getSupportedIdentityTypes()
+ {
+ return supportedIdentityTypes;
+ }
+
+ public void setSupportedIdentityTypes(List<IdentityObjectTypeMetaData> supportedIdentityTypes)
+ {
+ this.supportedIdentityTypes = supportedIdentityTypes;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ public List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ public String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreMappingMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreMappingMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/IdentityStoreMappingMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,101 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreMappingMetaData;
+
+import java.util.List;
+import java.util.Map;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityStoreMappingMetaDataImpl implements IdentityStoreMappingMetaData
+{
+ private String identityStoreId;
+
+ private List<String> identityObjectTypeMappings = new LinkedList<String>();
+
+ private Map<String, List<String>> options = new HashMap<String, List<String>>();
+
+ public IdentityStoreMappingMetaDataImpl()
+ {
+ }
+
+ public void setIdentityStoreId(String identityStoreId)
+ {
+ this.identityStoreId = identityStoreId;
+ }
+
+ public void setIdentityObjectTypeMappings(List<String> identityObjectTypeMappings)
+ {
+ this.identityObjectTypeMappings = identityObjectTypeMappings;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ public String getIdentityStoreId()
+ {
+ return identityStoreId;
+ }
+
+ public List<String> getIdentityObjectTypeMappings()
+ {
+ return identityObjectTypeMappings;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ public String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+
+
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RealmConfigurationMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RealmConfigurationMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RealmConfigurationMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,123 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.RealmConfigurationMetaData;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RealmConfigurationMetaDataImpl implements RealmConfigurationMetaData
+{
+
+ private String id;
+
+ private String identityRepositoryIdRef;
+
+ private String identityMapping;
+
+ private Map<String, String> groupTypeMappings;
+
+ private Map<String, List<String>> options;
+
+
+ public RealmConfigurationMetaDataImpl()
+ {
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getIdentityRepositoryIdRef()
+ {
+ return identityRepositoryIdRef;
+ }
+
+ public void setIdentityRepositoryIdRef(String identityRepositoryIdRef)
+ {
+ this.identityRepositoryIdRef = identityRepositoryIdRef;
+ }
+
+ public String getIdentityMapping()
+ {
+ return identityMapping;
+ }
+
+ public void setIdentityMapping(String identityMapping)
+ {
+ this.identityMapping = identityMapping;
+ }
+
+ public Map<String, String> getGroupTypeMappings()
+ {
+ return groupTypeMappings;
+ }
+
+ public void setGroupTypeMappings(Map<String, String> groupTypeMappings)
+ {
+ this.groupTypeMappings = groupTypeMappings;
+ }
+
+ public Map<String, List<String>> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map<String, List<String>> options)
+ {
+ this.options = options;
+ }
+
+ List<String> getOption(String optionName)
+ {
+ if (options != null )
+ {
+ return options.get(optionName);
+ }
+
+ return null;
+ }
+
+ String getOptionSingleValue(String optionName)
+ {
+ List<String> values = getOption(optionName);
+
+ if (values != null && values.size() > 0)
+ {
+ return values.get(0);
+ }
+
+ return null;
+ }
+}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RelationshipMetaDataImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RelationshipMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/configuration/metadata/RelationshipMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,62 @@
+/*
+* 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.impl.configuration.metadata;
+
+import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RelationshipMetaDataImpl implements RelationshipMetaData
+{
+
+ private String relationshipTypeRef;
+
+ private String identityObjectTypeRef;
+
+
+ public RelationshipMetaDataImpl()
+ {
+ }
+
+ public String getRelationshipTypeRef()
+ {
+ return relationshipTypeRef;
+ }
+
+ public void setRelationshipTypeRef(String relationshipTypeRef)
+ {
+ this.relationshipTypeRef = relationshipTypeRef;
+ }
+
+ public String getIdentityObjectTypeRef()
+ {
+ return identityObjectTypeRef;
+ }
+
+ public void setIdentityObjectTypeRef(String identityObjectTypeRef)
+ {
+ this.identityObjectTypeRef = identityObjectTypeRef;
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/AbstractIdentityStoreRepository.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -28,12 +28,15 @@
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreMappingMetaData;
import org.jboss.identity.exception.IdentityException;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
-import java.util.Collections;
+import java.util.List;
+import java.util.HashMap;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -42,29 +45,34 @@
public abstract class AbstractIdentityStoreRepository implements IdentityStoreRepository
{
- private final Map<String, IdentityStore> identityStoreMappings;
+ protected Map<String, IdentityStore> identityStoreMappings = new HashMap<String, IdentityStore>();
- private final Map<String, AttributeStore> attributeStoreMappings;
+ protected Map<String, AttributeStore> attributeStoreMappings = new HashMap<String, AttributeStore>();
- public AbstractIdentityStoreRepository(Map<String, IdentityStore> identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
+ public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ Map<String, IdentityStore> bootstrappedIdentityStores,
+ Map<String, AttributeStore> bootstrappedAttributeStores) throws IdentityException
{
- if (identityStoreMappings != null)
+
+ for (IdentityStoreMappingMetaData identityStoreMappingMetaData : configurationMD.getIdentityStoreToIdentityObjectTypeMappings())
{
- this.identityStoreMappings = Collections.unmodifiableMap(identityStoreMappings);
- }
- else
- {
- this.identityStoreMappings = null;
- }
+ String storeId = identityStoreMappingMetaData.getIdentityStoreId();
+ List<String> identityObjectTypeMappings = identityStoreMappingMetaData.getIdentityObjectTypeMappings();
- if (attributeStoreMappings != null)
- {
- this.attributeStoreMappings = Collections.unmodifiableMap(attributeStoreMappings);
+ IdentityStore store = bootstrappedIdentityStores.get(storeId);
+
+ if (store == null)
+ {
+ throw new IdentityException("Mapped IdentityStore not available: " + storeId);
+ }
+
+ for (String mapping : identityObjectTypeMappings)
+ {
+ identityStoreMappings.put(mapping, store);
+ attributeStoreMappings.put(mapping, store);
+ }
+
}
- else
- {
- this.attributeStoreMappings = null;
- }
}
@@ -98,7 +106,7 @@
return attributeStoreMappings.get(identityObjectType.getName());
}
- public boolean hasIdentityObject(IdentityStoreInvocationContext ctx, IdentityStore is, IdentityObject io) throws IdentityException
+ protected boolean hasIdentityObject(IdentityStoreInvocationContext ctx, IdentityStore is, IdentityObject io) throws IdentityException
{
try
{
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -26,17 +26,21 @@
import org.jboss.identity.spi.store.AttributeStore;
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.impl.NotYetImplementedException;
+import org.jboss.identity.impl.store.SimpleIdentityStoreInvocationContext;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
+import java.util.HashMap;
import java.io.IOException;
/**
@@ -47,28 +51,81 @@
*/
public class FallbackIdentityStoreRepository extends AbstractIdentityStoreRepository
{
+ private final String id;
- private final IdentityStore defaultIdentityStore;
+ private IdentityStore defaultIdentityStore;
- private final AttributeStore defaultAttributeStore;
+ private AttributeStore defaultAttributeStore;
- public FallbackIdentityStoreRepository(IdentityStore identityStore, AttributeStore attributeStore,
- Map<String, IdentityStore> identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
+ //TODO: rewrite this to other config object?
+ private IdentityRepositoryConfigurationMetaData configurationMD;
+
+ public FallbackIdentityStoreRepository(String id)
{
- super(identityStoreMappings, attributeStoreMappings);
+ this.id = id;
+ }
- this.defaultIdentityStore = identityStore;
- this.defaultAttributeStore = attributeStore;
+ public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ Map<String, IdentityStore> bootstrappedIdentityStores,
+ Map<String, AttributeStore> bootstrappedAttributeStores) throws IdentityException
+ {
+ super.bootstrap(configurationMD, bootstrappedIdentityStores, bootstrappedAttributeStores);
+
+ this.configurationMD = configurationMD;
+
+ String asId = configurationMD.getDefaultAttributeStroeId();
+ String isId = configurationMD.getDefaultIdentityStoreId();
+
+ if (asId != null && bootstrappedAttributeStores.keySet().contains(asId))
+ {
+ defaultAttributeStore = bootstrappedAttributeStores.get(asId);
+ }
+
+ if (isId != null && bootstrappedIdentityStores.keySet().contains(isId))
+ {
+ defaultIdentityStore = bootstrappedIdentityStores.get(isId);
+ }
+
}
- public void bootstrap() throws IOException
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
{
+ // Nothing
+ }
+ public IdentityStoreSession createIdentityStoreSession() throws IdentityException
+ {
+ Map<String, IdentityStoreSession> sessions = new HashMap<String, IdentityStoreSession>();
+
+ for (IdentityStore identityStore : identityStoreMappings.values())
+ {
+ sessions.put(identityStore.getId(), identityStore.createIdentityStoreSession());
+ }
+
+ for (AttributeStore attributeStore : attributeStoreMappings.values())
+ {
+ if (!sessions.containsKey(attributeStore.getId()))
+ {
+ sessions.put(attributeStore.getId(), attributeStore.createIdentityStoreSession());
+ }
+ }
+
+ if (!sessions.containsKey(defaultAttributeStore.getId()))
+ {
+ sessions.put(defaultAttributeStore.getId(), defaultAttributeStore.createIdentityStoreSession());
+ }
+
+ if (!sessions.containsKey(defaultIdentityStore.getId()))
+ {
+ sessions.put(defaultIdentityStore.getId(), defaultIdentityStore.createIdentityStoreSession());
+ }
+
+ return new RepositoryIdentityStoreSessionImpl(sessions);
}
public String getId()
{
- return null;
+ return id;
}
public FeaturesMetaData getSupportedFeatures()
@@ -101,32 +158,69 @@
return ads;
}
+ IdentityStoreInvocationContext resolveInvocationContext(IdentityStore targetStore, IdentityStoreInvocationContext invocationCtx)
+ {
+ return resolveInvocationContext(targetStore.getId(), invocationCtx);
+
+ }
+
+ IdentityStoreInvocationContext resolveInvocationContext(AttributeStore targetStore, IdentityStoreInvocationContext invocationCtx)
+ {
+ return resolveInvocationContext(targetStore.getId(), invocationCtx);
+
+ }
+
+ IdentityStoreInvocationContext resolveInvocationContext(String id, IdentityStoreInvocationContext invocationCtx)
+ {
+ RepositoryIdentityStoreSessionImpl repoSession = (RepositoryIdentityStoreSessionImpl)invocationCtx.getIdentityStoreSession();
+ IdentityStoreSession targetSession = repoSession.getIdentityStoreSession(id);
+
+ return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId());
+
+ }
+
public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
{
- return resolveIdentityStore(identityObjectType).createIdentityObject(invocationCtx, name, identityObjectType);
+ IdentityStore targetStore = resolveIdentityStore(identityObjectType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+ return targetStore.createIdentityObject(targetCtx, name, identityObjectType);
}
+
+
public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
{
- resolveIdentityStore(identity).removeIdentityObject(invocationCtx, identity);
+ IdentityStore targetStore = resolveIdentityStore(identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+
+ targetStore.removeIdentityObject(targetCtx, identity);
}
public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType) throws IdentityException
{
- return resolveIdentityStore(identityType).getIdentityObjectsCount(invocationCtx, identityType);
+ IdentityStore targetStore = resolveIdentityStore(identityType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+
+ return targetStore.getIdentityObjectsCount(targetCtx, identityType);
}
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException
{
- return resolveIdentityStore(identityObjectType).findIdentityObject(invocationContext, name, identityObjectType);
+ IdentityStore targetStore = resolveIdentityStore(identityObjectType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationContext);
+
+ return targetStore.findIdentityObject(targetCtx, name, identityObjectType);
}
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, Object id) throws IdentityException
{
+ //TODO: store
for (IdentityStore identityStore : getIdentityStoreMappings().values())
{
- IdentityObject io = identityStore.findIdentityObject(invocationContext, id);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(identityStore, invocationContext);
+
+ IdentityObject io = identityStore.findIdentityObject(targetCtx, id);
if (io != null)
{
return io;
@@ -138,12 +232,18 @@
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, String nameFilter, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
{
- return resolveIdentityStore(identityType).findIdentityObject(invocationCtx, identityType, nameFilter, offset, limit, orderByName, ascending);
+ IdentityStore targetStore = resolveIdentityStore(identityType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+
+ return targetStore.findIdentityObject(targetCtx, identityType, nameFilter, offset, limit, orderByName, ascending);
}
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, Map<String, String[]> attributes, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
{
- return resolveIdentityStore(identityType).findIdentityObject(invocationCtx, identityType, attributes, offset, limit, orderByName, ascending);
+ IdentityStore targetStore = resolveIdentityStore(identityType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
+
+ return targetStore.findIdentityObject(targetCtx, identityType, attributes, offset, limit, orderByName, ascending);
}
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
@@ -153,142 +253,186 @@
int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
{
//TODO:
- return defaultIdentityStore.findIdentityObject(invocationCxt, identity, relationshipType, parent, offset, limit, orderByName, ascending);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+ return defaultIdentityStore.findIdentityObject(targetCtx, identity, relationshipType, parent, offset, limit, orderByName, ascending);
+
}
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException
{
IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+
IdentityStore toStore = resolveIdentityStore(toIdentity);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+
if (fromStore == toStore)
{
- return fromStore.createRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+ return fromStore.createRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, fromIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, fromIdentity.getName(), fromIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, toIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, toIdentity.getName(), toIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
}
- return defaultIdentityStore.createRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
+ return defaultIdentityStore.createRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames);
}
public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName) throws IdentityException
{
IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+
IdentityStore toStore = resolveIdentityStore(toIdentity);
-
+
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+
if (fromStore == toStore)
{
- fromStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
+ fromStore.removeRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
return;
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, fromIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, fromIdentity.getName(), fromIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, toIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, toIdentity.getName(), toIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
}
- defaultIdentityStore.removeRelationship(invocationCxt, fromIdentity, toIdentity, relationshipType, relationshipName);
+ defaultIdentityStore.removeRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName);
}
public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException
{
IdentityStore fromStore = resolveIdentityStore(identity1);
+
IdentityStore toStore = resolveIdentityStore(identity2);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCtx);
+
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCtx);
+
+
if (fromStore == toStore)
{
- fromStore.removeRelationships(invocationCtx, identity1, identity2, named);
+ fromStore.removeRelationships(toTargetCtx, identity1, identity2, named);
return;
}
- if (!hasIdentityObject(invocationCtx, defaultIdentityStore, identity1))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity1))
{
- defaultIdentityStore.createIdentityObject(invocationCtx, identity1.getName(), identity1.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity1.getName(), identity1.getIdentityType());
}
- if (!hasIdentityObject(invocationCtx, defaultIdentityStore, identity2))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity2))
{
- defaultIdentityStore.createIdentityObject(invocationCtx, identity2.getName(), identity2.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity2.getName(), identity2.getIdentityType());
}
- defaultIdentityStore.removeRelationships(invocationCtx, identity1, identity2, named);
+ defaultIdentityStore.removeRelationships(defaultTargetCtx, identity1, identity2, named);
}
public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity) throws IdentityException
{
+
IdentityStore fromStore = resolveIdentityStore(fromIdentity);
+
IdentityStore toStore = resolveIdentityStore(toIdentity);
+ IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt);
+
+ IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt);
+
if (fromStore == toStore)
{
- return fromStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity);
+ return fromStore.resolveRelationships(toTargetCtx, fromIdentity, toIdentity);
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, fromIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, fromIdentity.getName(), fromIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType());
}
- if (!hasIdentityObject(invocationCxt, defaultIdentityStore, toIdentity))
+ if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity))
{
- defaultIdentityStore.createIdentityObject(invocationCxt, toIdentity.getName(), toIdentity.getIdentityType());
+ defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType());
}
- return defaultIdentityStore.resolveRelationships(invocationCxt, fromIdentity, toIdentity);
+ return defaultIdentityStore.resolveRelationships(defaultTargetCtx, fromIdentity, toIdentity);
}
public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.createRelationshipName(ctx, name);
+ return defaultIdentityStore.createRelationshipName(defaultCtx, name);
}
public String removeRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException
{
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.removeRelationshipName(ctx, name);
+ return defaultIdentityStore.removeRelationshipName(defaultCtx, name);
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
{
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(ctx, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, offset, limit, orderByName, ascending);
}
public Set<String> getRelationshipNames(IdentityStoreInvocationContext ctx, IdentityObject identity, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException, OperationNotSupportedException
{
+ IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultIdentityStore, ctx);
+
+
//TODO: For now just assume that named relationships are in default one
- return defaultIdentityStore.getRelationshipNames(ctx, identity, offset, limit, orderByName, ascending);
+ return defaultIdentityStore.getRelationshipNames(defaultCtx, identity, offset, limit, orderByName, ascending);
}
public boolean hasPasswordAttribute(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
{
- return resolveIdentityStore(type).hasPasswordAttribute(ctx, type);
+ IdentityStore toStore = resolveIdentityStore(type);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
+
+ return toStore.hasPasswordAttribute(targetCtx, type);
}
public boolean validatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
{
- return resolveIdentityStore(identityObject).validatePassword(ctx, identityObject, password);
+ IdentityStore toStore = resolveIdentityStore(identityObject);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
+
+ return toStore.validatePassword(targetCtx, identityObject, password);
}
public void updatePassword(IdentityStoreInvocationContext ctx, IdentityObject identityObject, String password) throws IdentityException
{
- resolveIdentityStore(identityObject).updatePassword(ctx, identityObject, password);
+ IdentityStore toStore = resolveIdentityStore(identityObject);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, ctx);
+
+ toStore.updatePassword(targetCtx, identityObject, password);
}
@@ -296,7 +440,9 @@
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
- return defaultAttributeStore.getSupportedAttributeNames(invocationContext, identityType);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+
+ return defaultAttributeStore.getSupportedAttributeNames(targetCtx, identityType);
//return resolveIdentityStore(identityType).getSupportedAttributeNames(invocationContext, identityType);
}
@@ -304,7 +450,9 @@
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
- return defaultAttributeStore.getAttributes(invocationContext, identity);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);
+
+ return defaultAttributeStore.getAttributes(targetCtx, identity);
//return resolveIdentityStore(identity).getAttributes(invocationContext, identity);
}
@@ -312,7 +460,9 @@
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
- defaultAttributeStore.updateAttributes(invocationCtx, identity, attributes);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+
+ defaultAttributeStore.updateAttributes(targetCtx, identity, attributes);
//resolveIdentityStore(identity).updateAttributes(invocationCtx, identity, attributes);
}
@@ -320,7 +470,9 @@
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
- defaultAttributeStore.addAttributes(invocationCtx, identity, attributes);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+
+ defaultAttributeStore.addAttributes(targetCtx, identity, attributes);
//resolveIdentityStore(identity).addAttributes(invocationCtx, identity, attributes);
}
@@ -328,7 +480,9 @@
{
//TODO: for profile stored in two stores this need to be merged with results from defaultAttributeStore. For now just use the default one.
- defaultAttributeStore.removeAttributes(invocationCtx, identity, attributes);
+ IdentityStoreInvocationContext targetCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);
+
+ defaultAttributeStore.removeAttributes(targetCtx, identity, attributes);
//resolveIdentityStore(identity).removeAttributes(invocationCtx, identity, attributes);
}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/RepositoryIdentityStoreSessionImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,146 @@
+/*
+* 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.impl.repository;
+
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.exception.IdentityException;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RepositoryIdentityStoreSessionImpl implements IdentityStoreSession
+{
+
+ //TODO: more sophisticated impl needed.
+
+ protected final Map<String, IdentityStoreSession> identityStoreSessionMappings;
+
+ public RepositoryIdentityStoreSessionImpl(Map<String, IdentityStoreSession> identityStoreSessionMappings)
+ {
+ if (identityStoreSessionMappings == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ this.identityStoreSessionMappings = identityStoreSessionMappings;
+ }
+
+ public Object getSessionContext() throws IdentityException
+ {
+ return null;
+ }
+
+ public IdentityStoreSession getIdentityStoreSession(String storeId)
+ {
+ return identityStoreSessionMappings.get(storeId);
+ }
+
+ public void close() throws IdentityException
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ identityStoreSession.close();
+ }
+ }
+
+ public void save() throws IdentityException
+ {
+ for (IdentityStoreSession iss : identityStoreSessionMappings.values())
+ {
+ iss.save();
+ }
+
+ }
+
+ public void clear() throws IdentityException
+ {
+ for (IdentityStoreSession iss : identityStoreSessionMappings.values())
+ {
+ iss.clear();
+ }
+
+ }
+
+ public boolean isOpen()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ if (identityStoreSession.isOpen())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isTransactionSupported()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ if (identityStoreSession.isTransactionSupported())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void startTransaction()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ identityStoreSession.startTransaction();
+ }
+ }
+
+ public void commitTransaction()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ identityStoreSession.commitTransaction();
+ }
+ }
+
+ public void rollbackTransaction()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ identityStoreSession.rollbackTransaction();
+ }
+ }
+
+ public boolean isTransactionActive()
+ {
+ for (IdentityStoreSession identityStoreSession : identityStoreSessionMappings.values())
+ {
+ if (identityStoreSession.isTransactionActive())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -26,11 +26,13 @@
import org.jboss.identity.spi.store.AttributeStore;
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.exception.IdentityException;
import java.util.Map;
@@ -54,15 +56,21 @@
public WrapperIdentityStoreRepository(IdentityStore identityStore, AttributeStore attributeStore,
Map<String, IdentityStore> identityStoreMappings, Map<String, AttributeStore> attributeStoreMappings)
{
- super(identityStoreMappings, attributeStoreMappings);
-
+// super(identityStoreMappings, attributeStoreMappings);
+//
this.identityStore = identityStore;
this.attributeStore = attributeStore;
}
- public void bootstrap() throws IOException
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
{
+ //TODO
+ }
+ public IdentityStoreSession createIdentityStoreSession()
+ {
+ //TODO
+ return null;
}
public String getId()
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/SimpleIdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/SimpleIdentityStoreInvocationContext.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/SimpleIdentityStoreInvocationContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,53 @@
+/*
+* 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.impl.store;
+
+import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleIdentityStoreInvocationContext implements IdentityStoreInvocationContext
+{
+ private final IdentityStoreSession identityStoreSession;
+
+ private final String realmId;
+
+ public SimpleIdentityStoreInvocationContext(IdentityStoreSession identityStoreSession, String realmId)
+ {
+ this.identityStoreSession = identityStoreSession;
+ this.realmId = realmId;
+ }
+
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return identityStoreSession;
+ }
+
+ public String getRealmId()
+ {
+ return realmId;
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -25,11 +25,14 @@
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship;
@@ -38,19 +41,20 @@
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipName;
import org.jboss.identity.impl.NotYetImplementedException;
import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
-import org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreInvocationContext;
import org.hibernate.ejb.HibernateEntityManager;
+import org.hibernate.ejb.HibernateEntityManagerFactory;
import org.hibernate.criterion.Restrictions;
import javax.persistence.NoResultException;
import javax.persistence.Query;
+import javax.persistence.Persistence;
import java.util.Set;
import java.util.Collection;
import java.util.Map;
import java.util.List;
import java.util.Iterator;
import java.util.HashSet;
-import java.io.IOException;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -78,34 +82,111 @@
"(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 POPULATE_MEMBERSHIP_TYPES = "populateRelationshipTypes";
+
+ public static final String POPULATE_IDENTITY_OBJECT_TYPES = "populateIdentityObjectTypes";
+
+ public static final String IS_REALM_AWARE = "isRealmAware";
+
private String id;
private FeaturesMetaData supportedFeatures;
- public HibernateIdentityStoreImpl()
+ private HibernateEntityManagerFactory emFactory;
+
+ private boolean isRealmAware = false;
+
+ // TODO: rewrite this into some more handy object
+ private IdentityStoreConfigurationMetaData configurationMD;
+
+ public HibernateIdentityStoreImpl(String id)
{
// For now just dummy impl
//TODO: initialize with configuration
supportedFeatures = new FeaturesMetaDataImpl();
+
+ this.id = id;
}
- public void start()
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
{
- //TODO: populate store with configured identity types if needed (and configured)
+ this.configurationMD = configurationMD;
+ //TODO: bootstrap supportedFeatures from configMD
- }
+ String persistenceUnit = configurationMD.getOptionSingleValue(PERSISTENCE_UNIT);
- public void stop()
- {
+ if (persistenceUnit == null)
+ {
+ throw new IdentityException("Persistence Unit not defined for IdentityStore: " + getId());
+ }
+ emFactory = (HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit);
+
+ String populateMembershipTypes = configurationMD.getOptionSingleValue(POPULATE_MEMBERSHIP_TYPES);
+ String populateIdentityObjectTypes = configurationMD.getOptionSingleValue(POPULATE_IDENTITY_OBJECT_TYPES);
+
+ HibernateEntityManager em = (HibernateEntityManager)emFactory.createEntityManager();
+
+ if (populateMembershipTypes != null && populateMembershipTypes.equalsIgnoreCase("true"))
+ {
+ List<String> memberships = new LinkedList<String>();
+
+ for (String membership : configurationMD.getSupportedRelationshipTypes())
+ {
+ memberships.add(membership);
+ }
+
+ try
+ {
+ populateRelationshipTypes(em, memberships.toArray(new String[memberships.size()]));
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to populate relationship types", e);
+ }
+
+
+ }
+
+ if (populateIdentityObjectTypes != null && populateIdentityObjectTypes.equalsIgnoreCase("true"))
+ {
+ List<String> types = new LinkedList<String>();
+
+ for (IdentityObjectTypeMetaData metaData : configurationMD.getSupportedIdentityTypes())
+ {
+ types.add(metaData.getName());
+ }
+
+ try
+ {
+ populateObjectTypes(em, types.toArray(new String[types.size()]));
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to populate identity object types", e);
+ }
+
+ }
+
+
}
+ public IdentityStoreSession createIdentityStoreSession() throws IdentityException
+ {
- public void bootstrap() throws IOException
- {
- //TODO: NYI
+ try
+ {
+ return new HibernateIdentityStoreSessionImpl((HibernateEntityManager)emFactory.createEntityManager());
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Failed to obtain HibernateEntityManager",e);
+ }
+
}
public String getId()
@@ -726,12 +807,14 @@
protected HibernateEntityManager getHibernateEntityManager(IdentityStoreInvocationContext ctx) throws IdentityException
{
- if (ctx instanceof HibernateIdentityStoreInvocationContext)
+ try
{
- return ((HibernateIdentityStoreInvocationContext)ctx).getHibernateEntityManager();
+ return (HibernateEntityManager)ctx.getIdentityStoreSession().getSessionContext();
}
-
- throw new IdentityException("Not supported IdentityStoreInvocationContext implementation");
+ catch (IdentityException e)
+ {
+ throw new IdentityException("Cannot obtain HibernateEntityManager", e);
+ }
}
private void checkIOInstance(IdentityObject io)
@@ -829,4 +912,52 @@
return relationshipType;
}
+ public void populateObjectTypes(HibernateEntityManager em, String[] typeNames) throws Exception
+ {
+
+ em.getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+
+ //Check if present
+
+ HibernateIdentityObjectType hibernateType = (HibernateIdentityObjectType)em.getSession().
+ createCriteria(HibernateIdentityObjectType.class).add(Restrictions.eq("name", typeName)).uniqueResult();
+
+ if (hibernateType == null)
+ {
+ hibernateType = new HibernateIdentityObjectType(typeName);
+ em.persist(hibernateType);
+ }
+
+ }
+
+ em.getTransaction().commit();
+
+ }
+
+ public void populateRelationshipTypes(HibernateEntityManager em, String[] typeNames) throws Exception
+ {
+
+ em.getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+ HibernateIdentityObjectRelationshipType hibernateType = (HibernateIdentityObjectRelationshipType)em.getSession().
+ createCriteria(HibernateIdentityObjectRelationshipType.class).add(Restrictions.eq("name", typeName)).uniqueResult();
+
+ if (hibernateType == null)
+ {
+ hibernateType = new HibernateIdentityObjectRelationshipType(typeName);
+ em.persist(hibernateType);
+ }
+
+ }
+
+ em.getTransaction().commit();
+ }
+
+
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreInvocationContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -29,9 +29,9 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface HibernateIdentityStoreInvocationContext extends IdentityStoreInvocationContext
-{
-
- public HibernateEntityManager getHibernateEntityManager();
-
-}
+//public interface HibernateIdentityStoreInvocationContext extends IdentityStoreInvocationContext
+//{
+//
+// public HibernateEntityManager getHibernateEntityManager();
+//
+//}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreSessionImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,101 @@
+/*
+* 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.impl.store.hibernate;
+
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.exception.IdentityException;
+import org.hibernate.ejb.HibernateEntityManagerFactory;
+import org.hibernate.ejb.HibernateEntityManager;
+
+import javax.persistence.Persistence;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateIdentityStoreSessionImpl implements IdentityStoreSession
+{
+
+ private final HibernateEntityManager hem;
+
+ public HibernateIdentityStoreSessionImpl(HibernateEntityManager hem)
+ {
+ this.hem = hem;
+ }
+
+ public HibernateIdentityStoreSessionImpl(String persistenceUnit)
+ {
+ HibernateEntityManagerFactory emFactory = (HibernateEntityManagerFactory)Persistence.createEntityManagerFactory(persistenceUnit);
+ hem = (HibernateEntityManager)emFactory.createEntityManager();
+ }
+
+ public Object getSessionContext()
+ {
+ return hem;
+ }
+
+ public void close() throws IdentityException
+ {
+ hem.close();
+ }
+
+ public void save() throws IdentityException
+ {
+ hem.flush();
+ }
+
+ public void clear() throws IdentityException
+ {
+ hem.clear();
+ }
+
+ public boolean isOpen()
+ {
+ return hem.isOpen();
+ }
+
+ public boolean isTransactionSupported()
+ {
+ return true;
+ }
+
+ public void startTransaction()
+ {
+ hem.getTransaction().begin();
+ }
+
+ public void commitTransaction()
+ {
+ hem.getTransaction().commit();
+ }
+
+ public void rollbackTransaction()
+ {
+ hem.getTransaction().rollback();
+ }
+
+ public boolean isTransactionActive()
+ {
+ return hem.getTransaction().isActive();
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -25,11 +25,13 @@
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+import org.jboss.identity.spi.store.IdentityStoreSession;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
@@ -76,19 +78,34 @@
private FeaturesMetaData supportedFeatures;
+ LDAPIdentityStoreConfiguration configuration;
+
public LDAPIdentityStore(String id)
{
- // For now just dummy impl
- //TODO: initialize with configuration
- supportedFeatures = new FeaturesMetaDataImpl();
this.id = id;
}
- public void bootstrap() throws IOException
+ public void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException
{
+ configuration = new SimpleLDAPIdentityStoreConfiguration(configurationMD);
+ //TODO: populate with configuration
+ supportedFeatures = new FeaturesMetaDataImpl();
+
}
+ public IdentityStoreSession createIdentityStoreSession()
+ {
+
+ return new LDAPIdentityStoreSessionImpl(
+ "com.sun.jndi.ldap.LdapCtxFactory",
+ configuration.getProviderURL(),
+ "simple",
+ configuration.getAdminDN(),
+ configuration.getAdminPassword());
+
+ }
+
public String getId()
{
return id;
@@ -962,6 +979,7 @@
return getTypeConfiguration(invocationContext, identityType).getMappedAttributesNames();
}
+
public Map<String, Set<String>> getAttributes(IdentityStoreInvocationContext ctx, IdentityObject identity) throws IdentityException
{
@@ -1396,26 +1414,12 @@
}
}
- private LDAPIdentityStoreInvocationContext castInvocationContext(IdentityStoreInvocationContext ctx) throws IdentityException
- {
- if (ctx == null)
- {
- throw new IllegalArgumentException("IdentityStoreInvocationContext is null");
- }
- if (ctx instanceof LDAPIdentityStoreInvocationContext)
- {
- return (LDAPIdentityStoreInvocationContext)ctx;
- }
-
- throw new IdentityException("Not supported IdentityStoreInvocationContext implementation");
- }
-
private LdapContext getLDAPContext(IdentityStoreInvocationContext ctx) throws IdentityException
{
try
{
- return castInvocationContext(ctx).getLdapContext();
+ return (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
}
catch (Exception e)
{
@@ -1425,7 +1429,7 @@
private LDAPIdentityStoreConfiguration getConfiguration(IdentityStoreInvocationContext ctx) throws IdentityException
{
- return castInvocationContext(ctx).getConfiguration();
+ return configuration;
}
private LDAPIdentityObjectTypeConfiguration getTypeConfiguration(IdentityStoreInvocationContext ctx, IdentityObjectType type) throws IdentityException
@@ -1437,4 +1441,6 @@
{
return this.getClass().getName() + "[" + getId() +"]";
}
+
+
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreInvocationContext.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreInvocationContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -30,11 +30,11 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface LDAPIdentityStoreInvocationContext extends IdentityStoreInvocationContext
-{
-
- LdapContext getLdapContext() throws Exception;
-
- LDAPIdentityStoreConfiguration getConfiguration();
-
-}
+//public interface LDAPIdentityStoreInvocationContext extends IdentityStoreInvocationContext
+//{
+//
+// LdapContext getLdapContext() throws Exception;
+//
+// LDAPIdentityStoreConfiguration getConfiguration();
+//
+//}
Added: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreSessionImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,132 @@
+/*
+* 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.impl.store.ldap;
+
+import org.jboss.identity.spi.store.IdentityStoreSession;
+import org.jboss.identity.exception.IdentityException;
+
+import javax.naming.ldap.LdapContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.Context;
+import java.util.Hashtable;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPIdentityStoreSessionImpl implements IdentityStoreSession
+{
+
+ private final String INITIAL_CONTEXT_FACTORY;
+
+ private final String PROVIDER_URL;
+
+ private final String SECURITY_AUTHENTICATION;
+
+ private final String SECURITY_PRINCIPAL;
+
+ private final String SECURITY_CREDENTIALS;
+
+
+ public LDAPIdentityStoreSessionImpl(String INITIAL_CONTEXT_FACTORY,
+ String PROVIDER_URL,
+ String SECURITY_AUTHENTICATION,
+ String SECURITY_PRINCIPAL,
+ String SECURITY_CREDENTIALS)
+ {
+ this.INITIAL_CONTEXT_FACTORY = INITIAL_CONTEXT_FACTORY;
+ this.PROVIDER_URL = PROVIDER_URL;
+ this.SECURITY_AUTHENTICATION = SECURITY_AUTHENTICATION;
+ this.SECURITY_PRINCIPAL = SECURITY_PRINCIPAL;
+ this.SECURITY_CREDENTIALS = SECURITY_CREDENTIALS;
+ }
+
+ public LdapContext getLdapContext() throws Exception
+ {
+ Hashtable<String,String> env = new Hashtable<String,String>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
+ env.put(Context.PROVIDER_URL, PROVIDER_URL);
+ env.put(Context.SECURITY_AUTHENTICATION, SECURITY_AUTHENTICATION);
+ env.put(Context.SECURITY_PRINCIPAL, SECURITY_PRINCIPAL);
+ env.put(Context.SECURITY_CREDENTIALS, SECURITY_CREDENTIALS);
+
+ return new InitialLdapContext(env, null);
+ }
+
+ public Object getSessionContext() throws IdentityException
+ {
+ try
+ {
+ return getLdapContext();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Could not create LdapContext", e);
+ }
+ }
+
+ public void close() throws IdentityException
+ {
+
+ }
+
+ public void save() throws IdentityException
+ {
+
+ }
+
+ public void clear() throws IdentityException
+ {
+
+ }
+
+ public boolean isOpen()
+ {
+ return false;
+ }
+
+ public boolean isTransactionSupported()
+ {
+ return false;
+ }
+
+ public void startTransaction()
+ {
+
+ }
+
+ public void commitTransaction()
+ {
+
+ }
+
+ public void rollbackTransaction()
+ {
+
+ }
+
+ public boolean isTransactionActive()
+ {
+ return false;
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java (from rev 109, trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityObjectTypeConfiguration.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,327 @@
+/*
+* 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.impl.store.ldap;
+
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.spi.configuration.metadata.RelationshipMetaData;
+import org.jboss.identity.spi.attribute.AttributeMetaData;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleLDAPIdentityObjectTypeConfiguration implements LDAPIdentityObjectTypeConfiguration
+{
+ private final String idAttributeName;
+
+ private final String[] ctxDNs;
+
+ private final String entrySearchFilter;
+
+ private final boolean allowCreateEntry;
+
+ private final Map<String, String[]> createEntryAttributeValues;
+
+ private final String[] allowedMembershipTypes;
+
+ private final String membershipAttributeName;
+
+ private final boolean isMembershipAttributeDN;
+
+ private final boolean allowEmptyMemberships;
+
+ private final Map<String, String> attributeNames;
+
+
+ //Consts
+
+ public static final String ID_ATTRIBUTE_NAME = "idAttributeName";
+
+ public static final String CTX_DNS = "ctxDNs";
+
+ public static final String ENTRY_SEARCH_FILTER = "entrySearchFilter";
+
+ public static final String ALLOW_CREATE_ENTRY = "allowCreateEntry";
+
+ public static final String MEMBERSHIP_ATTRIBUTE_NAME = "membershipAttributeName";
+
+ public static final String IS_MEMBERSHIP_ATTRIBUTE_DN = "isMembershipAttributeDN";
+
+ public static final String ALLOW_EMPTY_MEMBERSHIPS = "allowEmptyMemberships";
+
+ public static final String CREATE_ENTRY_ATTRIBUTE_VALUES = "createEntryAttributeValues";
+
+
+
+ public SimpleLDAPIdentityObjectTypeConfiguration(IdentityObjectTypeMetaData objectTypeMD)
+ {
+ this.idAttributeName = objectTypeMD.getOptionSingleValue(ID_ATTRIBUTE_NAME);
+ this.entrySearchFilter = objectTypeMD.getOptionSingleValue(ENTRY_SEARCH_FILTER);
+ this.membershipAttributeName = objectTypeMD.getOptionSingleValue(MEMBERSHIP_ATTRIBUTE_NAME);
+ String allowCreateEntry = objectTypeMD.getOptionSingleValue(ALLOW_CREATE_ENTRY);
+ if (allowCreateEntry != null && allowCreateEntry.equalsIgnoreCase("true"))
+ {
+ this.allowCreateEntry = true;
+ }
+ else
+ {
+ this.allowCreateEntry = false;
+ }
+
+ String isMembershipAttributeDN = objectTypeMD.getOptionSingleValue(IS_MEMBERSHIP_ATTRIBUTE_DN);
+ if (isMembershipAttributeDN != null && isMembershipAttributeDN.equalsIgnoreCase("true"))
+ {
+ this.isMembershipAttributeDN = true;
+ }
+ else
+ {
+ this.isMembershipAttributeDN = false;
+ }
+
+ String allowEmptyMemberships = objectTypeMD.getOptionSingleValue(ALLOW_EMPTY_MEMBERSHIPS);
+ if (allowEmptyMemberships != null && allowEmptyMemberships.equalsIgnoreCase("true"))
+ {
+ this.allowEmptyMemberships = true;
+ }
+ else
+ {
+ this.allowEmptyMemberships = false;
+ }
+
+ List<String> relationships = new LinkedList<String>();
+
+ if (objectTypeMD.getRelationships() != null)
+ {
+ for (RelationshipMetaData relationshipMetaData : objectTypeMD.getRelationships())
+ {
+ relationships.add(relationshipMetaData.getIdentityObjectTypeRef());
+ }
+ }
+
+ allowedMembershipTypes = relationships.toArray(new String[relationships.size()]);
+
+ attributeNames = new HashMap<String, String>();
+
+ for (AttributeMetaData attributeMetaData : objectTypeMD.getAttributes())
+ {
+ attributeNames.put(attributeMetaData.getName(), attributeMetaData.getStoreMapping());
+ }
+
+ List<String> dns = objectTypeMD.getOption(CTX_DNS);
+ if (dns != null)
+ {
+ this.ctxDNs = dns.toArray(new String[dns.size()]);
+ }
+ else
+ {
+ this.ctxDNs = null;
+ }
+
+ Map<String, List<String>> createEntryAttributesMap = new HashMap<String, List<String>>();
+
+
+
+ List<String> createAttributes = objectTypeMD.getOption(CREATE_ENTRY_ATTRIBUTE_VALUES);
+
+ if (createAttributes != null && createAttributes.size() > 0 )
+ {
+ for (String attribute : createAttributes)
+ {
+ String[] parts = attribute.split("=", 2);
+ if (parts.length != 2)
+ {
+ continue;
+ }
+
+ String name = parts[0];
+ String value = parts[1];
+
+ if (!createEntryAttributesMap.containsKey(name))
+ {
+ List<String> list = new LinkedList<String>();
+ list.add(value);
+ createEntryAttributesMap.put(name, list);
+ }
+ else
+ {
+ createEntryAttributesMap.get(name).add(value);
+ }
+ }
+
+ Map<String, String[]> createEntryAttributesArray = new HashMap<String, String[]>();
+
+ for (Map.Entry<String, List<String>> entry : createEntryAttributesMap.entrySet())
+ {
+ createEntryAttributesArray.put(entry.getKey(), entry.getValue().toArray(new String[entry.getValue().size()]));
+ }
+
+ this.createEntryAttributeValues = createEntryAttributesArray;
+ }
+ else
+ {
+ this.createEntryAttributeValues = new HashMap<String, String[]>();
+ }
+
+ //TODO: validate all required options - throw exception for missing ones and set defaults for others
+
+
+
+ }
+
+ public SimpleLDAPIdentityObjectTypeConfiguration(String idAttributeName,
+ String[] ctxDNs,
+ String entrySearchFilter,
+ boolean allowCreateEntry,
+ Map<String, String[]> createEntryAttributeValues,
+ String[] allowedMembershipTypes,
+ String membershipAttributeName,
+ boolean membershipAttributeDN,
+ boolean allowEmptyMemberships,
+ Map<String, String> attributeNames)
+ {
+ this.idAttributeName = idAttributeName;
+ this.ctxDNs = ctxDNs;
+ this.entrySearchFilter = entrySearchFilter;
+ this.allowCreateEntry = allowCreateEntry;
+ this.createEntryAttributeValues = createEntryAttributeValues;
+ this.allowedMembershipTypes = allowedMembershipTypes;
+ this.membershipAttributeName = membershipAttributeName;
+ isMembershipAttributeDN = membershipAttributeDN;
+ this.allowEmptyMemberships = allowEmptyMemberships;
+ this.attributeNames = attributeNames;
+ }
+
+
+
+ public String getIdAttributeName()
+ {
+ return idAttributeName;
+ }
+
+ public String[] getCtxDNs()
+ {
+ return ctxDNs;
+ }
+
+ public String getEntrySearchFilter()
+ {
+ return entrySearchFilter;
+ }
+
+ public boolean isAllowCreateEntry()
+ {
+ return allowCreateEntry;
+ }
+
+ public Map<String, String[]> getCreateEntryAttributeValues()
+ {
+ return createEntryAttributeValues;
+ }
+
+ public String[] getAllowedMembershipTypes()
+ {
+ return allowedMembershipTypes;
+ }
+
+ public String getMembershipAttributeName()
+ {
+ return membershipAttributeName;
+ }
+
+ public boolean isMembershipAttributeDN()
+ {
+ return isMembershipAttributeDN;
+ }
+
+ public boolean allowEmptyMemberships()
+ {
+ return allowEmptyMemberships;
+ }
+
+ public String getAttributeMapping(String name)
+ {
+ return attributeNames.get(name);
+ }
+
+// public void setIdAttributeName(String idAttributeName)
+// {
+// this.idAttributeName = idAttributeName;
+// }
+//
+// public void setCtxDNs(String[] ctxDNs)
+// {
+// this.ctxDNs = ctxDNs;
+// }
+//
+// public void setEntrySearchFilter(String entrySearchFilter)
+// {
+// this.entrySearchFilter = entrySearchFilter;
+// }
+//
+// public void setAllowCreateEntry(boolean allowCreateEntry)
+// {
+// this.allowCreateEntry = allowCreateEntry;
+// }
+//
+// public void setCreateEntryAttributeValues(Map<String, String[]> createEntryAttributeValues)
+// {
+// this.createEntryAttributeValues = createEntryAttributeValues;
+// }
+//
+// public void setAllowedMembershipTypes(String[] allowedMembershipTypes)
+// {
+// this.allowedMembershipTypes = allowedMembershipTypes;
+// }
+//
+// public void setMembershipAttributeName(String membershipAttributeName)
+// {
+// this.membershipAttributeName = membershipAttributeName;
+// }
+//
+// public void setMembershipAttributeDN(boolean membershipAttributeDN)
+// {
+// isMembershipAttributeDN = membershipAttributeDN;
+// }
+//
+// public void setAllowEmptyMemberships(boolean allowEmptyMemberships)
+// {
+// this.allowEmptyMemberships = allowEmptyMemberships;
+// }
+//
+// public void setAttributeNames(Map<String, String> attributeNames)
+// {
+// this.attributeNames = attributeNames;
+// }
+
+ public Set<String> getMappedAttributesNames()
+ {
+ return Collections.unmodifiableSet(attributeNames.keySet());
+ }
+}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java (from rev 109, trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreConfiguration.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,147 @@
+/*
+* 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.impl.store.ldap;
+
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.jboss.identity.spi.configuration.metadata.IdentityObjectTypeMetaData;
+import org.jboss.identity.impl.types.SimpleIdentityObjectType;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleLDAPIdentityStoreConfiguration implements LDAPIdentityStoreConfiguration
+{
+ private final String providerURL;
+
+ private final String adminDN;
+
+ private final String adminPassword;
+
+ private final int searchTimeLimit;
+
+ private final Map<String, LDAPIdentityObjectTypeConfiguration> typesConfiguration;
+
+
+ // Consts
+
+ public static final String PROVIDER_URL = "providerURL";
+
+ public static final String ADMIN_DN = "adminDN";
+
+ public static final String ADMIN_PASSWORD = "adminPassword";
+
+ public static final String SEARCH_TIME_LIMIT = "searchTimeLimit";
+
+ public static final int SEARCH_TIME_LIMIT_DEFAULT = 10000;
+
+// public SimpleLDAPIdentityStoreConfiguration(String providerURL, String adminDN, String adminPassword, int searchTimeLimit, Map<String, LDAPIdentityObjectTypeConfiguration> typesConfiguration)
+// {
+// this.providerURL = providerURL;
+// this.adminDN = adminDN;
+// this.adminPassword = adminPassword;
+// this.searchTimeLimit = searchTimeLimit;
+// this.typesConfiguration = typesConfiguration;
+// }
+
+ public SimpleLDAPIdentityStoreConfiguration(IdentityStoreConfigurationMetaData storeMD)
+ {
+ if (storeMD == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ providerURL = storeMD.getOptionSingleValue(PROVIDER_URL);
+ adminDN = storeMD.getOptionSingleValue(ADMIN_DN);
+ adminPassword = storeMD.getOptionSingleValue(ADMIN_PASSWORD);
+ String searchTL = storeMD.getOptionSingleValue(SEARCH_TIME_LIMIT);
+
+ if (searchTL != null)
+ {
+ searchTimeLimit = Integer.valueOf(searchTL);
+ }
+ else
+ {
+ searchTimeLimit = SEARCH_TIME_LIMIT_DEFAULT;
+ }
+
+ Map<String, LDAPIdentityObjectTypeConfiguration> types = new HashMap<String, LDAPIdentityObjectTypeConfiguration>();
+
+ for (IdentityObjectTypeMetaData identityObjectTypeMetaData : storeMD.getSupportedIdentityTypes())
+ {
+ LDAPIdentityObjectTypeConfiguration typeConfig = new SimpleLDAPIdentityObjectTypeConfiguration(identityObjectTypeMetaData);
+ types.put(identityObjectTypeMetaData.getName(), typeConfig);
+
+ }
+
+ typesConfiguration = types;
+
+ //TODO: validate if critical values are present
+
+
+ }
+
+ public String getProviderURL()
+ {
+ return providerURL;
+ }
+
+ public String getAdminDN()
+ {
+ return adminDN;
+ }
+
+ public String getAdminPassword()
+ {
+ return adminPassword;
+ }
+
+ public int getSearchTimeLimit()
+ {
+ return searchTimeLimit;
+ }
+
+ public LDAPIdentityObjectTypeConfiguration getTypeConfiguration(String typeName)
+ {
+ return typesConfiguration.get(typeName);
+ }
+
+ public IdentityObjectType[] getConfiguredTypes()
+ {
+ IdentityObjectType[] types = new IdentityObjectType[typesConfiguration.size()];
+ Object[] names = typesConfiguration.keySet().toArray();
+
+ for (int i = 0; i < names.length; i++)
+ {
+ String name = names[i].toString();
+ types[i] = new SimpleIdentityObjectType(name);
+ }
+
+ return types;
+ }
+
+}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/HibernateTestSupport.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/HibernateTestSupport.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/HibernateTestSupport.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -120,6 +120,7 @@
}
em.getTransaction().commit();
+
}
public void populateRelationshipTypes(String[] typeNames) throws Exception
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -24,38 +24,15 @@
import junit.framework.TestCase;
import org.jboss.identity.impl.HibernateTestSupport;
-import org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl;
-import org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreInvocationContext;
-import org.jboss.identity.impl.store.ldap.LDAPIdentityObjectTypeConfiguration;
-import org.jboss.identity.impl.store.ldap.SimpleLDAPIdentityObjectTypeConfiguration;
-import org.jboss.identity.impl.store.ldap.SimpleLDAPIdentityStoreConfiguration;
-import org.jboss.identity.impl.store.ldap.SimpleLDAPIdentityStoreInvocationContext;
-import org.jboss.identity.impl.store.ldap.LDAPIdentityStoreInvocationContext;
-import org.jboss.identity.impl.store.ldap.LDAPIdentityStoreConfiguration;
-import org.jboss.identity.impl.store.ldap.LDAPIdentityStore;
-import org.jboss.identity.impl.store.IdentityTypeEnum;
-import org.jboss.identity.impl.repository.WrapperIdentityStoreRepository;
-import org.jboss.identity.impl.repository.FallbackIdentityStoreRepository;
import org.jboss.identity.api.IdentitySessionFactory;
-import org.jboss.identity.api.IdentitySession;
-import org.jboss.identity.spi.repository.IdentityStoreRepository;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.AttributeStore;
import org.jboss.identity.opends.OpenDSService;
-import org.hibernate.ejb.HibernateEntityManager;
import org.opends.server.tools.LDAPModify;
import javax.naming.directory.DirContext;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.Binding;
-import javax.naming.ldap.LdapContext;
import javax.naming.ldap.InitialLdapContext;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Hashtable;
import java.io.File;
@@ -65,14 +42,8 @@
*/
public class APITestCase extends TestCase implements APITestContext
{
+ HibernateTestSupport hibernateSupport = new HibernateTestSupport("unit-testing-jpa1", "jboss-identity-model1");
- //TODO: Code below is hardly readable mess... just made it quickly for prototyping. Testing bits will be cleanly initialized
- //TODO: once I make XML configuration for all services
-
- HibernateTestSupport hibernateSupport = new HibernateTestSupport("unit-testing-jpa", "jboss-identity-model");
-
- LDAPIdentityStoreInvocationContext ctx;
-
OrganizationTest orgTest;
IdentitySessionFactory identitySessionFactory;
@@ -112,7 +83,7 @@
protected void tearDown() throws Exception
{
hibernateSupport.stop();
-
+
cleanUp(new InitialLdapContext(env, null));
openDSService.stop();
@@ -120,193 +91,39 @@
public void testDBOrganization() throws Exception
{
- IdentityStore store = new HibernateIdentityStoreImpl();
- IdentityStoreRepository repository = new WrapperIdentityStoreRepository(store, store, null, null);
- final IdentityStoreInvocationContext invocationContext = new HibernateIdentityStoreInvocationContext()
- {
- public HibernateEntityManager getHibernateEntityManager()
- {
- return hibernateSupport.getHibernateEntityManager();
- }
- };
- prepareRealm(repository, invocationContext, OrganizationTest.RED_HAT_REALM,
- new String[]{"IDENTITY", "ORGANIZATION", "ORGANIZATION_UNIT", "DIVISION", "DEPARTMENT", "PROJECT", "PEOPLE"});
- orgTest.testRedHatOrganization();
+ identitySessionFactory = new IdentitySessionFactoryImpl(new File("src/test/resources/organization-test-config.xml"));
+
+ orgTest.testRedHatOrganization("realm://RedHat/DB");
}
public void testDBSamplePortal() throws Exception
{
- IdentityStore store = new HibernateIdentityStoreImpl();
- IdentityStoreRepository repository = new WrapperIdentityStoreRepository(store, store, null, null);
- final IdentityStoreInvocationContext invocationContext = new HibernateIdentityStoreInvocationContext()
- {
- public HibernateEntityManager getHibernateEntityManager()
- {
- return hibernateSupport.getHibernateEntityManager();
- }
- };
- prepareRealm(repository, invocationContext, OrganizationTest.PORTAL_REALM,
- new String[]{"IDENTITY", "SYSTEM", "ADMINISTRATION", "COMMUNITY", "ORGANIZATION", "ORGANIZATION_UNIT",
- "OFFICE", "DIVISION", "DEPARTMENT", "SECURITY", "PEOPLE"});
- orgTest.testSamplePortal();
+
+ identitySessionFactory = new IdentitySessionFactoryImpl(new File("src/test/resources/organization-test-config.xml"));
+
+ orgTest.testSamplePortal("realm://portal/SamplePortal/DB");
}
public void testLDAPMixedOrganization() throws Exception
{
populateClean();
- IdentityStore hibernateStore = new HibernateIdentityStoreImpl();
+ identitySessionFactory = new IdentitySessionFactoryImpl(new File("src/test/resources/organization-test-config.xml"));
- final LDAPIdentityStoreConfiguration ldapConfig = createLDAPConfig("IDENTITY", null, null);
-
-
- IdentityStore ldapStore = new LDAPIdentityStore("LDAPStore");
-
- Map<String, IdentityStore> isMap = new HashMap<String, IdentityStore>();
- isMap.put("IDENTITY",ldapStore);
- isMap.put("ORGANIZATION",hibernateStore);
- isMap.put("ORGANIZATION_UNIT",hibernateStore);
- isMap.put("DIVISION",hibernateStore);
- isMap.put("DEPARTMENT",hibernateStore);
- isMap.put("PROJECT",hibernateStore);
- isMap.put("PEOPLE",hibernateStore);
-
- Map<String, AttributeStore> asMap = new HashMap<String, AttributeStore>();
- isMap.put("IDENTITY",ldapStore);
- isMap.put("ORGANIZATION",hibernateStore);
- isMap.put("ORGANIZATION_UNIT",hibernateStore);
- isMap.put("DIVISION",hibernateStore);
- isMap.put("DEPARTMENT",hibernateStore);
- isMap.put("PROJECT",hibernateStore);
- isMap.put("PEOPLE",hibernateStore);
-
- IdentityStoreRepository repository = new FallbackIdentityStoreRepository(hibernateStore, hibernateStore, isMap, asMap);
-
- final IdentityStoreInvocationContext invocationContext = new TestInvocationContext()
- {
- public LdapContext getLdapContext() throws Exception
- {
-
-
- return new InitialLdapContext(env, null);
- }
-
- public LDAPIdentityStoreConfiguration getConfiguration()
- {
- return ldapConfig;
- }
-
- public HibernateEntityManager getHibernateEntityManager()
- {
- return hibernateSupport.getHibernateEntityManager();
- }
- };
-
- prepareRealm(repository, invocationContext, OrganizationTest.RED_HAT_REALM,
- new String[]{"IDENTITY", "ORGANIZATION", "ORGANIZATION_UNIT", "DIVISION", "DEPARTMENT", "PROJECT", "PEOPLE"});
- orgTest.testRedHatOrganization();
+ orgTest.testRedHatOrganization("realm://RedHat/DB_LDAP");
}
public void testLDAPMixedSamplePortal() throws Exception
- {
- populateClean();
-
- IdentityStore hibernateStore = new HibernateIdentityStoreImpl();
-
- final LDAPIdentityStoreConfiguration ldapConfig = createLDAPConfig("IDENTITY", null, null);
-
- IdentityStore ldapStore = new LDAPIdentityStore("LDAPStore");
-
- Map<String, IdentityStore> isMap = new HashMap<String, IdentityStore>();
- isMap.put("IDENTITY",ldapStore);
- isMap.put("SYSTEM",hibernateStore);
- isMap.put("ADMINISTRATION",hibernateStore);
- isMap.put("COMMUNITY",hibernateStore);
- isMap.put("ORGANIZATION",hibernateStore);
- isMap.put("ORGANIZATION_UNIT",hibernateStore);
- isMap.put("OFFICE",hibernateStore);
- isMap.put("DIVISION",hibernateStore);
- isMap.put("DEPARTMENT",hibernateStore);
- isMap.put("SECURITY",hibernateStore);
- isMap.put("PEOPLE",hibernateStore);
-
- Map<String, AttributeStore> asMap = new HashMap<String, AttributeStore>();
- asMap.put("IDENTITY",ldapStore);
- asMap.put("SYSTEM",hibernateStore);
- asMap.put("ADMINISTRATION",hibernateStore);
- asMap.put("COMMUNITY",hibernateStore);
- asMap.put("ORGANIZATION",hibernateStore);
- asMap.put("ORGANIZATION_UNIT",hibernateStore);
- asMap.put("OFFICE",hibernateStore);
- asMap.put("DIVISION",hibernateStore);
- asMap.put("DEPARTMENT",hibernateStore);
- asMap.put("SECURITY",hibernateStore);
- asMap.put("PEOPLE",hibernateStore);
-
- IdentityStoreRepository repository = new FallbackIdentityStoreRepository(hibernateStore, hibernateStore, isMap, asMap);
-
- final IdentityStoreInvocationContext invocationContext = new TestInvocationContext()
- {
- public LdapContext getLdapContext() throws Exception
- {
- return new InitialLdapContext(env, null);
- }
-
- public LDAPIdentityStoreConfiguration getConfiguration()
- {
- return ldapConfig;
- }
-
- public HibernateEntityManager getHibernateEntityManager()
- {
- return hibernateSupport.getHibernateEntityManager();
- }
- };
-
- prepareRealm(repository, invocationContext, OrganizationTest.PORTAL_REALM,
- new String[]{"IDENTITY", "SYSTEM", "ADMINISTRATION", "COMMUNITY", "ORGANIZATION", "ORGANIZATION_UNIT",
- "OFFICE", "DIVISION", "DEPARTMENT", "SECURITY", "PEOPLE"});
- orgTest.testSamplePortal();
- }
-
- // Helper
-
- private void prepareRealm(IdentityStoreRepository repository, final IdentityStoreInvocationContext invocationContext, String realmName, String[] objectTypes) throws Exception
{
+ populateClean();
- Set<SessionWrapper> sessionWrappers = new HashSet<SessionWrapper>();
- sessionWrappers.add(new EntityManagerWrapper(hibernateSupport.getHibernateEntityManager()));
-
- hibernateSupport.populateObjectTypes(objectTypes);
- hibernateSupport.populateRelationshipTypes(new String[]{"JBOSS_IDENTITY_MEMBERSHIP", "JBOSS_IDENTITY_ROLE"});
-
- IdentityObjectTypeMapper iotMapper = new DirectIdentityObjectTypeMapperImpl("IDENTITY");
-
-
-
- IdentityStoreInvocationContextResolver contextResolver = new IdentityStoreInvocationContextResolver()
- {
- public IdentityStoreInvocationContext resolveInvocationContext()
- {
- return invocationContext;
- }
- };
-
- IdentitySessionContext identitySessionContext = new IdentitySessionContextImpl(repository, iotMapper, contextResolver);
-
- IdentitySession identitySession = new IdentitySessionImpl(realmName, identitySessionContext, sessionWrappers);
-
- Map<String, IdentitySession> sessionMap = new HashMap<String, IdentitySession>();
+ identitySessionFactory = new IdentitySessionFactoryImpl(new File("src/test/resources/organization-test-config.xml"));
- sessionMap.put(realmName, identitySession);
- identitySessionFactory = new IdentitySessionFactoryImpl(sessionMap);
-
+ orgTest.testSamplePortal("realm://portal/SamplePortal/DB_LDAP");
}
-
-
public IdentitySessionFactory getIdentitySessionFactory()
{
return identitySessionFactory;
@@ -371,90 +188,6 @@
mainCtx.unbind(name);
}
- private SimpleLDAPIdentityStoreConfiguration createLDAPConfig(String peopleTypeName, String rolesTypeName, String groupsTypeName)
- {
- Map<String, LDAPIdentityObjectTypeConfiguration> typesMap = new HashMap<String, LDAPIdentityObjectTypeConfiguration>();
-
- //People
- SimpleLDAPIdentityObjectTypeConfiguration tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {});
- tc.setAllowEmptyMemberships(true);
- Map<String, String> attrs = new HashMap<String, String>();
- attrs.put("phone", "telephoneNumber");
- attrs.put("description", "description");
- attrs.put("carLicense", "carLicense");
- tc.setAttributeNames(attrs);
- Map<String, String[]> newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "inetOrgPerson"});
- newAttrs.put("sn", new String[]{" "});
- newAttrs.put("cn", new String[]{" "});
-
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=People,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("uid");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName(null);
- typesMap.put(peopleTypeName, tc);
-
-
- if (rolesTypeName != null)
- {
- // ROLE
- tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName()});
- tc.setAllowEmptyMemberships(true);
- attrs = new HashMap<String, String>();
- //attrs.put();
- tc.setAttributeNames(attrs);
- newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=Roles,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("cn");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName("member");
- typesMap.put(rolesTypeName, tc);
- }
-
- if (groupsTypeName != null)
- {
- // GROUP
- tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName(), IdentityTypeEnum.ROLE.getName(), IdentityTypeEnum.GROUP.getName()});
- tc.setAllowEmptyMemberships(true);
- attrs = new HashMap<String, String>();
- //attrs.put();
- tc.setAttributeNames(attrs);
- newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
-
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=Groups,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("cn");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName("member");
- typesMap.put(groupsTypeName, tc);
- }
-
- return new SimpleLDAPIdentityStoreConfiguration(
- LDAP_PROVIDER_URL,
- LDAP_PRINCIPAL,
- LDAP_CREDENTIALS,
- 10000,
- typesMap);
- }
-
- private interface TestInvocationContext extends HibernateIdentityStoreInvocationContext, LDAPIdentityStoreInvocationContext
- {
-
- }
-
}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -44,11 +44,6 @@
*/
public class OrganizationTest extends Assert
{
-
- public static final String RED_HAT_REALM = "realm://RedHat";
-
- public static final String PORTAL_REALM = "realm://portal/SamplePortal";
-
APITestContext ctx;
public OrganizationTest(APITestContext ctx)
@@ -66,7 +61,7 @@
return ctx;
}
- public void testRedHatOrganization() throws Exception
+ public void testRedHatOrganization(String realmName) throws Exception
{
// GroupType
@@ -79,7 +74,7 @@
IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
- IdentitySession session = factory.createIdentitySession(RED_HAT_REALM);
+ IdentitySession session = factory.createIdentitySession(realmName);
session.getTransaction().start();
@@ -279,7 +274,7 @@
}
- public void testSamplePortal() throws Exception
+ public void testSamplePortal(String realmName) throws Exception
{
GroupType SYSTEM = new SimpleGroupType("SYSTEM");
GroupType ADMINISTRATION = new SimpleGroupType("ADMINISTRATION");
@@ -296,7 +291,7 @@
//TODO: alter realm policies to make ORGANIZATION, ORGANIZATION_UNIT, DIVISION, DEPARTMENT and OFFICE hierarchical groups
- IdentitySession session = factory.createIdentitySession(PORTAL_REALM);
+ IdentitySession session = factory.createIdentitySession(realmName);
session.getTransaction().start();
Added: trunk/identity-impl/src/test/java/org/jboss/identity/impl/configuration/ConfigurationTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/configuration/ConfigurationTestCase.java (rev 0)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/configuration/ConfigurationTestCase.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,52 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.impl.configuration;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+import org.jboss.identity.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.jboss.identity.spi.configuration.metadata.IdentityConfigurationMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ConfigurationTestCase extends TestCase
+{
+
+
+
+ public void testSimple() throws Exception
+ {
+
+ IdentityConfigurationMetaData config = JAXB2IdentityConfiguration.createConfigurationMetaData(new File("src/test/resources/test-config.xml"));
+
+ assertNotNull(config);
+
+ assertEquals("Hibernate Identity Store", config.getIdentityStores().get(0).getId() );
+
+
+ }
+}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -61,7 +61,7 @@
{
super.setUp();
- store = new HibernateIdentityStoreImpl()
+ store = new HibernateIdentityStoreImpl("test-id")
{
protected HibernateEntityManager getHibernateEntityManager(IdentityStoreInvocationContext ctx)
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStoreTestCase.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -1,514 +1,514 @@
-/*
-* 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.impl.store.ldap;
-
-import junit.framework.TestCase;
-import org.jboss.identity.opends.OpenDSService;
-import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.spi.model.IdentityObject;
-import org.jboss.identity.impl.store.IdentityTypeEnum;
-import org.jboss.identity.impl.store.CommonIdentityStoreTest;
-import org.jboss.identity.impl.store.IdentityStoreTestContext;
-import org.opends.server.tools.LDAPModify;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.LdapContext;
-import javax.naming.ldap.InitialLdapContext;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-import java.io.File;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPIdentityStoreTestCase extends TestCase implements IdentityStoreTestContext
-{
-
- public static final String LDAP_HOST = "localhost";
-
- public static final String LDAP_PORT = "10389";
-
- public static final String LDAP_PROVIDER_URL = "ldap://" + LDAP_HOST + ":" + LDAP_PORT;
-
- public static final String LDAP_PRINCIPAL = "cn=Directory Manager";
-
- public static final String LDAP_CREDENTIALS = "password";
-
- OpenDSService openDSService = new OpenDSService("target/test-classes/opends");
-
- IdentityStore store;
-
- CommonIdentityStoreTest commonTest;
-
- LDAPIdentityStoreInvocationContext ctx;
-
- public LDAPIdentityStoreTestCase(String s)
- {
- super(s);
- commonTest = new CommonIdentityStoreTest(this);
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- openDSService.start();
-
- // Initiate invocation context with simple configuration
- initiateCtx();
-
+///*
+//* 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.impl.store.ldap;
+//
+//import junit.framework.TestCase;
+//import org.jboss.identity.opends.OpenDSService;
+//import org.jboss.identity.spi.store.IdentityStore;
+//import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
+//import org.jboss.identity.spi.model.IdentityObject;
+//import org.jboss.identity.impl.store.IdentityTypeEnum;
+//import org.jboss.identity.impl.store.CommonIdentityStoreTest;
+//import org.jboss.identity.impl.store.IdentityStoreTestContext;
+//import org.opends.server.tools.LDAPModify;
+//
+//import javax.naming.Context;
+//import javax.naming.NamingException;
+//import javax.naming.NamingEnumeration;
+//import javax.naming.Binding;
+//import javax.naming.directory.DirContext;
+//import javax.naming.ldap.LdapContext;
+//import javax.naming.ldap.InitialLdapContext;
+//import java.net.URL;
+//import java.util.Hashtable;
+//import java.util.Map;
+//import java.util.HashMap;
+//import java.util.Set;
+//import java.util.HashSet;
+//import java.util.logging.Logger;
+//import java.util.logging.Level;
+//import java.io.File;
+//
+///**
+// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+// * @version : 0.1 $
+// */
+//public class LDAPIdentityStoreTestCase extends TestCase implements IdentityStoreTestContext
+//{
+//
+// public static final String LDAP_HOST = "localhost";
+//
+// public static final String LDAP_PORT = "10389";
+//
+// public static final String LDAP_PROVIDER_URL = "ldap://" + LDAP_HOST + ":" + LDAP_PORT;
+//
+// public static final String LDAP_PRINCIPAL = "cn=Directory Manager";
+//
+// public static final String LDAP_CREDENTIALS = "password";
+//
+// OpenDSService openDSService = new OpenDSService("target/test-classes/opends");
+//
+// IdentityStore store;
+//
+// CommonIdentityStoreTest commonTest;
+//
+// LDAPIdentityStoreInvocationContext ctx;
+//
+// public LDAPIdentityStoreTestCase(String s)
+// {
+// super(s);
+// commonTest = new CommonIdentityStoreTest(this);
+// }
+//
+// protected void setUp() throws Exception
+// {
+// super.setUp();
+//
+// openDSService.start();
+//
+// // Initiate invocation context with simple configuration
+// initiateCtx();
+//
+//// populate();
+//
+// store = new LDAPIdentityStore("simpleTestLDAPStore");
+//
+//
+//
+// }
+//
+// protected void tearDown() throws Exception
+// {
+// super.tearDown();
+//
+// cleanUp();
+//
+// openDSService.stop();
+// }
+//
+// public void begin() throws Exception
+// {
+// //nothing
+// }
+//
+// public void commit() throws Exception
+// {
+// //nothing
+// }
+//
+// public void flush() throws Exception
+// {
+// //nothing
+// }
+//
+// public IdentityStore getStore()
+// {
+// return store;
+// }
+//
+// public IdentityStoreInvocationContext getCtx()
+// {
+// return ctx;
+// }
+//
+//
+//
+//
+//
+// public void populate() throws Exception
+// {
+// populateLDIF("target/test-classes/ldap/initial-opends.ldif");
+// }
+//
+// public void populateClean() throws Exception
+// {
+// populateLDIF("target/test-classes/ldap/initial-empty-opends.ldif");
+// }
+//
+// public void populateLDIF(String ldifRelativePath) throws Exception
+// {
+// File ldif = new File(ldifRelativePath);
+//
+// System.out.println("LDIF: " + ldif.getAbsolutePath());
+//
+// String[] cmd = new String[] {"-h", LDAP_HOST,
+// "-p", LDAP_PORT,
+// "-D", LDAP_PRINCIPAL,
+// "-w", LDAP_CREDENTIALS,
+// "-a", "-f", ldif.getPath()};
+//
+// System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
+//
+// }
+//
+// protected void cleanUp() throws Exception
+// {
+// try
+// {
+//
+// DirContext ldapCtx = ctx.getLdapContext();
+// String dn = "dc=portal,dc=example,dc=com";
+//
+// System.out.println("Removing: " + dn);
+//
+// removeContext(ldapCtx, dn);
+// }
+// catch (Exception e)
+// {
+// //
+// }
+// }
+//
+// //subsequent remove of javax.naming.Context
+// protected void removeContext(Context mainCtx, String name) throws Exception
+// {
+// Context deleteCtx = (Context)mainCtx.lookup(name);
+// NamingEnumeration subDirs = mainCtx.listBindings(name);
+//
+// while (subDirs.hasMoreElements())
+// {
+// Binding binding = (Binding)subDirs.nextElement();
+// String subName = binding.getName();
+//
+// removeContext(deleteCtx, subName);
+// }
+//
+// mainCtx.unbind(name);
+// }
+//
+// private void initiateCtx()
+// {
+//
+// Map<String, LDAPIdentityObjectTypeConfiguration> typesMap = new HashMap<String, LDAPIdentityObjectTypeConfiguration>();
+//
+// //USER
+// SimpleLDAPIdentityObjectTypeConfiguration tc = new SimpleLDAPIdentityObjectTypeConfiguration();
+// tc.setAllowCreateEntry(true);
+// tc.setAllowedMembershipTypes(new String[] {});
+// tc.setAllowEmptyMemberships(true);
+// Map<String, String> attrs = new HashMap<String, String>();
+// attrs.put("phone", "telephoneNumber");
+// attrs.put("description", "description");
+// attrs.put("carLicense", "carLicense");
+// tc.setAttributeNames(attrs);
+// Map<String, String[]> newAttrs = new HashMap<String, String[]>();
+// newAttrs.put("objectClass", new String[]{"top", "inetOrgPerson"});
+// newAttrs.put("sn", new String[]{" "});
+// newAttrs.put("cn", new String[]{" "});
+//
+// tc.setCreateEntryAttributeValues(newAttrs);
+// tc.setCtxDNs(new String[] {"ou=People,o=test,dc=portal,dc=example,dc=com"});
+// tc.setEntrySearchFilter(null);
+// tc.setIdAttributeName("uid");
+// tc.setMembershipAttributeDN(true);
+// tc.setMembershipAttributeName(null);
+// typesMap.put(IdentityTypeEnum.USER.getName(), tc);
+//
+//
+// // ROLE
+// tc = new SimpleLDAPIdentityObjectTypeConfiguration();
+// tc.setAllowCreateEntry(true);
+// tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName()});
+// tc.setAllowEmptyMemberships(true);
+// attrs = new HashMap<String, String>();
+// //attrs.put();
+// tc.setAttributeNames(attrs);
+// newAttrs = new HashMap<String, String[]>();
+// newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
+// tc.setCreateEntryAttributeValues(newAttrs);
+// tc.setCtxDNs(new String[] {"ou=Roles,o=test,dc=portal,dc=example,dc=com"});
+// tc.setEntrySearchFilter(null);
+// tc.setIdAttributeName("cn");
+// tc.setMembershipAttributeDN(true);
+// tc.setMembershipAttributeName("member");
+// typesMap.put(IdentityTypeEnum.ROLE.getName(), tc);
+//
+// // GROUP
+// tc = new SimpleLDAPIdentityObjectTypeConfiguration();
+// tc.setAllowCreateEntry(true);
+// tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName(), IdentityTypeEnum.ROLE.getName(), IdentityTypeEnum.GROUP.getName()});
+// tc.setAllowEmptyMemberships(true);
+// attrs = new HashMap<String, String>();
+// //attrs.put();
+// tc.setAttributeNames(attrs);
+// newAttrs = new HashMap<String, String[]>();
+// newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
+//
+// tc.setCreateEntryAttributeValues(newAttrs);
+// tc.setCtxDNs(new String[] {"ou=Groups,o=test,dc=portal,dc=example,dc=com"});
+// tc.setEntrySearchFilter(null);
+// tc.setIdAttributeName("cn");
+// tc.setMembershipAttributeDN(true);
+// tc.setMembershipAttributeName("member");
+// typesMap.put(IdentityTypeEnum.GROUP.getName(), tc);
+//
+// // ORGANIZATION
+// tc = new SimpleLDAPIdentityObjectTypeConfiguration();
+// tc.setAllowCreateEntry(true);
+// tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName(), IdentityTypeEnum.ROLE.getName(), IdentityTypeEnum.GROUP.getName()});
+// tc.setAllowEmptyMemberships(true);
+// attrs = new HashMap<String, String>();
+// //attrs.put();
+// tc.setAttributeNames(attrs);
+// newAttrs = new HashMap<String, String[]>();
+// newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
+//
+// tc.setCreateEntryAttributeValues(newAttrs);
+// tc.setCtxDNs(new String[] {"ou=Organizations,o=test,dc=portal,dc=example,dc=com"});
+// tc.setEntrySearchFilter(null);
+// tc.setIdAttributeName("cn");
+// tc.setMembershipAttributeDN(true);
+// tc.setMembershipAttributeName("member");
+// typesMap.put(IdentityTypeEnum.ORGANIZATION.getName(), tc);
+//
+//
+// SimpleLDAPIdentityStoreConfiguration configuration =
+// new SimpleLDAPIdentityStoreConfiguration(
+// LDAP_PROVIDER_URL,
+// LDAP_PRINCIPAL,
+// LDAP_CREDENTIALS,
+// 10000,
+// typesMap);
+//
+// ctx = new SimpleLDAPIdentityStoreInvocationContext(configuration);
+// }
+//
+//
+// // Tests
+//
+//// Just test if OpenDS is running and was populated...
+// public void testSimple() throws Exception
+// {
// populate();
-
- store = new LDAPIdentityStore("simpleTestLDAPStore");
-
-
-
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- cleanUp();
-
- openDSService.stop();
- }
-
- public void begin() throws Exception
- {
- //nothing
- }
-
- public void commit() throws Exception
- {
- //nothing
- }
-
- public void flush() throws Exception
- {
- //nothing
- }
-
- public IdentityStore getStore()
- {
- return store;
- }
-
- public IdentityStoreInvocationContext getCtx()
- {
- return ctx;
- }
-
-
-
-
-
- public void populate() throws Exception
- {
- populateLDIF("target/test-classes/ldap/initial-opends.ldif");
- }
-
- public void populateClean() throws Exception
- {
- populateLDIF("target/test-classes/ldap/initial-empty-opends.ldif");
- }
-
- public void populateLDIF(String ldifRelativePath) throws Exception
- {
- File ldif = new File(ldifRelativePath);
-
- System.out.println("LDIF: " + ldif.getAbsolutePath());
-
- String[] cmd = new String[] {"-h", LDAP_HOST,
- "-p", LDAP_PORT,
- "-D", LDAP_PRINCIPAL,
- "-w", LDAP_CREDENTIALS,
- "-a", "-f", ldif.getPath()};
-
- System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
-
- }
-
- protected void cleanUp() throws Exception
- {
- try
- {
-
- DirContext ldapCtx = ctx.getLdapContext();
- String dn = "dc=portal,dc=example,dc=com";
-
- System.out.println("Removing: " + dn);
-
- removeContext(ldapCtx, dn);
- }
- catch (Exception e)
- {
- //
- }
- }
-
- //subsequent remove of javax.naming.Context
- protected void removeContext(Context mainCtx, String name) throws Exception
- {
- Context deleteCtx = (Context)mainCtx.lookup(name);
- NamingEnumeration subDirs = mainCtx.listBindings(name);
-
- while (subDirs.hasMoreElements())
- {
- Binding binding = (Binding)subDirs.nextElement();
- String subName = binding.getName();
-
- removeContext(deleteCtx, subName);
- }
-
- mainCtx.unbind(name);
- }
-
- private void initiateCtx()
- {
-
- Map<String, LDAPIdentityObjectTypeConfiguration> typesMap = new HashMap<String, LDAPIdentityObjectTypeConfiguration>();
-
- //USER
- SimpleLDAPIdentityObjectTypeConfiguration tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {});
- tc.setAllowEmptyMemberships(true);
- Map<String, String> attrs = new HashMap<String, String>();
- attrs.put("phone", "telephoneNumber");
- attrs.put("description", "description");
- attrs.put("carLicense", "carLicense");
- tc.setAttributeNames(attrs);
- Map<String, String[]> newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "inetOrgPerson"});
- newAttrs.put("sn", new String[]{" "});
- newAttrs.put("cn", new String[]{" "});
-
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=People,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("uid");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName(null);
- typesMap.put(IdentityTypeEnum.USER.getName(), tc);
-
-
- // ROLE
- tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName()});
- tc.setAllowEmptyMemberships(true);
- attrs = new HashMap<String, String>();
- //attrs.put();
- tc.setAttributeNames(attrs);
- newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=Roles,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("cn");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName("member");
- typesMap.put(IdentityTypeEnum.ROLE.getName(), tc);
-
- // GROUP
- tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName(), IdentityTypeEnum.ROLE.getName(), IdentityTypeEnum.GROUP.getName()});
- tc.setAllowEmptyMemberships(true);
- attrs = new HashMap<String, String>();
- //attrs.put();
- tc.setAttributeNames(attrs);
- newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
-
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=Groups,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("cn");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName("member");
- typesMap.put(IdentityTypeEnum.GROUP.getName(), tc);
-
- // ORGANIZATION
- tc = new SimpleLDAPIdentityObjectTypeConfiguration();
- tc.setAllowCreateEntry(true);
- tc.setAllowedMembershipTypes(new String[] {IdentityTypeEnum.USER.getName(), IdentityTypeEnum.ROLE.getName(), IdentityTypeEnum.GROUP.getName()});
- tc.setAllowEmptyMemberships(true);
- attrs = new HashMap<String, String>();
- //attrs.put();
- tc.setAttributeNames(attrs);
- newAttrs = new HashMap<String, String[]>();
- newAttrs.put("objectClass", new String[]{"top", "groupOfNames"});
-
- tc.setCreateEntryAttributeValues(newAttrs);
- tc.setCtxDNs(new String[] {"ou=Organizations,o=test,dc=portal,dc=example,dc=com"});
- tc.setEntrySearchFilter(null);
- tc.setIdAttributeName("cn");
- tc.setMembershipAttributeDN(true);
- tc.setMembershipAttributeName("member");
- typesMap.put(IdentityTypeEnum.ORGANIZATION.getName(), tc);
-
-
- SimpleLDAPIdentityStoreConfiguration configuration =
- new SimpleLDAPIdentityStoreConfiguration(
- LDAP_PROVIDER_URL,
- LDAP_PRINCIPAL,
- LDAP_CREDENTIALS,
- 10000,
- typesMap);
-
- ctx = new SimpleLDAPIdentityStoreInvocationContext(configuration);
- }
-
-
- // Tests
-
-// Just test if OpenDS is running and was populated...
- public void testSimple() throws Exception
- {
- populate();
-
- Hashtable<String,String> env = new Hashtable<String,String>();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL);
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, LDAP_PRINCIPAL);
- env.put(Context.SECURITY_CREDENTIALS, LDAP_CREDENTIALS);
-
- LdapContext ldapCtx = null;
- try
- {
- ldapCtx = new InitialLdapContext(env, null);
-
-// Do something ...
- System.out.println("Attributes: " + ldapCtx.getAttributes("o=test,dc=portal,dc=example,dc=com"));
-
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- if (ldapCtx != null)
- {
- ldapCtx.close();
- }
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- }
- }
-
- public void testIdentityObjectCount() throws Exception
- {
- populate();
-
- assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
- assertEquals(5, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.ROLE));
- assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
- }
-
- public void testFindCreateRemove() throws Exception
- {
- populate();
-
- assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-
- IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
- assertEquals("admin", io.getName());
- assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getId().toString());
-
- //
-
- store.removeIdentityObject(ctx, io);
-
- assertEquals(6, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-
- store.createIdentityObject(ctx, "newUserA", IdentityTypeEnum.USER);
-
- assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-
- //
-
- assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
-
- store.createIdentityObject(ctx, "newGroupA", IdentityTypeEnum.GROUP);
-
- assertEquals(3, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
-
- //
-
- io = store.findIdentityObject(ctx, "cn=newGroupA,ou=Groups,o=test,dc=portal,dc=example,dc=com");
- assertEquals("newGroupA", io.getName());
-
- }
-
- public void testAttributes() throws Exception{
-
- populate();
-
- IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
- IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
-
- //
-
- Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
- HashSet<String> vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
-
- attrs.put("phone", vals);
-
- vals = new HashSet<String>();
- vals.add("val1");
- vals.add("val2");
- vals.add("val3");
- vals.add("val4");
- attrs.put("description", vals);
-
- store.addAttributes(ctx, user1, attrs);
-
- //
-
- Map<String, Set<String>> persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(2, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("phone"));
- assertEquals(3, persistedAttrs.get("phone").size());
-
- assertTrue(persistedAttrs.containsKey("description"));
- assertEquals(4, persistedAttrs.get("description").size());
-
- //
-
- attrs = new HashMap<String, Set<String>>();
- vals = new HashSet<String>();
- vals.add("val1");
- attrs.put("carLicense", vals);
-
- store.addAttributes(ctx, user1, attrs);
-
- //
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("phone"));
- assertEquals(3, persistedAttrs.get("phone").size());
-
- assertTrue(persistedAttrs.containsKey("description"));
- assertEquals(4, persistedAttrs.get("description").size());
-
- assertTrue(persistedAttrs.containsKey("carLicense"));
- assertEquals(1, persistedAttrs.get("carLicense").size());
-
- //
-
- vals = new HashSet<String>();
- vals.add("val2");
- attrs.put("carLicense", vals);
-
- store.addAttributes(ctx, user1, attrs);
-
- //
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("carLicense"));
- assertEquals(2, persistedAttrs.get("carLicense").size());
-
- //
-
- store.updateAttributes(ctx, user1, attrs);
-
- //
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("carLicense"));
- assertEquals(1, persistedAttrs.get("carLicense").size());
-
- //
-
- Set<String> names = new HashSet<String>();
- names.add("carLicense");
- store.removeAttributes(ctx, user1, names);
-
- //
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(2, persistedAttrs.keySet().size());
-
- }
-
- public void testRelationships() throws Exception
- {
- populateClean();
-
- commonTest.testRelationships();
-
- }
-
- public void testStorePersistence() throws Exception
- {
- populateClean();
-
- commonTest.testStorePersistence();
-
- }
-
- public void testFindMethods() throws Exception
- {
- populateClean();
-
- commonTest.testFindMethods();
-
- }
-
-}
+//
+// Hashtable<String,String> env = new Hashtable<String,String>();
+// env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+// env.put(Context.PROVIDER_URL, LDAP_PROVIDER_URL);
+// env.put(Context.SECURITY_AUTHENTICATION, "simple");
+// env.put(Context.SECURITY_PRINCIPAL, LDAP_PRINCIPAL);
+// env.put(Context.SECURITY_CREDENTIALS, LDAP_CREDENTIALS);
+//
+// LdapContext ldapCtx = null;
+// try
+// {
+// ldapCtx = new InitialLdapContext(env, null);
+//
+//// Do something ...
+// System.out.println("Attributes: " + ldapCtx.getAttributes("o=test,dc=portal,dc=example,dc=com"));
+//
+// }
+// catch (NamingException e)
+// {
+// e.printStackTrace();
+// }
+// finally
+// {
+// try
+// {
+// if (ldapCtx != null)
+// {
+// ldapCtx.close();
+// }
+// }
+// catch (NamingException e)
+// {
+// e.printStackTrace();
+// }
+// }
+// }
+//
+// public void testIdentityObjectCount() throws Exception
+// {
+// populate();
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+// assertEquals(5, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.ROLE));
+// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+// }
+//
+// public void testFindCreateRemove() throws Exception
+// {
+// populate();
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
+// assertEquals("admin", io.getName());
+// assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getId().toString());
+//
+// //
+//
+// store.removeIdentityObject(ctx, io);
+//
+// assertEquals(6, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// store.createIdentityObject(ctx, "newUserA", IdentityTypeEnum.USER);
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// //
+//
+// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+//
+// store.createIdentityObject(ctx, "newGroupA", IdentityTypeEnum.GROUP);
+//
+// assertEquals(3, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+//
+// //
+//
+// io = store.findIdentityObject(ctx, "cn=newGroupA,ou=Groups,o=test,dc=portal,dc=example,dc=com");
+// assertEquals("newGroupA", io.getName());
+//
+// }
+//
+// public void testAttributes() throws Exception{
+//
+// populate();
+//
+// IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+// IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+//
+// //
+//
+// Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
+// HashSet<String> vals = new HashSet<String>();
+// vals.add("val1");
+// vals.add("val2");
+// vals.add("val3");
+//
+// attrs.put("phone", vals);
+//
+// vals = new HashSet<String>();
+// vals.add("val1");
+// vals.add("val2");
+// vals.add("val3");
+// vals.add("val4");
+// attrs.put("description", vals);
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// Map<String, Set<String>> persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(2, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("phone"));
+// assertEquals(3, persistedAttrs.get("phone").size());
+//
+// assertTrue(persistedAttrs.containsKey("description"));
+// assertEquals(4, persistedAttrs.get("description").size());
+//
+// //
+//
+// attrs = new HashMap<String, Set<String>>();
+// vals = new HashSet<String>();
+// vals.add("val1");
+// attrs.put("carLicense", vals);
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("phone"));
+// assertEquals(3, persistedAttrs.get("phone").size());
+//
+// assertTrue(persistedAttrs.containsKey("description"));
+// assertEquals(4, persistedAttrs.get("description").size());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(1, persistedAttrs.get("carLicense").size());
+//
+// //
+//
+// vals = new HashSet<String>();
+// vals.add("val2");
+// attrs.put("carLicense", vals);
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(2, persistedAttrs.get("carLicense").size());
+//
+// //
+//
+// store.updateAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(1, persistedAttrs.get("carLicense").size());
+//
+// //
+//
+// Set<String> names = new HashSet<String>();
+// names.add("carLicense");
+// store.removeAttributes(ctx, user1, names);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(2, persistedAttrs.keySet().size());
+//
+// }
+//
+// public void testRelationships() throws Exception
+// {
+// populateClean();
+//
+// commonTest.testRelationships();
+//
+// }
+//
+// public void testStorePersistence() throws Exception
+// {
+// populateClean();
+//
+// commonTest.testStorePersistence();
+//
+// }
+//
+// public void testFindMethods() throws Exception
+// {
+// populateClean();
+//
+// commonTest.testFindMethods();
+//
+// }
+//
+//}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreInvocationContext.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/store/ldap/SimpleLDAPIdentityStoreInvocationContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -1,60 +1,60 @@
-/*
-* 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.impl.store.ldap;
-
-import javax.naming.ldap.LdapContext;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.Context;
-import java.util.Hashtable;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleLDAPIdentityStoreInvocationContext implements LDAPIdentityStoreInvocationContext
-{
-
- LDAPIdentityStoreConfiguration configuration;
-
- public SimpleLDAPIdentityStoreInvocationContext(LDAPIdentityStoreConfiguration configuration)
- {
- this.configuration = configuration;
- }
-
- public LdapContext getLdapContext() throws Exception
- {
- Hashtable<String,String> env = new Hashtable<String,String>();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL, getConfiguration().getProviderURL());
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, getConfiguration().getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS, getConfiguration().getAdminPassword());
-
- return new InitialLdapContext(env, null);
- }
-
- public LDAPIdentityStoreConfiguration getConfiguration()
- {
- return configuration;
- }
-}
+///*
+//* 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.impl.store.ldap;
+//
+//import javax.naming.ldap.LdapContext;
+//import javax.naming.ldap.InitialLdapContext;
+//import javax.naming.Context;
+//import java.util.Hashtable;
+//
+///**
+// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+// * @version : 0.1 $
+// */
+//public class SimpleLDAPIdentityStoreInvocationContext implements LDAPIdentityStoreInvocationContext
+//{
+//
+// LDAPIdentityStoreConfiguration configuration;
+//
+// public SimpleLDAPIdentityStoreInvocationContext(LDAPIdentityStoreConfiguration configuration)
+// {
+// this.configuration = configuration;
+// }
+//
+// public LdapContext getLdapContext() throws Exception
+// {
+// Hashtable<String,String> env = new Hashtable<String,String>();
+// env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+// env.put(Context.PROVIDER_URL, getConfiguration().getProviderURL());
+// env.put(Context.SECURITY_AUTHENTICATION, "simple");
+// env.put(Context.SECURITY_PRINCIPAL, getConfiguration().getAdminDN());
+// env.put(Context.SECURITY_CREDENTIALS, getConfiguration().getAdminPassword());
+//
+// return new InitialLdapContext(env, null);
+// }
+//
+// public LDAPIdentityStoreConfiguration getConfiguration()
+// {
+// return configuration;
+// }
+//}
Modified: trunk/identity-impl/src/test/resources/META-INF/persistence.xml
===================================================================
--- trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-impl/src/test/resources/META-INF/persistence.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -5,7 +5,7 @@
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
- <persistence-unit name="jboss-identity-model" transaction-type="RESOURCE_LOCAL">
+ <persistence-unit name="jboss-identity-model1" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
@@ -19,14 +19,39 @@
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
- <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa"/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa1"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
+
+ <persistence-unit name="jboss-identity-model2" transaction-type="RESOURCE_LOCAL">
+
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObject</class>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectAttribute</class>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType</class>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationship</class>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipType</class>
+ <class>org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipName</class>
+
+
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa2"/>
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ </properties>
+
+
+ </persistence-unit>
</persistence>
\ No newline at end of file
Added: trunk/identity-impl/src/test/resources/identity-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xml (rev 0)
+++ trunk/identity-impl/src/test/resources/identity-config.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--<xs:schema-->
+<!--attributeFormDefault="unqualified"-->
+<!--elementFormDefault="qualified"-->
+<!--xmlns:xs="http://www.w3.org/2001/XMLSchema"-->
+<!--targetNamespace="urn:jboss:identity:config:v0_1"-->
+<!--xmlns="urn:jboss:identity:config:v0_1"-->
+<!--xmlns:xml="http://www.w3.org/XML/1998/namespace"-->
+<!--xmlns:wcc="urn:jboss:identity:config:v0_1"> -->
+
+<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
+ <realms>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ <realm-configuration>
+ <identity-type-mappings>
+ <identity-mapping></identity-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
+ <group-type-mapping>
+ <group-type-name></group-type-name>
+ <identity-object-type-name></identity-object-type-name>
+ </group-type-mapping>
+ </identity-type-mappings>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </realm-configuration>
+ </realm>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ <realm-configuration/>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id></id>
+ <class></class>
+ <repository-configuration>
+ <external-config override="true"></external-config>
+ <default-identity-store-id></default-identity-store-id>
+ <default-attribute-store-id></default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id></identity-store-id>
+ <identity-object-types>
+ <identity-object-type></identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </repository-configuration>
+ </repository>
+ <repository>
+ <id></id>
+ <class></class>
+ <repository-configuration/>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <identity-store-configuration>
+ <external-config override="false"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name></name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name></name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ </identity-store-configuration>
+ </identity-store>
+ <identity-store>
+ <id></id>
+ <class></class>
+ <identity-store-configuration>
+ <external-config override="true"></external-config>
+ <supported-relationship-types>
+ <relationship-type></relationship-type>
+ <relationship-type></relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name></name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping></mapping>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired></isRequired>
+ <isMultivalued></isMultivalued>
+ <isReadOnly></isReadOnly>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name></name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref></relationship-type-ref>
+ <identity-object-type-ref></identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>true</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name></name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name></name>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </option>
+ </options>
+ </identity-store-configuration>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Added: trunk/identity-impl/src/test/resources/identity-config.xsd
===================================================================
--- trunk/identity-impl/src/test/resources/identity-config.xsd (rev 0)
+++ trunk/identity-impl/src/test/resources/identity-config.xsd 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:jboss:identity:config:v0_1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:config:v0_1">
+ <xs:annotation>
+ <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:config:v0_1"xmlns="urn:jboss:identity:config:v0_1"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:config:v0_1"></xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="repositoryType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
+ <xs:element type="urn:repository-configurationType" name="repository-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-store-configurationType">
+ <xs:sequence>
+ <xs:element type="urn:external-configType" name="external-config" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:supported-relationship-typesType" name="supported-relationship-types" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:supported-identity-object-typesType" name="supported-identity-object-types" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element name="options">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="external-configType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute type="xs:string" name="override" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="identity-store-mappingsType">
+ <xs:sequence>
+ <xs:element type="urn:identity-store-mappingType" name="identity-store-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="jboss-identityType">
+ <xs:sequence>
+ <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="optionType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element type="xs:string" name="value" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmsType">
+ <xs:sequence>
+ <xs:element type="urn:realmType" name="realm" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-type-mappingsType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-mapping"/>
+ <xs:element type="urn:group-type-mappingType" name="group-type-mapping" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-storesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-storeType" name="identity-store" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-store-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-store-id"/>
+ <xs:element type="urn:identity-object-typesType" name="identity-object-types" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="attributesType">
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realm-configurationType">
+ <xs:sequence>
+ <xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repository-configurationType">
+ <xs:sequence>
+ <xs:element type="urn:external-configType" name="external-config" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
+ <xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
+ <xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ <xs:element type="urn:optionsType" name="options" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-object-typeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element name="relationships">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="attributes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="options">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="identity-storeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="class"/>
+ <xs:element type="urn:identity-store-configurationType" name="identity-store-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="storesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="attribute-stores"/>
+ <xs:element type="urn:identity-storesType" name="identity-stores" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="supported-identity-object-typesType">
+ <xs:sequence>
+ <xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="group-type-mappingType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="group-type-name"/>
+ <xs:element type="xs:string" name="identity-object-type-name"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="repositoriesType">
+ <xs:sequence>
+ <xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="realmType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="id"/>
+ <xs:element type="xs:string" name="repository-id-ref"/>
+ <xs:element type="urn:realm-configurationType" name="realm-configuration" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipsType">
+ <xs:sequence>
+ <xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="supported-relationship-typesType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="optionsType">
+ <xs:sequence>
+ <xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0" xmlns:urn="urn:jboss:identity:config:v0_1"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="relationshipType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="relationship-type-ref"/>
+ <xs:element type="xs:string" name="identity-object-type-ref"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="attributeType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="name"/>
+ <xs:element type="xs:string" name="mapping"/>
+ <xs:element type="xs:string" name="isRequired"/>
+ <xs:element type="xs:string" name="isMultivalued"/>
+ <xs:element type="xs:string" name="isReadOnly" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
\ No newline at end of file
Added: trunk/identity-impl/src/test/resources/organization-test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/organization-test-config.xml (rev 0)
+++ trunk/identity-impl/src/test/resources/organization-test-config.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,439 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
+ <realms>
+ <realm>
+ <id>realm://RedHat/DB</id>
+ <repository-id-ref>RedHat Repository DB</repository-id-ref>
+ <realm-configuration>
+ <identity-type-mappings>
+ <identity-mapping>IDENTITY</identity-mapping>
+ </identity-type-mappings>
+ </realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB</id>
+ <repository-id-ref>Sample Portal Repository DB</repository-id-ref>
+ <realm-configuration>
+ <identity-type-mappings>
+ <identity-mapping>IDENTITY</identity-mapping>
+ </identity-type-mappings>
+ </realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://RedHat/DB_LDAP</id>
+ <repository-id-ref>RedHat Repository DB+LDAP</repository-id-ref>
+ <realm-configuration>
+ <identity-type-mappings>
+ <identity-mapping>IDENTITY</identity-mapping>
+ </identity-type-mappings>
+ </realm-configuration>
+ </realm>
+ <realm>
+ <id>realm://portal/SamplePortal/DB_LDAP</id>
+ <repository-id-ref>Sample Portal Repository DB+LDAP</repository-id-ref>
+ <realm-configuration>
+ <identity-type-mappings>
+ <identity-mapping>IDENTITY</identity-mapping>
+ </identity-type-mappings>
+ </realm-configuration>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>RedHat Repository DB</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
+ <repository-configuration>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ </repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
+ <repository-configuration>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ </repository-configuration>
+ </repository>
+ <repository>
+ <id>RedHat Repository DB+LDAP</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
+ <repository-configuration>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>PROJECT</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ </repository-configuration>
+ </repository>
+ <repository>
+ <id>Sample Portal Repository DB+LDAP</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
+ <repository-configuration>
+ <external-config/>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>SYSTEM</identity-object-type>
+ <identity-object-type>ADMINISTRATION</identity-object-type>
+ <identity-object-type>COMMUNITY</identity-object-type>
+ <identity-object-type>ORGANIZATION</identity-object-type>
+ <identity-object-type>ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>OFFICE</identity-object-type>
+ <identity-object-type>DIVISION</identity-object-type>
+ <identity-object-type>DEPARTMENT</identity-object-type>
+ <identity-object-type>SECURITY</identity-object-type>
+ <identity-object-type>PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>IDENTITY</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ </repository-configuration>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <identity-store-configuration>
+ <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>IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ORGANIZATION_UNIT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DIVISION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>DEPARTMENT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PROJECT</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>PEOPLE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ADMINISTRATION</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>COMMUNITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>OFFICE</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SECURITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>SYSTEM</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>persistenceUnit</name>
+ <value>jboss-identity-model1</value>
+ </option>
+ <option>
+ <name>populateRelationshipTypes</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>populateIdentityObjectTypes</name>
+ <value>true</value>
+ </option>
+ </options>
+ </identity-store-configuration>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.impl.store.ldap.LDAPIdentityStore</class>
+ <identity-store-configuration>
+ <external-config/>
+ <supported-relationship-types/>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>phone</name>
+ <mapping>telephoneNumber</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ <attribute>
+ <name>carLicense</name>
+ <mapping>carLicense</mapping>
+ <isRequired/>
+ <isMultivalued/>
+ <isReadOnly/>
+ </attribute>
+ </attributes>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>uid</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=inetOrgPerson</value>
+ <value>sn= </value>
+ <value>cn= </value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>ROLE</identity-object-type-ref>
+ </relationship>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>GROUP</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ <identity-object-type>
+ <name>ROLE</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref/>
+ <identity-object-type-ref>IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options>
+ <option>
+ <name>idAttributeName</name>
+ <value>cn</value>
+ </option>
+ <option>
+ <name>ctxDNs</name>
+ <value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
+ </option>
+ <!--<option>-->
+ <!--<name>entrySearchFilter</name>-->
+ <!--<value></value>-->
+ <!--</option>-->
+ <option>
+ <name>allowCreateEntry</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>membershipAttributeName</name>
+ <value>member</value>
+ </option>
+ <option>
+ <name>isMembershipAttributeDN</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>allowEmptyMemberships</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>createEntryAttributeValues</name>
+ <value>objectClass=top</value>
+ <value>objectClass=groupOfNames</value>
+ </option>
+ </options>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options>
+ <option>
+ <name>providerURL</name>
+ <value>ldap://localhost:10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>searchTimeLimit</name>
+ <value>10000</value>
+ </option>
+ </options>
+ </identity-store-configuration>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Added: trunk/identity-impl/src/test/resources/test-config.xml
===================================================================
--- trunk/identity-impl/src/test/resources/test-config.xml (rev 0)
+++ trunk/identity-impl/src/test/resources/test-config.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-identity xmlns="urn:jboss:identity:config:v0_1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:identity:config:v0_1 identity-config.xsd">
+ <realms>
+ <realm>
+ <id></id>
+ <repository-id-ref></repository-id-ref>
+ <realm-configuration>
+ <!--Use direct type mappper when not specified-->
+ <!--<identity-type-mappings>-->
+ <!--<identity-mapping>JBOSS_IDENTITY_IDENTITY</identity-mapping>-->
+ <!--<group-type-mapping>-->
+ <!--<group-type-name>ORGANIZATION</group-type-name>-->
+ <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--<group-type-mapping>-->
+ <!--<group-type-name>ORGANIZATION_UNIT</group-type-name>-->
+ <!--<identity-object-type-name>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type-name>-->
+ <!--</group-type-mapping>-->
+ <!--</identity-type-mappings>-->
+ </realm-configuration>
+ </realm>
+ </realms>
+ <repositories>
+ <repository>
+ <id>Fallback Repository - ACME</id>
+ <class>org.jboss.identity.impl.repository.FallbackIdentityStoreRepository</class>
+ <repository-configuration>
+ <external-config override="false">path/to/file.xml</external-config>
+ <default-identity-store-id>Hibernate Identity Store</default-identity-store-id>
+ <default-attribute-store-id>Hibernate Identity Store</default-attribute-store-id>
+ <identity-store-mappings>
+ <identity-store-mapping>
+ <identity-store-id>Hibernate Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_ORGANIZATION_UNIT</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_DIVISION</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_DEPARTMENT</identity-object-type>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_PROJECT</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ <identity-store-mapping>
+ <identity-store-id>LDAP Identity Store</identity-store-id>
+ <identity-object-types>
+ <identity-object-type>JBOSS_IDENTITY_GROUP_PEOPLE</identity-object-type>
+ </identity-object-types>
+ <options/>
+ </identity-store-mapping>
+ </identity-store-mappings>
+ <!--<option-groups>-->
+ <!--<option-group>-->
+ <!--<name></name>-->
+ <!--<options>-->
+ <!--<option>-->
+ <!--<name></name>-->
+ <!--<values>-->
+ <!--<value></value>-->
+ <!--</values>-->
+ <!--</option>-->
+ <!--</options>-->
+ <!--</option-group>-->
+ <!--</option-groups>-->
+ </repository-configuration>
+ </repository>
+ </repositories>
+ <stores>
+ <attribute-stores/>
+ <identity-stores>
+ <identity-store>
+ <id>Hibernate Identity Store</id>
+ <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <identity-store-configuration>
+ <external-config/>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes/>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+
+ </identity-store-configuration>
+ </identity-store>
+ <identity-store>
+ <id>LDAP Identity Store</id>
+ <class>org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreImpl</class>
+ <identity-store-configuration>
+ <external-config override="false">path/to/file.xml</external-config>
+ <supported-relationship-types>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type>
+ <relationship-type>JBOSS_IDENTITY_RELATIONSHIP_ROLE</relationship-type>
+ </supported-relationship-types>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_IDENTITY</name>
+ <relationships/>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ <identity-object-type>
+ <name>JBOSS_IDENTITY_GROUP_ORGANIZATION</name>
+ <relationships>
+ <relationship>
+ <relationship-type-ref>JBOSS_IDENTITY_RELATIONSHIP_MEMBERSHIP</relationship-type-ref>
+ <identity-object-type-ref>JBOSS_IDENTITY_IDENTITY</identity-object-type-ref>
+ </relationship>
+ </relationships>
+ <attributes>
+ <attribute>
+ <name>user.name.given</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ <attribute>
+ <name>user.name.family</name>
+ <mapping/>
+ <isRequired>false</isRequired>
+ <isMultivalued>true</isMultivalued>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
+ <options/>
+ <!--<options>-->
+ <!--<option>-->
+ <!--<name></name>-->
+ <!--<values>-->
+ <!--<value></value>-->
+ <!--</values>-->
+ <!--</option>-->
+ <!--</options>-->
+ </identity-store-configuration>
+ </identity-store>
+ </identity-stores>
+ </stores>
+</jboss-identity>
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -31,12 +31,22 @@
/**
* @return
*/
+ String getName();
+
+ /**
+ * @return
+ */
+ String getStoreMapping();
+
+ /**
+ * @return
+ */
boolean isReadonly();
/**
* @return
*/
- boolean isMultivalue();
+ boolean isMultivalued();
/**
* @return
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaDataImpl.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaDataImpl.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaDataImpl.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,95 @@
+/*
+* 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.spi.attribute;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class AttributeMetaDataImpl implements AttributeMetaData
+{
+
+ private String name;
+
+ private String storeMapping;
+
+ private boolean readonly;
+
+ private boolean multivalued;
+
+ private boolean required;
+
+ public AttributeMetaDataImpl()
+ {
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getStoreMapping()
+ {
+ return storeMapping;
+ }
+
+ public void setStoreMapping(String storeMapping)
+ {
+ this.storeMapping = storeMapping;
+ }
+
+ public boolean isReadonly()
+ {
+ return readonly;
+ }
+
+ public void setReadonly(boolean readonly)
+ {
+ this.readonly = readonly;
+ }
+
+ public boolean isMultivalued()
+ {
+ return multivalued;
+ }
+
+ public void setMultivalued(boolean multivalued)
+ {
+ this.multivalued = multivalued;
+ }
+
+ public boolean isRequired()
+ {
+ return required;
+ }
+
+ public void setRequired(boolean required)
+ {
+ this.required = required;
+ }
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/ConfigurationService.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -25,33 +25,14 @@
import java.util.Collection;
/**
- *
- * Main entry point to grab configuration information
- *
- * //TODO: Should this be readonly (bootstrapped once) or expose setters also
- *
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
public interface ConfigurationService
{
- /**
- * @return group of global properties
- */
- PropertyGroup getProperties();
- /**
- * @param groupName
- * @return group of properties under given namespace
- */
- PropertyGroup getProperties(String groupName);
- /**
- * @return all property groups
- */
- Collection<PropertyGroup> getPropertyGroups();
-
}
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/PropertyGroup.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -1,41 +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.spi.configuration;
-
-import java.util.Set;
-import java.util.Map;
-
-/**
- * Group of multivalued properties
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface PropertyGroup
-{
-
- Map<String, Set<String>> getProperties();
-
- Set<String> getPropertyValues(String name);
-
-}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityConfigurationMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,41 @@
+/*
+* 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.spi.configuration.metadata;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityConfigurationMetaData
+{
+ List<RealmConfigurationMetaData> getRealms();
+
+ List<IdentityRepositoryConfigurationMetaData> getRepositories();
+
+ List<IdentityStoreConfigurationMetaData> getIdentityStores();
+
+ Map<String, List<String>> getOptions();
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityObjectTypeMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,47 @@
+/*
+* 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.spi.configuration.metadata;
+
+import org.jboss.identity.spi.attribute.AttributeMetaData;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityObjectTypeMetaData
+{
+ String getName();
+
+ List<RelationshipMetaData> getRelationships();
+
+ List<AttributeMetaData> getAttributes();
+
+ Map<String, List<String>> getOptions();
+
+ List<String> getOption(String optionName);
+
+ String getOptionSingleValue(String optionName);
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityRepositoryConfigurationMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,51 @@
+/*
+* 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.spi.configuration.metadata;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityRepositoryConfigurationMetaData
+{
+ String getId();
+
+ String getClassName();
+
+ String getExternalConfig();
+
+ String getDefaultIdentityStoreId();
+
+ String getDefaultAttributeStroeId();
+
+ List<IdentityStoreMappingMetaData> getIdentityStoreToIdentityObjectTypeMappings();
+
+ Map<String, List<String>> getOptions();
+
+ List<String> getOption(String optionName);
+
+ String getOptionSingleValue(String optionName);
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreConfigurationMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,49 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.configuration.metadata;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreConfigurationMetaData
+{
+ String getId();
+
+ String getClassName();
+
+ String getExternalConfig();
+
+ List<String> getSupportedRelationshipTypes();
+
+ List<IdentityObjectTypeMetaData> getSupportedIdentityTypes();
+
+ Map<String, List<String>> getOptions();
+
+ List<String> getOption(String optionName);
+
+ String getOptionSingleValue(String optionName);
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/IdentityStoreMappingMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,43 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.configuration.metadata;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreMappingMetaData
+{
+ String getIdentityStoreId();
+
+ List<String> getIdentityObjectTypeMappings();
+
+ Map<String, List<String>> getOptions();
+
+ List<String> getOption(String optionName);
+
+ String getOptionSingleValue(String optionName);
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RealmConfigurationMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,43 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.configuration.metadata;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RealmConfigurationMetaData
+{
+ String getId();
+
+ String getIdentityRepositoryIdRef();
+
+ String getIdentityMapping();
+
+ Map<String, String> getGroupTypeMappings();
+
+ Map<String, List<String>> getOptions();
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/configuration/metadata/RelationshipMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,34 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.configuration.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RelationshipMetaData
+{
+ String getRelationshipTypeRef();
+
+ String getIdentityObjectTypeRef();
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/exception/IdentityConfigurationException.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/exception/IdentityConfigurationException.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/exception/IdentityConfigurationException.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,52 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.exception;
+
+import org.jboss.identity.exception.IdentityException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityConfigurationException extends IdentityException
+{
+ public IdentityConfigurationException()
+ {
+ super();
+ }
+
+ public IdentityConfigurationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public IdentityConfigurationException(String msg)
+ {
+ super(msg);
+ }
+
+ public IdentityConfigurationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/repository/IdentityStoreRepository.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/repository/IdentityStoreRepository.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/repository/IdentityStoreRepository.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -23,12 +23,12 @@
import java.util.Map;
import java.util.Set;
-import java.util.List;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.AttributeStore;
-import org.jboss.identity.spi.policy.RelationshipPolicy;
+import org.jboss.identity.spi.configuration.metadata.IdentityRepositoryConfigurationMetaData;
+import org.jboss.identity.exception.IdentityException;
/**
* IdentityStoreRepository exposes identity object management
@@ -43,6 +43,11 @@
*/
public interface IdentityStoreRepository extends IdentityStore
{
+
+ public void bootstrap(IdentityRepositoryConfigurationMetaData configurationMD,
+ Map<String, IdentityStore> bootstrappedIdentityStores,
+ Map<String, AttributeStore> bootstrappedAttributeStores) throws IdentityException;
+
/**
* @return a set of configured identity stores
*/
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/AttributeStore.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -36,9 +36,14 @@
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
*/
-public interface AttributeStore
+public interface AttributeStore extends IdentityStoreSessionFactory
{
+ /**
+ * @return id of this identity store
+ */
+ String getId();
+
//TODO: replace Set<String> with String[] in method signatures
/**
@@ -50,6 +55,8 @@
<T extends IdentityObjectType> Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext invocationContext, T identityType)
throws IdentityException;
+ //TODO: isNotConfiguredAttributeSupported - if store can handle attribute not mentioned in method above
+
/**
* Get attributes for the given identity
*
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -37,6 +37,9 @@
*/
public interface FeaturesMetaData
{
+
+ //TODO: change supported operations to isControlSupported(IdentitySearchControl)
+
/**
* Get the supported operations
* @param identityObjectType a type representing identity, role, group
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -31,6 +31,7 @@
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
+import org.jboss.identity.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
import org.jboss.identity.exception.IdentityException;
/**
@@ -42,10 +43,14 @@
*/
public interface IdentityStore extends AttributeStore
{
+
/**
* Set up the store
+ *
+ * @param configurationMD
+ * @throws IOException
*/
- void bootstrap() throws IOException;
+ void bootstrap(IdentityStoreConfigurationMetaData configurationMD) throws IdentityException;
/**
* @return id of this identity store
@@ -72,6 +77,10 @@
*/
IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException;
+
+ //TODO: create method with a set of attributes (for required attrs)
+
+
/**
* Remove given identity
*
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreInvocationContext.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreInvocationContext.java 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreInvocationContext.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -31,4 +31,9 @@
*/
public interface IdentityStoreInvocationContext
{
+
+ IdentityStoreSession getIdentityStoreSession();
+
+ String getRealmId();
+
}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSession.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,87 @@
+/*
+* 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.spi.store;
+
+import org.jboss.identity.exception.IdentityException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreSession
+{
+
+ /**
+ * Session Context
+ * @return
+ */
+ Object getSessionContext() throws IdentityException;
+
+ /**
+ * Close this session
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ void close() throws IdentityException;
+
+ /**
+ * Save all pending changes
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ void save() throws IdentityException;
+
+ /**
+ * Clear this session
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ void clear() throws IdentityException;
+
+ /**
+ * Check if this session is open
+ * @return
+ */
+ boolean isOpen();
+
+
+ boolean isTransactionSupported();
+
+ /**
+ * Begin new transaction
+ */
+ void startTransaction();
+
+ /**
+ * Commit transaction - flush associated session
+ */
+ void commitTransaction();
+
+ /**
+ * Rollback transaction
+ */
+ void rollbackTransaction();
+
+ /**
+ *
+ * @return
+ */
+ boolean isTransactionActive();
+}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSessionFactory.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSessionFactory.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStoreSessionFactory.java 2008-11-06 23:36:08 UTC (rev 120)
@@ -0,0 +1,39 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.spi.store;
+
+import org.jboss.identity.exception.IdentityException;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface IdentityStoreSessionFactory
+{
+
+ /**
+ * @return
+ */
+ IdentityStoreSession createIdentityStoreSession() throws IdentityException;
+
+}
Modified: trunk/parent/pom.xml
===================================================================
--- trunk/parent/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
+++ trunk/parent/pom.xml 2008-11-06 23:36:08 UTC (rev 120)
@@ -45,7 +45,7 @@
<disableXmlReport>false</disableXmlReport>
<testFailureIgnore>false</testFailureIgnore>
<includes>
- <include>**/*TestCase.java</include>
+ <include>**/APITestCase.java</include>
</includes>
<forkMode>pertest</forkMode>
<argLine>${surefire.jvm.args}</argLine>
15 years, 6 months
JBoss Identity SVN: r119 - in identity-federation/trunk: identity-bindings and 12 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-11-03 22:45:19 -0500 (Mon, 03 Nov 2008)
New Revision: 119
Added:
identity-federation/trunk/identity-samples/
identity-federation/trunk/identity-samples/employee/
identity-federation/trunk/identity-samples/employee/pom.xml
identity-federation/trunk/identity-samples/employee/resources/
identity-federation/trunk/identity-samples/employee/resources/META-INF/
identity-federation/trunk/identity-samples/employee/resources/WEB-INF/
identity-federation/trunk/identity-samples/employee/resources/WEB-INF/web.xml
identity-federation/trunk/identity-samples/employee/resources/error.jsp
identity-federation/trunk/identity-samples/employee/resources/index.jsp
identity-federation/trunk/identity-samples/employee/resources/login.jsp
identity-federation/trunk/identity-samples/pom.xml
identity-federation/trunk/identity-samples/sales/
identity-federation/trunk/identity-samples/sales/pom.xml
identity-federation/trunk/identity-samples/sales/resources/
identity-federation/trunk/identity-samples/sales/resources/META-INF/
identity-federation/trunk/identity-samples/sales/resources/WEB-INF/
identity-federation/trunk/identity-samples/sales/resources/WEB-INF/web.xml
identity-federation/trunk/identity-samples/sales/resources/error.jsp
identity-federation/trunk/identity-samples/sales/resources/index.jsp
identity-federation/trunk/identity-samples/sales/resources/login.jsp
identity-federation/trunk/identity-samples/sales/resources/samples/
identity-federation/trunk/identity-samples/sales/resources/samples/sales/
identity-federation/trunk/identity-samples/sales/resources/samples/sales/META-INF/
identity-federation/trunk/identity-samples/sales/resources/samples/sales/WEB-INF/
Modified:
identity-federation/trunk/identity-bindings/.classpath
identity-federation/trunk/identity-bindings/pom.xml
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java
identity-federation/trunk/parent/pom.xml
identity-federation/trunk/pom.xml
Log:
identity fed samples
Modified: identity-federation/trunk/identity-bindings/.classpath
===================================================================
--- identity-federation/trunk/identity-bindings/.classpath 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/identity-bindings/.classpath 2008-11-04 03:45:19 UTC (rev 119)
@@ -11,5 +11,6 @@
<classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-coyote/5.5.12/tomcat-coyote-5.5.12.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
<classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-http/5.5.12/tomcat-http-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/naming-resources/5.5.12/naming-resources-5.5.12.jar"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: identity-federation/trunk/identity-bindings/pom.xml
===================================================================
--- identity-federation/trunk/identity-bindings/pom.xml 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/identity-bindings/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -21,11 +21,6 @@
<name>JBoss Inc.</name>
<url>http://www.jboss.org</url>
</organization>
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/identity-federation/...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/identity-federation/trunk</developerConnection>
- <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/identity-federat...</url>
- </scm>
<build>
<plugins>
<plugin>
@@ -74,6 +69,12 @@
</dependency>
<dependency>
<groupId>apache-tomcat</groupId>
+ <artifactId>naming-resources</artifactId>
+ <version>5.5.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
<artifactId>tomcat-http</artifactId>
<version>5.5.12</version>
<scope>test</scope>
Modified: identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java 2008-11-04 03:45:19 UTC (rev 119)
@@ -39,6 +39,10 @@
emb.startServer();
Thread.sleep(2000);
assertTrue("Tomcat5 started", emb.hasStarted());
+
+ // emb.createContext("target/../identity-samples/samples/employee/target/employee.war");
+
+
emb.stopServer();
Thread.sleep(1000);
assertTrue(emb.hasStopped());
Modified: identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java 2008-11-04 03:45:19 UTC (rev 119)
@@ -23,6 +23,7 @@
import java.net.InetAddress;
+import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleEvent;
@@ -49,15 +50,23 @@
{
this.homePath = path;
}
-
+
+ public void createContext(String contextPath)
+ {
+ Context context = embedded.createContext(homePath, contextPath);
+ context.setPrivileged(true);
+ host.addChild(context);
+ }
+
public void startServer() throws Exception
{
if(this.homePath == null)
throw new IllegalStateException("Catalina path not set");
-
- //System.setProperty("catalina.home", this.homePath);
+
embedded = new Embedded();
embedded.setCatalinaHome(homePath);
+
+ //Create an Engine
Engine engine = embedded.createEngine();
engine.setDefaultHost("localhost");
@@ -66,7 +75,7 @@
+ "/webapps");
engine.addChild(this.host);
-
+ //Add the engine
embedded.addEngine(engine);
/*
Added: identity-federation/trunk/identity-samples/employee/pom.xml
===================================================================
--- identity-federation/trunk/identity-samples/employee/pom.xml (rev 0)
+++ identity-federation/trunk/identity-samples/employee/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.identity.federation</groupId>
+ <artifactId>jboss-identity-samples-employee</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>JBoss Identity Federation Samples Employee</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <warName>employee</warName>
+ <webappDirectory>${basedir}/resources/</webappDirectory>
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
Added: identity-federation/trunk/identity-samples/employee/resources/WEB-INF/web.xml
===================================================================
--- identity-federation/trunk/identity-samples/employee/resources/WEB-INF/web.xml (rev 0)
+++ identity-federation/trunk/identity-samples/employee/resources/WEB-INF/web.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <description>Employee Application</description>
+
+ <security-constraint>
+ <display-name>Restricted</display-name>
+ <web-resource-collection>
+ <web-resource-name>Restricted Access</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Employee</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-role>
+ <role-name>Employee</role-name>
+ </security-role>
+
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/error.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+</web-app>
Added: identity-federation/trunk/identity-samples/employee/resources/error.jsp
===================================================================
--- identity-federation/trunk/identity-samples/employee/resources/error.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/employee/resources/error.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,12 @@
+<html> <head> <title>Error!</title></head>
+<body>
+
+<font size='4' color='red'>
+ The username and password you supplied are not valid.
+</p>
+Click <a href='<%= response.encodeURL("login.jsp") %>'>here</a>
+to retry login
+
+</body>
+</form>
+</html>
Added: identity-federation/trunk/identity-samples/employee/resources/index.jsp
===================================================================
--- identity-federation/trunk/identity-samples/employee/resources/index.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/employee/resources/index.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1 @@
+Welcome to Employee Page.
Added: identity-federation/trunk/identity-samples/employee/resources/login.jsp
===================================================================
--- identity-federation/trunk/identity-samples/employee/resources/login.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/employee/resources/login.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,16 @@
+<html><head><title>Login Page</title></head>
+<body>
+<font size='5' color='blue'>Please Login</font><hr>
+
+<form action='j_security_check' method='post'>
+<table>
+ <tr><td>Name:</td>
+ <td><input type='text' name='j_username'></td></tr>
+ <tr><td>Password:</td>
+ <td><input type='password' name='j_password' size='8'></td>
+ </tr>
+</table>
+<br>
+ <input type='submit' value='login'>
+</form></body>
+ </html>
Added: identity-federation/trunk/identity-samples/pom.xml
===================================================================
--- identity-federation/trunk/identity-samples/pom.xml (rev 0)
+++ identity-federation/trunk/identity-samples/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-fed-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-identity-samples</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Identity Federation Samples</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <modules>
+ <module>sales</module>
+ <module>employee</module>
+ </modules>
+</project>
Added: identity-federation/trunk/identity-samples/sales/pom.xml
===================================================================
--- identity-federation/trunk/identity-samples/sales/pom.xml (rev 0)
+++ identity-federation/trunk/identity-samples/sales/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.identity.federation</groupId>
+ <artifactId>jboss-identity-samples-sales</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>JBoss Identity Federation Samples - Sales</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <warName>sales</warName>
+ <webappDirectory>${basedir}/resources/</webappDirectory>
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
Added: identity-federation/trunk/identity-samples/sales/resources/WEB-INF/web.xml
===================================================================
--- identity-federation/trunk/identity-samples/sales/resources/WEB-INF/web.xml (rev 0)
+++ identity-federation/trunk/identity-samples/sales/resources/WEB-INF/web.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <description>Sales Application</description>
+
+ <security-constraint>
+ <display-name>Restricted</display-name>
+ <web-resource-collection>
+ <web-resource-name>Restricted Access</web-resource-name>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>Sales</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <security-role>
+ <role-name>Sales</role-name>
+ </security-role>
+
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/error.jsp</form-error-page>
+ </form-login-config>
+ </login-config>
+</web-app>
Added: identity-federation/trunk/identity-samples/sales/resources/error.jsp
===================================================================
--- identity-federation/trunk/identity-samples/sales/resources/error.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/sales/resources/error.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,12 @@
+<html> <head> <title>Error!</title></head>
+<body>
+
+<font size='4' color='red'>
+ The username and password you supplied are not valid.
+</p>
+Click <a href='<%= response.encodeURL("login.jsp") %>'>here</a>
+to retry login
+
+</body>
+</form>
+</html>
Added: identity-federation/trunk/identity-samples/sales/resources/index.jsp
===================================================================
--- identity-federation/trunk/identity-samples/sales/resources/index.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/sales/resources/index.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1 @@
+Welcome to SALES Page.
Added: identity-federation/trunk/identity-samples/sales/resources/login.jsp
===================================================================
--- identity-federation/trunk/identity-samples/sales/resources/login.jsp (rev 0)
+++ identity-federation/trunk/identity-samples/sales/resources/login.jsp 2008-11-04 03:45:19 UTC (rev 119)
@@ -0,0 +1,16 @@
+<html><head><title>Login Page</title></head>
+<body>
+<font size='5' color='blue'>Please Login</font><hr>
+
+<form action='j_security_check' method='post'>
+<table>
+ <tr><td>Name:</td>
+ <td><input type='text' name='j_username'></td></tr>
+ <tr><td>Password:</td>
+ <td><input type='password' name='j_password' size='8'></td>
+ </tr>
+</table>
+<br>
+ <input type='submit' value='login'>
+</form></body>
+ </html>
Modified: identity-federation/trunk/parent/pom.xml
===================================================================
--- identity-federation/trunk/parent/pom.xml 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/parent/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -85,6 +85,11 @@
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
Modified: identity-federation/trunk/pom.xml
===================================================================
--- identity-federation/trunk/pom.xml 2008-11-02 06:03:20 UTC (rev 118)
+++ identity-federation/trunk/pom.xml 2008-11-04 03:45:19 UTC (rev 119)
@@ -16,6 +16,8 @@
<modules>
<module>parent</module>
<module>identity-opensaml</module>
+ <module>identity-samples</module>
+ <module>identity-bindings</module>
<module>assembly</module>
</modules>
</project>
15 years, 6 months
JBoss Identity SVN: r118 - in identity-federation/trunk: identity-bindings and 16 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-11-02 01:03:20 -0500 (Sun, 02 Nov 2008)
New Revision: 118
Added:
identity-federation/trunk/identity-bindings/
identity-federation/trunk/identity-bindings/.classpath
identity-federation/trunk/identity-bindings/.project
identity-federation/trunk/identity-bindings/pom.xml
identity-federation/trunk/identity-bindings/src/
identity-federation/trunk/identity-bindings/src/main/
identity-federation/trunk/identity-bindings/src/main/java/
identity-federation/trunk/identity-bindings/src/main/java/org/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/
identity-federation/trunk/identity-bindings/src/main/resources/
identity-federation/trunk/identity-bindings/src/test/
identity-federation/trunk/identity-bindings/src/test/java/
identity-federation/trunk/identity-bindings/src/test/java/org/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/
identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java
identity-federation/trunk/identity-bindings/src/test/resources/
Log:
JBID-32: embedded tomcat
Added: identity-federation/trunk/identity-bindings/.classpath
===================================================================
--- identity-federation/trunk/identity-bindings/.classpath (rev 0)
+++ identity-federation/trunk/identity-bindings/.classpath 2008-11-02 06:03:20 UTC (rev 118)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/catalina/5.5.12/catalina-5.5.12.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-util/5.5.12/tomcat-util-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-modeler/commons-modeler/1.1patch/commons-modeler-1.1patch.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-coyote/5.5.12/tomcat-coyote-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-http/5.5.12/tomcat-http-5.5.12.jar"/>
+ <classpathentry kind="output" path="target/eclipse-classes"/>
+</classpath>
Added: identity-federation/trunk/identity-bindings/.project
===================================================================
--- identity-federation/trunk/identity-bindings/.project (rev 0)
+++ identity-federation/trunk/identity-bindings/.project 2008-11-02 06:03:20 UTC (rev 118)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>identity-bindings</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: identity-federation/trunk/identity-bindings/pom.xml
===================================================================
--- identity-federation/trunk/identity-bindings/pom.xml (rev 0)
+++ identity-federation/trunk/identity-bindings/pom.xml 2008-11-02 06:03:20 UTC (rev 118)
@@ -0,0 +1,99 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-fed-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-identity-bindings</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity Federation Server Bindings</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</description>
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+ </license>
+ </licenses>
+ <organization>
+ <name>JBoss Inc.</name>
+ <url>http://www.jboss.org</url>
+ </organization>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossidentity/identity-federation/...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/jbossidentity/identity-federation/trunk</developerConnection>
+ <url>http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossidentity/identity-federat...</url>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <printSummary>true</printSummary>
+ <disableXmlReport>false</disableXmlReport>
+ <testFailureIgnore>false</testFailureIgnore>
+ <includes>
+ <include>**/**TestCase.java</include>
+ </includes>
+ <forkMode>pertest</forkMode>
+ <argLine>-Djava.endorsed.dirs=${basedir}/src/test/resources/endorsed</argLine>
+ <useFile>false</useFile>
+ <trimStackTrace>false</trimStackTrace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>5.5.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>tomcat-coyote</artifactId>
+ <version>5.5.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>tomcat-util</artifactId>
+ <version>5.5.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-tomcat</groupId>
+ <artifactId>tomcat-http</artifactId>
+ <version>5.5.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>1.0.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>apache-modeler</groupId>
+ <artifactId>commons-modeler</artifactId>
+ <version>1.1patch</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java (rev 0)
+++ identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/bindings/Tomcat5TestCase.java 2008-11-02 06:03:20 UTC (rev 118)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.tomcat.bindings;
+
+import org.jboss.test.tomcat.helpers.Tomcat5Embedded;
+
+import junit.framework.TestCase;
+
+/**
+ * Tomcat5 Embedded
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Nov 1, 2008
+ */
+public class Tomcat5TestCase extends TestCase
+{
+ public void testTomcat5() throws Exception
+ {
+ Tomcat5Embedded emb = new Tomcat5Embedded();
+ emb.setHomePath("target/tomcat");
+ emb.startServer();
+ Thread.sleep(2000);
+ assertTrue("Tomcat5 started", emb.hasStarted());
+ emb.stopServer();
+ Thread.sleep(1000);
+ assertTrue(emb.hasStopped());
+ }
+}
\ No newline at end of file
Added: identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java (rev 0)
+++ identity-federation/trunk/identity-bindings/src/test/java/org/jboss/test/tomcat/helpers/Tomcat5Embedded.java 2008-11-02 06:03:20 UTC (rev 118)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.tomcat.helpers;
+
+import java.net.InetAddress;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.startup.Embedded;
+import org.apache.tomcat.util.IntrospectionUtils;
+
+/**
+ * Embedded Tomcat Service
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Nov 1, 2008
+ */
+public class Tomcat5Embedded
+{
+ Embedded embedded = null;
+ Host host;
+
+ String homePath = null;
+
+ StartStopLifeCycleListener listener = new StartStopLifeCycleListener();
+
+ public void setHomePath( String path)
+ {
+ this.homePath = path;
+ }
+
+ public void startServer() throws Exception
+ {
+ if(this.homePath == null)
+ throw new IllegalStateException("Catalina path not set");
+
+ //System.setProperty("catalina.home", this.homePath);
+ embedded = new Embedded();
+ embedded.setCatalinaHome(homePath);
+ Engine engine = embedded.createEngine();
+ engine.setDefaultHost("localhost");
+
+ // Create a default virtual host
+ this.host = this.embedded.createHost("localhost", this.homePath
+ + "/webapps");
+ engine.addChild(this.host);
+
+
+ embedded.addEngine(engine);
+
+ /*
+ * embedded.createConnector(...)
+ * seems to be broken.. it always returns a null connector.
+ * see work around below
+ */
+ InetAddress address = null;
+ Connector connector = null;
+ try
+ {
+ connector = new Connector();
+ connector.setScheme("http");
+ connector.setSecure(false);
+ address = InetAddress.getLocalHost();
+ if (address != null)
+ {
+ IntrospectionUtils.setProperty(connector, "address", ""
+ + address);
+ }
+ IntrospectionUtils.setProperty(connector, "port", "" + 8080);
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ connector.setEnableLookups(false);
+
+ embedded.addConnector(connector);
+ embedded.addLifecycleListener(listener);
+ // Start the embedded server
+ embedded.start();
+ }
+
+ public boolean hasStarted()
+ {
+ return this.listener.isStarted();
+ }
+
+ public boolean hasStopped()
+ {
+ return this.listener.hasStopped();
+ }
+
+ public void stopServer() throws Exception
+ {
+ embedded.stop();
+ }
+
+ class StartStopLifeCycleListener implements LifecycleListener
+ {
+ private boolean started = false;
+ private boolean stopped = true;
+
+ public void lifecycleEvent(LifecycleEvent lifecycleEvent)
+ {
+ if(lifecycleEvent.getType().equals("start"))
+ {
+ started = true;
+ stopped = false;
+ }
+ else
+ if(lifecycleEvent.getType().equals("stop"))
+ {
+ started = false;
+ stopped = true;
+ }
+ }
+
+ public boolean isStarted()
+ {
+ return started;
+ }
+
+ public boolean hasStopped()
+ {
+ return stopped;
+ }
+ }
+}
\ No newline at end of file
15 years, 6 months