directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1513046 - in /directory/escimo/trunk: common/src/main/java/org/apache/directory/scim/ ldap/ ldap/src/main/java/org/apache/directory/scim/ldap/ ldap/src/main/resources/ server/src/main/java/org/apache/directory/scim/rest/ tests/
Date Mon, 12 Aug 2013 06:11:18 GMT
Author: kayyagari
Date: Mon Aug 12 06:11:18 2013
New Revision: 1513046

URL: http://svn.apache.org/r1513046
Log:
o updated versions of api and apacheds to  M19 and M20 snapshots respectively
o added groups multivalue attribute handler

Modified:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/RequestContext.java
    directory/escimo/trunk/ldap/pom.xml
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
    directory/escimo/trunk/ldap/src/main/resources/escimo-ldap-mapping.xml
    directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
    directory/escimo/trunk/tests/pom.xml

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/RequestContext.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/RequestContext.java?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/RequestContext.java
(original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/RequestContext.java
Mon Aug 12 06:11:18 2013
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.scim;
 
+
 import javax.ws.rs.core.UriInfo;
 
+
 /**
  * TODO RequestContext.
  *
@@ -28,39 +30,46 @@ import javax.ws.rs.core.UriInfo;
  */
 public class RequestContext
 {
-    private Object resourceConnection;
+    private ProviderService providerService;
+
     private UriInfo uriInfo;
-    
+
     private User user;
 
-    public Object getResourceConnection()
-    {
-        return resourceConnection;
-    }
 
-    public void setResourceConnection( Object resourceConnection )
+    public RequestContext( ProviderService providerService )
     {
-        this.resourceConnection = resourceConnection;
+        this.providerService = providerService;
     }
 
+
     public User getUser()
     {
         return user;
     }
 
+
     public void setUser( User user )
     {
         this.user = user;
     }
 
+
     public UriInfo getUriInfo()
     {
         return uriInfo;
     }
 
+
     public void setUriInfo( UriInfo uriInfo )
     {
         this.uriInfo = uriInfo;
     }
-    
+
+
+    public ProviderService getProviderService()
+    {
+        return providerService;
+    }
+
 }

Modified: directory/escimo/trunk/ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/pom.xml?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/pom.xml (original)
+++ directory/escimo/trunk/ldap/pom.xml Mon Aug 12 06:11:18 2013
@@ -12,7 +12,7 @@
   <name>eSCIMo LDAP Backend</name>
   
   <properties>
-    <ldap.api.version>1.0.0-M19</ldap.api.version>
+    <ldap.api.version>1.0.0-M20-SNAPSHOT</ldap.api.version>
     <dom4j.version>1.6.1</dom4j.version>
   </properties>
   

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapResourceProvider.java
Mon Aug 12 06:11:18 2013
@@ -327,16 +327,7 @@ public class LdapResourceProvider implem
                 }
                 else if ( stg != null )
                 {
-                    List<SimpleAttributeGroup> atGroupList = null;
-
-                    if ( !Strings.isEmpty( mt.getFilter() ) )
-                    {
-                        atGroupList = getDynamicMultiValAtFrom( stg, mt.getFilter(), mt.getBaseDn(),
entry );
-                    }
-                    else
-                    {
-                        atGroupList = getValuesFor( stg, entry );
-                    }
+                    List<SimpleAttributeGroup> atGroupList = getValuesFor( stg, entry
);
 
                     if ( atGroupList != null )
                     {
@@ -351,64 +342,6 @@ public class LdapResourceProvider implem
     }
 
 
-    private List<SimpleAttributeGroup> getDynamicMultiValAtFrom( SimpleTypeGroup stg,
String filter, String baseDn,
-        Entry entry )
-        throws LdapException, IOException, CursorException
-    {
-        if ( Strings.isEmpty( baseDn ) )
-        {
-            baseDn = ""; // RootDSE
-        }
-
-        /* if( filter.contains( "$" ))
-         {
-             StringBuilder sb = new StringBuilder();
-             int len = filter.length();
-             int pos = 0;
-             while( pos < len-1 )
-             {
-                 int equalPos = filter.indexOf( "=", pos );
-                 sb.append( filter.subSequence( pos, equalPos+1 ) );
-                 
-                 int dollarPos = filter.indexOf( "$", equalPos );
-                 if( dollarPos != -1 )
-                 {
-                     int rightParenPos = filter.indexOf( ")", dollarPos );
-                     while( filter.charAt( rightParenPos - 1 ) == '\\' )
-                     {
-                         rightParenPos = filter.indexOf( ")", rightParenPos );
-                     }
-                     
-                 }
-                 
-             }
-         }*/
-
-        List<SimpleAttributeGroup> lst = new ArrayList<SimpleAttributeGroup>();
-
-        EntryCursor cursor = connection.search( baseDn, filter, SearchScope.SUBTREE,
-            SchemaConstants.ALL_ATTRIBUTES_ARRAY );
-        while ( cursor.next() )
-        {
-            Entry mvEntry = cursor.get();
-            List<SimpleAttributeGroup> tmp = getValuesFor( stg, mvEntry );
-            if ( tmp != null )
-            {
-                lst.add( tmp.get( 0 ) );
-            }
-        }
-
-        cursor.close();
-
-        if ( lst.isEmpty() )
-        {
-            return null;
-        }
-
-        return lst;
-    }
-
-
     private List<SimpleAttributeGroup> getValuesFor( SimpleTypeGroup stg, Entry entry
) throws LdapException
     {
         if ( stg == null )
@@ -574,9 +507,29 @@ public class LdapResourceProvider implem
     }
 
 
+    public LdapConnection getConnection()
+    {
+        return connection;
+    }
+
+
+    public Entry fetchEntry( String dn )
+    {
+        try
+        {
+            return connection.lookup( dn, ALL_ATTRIBUTES_ARRAY );
+        }
+        catch( LdapException e )
+        {
+            LOG.debug( "Couldn't find the entry with dn {}", dn, e );
+        }
+        
+        return null;
+    }
+    
     public static void main( String[] args ) throws Exception
     {
-        System.setProperty( StandaloneLdapApiService.DEFAULT_CONTROLS_LIST,
+        System.setProperty( StandaloneLdapApiService.CONTROLS_LIST,
             "org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory," +
                 "org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory,"
+
                 "org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory,"
+
@@ -612,7 +565,7 @@ public class LdapResourceProvider implem
 
         System.out.println( entry );
         LdapResourceProvider lr = new LdapResourceProvider( c );
-        User user = lr.toUser( new RequestContext(), entry );
+        User user = lr.toUser( new RequestContext( lr ), entry );
         System.out.println( user );
         System.out.println( ResourceSerializer.serialize( user ) );
         c.close();

Modified: directory/escimo/trunk/ldap/src/main/resources/escimo-ldap-mapping.xml
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/resources/escimo-ldap-mapping.xml?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/resources/escimo-ldap-mapping.xml (original)
+++ directory/escimo/trunk/ldap/src/main/resources/escimo-ldap-mapping.xml Mon Aug 12 06:11:18
2013
@@ -70,11 +70,7 @@
             </type>
         </multival-attribute>
 
-        <multival-attribute name="groups">
-            <at-group>
-                <attribute name="value" mappedTo="member" />
-            </at-group>
-        </multival-attribute>
+        <multival-attribute name="groups" basedDn="ou=system" filter="(uniqueMember =
$entryDn)" handlerRef="groupsHandler"/>
 
         <complex-attribute name="meta" handlerRef="metaHandler" />
 
@@ -109,5 +105,7 @@
             class="org.apache.directory.scim.ldap.handlers.ActiveAttributeHandler" />
         <handler name="metaHandler"
             class="org.apache.directory.scim.ldap.handlers.MetaAttributeHandler" />
+        <handler name="groupsHandler"
+            class="org.apache.directory.scim.ldap.handlers.GroupsAttributeHandler" />
     </atHandlers>
 </entities>
\ No newline at end of file

Modified: directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
(original)
+++ directory/escimo/trunk/server/src/main/java/org/apache/directory/scim/rest/UserService.java
Mon Aug 12 06:11:18 2013
@@ -54,7 +54,7 @@ public class UserService
         
         try
         {
-            RequestContext ctx = new RequestContext();
+            RequestContext ctx = new RequestContext( provider );
             ctx.setUriInfo( uriInfo );
             
             User user = provider.getUser( ctx, userId );

Modified: directory/escimo/trunk/tests/pom.xml
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/tests/pom.xml?rev=1513046&r1=1513045&r2=1513046&view=diff
==============================================================================
--- directory/escimo/trunk/tests/pom.xml (original)
+++ directory/escimo/trunk/tests/pom.xml Mon Aug 12 06:11:18 2013
@@ -12,8 +12,8 @@
   <name>eSCIMo Tests</name>
 
   <properties>
-    <ldap.api.version>1.0.0-M19</ldap.api.version>
-    <apacheds.version>2.0.0-M14</apacheds.version>
+    <ldap.api.version>1.0.0-M20-SNAPSHOT</ldap.api.version>
+    <apacheds.version>2.0.0-M15-SNAPSHOT</apacheds.version>
     <slf4j.api.version>1.7.5</slf4j.api.version>
     <slf4j.log4j12.version>1.7.5</slf4j.log4j12.version>
     <log4j.version>1.2.17</log4j.version>



Mime
View raw message