directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r939063 - /directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java
Date Wed, 28 Apr 2010 19:44:31 GMT
Author: kayyagari
Date: Wed Apr 28 19:44:31 2010
New Revision: 939063

URL: http://svn.apache.org/viewvc?rev=939063&view=rev
Log:
added a convenient method to get the EventType from the given standard event mask(i.e those
explicitly declared in EventType class) value 

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java?rev=939063&r1=939062&r2=939063&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/EventType.java
Wed Apr 28 19:44:31 2010
@@ -195,4 +195,30 @@ public enum EventType
         
         return mask;
     }
+    
+    
+    /**
+     * checks if the given mask value matches with any of the defined
+     * standard EventTypes 
+     *
+     * @param mask the mask value of the EventType
+     * @return EventType matching the mask value of the standard event types defined, else
throws IllegalArgumentException 
+     */
+    public static EventType getType( int mask )
+    {
+        switch( mask )
+        {
+            case 1: return ADD;
+            
+            case 2: return DELETE;
+            
+            case 4: return MODIFY;
+            
+            case 8: return RENAME;
+            
+            case 16: return MOVE;
+            
+            default: throw new IllegalArgumentException( "unknown mask value " + mask );
+        }
+    }
 }



Mime
View raw message