directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r279687 - /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java
Date Fri, 09 Sep 2005 02:53:13 GMT
Author: akarasulu
Date: Thu Sep  8 19:53:09 2005
New Revision: 279687

URL: http://svn.apache.org/viewcvs?rev=279687&view=rev
Log:
fixed couple bugs where we were firing adds when remove ops or change ops were
being performed.  furthermore fixed it so that the proper listeners are now 
notified of their respective event types.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java?rev=279687&r1=279686&r2=279687&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/event/EventService.java
Thu Sep  8 19:53:09 2005
@@ -130,17 +130,6 @@
                 nclistener.objectAdded( new NamingEvent( rec.getEventContext(),
                         NamingEvent.OBJECT_ADDED, null, binding, entry ) );
             }
-            else if ( listener instanceof ObjectChangeListener )
-            {
-                ObjectChangeListener oclistener = ( ObjectChangeListener ) listener;
-                Binding binding = new Binding( upName, entry, false );
-                oclistener.objectChanged( new NamingEvent( rec.getEventContext(),
-                        NamingEvent.OBJECT_ADDED, null, binding, entry ) );
-            }
-            else
-            {
-                throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass()
);
-            }
         }
     }
 
@@ -165,20 +154,9 @@
             {
                 NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener;
                 Binding binding = new Binding( name.toString(), entry, false );
-                nclistener.objectAdded( new NamingEvent( rec.getEventContext(),
+                nclistener.objectRemoved( new NamingEvent( rec.getEventContext(),
                         NamingEvent.OBJECT_REMOVED, binding, null, entry ) );
             }
-            else if ( listener instanceof ObjectChangeListener )
-            {
-                ObjectChangeListener oclistener = ( ObjectChangeListener ) listener;
-                Binding binding = new Binding( name.toString(), entry, false );
-                oclistener.objectChanged( new NamingEvent( rec.getEventContext(),
-                        NamingEvent.OBJECT_REMOVED, binding, null, entry ) );
-            }
-            else
-            {
-                throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass()
);
-            }
         }
     }
 
@@ -198,24 +176,13 @@
             EventSourceRecord rec = ( EventSourceRecord ) list.next();
             NamingListener listener = rec.getNamingListener();
 
-            if ( listener instanceof NamespaceChangeListener )
-            {
-                NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener;
-                Binding binding = new Binding( name.toString(), entry, false );
-                nclistener.objectAdded( new NamingEvent( rec.getEventContext(),
-                        NamingEvent.OBJECT_CHANGED, binding, binding, entry ) );
-            }
-            else if ( listener instanceof ObjectChangeListener )
+            if ( listener instanceof ObjectChangeListener )
             {
                 ObjectChangeListener oclistener = ( ObjectChangeListener ) listener;
                 Binding binding = new Binding( name.toString(), entry, false );
                 oclistener.objectChanged( new NamingEvent( rec.getEventContext(),
                         NamingEvent.OBJECT_CHANGED, binding, binding, entry ) );
             }
-            else
-            {
-                throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass()
);
-            }
         }
     }
 
@@ -253,20 +220,8 @@
                 NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener;
                 Binding oldBinding = new Binding( oldName.toString(), entry, false );
                 Binding newBinding = new Binding( oldName.toString(), entry, false );
-                nclistener.objectAdded( new NamingEvent( rec.getEventContext(),
-                        NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) );
-            }
-            else if ( listener instanceof ObjectChangeListener )
-            {
-                ObjectChangeListener oclistener = ( ObjectChangeListener ) listener;
-                Binding oldBinding = new Binding( oldName.toString(), entry, false );
-                Binding newBinding = new Binding( oldName.toString(), entry, false );
-                oclistener.objectChanged( new NamingEvent( rec.getEventContext(),
-                        NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) );
-            }
-            else
-            {
-                throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass()
);
+                nclistener.objectRenamed( new NamingEvent( rec.getEventContext(),
+                        NamingEvent.OBJECT_RENAMED, oldBinding, newBinding, entry ) );
             }
         }
     }



Mime
View raw message