directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r939379 [2/2] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/ core-api/src/main/java/org/apache/directory/server/core/interceptor/ core-api/src/main/java/org/apache/directory/server/core/interceptor/...
Date Thu, 29 Apr 2010 17:04:02 GMT
Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Thu Apr 29 17:04:00 2010
@@ -363,10 +363,12 @@ public class JdbmStore<E> extends Abstra
         DN dn = new DN();
 
         long parentId = id.longValue();
+        
         do
         {
             RDN curRdn = rdnIdx.reverseLookup( parentId );
             parentId = curRdn._getParentId();
+            
             if ( parentId == 0 )
             {
                 // we reached the suffix, add the context entry DN
@@ -377,6 +379,7 @@ public class JdbmStore<E> extends Abstra
                     contextEntryDn = new DN( curRdn.getName() );
                     contextEntryDn.normalize( schemaManager.getNormalizerMapping() );
                 }
+                
                 for ( RDN rdn : contextEntryDn )
                 {
                     dn.addNormalizedInOrder( rdn );
@@ -821,17 +824,22 @@ public class JdbmStore<E> extends Abstra
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Entry lookup( Long id ) throws Exception
     {
-        Entry se = ( Entry ) master.get( id );
+        Entry entry = ( Entry ) master.get( id );
 
-        if ( se == null )
+        if ( entry != null )
         {
-            return null;
+            DN dn = buildEntryDn( id );
+            entry.setDn( dn );
+            
+            return entry;
         }
 
-        se.setDn( buildEntryDn( id ) );
-        return se;
+        return null;
     }
 
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Thu Apr 29 17:04:00 2010
@@ -36,6 +36,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
 import org.apache.directory.server.ldap.handlers.bind.SaslConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
@@ -130,7 +131,7 @@ public class BindHandler extends LdapReq
              * detect conditions where ancestors of the DN are referrals
              * and delegate appropriately.
              */
-            ClonedServerEntry principalEntry = null;
+            Entry principalEntry = null;
 
             try
             {
@@ -151,7 +152,7 @@ public class BindHandler extends LdapReq
                 return;
             }
 
-            if ( principalEntry.getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
+            if ( ((ClonedServerEntry)principalEntry).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
                 SchemaConstants.REFERRAL_OC ) )
             {
                 LOG.info( "Bind principalDn points to referral." );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ReferralAwareRequestHandler.java
Thu Apr 29 17:04:00 2010
@@ -26,6 +26,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -123,11 +124,11 @@ public abstract class ReferralAwareReque
      * @return the farthest referral ancestor or null
      * @throws Exception if there are problems during this search
      */
-    public static final ClonedServerEntry getFarthestReferralAncestor( LdapSession session,
DN target ) 
+    public static final Entry getFarthestReferralAncestor( LdapSession session, DN target
) 
         throws Exception
     {
-        ClonedServerEntry entry;
-        ClonedServerEntry farthestReferralAncestor = null;
+        Entry entry;
+        Entry farthestReferralAncestor = null;
         DN dn = ( DN ) target.clone();
         
         try
@@ -147,7 +148,7 @@ public abstract class ReferralAwareReque
             {
                 entry = session.getCoreSession().lookup( dn );
 
-                if ( isEntryReferral( entry ) )
+                if ( isEntryReferral( ((ClonedServerEntry)entry) ) )
                 {
                     farthestReferralAncestor = entry;
                 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Thu Apr 29 17:04:00 2010
@@ -41,6 +41,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.search.controls.persistentSearch.PersistentSearchControl;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -1025,7 +1026,7 @@ public class SearchHandler extends Refer
     public void handleWithReferrals( LdapSession session, DN reqTargetDn, InternalSearchRequest
req ) throws LdapException
     {
         InternalLdapResult result = req.getResultResponse().getLdapResult();
-        ClonedServerEntry entry = null;
+        Entry entry = null;
         boolean isReferral = false;
         boolean isparentReferral = false;
         ReferralManager referralManager = session.getCoreSession().getDirectoryService().getReferralManager();
@@ -1091,7 +1092,7 @@ public class SearchHandler extends Refer
                 {
                     LOG.debug( "Entry is a referral: {}", entry );
                     
-                    handleReferralEntryForSearch( session, ( InternalSearchRequest ) req,
entry );
+                    handleReferralEntryForSearch( session, ( InternalSearchRequest ) req,
((ClonedServerEntry)entry) );
 
                     return;
                 }
@@ -1112,7 +1113,7 @@ public class SearchHandler extends Refer
             else
             {
                 // The entry is null : it has a parent referral.
-                ClonedServerEntry referralAncestor = null;
+                Entry referralAncestor = null;
     
                 try
                 {
@@ -1135,7 +1136,7 @@ public class SearchHandler extends Refer
                 // if we get here then we have a valid referral ancestor
                 try
                 {
-                    InternalReferral referral = getReferralOnAncestorForSearch( session,
( InternalSearchRequest ) req, referralAncestor );
+                    InternalReferral referral = getReferralOnAncestorForSearch( session,
( InternalSearchRequest ) req, ((ClonedServerEntry)referralAncestor) );
                     
                     result.setResultCode( ResultCodeEnum.REFERRAL );
                     result.setReferral( referral );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Thu Apr 29 17:04:00 2010
@@ -35,6 +35,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.extended.operations.certGeneration.CertGenerationContainer;
 import org.apache.directory.shared.ldap.codec.extended.operations.certGeneration.CertGenerationDecoder;
 import org.apache.directory.shared.ldap.codec.extended.operations.certGeneration.CertGenerationObject;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.message.extended.CertGenerationRequest;
 import org.apache.directory.shared.ldap.message.extended.CertGenerationResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
@@ -95,10 +96,11 @@ public class CertGenerationRequestHandle
         
         CertGenerationObject certGenObj = container.getCertGenerationObject();
         
-        ClonedServerEntry entry = session.getCoreSession().lookup( new DN( certGenObj.getTargetDN()
) );
-        if( entry != null )
+        Entry entry = session.getCoreSession().lookup( new DN( certGenObj.getTargetDN() )
);
+        
+        if ( entry != null )
         {
-            TlsKeyGenerator.addKeyPair( entry.getOriginalEntry(), certGenObj.getIssuerDN(),
certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
+            TlsKeyGenerator.addKeyPair( ((ClonedServerEntry)entry).getOriginalEntry(), certGenObj.getIssuerDN(),
certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
         }
     }
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsConfidentialityIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsConfidentialityIT.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsConfidentialityIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsConfidentialityIT.java
Thu Apr 29 17:04:00 2010
@@ -56,11 +56,11 @@ import org.apache.directory.server.annot
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.annotations.CreateDS;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.integ.ServerIntegrationUtils;
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
@@ -121,7 +121,7 @@ public class StartTlsConfidentialityIT e
         
         ksFile = File.createTempFile( "testStore", "ks" );
         CoreSession session = ldapServer.getDirectoryService().getAdminSession();
-        ClonedServerEntry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS
);
+        Entry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS );
         byte[] userCertificate = entry.get( CERT_IDS[0] ).getBytes();
         assertNotNull( userCertificate );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsIT.java
Thu Apr 29 17:04:00 2010
@@ -48,10 +48,10 @@ import org.apache.directory.server.annot
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.annotations.CreateDS;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
+import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
@@ -114,7 +114,7 @@ public class StartTlsIT extends Abstract
         
         ksFile = File.createTempFile( "testStore", "ks" );
         CoreSession session = ldapServer.getDirectoryService().getAdminSession();
-        ClonedServerEntry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS
);
+        Entry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS );
         byte[] userCertificate = entry.get( CERT_IDS[0] ).getBytes();
         assertNotNull( userCertificate );
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsUpdateCertificateIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsUpdateCertificateIT.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsUpdateCertificateIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ssl/StartTlsUpdateCertificateIT.java
Thu Apr 29 17:04:00 2010
@@ -46,7 +46,6 @@ import org.apache.directory.server.annot
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.annotations.CreateDS;
-import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.security.TlsKeyGenerator;
@@ -112,7 +111,7 @@ public class StartTlsUpdateCertificateIT
         
         ksFile = File.createTempFile( "testStore", "ks" );
         CoreSession session = ldapServer.getDirectoryService().getAdminSession();
-        ClonedServerEntry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS
);
+        Entry entry = session.lookup( new DN( "uid=admin,ou=system" ), CERT_IDS );
         byte[] userCertificate = entry.get( CERT_IDS[0] ).getBytes();
         assertNotNull( userCertificate );
 

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
(original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
Thu Apr 29 17:04:00 2010
@@ -341,7 +341,8 @@ public class ApacheDS
      */
     private void loadLdif( File ldifFile ) throws Exception
     {
-        ClonedServerEntry fileEntry = null;
+        Entry fileEntry = null;
+        
         try
         {
             fileEntry = directoryService.getAdminSession().lookup( buildProtectedFileEntryDn(
ldifFile ) );

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=939379&r1=939378&r2=939379&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
(original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Store.java
Thu Apr 29 17:04:00 2010
@@ -420,6 +420,13 @@ public interface Store<E, ID>
     void add( Entry entry ) throws Exception;
 
 
+    /**
+     * Get back an entry knowing its ID
+     *
+     * @param id The Entry ID we want to get back
+     * @return The found Entry, or null if not found
+     * @throws Exception If the lookup failed for any reason (except a not found entry)
+     */
     Entry lookup( ID id ) throws Exception;
 
 



Mime
View raw message