svn commit: r700404 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/ co...

View: New views
1 Messages — Rating Filter:   Alert me  

svn commit: r700404 - in /portals/jetspeed-2/portal/branches/security-refactoring: components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/ co...

by ddam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Author: ddam
Date: Tue Sep 30 03:16:45 2008
New Revision: 700404

URL: http://svn.apache.org/viewvc?rev=700404&view=rev
Log:
Preparation for LDAP replication: add Entity Factory implementation, which can be obtained via a SecurityEntityManager
- create default entity factory for each EntityDAO in constructor
- create default LDAP context mapper for each EntityDAO in the constructor (was set in the get method before)
- adjust LDAP spring configuration: set DAO Configuration via constructor instead of property, since a DAO can't function without it's configuration
- adjust test cases accordingly

Added:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java   (with props)
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java   (with props)
Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/AbstractSetup1LDAPTest.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/AbstractSetup2LDAPTest.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/stubs/StubEntityDAO.java
    portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java?rev=700404&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java Tue Sep 30 03:16:45 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mapping;
+
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.mapping.model.Entity;
+import org.springframework.ldap.core.DirContextOperations;
+
+
+/**
+ * @author <a href="mailto:ddam@...">Dennis Dam</a>
+ * @version $Id$
+ */
+
+public interface EntityFactory
+{
+
+    Entity createEntity(JetspeedPrincipal principal);
+
+    Entity createEntity(DirContextOperations ctx);
+    
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java Tue Sep 30 03:16:45 2008
@@ -45,4 +45,6 @@
 
     void addRelatedEntity(Entity entity, Entity relatedEntity, SecurityEntityRelationType relationType);
 
+    EntityFactory getEntityFactory(String entityType);
+    
 }

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java?rev=700404&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java Tue Sep 30 03:16:45 2008
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.mapping.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.SecurityAttribute;
+import org.apache.jetspeed.security.SecurityAttributes;
+import org.apache.jetspeed.security.mapping.EntityFactory;
+import org.apache.jetspeed.security.mapping.ldap.dao.LDAPEntityDAOConfiguration;
+import org.apache.jetspeed.security.mapping.model.Attribute;
+import org.apache.jetspeed.security.mapping.model.AttributeDef;
+import org.apache.jetspeed.security.mapping.model.Entity;
+import org.apache.jetspeed.security.mapping.model.impl.AttributeImpl;
+import org.apache.jetspeed.security.mapping.model.impl.EntityImpl;
+import org.springframework.ldap.core.DirContextOperations;
+
+
+/**
+ * @author <a href="mailto:ddam@...">Dennis Dam</a>
+ * @version $Id$
+ */
+
+public class EntityFactoryImpl implements EntityFactory
+{
+
+    LDAPEntityDAOConfiguration searchConfiguration;
+
+    public EntityFactoryImpl(
+            LDAPEntityDAOConfiguration searchConfiguration)
+    {
+        this.searchConfiguration = searchConfiguration;
+    }
+
+    private EntityImpl internalCreateEntity(String entityId, String internalId, Set<Attribute> attributes){
+        if (entityId != null)
+        {
+            EntityImpl entity = new EntityImpl(searchConfiguration
+                    .getEntityType(), entityId, searchConfiguration
+                    .getAttributeDefinitions());
+            entity.setAttributes(attributes);
+            if (internalId != null){
+                entity.setInternalId(internalId);
+            }
+            entity.setType(searchConfiguration.getEntityType());
+            return entity;
+        } else
+        {
+            return null;
+        }
+    }
+    
+    public Entity createEntity(JetspeedPrincipal principal)
+    {
+        Set<Attribute> ldapAttrValues = new HashSet<Attribute>();
+        SecurityAttributes sas = principal.getSecurityAttributes();
+        for (AttributeDef attrDef : searchConfiguration
+                .getAttributeDefinitions())
+        {
+            SecurityAttribute sa = sas.getAttribute(attrDef.getMappedName());
+            if (sa!=null){
+                // currently only single-valued attributes are supported
+                ldapAttrValues.add(new AttributeImpl(attrDef));
+            }
+        }
+        return internalCreateEntity(principal.getName(),null,ldapAttrValues);
+    }
+
+    public Entity createEntity(DirContextOperations ctx)
+    {
+        String entityId = null;
+        Set<Attribute> attributes = new HashSet<Attribute>();
+        for (AttributeDef attrDef : searchConfiguration
+                .getAttributeDefinitions())
+        {
+
+            String[] values = ctx.getStringAttributes(attrDef.getName());
+            if (values != null && values.length > 0)
+            {
+                Attribute a = new AttributeImpl(attrDef);
+                if (attrDef.isMultiValue())
+                {
+                    Collection<String> attrValues = new ArrayList<String>();
+                    attrValues.addAll(Arrays.asList(values));
+                    a.setValues(attrValues);
+                } else
+                {
+                    if (attrDef.getName().equals(
+                            searchConfiguration.getLdapIdAttribute()))
+                    {
+                        entityId = values[0];
+                    }
+                    a.setValue(values[0]);
+                }
+                attributes.add(a);
+            }
+        }
+        return internalCreateEntity(entityId, ctx.getNameInNamespace().toString(), attributes);
+    }
+
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/EntityFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java Tue Sep 30 03:16:45 2008
@@ -16,20 +16,10 @@
  */
 package org.apache.jetspeed.security.mapping.ldap.dao;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
+import org.apache.jetspeed.security.mapping.EntityFactory;
 import org.springframework.ldap.core.DirContextOperations;
 import org.springframework.ldap.core.support.AbstractContextMapper;
 
-import org.apache.jetspeed.security.mapping.model.Attribute;
-import org.apache.jetspeed.security.mapping.model.AttributeDef;
-import org.apache.jetspeed.security.mapping.model.impl.AttributeImpl;
-import org.apache.jetspeed.security.mapping.model.impl.EntityImpl;
-
 /**
  * @author <a href="mailto:ddam@...">Dennis Dam</a>
  * @version $Id$
@@ -37,63 +27,16 @@
 public class DefaultEntityContextMapper extends AbstractContextMapper
 {
 
-    LDAPEntityDAOConfiguration searchConfiguration;
+    EntityFactory entityFactory;
 
-    public DefaultEntityContextMapper(
-            LDAPEntityDAOConfiguration searchConfiguration)
+    public DefaultEntityContextMapper(EntityFactory entityFactory)
     {
-        this.searchConfiguration = searchConfiguration;
+        this.entityFactory = entityFactory;
     }
 
     public Object doMapFromContext(DirContextOperations ctx)
     {
-        String entityId = null;
-        Set<Attribute> attributes = new HashSet<Attribute>();
-        for (AttributeDef attrDef : searchConfiguration
-                .getAttributeDefinitions())
-        {
-
-            String[] values = ctx.getStringAttributes(attrDef.getName());
-            if (values != null && values.length > 0)
-            {
-                Attribute a = new AttributeImpl(attrDef);
-                if (attrDef.isMultiValue())
-                {
-                    Collection attrValues = new ArrayList();
-                    attrValues.addAll(Arrays.asList(values));
-                    a.setValues(attrValues);
-                } else
-                {
-                    if (attrDef.getName().equals(
-                            searchConfiguration.getLdapIdAttribute()))
-                    {
-                        entityId = values[0];
-                    }
-                    a.setValue(values[0]);
-                }
-                attributes.add(a);
-            }
-        }
-        if (entityId != null)
-        {
-            EntityImpl entity = new EntityImpl(searchConfiguration
-                    .getEntityType(), entityId, searchConfiguration
-                    .getAttributeDefinitions());
-            entity.setAttributes(attributes);
-            entity.setInternalId(ctx.getNameInNamespace().toString()); // set
-                                                                       // full
-                                                                       // DN
-                                                                       // (incl.
-                                                                       // base
-                                                                       // DN) as
-                                                                       // internal
-                                                                       // ID
-            entity.setType(searchConfiguration.getEntityType());
-            return entity;
-        } else
-        {
-            return null;
-        }
+        return entityFactory.createEntity(ctx);
     }
 
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java Tue Sep 30 03:16:45 2008
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.jetspeed.security.mapping.EntityFactory;
 import org.apache.jetspeed.security.mapping.SecurityEntityManager;
 import org.apache.jetspeed.security.mapping.SecurityEntityRelationType;
 import org.apache.jetspeed.security.mapping.impl.SecurityEntityRelationTypeImpl;
@@ -164,5 +165,14 @@
             this.entityRelationDAOs.put( dao.getRelationType(), dao);
         }
     }
+
+    public EntityFactory getEntityFactory(String entityType)
+    {
+        EntityDAO dao = entityDAOs.get(entityType);
+        
+        return dao != null ? dao.getEntityFactory() : null;
+    }
+    
+    
     
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java Tue Sep 30 03:16:45 2008
@@ -18,9 +18,9 @@
 
 import java.util.Collection;
 
-import org.springframework.ldap.filter.Filter;
-
+import org.apache.jetspeed.security.mapping.EntityFactory;
 import org.apache.jetspeed.security.mapping.model.Entity;
+import org.springframework.ldap.filter.Filter;
 
 /**
  * @author <a href="mailto:ddam@...">Dennis Dam</a>
@@ -78,5 +78,7 @@
     void addEntity(Entity entity);
 
     void removeEntity(Entity entity);
+    
+    EntityFactory getEntityFactory();
 
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java Tue Sep 30 03:16:45 2008
@@ -23,6 +23,8 @@
 import javax.naming.directory.SearchControls;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.security.mapping.EntityFactory;
+import org.apache.jetspeed.security.mapping.impl.EntityFactoryImpl;
 import org.apache.jetspeed.security.mapping.ldap.dao.DefaultEntityContextMapper;
 import org.apache.jetspeed.security.mapping.ldap.dao.EntityDAO;
 import org.apache.jetspeed.security.mapping.ldap.dao.LDAPEntityDAOConfiguration;
@@ -45,6 +47,16 @@
     protected LdapTemplate ldapTemplate;
     protected LDAPEntityDAOConfiguration configuration;
     private ContextMapper contextMapper;
+    private EntityFactory entityFactory;
+
+    
+    public SpringLDAPEntityDAO(LDAPEntityDAOConfiguration configuration)
+    {
+        super();
+        this.configuration = configuration;
+        this.entityFactory = new EntityFactoryImpl(configuration);
+        this.contextMapper = new DefaultEntityContextMapper(entityFactory);
+    }
 
     public void initialize(LdapTemplate ldapTemplate)
     {
@@ -148,11 +160,6 @@
         return configuration;
     }
 
-    public void setConfiguration(LDAPEntityDAOConfiguration configuration)
-    {
-        this.configuration = configuration;
-    }
-
     protected Filter createFilterForIdSearch(String entityId)
     {
         return SearchUtil.constructMatchingFieldsFilter(configuration.getBaseFilter(), new String[] { configuration.getLdapIdAttribute(), entityId });
@@ -160,13 +167,14 @@
 
     public ContextMapper getContextMapper()
     {
-        if (contextMapper == null && configuration != null)
-        {
-            contextMapper = new DefaultEntityContextMapper(configuration);
-        }
         return contextMapper;
     }
 
+    public EntityFactory getEntityFactory()
+    {
+        return entityFactory;
+    }
+
     public void setLdapTemplate(LdapTemplate ldapTemplate)
     {
         this.ldapTemplate = ldapTemplate;

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/AbstractSetup1LDAPTest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/AbstractSetup1LDAPTest.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/AbstractSetup1LDAPTest.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/AbstractSetup1LDAPTest.java Tue Sep 30 03:16:45 2008
@@ -93,9 +93,8 @@
         userSearchConfig.setAttributeDefinitions(userAttrDefs);
         userSearchConfig.setEntityType("user");
 
-        SpringLDAPEntityDAO userDAO = new SpringLDAPEntityDAO();
+        SpringLDAPEntityDAO userDAO = new SpringLDAPEntityDAO(userSearchConfig);
         userDAO.setLdapTemplate(ldapTemplate);
-        userDAO.setConfiguration(userSearchConfig);
 
         // setting up role DAO
 
@@ -111,9 +110,8 @@
         roleSearchConfig.setAttributeDefinitions(roleAttrDefs);
         roleSearchConfig.setEntityType("role");
 
-        SpringLDAPEntityDAO roleDAO = new SpringLDAPEntityDAO();
+        SpringLDAPEntityDAO roleDAO = new SpringLDAPEntityDAO(roleSearchConfig);
         roleDAO.setLdapTemplate(ldapTemplate);
-        roleDAO.setConfiguration(roleSearchConfig);
 
         Map<String, EntityDAO> daos = new HashMap<String, EntityDAO>();
         daos.put("user", userDAO);

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/AbstractSetup2LDAPTest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/AbstractSetup2LDAPTest.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/AbstractSetup2LDAPTest.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/AbstractSetup2LDAPTest.java Tue Sep 30 03:16:45 2008
@@ -95,9 +95,8 @@
         userSearchConfig.setAttributeDefinitions(userAttrDefs);
         userSearchConfig.setEntityType("user");
 
-        SpringLDAPEntityDAO userDAO = new SpringLDAPEntityDAO();
+        SpringLDAPEntityDAO userDAO = new SpringLDAPEntityDAO(userSearchConfig);
         userDAO.setLdapTemplate(ldapTemplate);
-        userDAO.setConfiguration(userSearchConfig);
 
         // setting up role DAO
 
@@ -113,9 +112,8 @@
         roleSearchConfig.setAttributeDefinitions(roleAttrDefs);
         roleSearchConfig.setEntityType("role");
 
-        SpringLDAPEntityDAO roleDAO = new SpringLDAPEntityDAO();
+        SpringLDAPEntityDAO roleDAO = new SpringLDAPEntityDAO(roleSearchConfig);
         roleDAO.setLdapTemplate(ldapTemplate);
-        roleDAO.setConfiguration(roleSearchConfig);
 
         Map<String, EntityDAO> daos = new HashMap<String, EntityDAO>();
         daos.put("user", userDAO);

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/stubs/StubEntityDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/stubs/StubEntityDAO.java?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/stubs/StubEntityDAO.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/stubs/StubEntityDAO.java Tue Sep 30 03:16:45 2008
@@ -20,6 +20,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.jetspeed.security.mapping.EntityFactory;
 import org.apache.jetspeed.security.mapping.ldap.dao.EntityDAO;
 import org.apache.jetspeed.security.mapping.model.Entity;
 import org.springframework.ldap.filter.Filter;
@@ -74,4 +75,10 @@
         entities.put(entity.getId(),entity);
     }
 
+    public EntityFactory getEntityFactory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml?rev=700404&r1=700403&r2=700404&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml Tue Sep 30 03:16:45 2008
@@ -176,12 +176,12 @@
   </bean>  
   <bean id="UserDao" class="org.apache.jetspeed.security.mapping.ldap.dao.impl.SpringLDAPEntityDAO">
     <meta key="j2:cat" value="ldap" />
+    <constructor-arg index="1" ref="UserDaoConfiguration"/>
     <property name="ldapTemplate">
       <bean class="org.springframework.ldap.core.LdapTemplate">
         <property name="contextSource" ref="LdapSpringContext" />
       </bean>
     </property>
-    <property name="configuration" ref="UserDaoConfiguration" />
   </bean>
 
   <bean id="UserRoleRelationDAO" class="org.apache.jetspeed.security.mapping.ldap.dao.impl.AttributeBasedRelationDAO">
@@ -243,22 +243,22 @@
   
   <bean id="RoleDao" class="org.apache.jetspeed.security.mapping.ldap.dao.impl.SpringLDAPEntityDAO">
     <meta key="j2:cat" value="ldap" />
+    <constructor-arg index="1" ref="RoleDaoConfiguration"/>
     <property name="ldapTemplate">
       <bean class="org.springframework.ldap.core.LdapTemplate">
         <property name="contextSource" ref="LdapSpringContext" />
       </bean>
     </property>
-    <property name="configuration" ref="RoleDaoConfiguration" />
   </bean>
   
   <bean id="GroupDao" class="org.apache.jetspeed.security.mapping.ldap.dao.impl.SpringLDAPEntityDAO">
     <meta key="j2:cat" value="ldap" />
+    <constructor-arg index="1" ref="GroupDaoConfiguration"/>
     <property name="ldapTemplate">
       <bean class="org.springframework.ldap.core.LdapTemplate">
         <property name="contextSource" ref="LdapSpringContext" />
       </bean>
     </property>
-    <property name="configuration" ref="GroupDaoConfiguration" />
   </bean>
   
   <bean id="LdapSpringContext" class="org.springframework.ldap.core.support.LdapContextSource">



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@...
For additional commands, e-mail: jetspeed-dev-help@...

LightInTheBox - Buy quality products at wholesale price!