directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1026312 - in /directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io: ./ api/ jndi/
Date Fri, 22 Oct 2010 12:46:00 GMT
Author: pamarcelot
Date: Fri Oct 22 12:45:59 2010
New Revision: 1026312

URL: http://svn.apache.org/viewvc?rev=1026312&view=rev
Log:
Added search and modify logging information for search and modify operations (create, rename
and delete operations still remain).

Modified:
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/AbstractStudioNamingEnumeration.java
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/CursorStudioNamingEnumeration.java
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
    directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/AbstractStudioNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/AbstractStudioNamingEnumeration.java?rev=1026312&r1=1026311&r2=1026312&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/AbstractStudioNamingEnumeration.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/AbstractStudioNamingEnumeration.java
Fri Oct 22 12:45:59 2010
@@ -20,31 +20,14 @@
 package org.apache.directory.studio.connection.core.io;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.NamingException;
-import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 import javax.naming.ldap.Control;
 
-import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.message.Referral;
-import org.apache.directory.shared.ldap.message.Response;
-import org.apache.directory.shared.ldap.message.SearchResultDone;
-import org.apache.directory.shared.ldap.message.SearchResultEntry;
-import org.apache.directory.shared.ldap.message.SearchResultReference;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
-import org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo;
-import org.apache.directory.studio.connection.core.io.jndi.JndiStudioNamingEnumeration;
-import org.apache.directory.studio.connection.core.io.jndi.StudioSearchResult;
 
 
 /**
@@ -62,8 +45,10 @@ public abstract class AbstractStudioNami
     protected AliasDereferencingMethod aliasesDereferencingMethod;
     protected ReferralHandlingMethod referralsHandlingMethod;
     protected Control[] controls;
+    protected long requestNum;
     protected StudioProgressMonitor monitor;
     protected ReferralsInfo referralsInfo;
+    protected long resultEntryCounter;
 
 
     /**
@@ -92,7 +77,9 @@ public abstract class AbstractStudioNami
         this.aliasesDereferencingMethod = aliasesDereferencingMethod;
         this.referralsHandlingMethod = referralsHandlingMethod;
         this.controls = controls;
+        this.requestNum = requestNum;
         this.monitor = monitor;
         this.referralsInfo = referralsInfo;
+        this.resultEntryCounter = 0;
     }
 }

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/CursorStudioNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/CursorStudioNamingEnumeration.java?rev=1026312&r1=1026311&r2=1026312&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/CursorStudioNamingEnumeration.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/CursorStudioNamingEnumeration.java
Fri Oct 22 12:45:59 2010
@@ -40,6 +40,8 @@ import org.apache.directory.studio.commo
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.IJndiLogger;
 import org.apache.directory.studio.connection.core.io.AbstractStudioNamingEnumeration;
 import org.apache.directory.studio.connection.core.io.ConnectionWrapperUtils;
 import org.apache.directory.studio.connection.core.io.StudioNamingEnumeration;
@@ -214,6 +216,11 @@ public class CursorStudioNamingEnumerati
                 }
             }
 
+            for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers()
)
+            {
+                logger.logSearchResultDone( connection, resultEntryCounter, requestNum, null
);
+            }
+
             return false;
         }
         catch ( Exception e )
@@ -241,6 +248,7 @@ public class CursorStudioNamingEnumerati
         {
             if ( currentSearchResultEntry != null )
             {
+                resultEntryCounter++;
                 SearchResult sr = new SearchResult( currentSearchResultEntry.getObjectName().toString(),
null,
                         AttributeUtils.toAttributes( currentSearchResultEntry.getEntry()
) );
                 sr.setNameInNamespace( currentSearchResultEntry.getObjectName().toString()
);
@@ -256,6 +264,7 @@ public class CursorStudioNamingEnumerati
                 // Checking the current referral's URLs list
                 if ( ( currentReferralUrlsList != null ) && ( currentReferralUrlsList.size()
> 0 ) )
                 {
+                    resultEntryCounter++;
                     // Building an LDAP URL from the the url
                     LdapURL url = new LdapURL( currentReferralUrlsList.remove( 0 ) );
 
@@ -271,6 +280,7 @@ public class CursorStudioNamingEnumerati
             // Are we following referrals automatically?
             else if ( referralsHandlingMethod == ReferralHandlingMethod.FOLLOW )
             {
+                resultEntryCounter++;
                 return new StudioSearchResult( cursorNamingEnumeration.next(), connection,
true, null );
             }
 

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1026312&r1=1026311&r2=1026312&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Fri Oct 22 12:45:59 2010
@@ -21,8 +21,6 @@ package org.apache.directory.studio.conn
 
 
 import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -70,6 +68,7 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 import org.apache.directory.studio.connection.core.IAuthHandler;
 import org.apache.directory.studio.connection.core.ICredentials;
+import org.apache.directory.studio.connection.core.IJndiLogger;
 import org.apache.directory.studio.connection.core.Messages;
 import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
 import org.apache.directory.studio.connection.core.io.StudioNamingEnumeration;
@@ -144,7 +143,6 @@ public class DirectoryApiConnectionWrapp
 
             try
             {
-
                 // get default trust managers (using JVM "cacerts" key store)
                 TrustManagerFactory factory = TrustManagerFactory.getInstance( TrustManagerFactory
                     .getDefaultAlgorithm() );
@@ -386,6 +384,27 @@ public class DirectoryApiConnectionWrapp
                 {
                     exception = e;
                 }
+
+                NamingException ne = null;
+                if ( exception != null )
+                {
+                    ne = new NamingException( exception.getMessage() );
+                }
+
+                for ( IJndiLogger logger : getJndiLoggers() )
+                {
+                    if ( namingEnumeration != null )
+                    {
+                        logger.logSearchRequest( connection, searchBase, filter, searchControls,
+                            aliasesDereferencingMethod, controls, requestNum, ne );
+                    }
+                    else
+                    {
+                        logger.logSearchRequest( connection, searchBase, filter, searchControls,
+                            aliasesDereferencingMethod, controls, requestNum, ne );
+                        logger.logSearchResultDone( connection, 0, requestNum, ne );
+                    }
+                }
             }
         };
 
@@ -543,6 +562,17 @@ public class DirectoryApiConnectionWrapp
                 {
                     exception = e;
                 }
+
+                NamingException ne = null;
+                if ( exception != null )
+                {
+                    ne = new NamingException( exception.getMessage() );
+                }
+
+                for ( IJndiLogger logger : getJndiLoggers() )
+                {
+                    logger.logChangetypeModify( connection, dn, modificationItems, controls,
ne );
+                }
             }
         };
 
@@ -944,4 +974,10 @@ public class DirectoryApiConnectionWrapp
             }
         }
     }
+
+
+    private List<IJndiLogger> getJndiLoggers()
+    {
+        return ConnectionCorePlugin.getDefault().getJndiLoggers();
+    }
 }

Modified: directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java?rev=1026312&r1=1026311&r2=1026312&view=diff
==============================================================================
--- directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java
(original)
+++ directory/studio/branches/studio-connection-refactoring/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JndiStudioNamingEnumeration.java
Fri Oct 22 12:45:59 2010
@@ -58,9 +58,6 @@ public class JndiStudioNamingEnumeration
     private NamingEnumeration<SearchResult> delegate;
     private NamingException initialReferralException;
 
-    private long requestNum;
-    private long resultEntryCounter;
-
 
     /**
      * Creates a new instance of ReferralNamingEnumeration.
@@ -89,7 +86,6 @@ public class JndiStudioNamingEnumeration
         this.delegate = delegate;
         this.initialReferralException = initialReferralException;
         this.requestNum = requestNum;
-        this.resultEntryCounter = 0;
     }
 
 



Mime
View raw message