directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r957843 - in /directory/shared/trunk: i18n/src/main/java/org/apache/directory/shared/i18n/ i18n/src/main/resources/org/apache/directory/shared/i18n/ ldap/src/main/antlr/ ldap/src/main/java/org/apache/directory/shared/ldap/aci/
Date Fri, 25 Jun 2010 08:40:33 GMT
Author: elecharny
Date: Fri Jun 25 08:40:33 2010
New Revision: 957843

URL: http://svn.apache.org/viewvc?rev=957843&view=rev
Log:
o Minor refactoring :
- added some Javadoc
- formatting some code
- changing some of the error code
- the ACIItem class is not anymore serializable (no need to be)

Modified:
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACITuple.java

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=957843&r1=957842&r2=957843&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Fri
Jun 25 08:40:33 2010
@@ -139,9 +139,9 @@ public enum I18n
     ERR_03040( "ERR_03040" ),
 
     // ldap
-    ERR_04001( "ERR_04001" ),
-    ERR_04002( "ERR_04002" ),
-    ERR_04003( "ERR_04003" ),
+    ERR_04001_NULL_IDENTIFICATION_TAG( "ERR_04001_NULL_IDENTIFICATION_TAG" ),
+    ERR_04002_BAD_PRECENDENCE( "ERR_04002_BAD_PRECENDENCE" ),
+    ERR_04003_NULL_AUTHENTICATION_LEVEL( "ERR_04003_NULL_AUTHENTICATION_LEVEL" ),
     ERR_04004( "ERR_04004" ),
     ERR_04005( "ERR_04005" ),
     ERR_04006( "ERR_04006" ),

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=957843&r1=957842&r2=957843&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
(original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
Fri Jun 25 08:40:33 2010
@@ -123,9 +123,9 @@ ERR_03039=the given requestID is not an 
 ERR_03040=unable to find the batch request
 
 # ldap
-ERR_04001=identificationTag
-ERR_04002=precedence: {0}
-ERR_04003=authenticationLevel
+ERR_04001_NULL_IDENTIFICATION_TAG=identificationTag parameter is null
+ERR_04002_BAD_PRECENDENCE=precedence parameter not in [0-255] : {0}
+ERR_04003_NULL_AUTHENTICATION_LEVEL=authenticationLevel parameter is null
 ERR_04004=Parser failure on ACIItem\:\n\t{0}\nAntlr exception trace\:\n{1}
 ERR_04005=The PDU buffer size is too small !
 ERR_04006=The And filter PDU must not be empty

Modified: directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/ACIItem.g?rev=957843&r1=957842&r2=957843&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/ACIItem.g Fri Jun 25 08:40:33 2010
@@ -180,19 +180,19 @@ tokens
 // parser productions
 // ----------------------------------------------------------------------------
 
-wrapperEntryPoint returns [ ACIItem l_ACIItem ]
+wrapperEntryPoint returns [ ACIItem aciItem ]
 {
     log.debug( "entered wrapperEntryPoint()" );
-    l_ACIItem = null;
+    aciItem = null;
 }
     :
-    ( SP )* l_ACIItem=theACIItem ( SP )* EOF
+    ( SP )* aciItem = theACIItem ( SP )* EOF
     ;
 
-theACIItem returns [ ACIItem ACIItem ]
+theACIItem returns [ ACIItem aciItem ]
 {
     log.debug( "entered theACIItem()" );
-    ACIItem = null;
+    aciItem = null;
     mainACIItemComponentsMonitor = new MandatoryComponentsMonitor( 
             new String [] { "identificationTag", "precedence", "authenticationLevel", "itemOrUserFirst"
} );
 }
@@ -210,7 +210,7 @@ theACIItem returns [ ACIItem ACIItem ]
         
         if ( isItemFirstACIItem )
         {
-            ACIItem = new ItemFirstACIItem(
+            aciItem = new ItemFirstACIItem(
                     identificationTag,
                     aciPrecedence,
                     authenticationLevel,
@@ -219,14 +219,13 @@ theACIItem returns [ ACIItem ACIItem ]
         }
         else
         {
-            ACIItem = new UserFirstACIItem(
+            aciItem = new UserFirstACIItem(
                     identificationTag,
                     aciPrecedence,
                     authenticationLevel,
                     userClasses,
                     userPermissions );
         }
-        
     }
     ;
     

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java?rev=957843&r1=957842&r2=957843&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
Fri Jun 25 08:40:33 2010
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.aci;
 
 
-import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -36,41 +35,40 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class ACIItem implements Serializable
+public abstract class ACIItem
 {
+    /** The ACIItemComponet identifier */
     private String identificationTag;
 
-    /* 0 ~ 255 */
+    /** The precedence : a number in [0 - 255] */
     private int precedence = 0;
 
+    /** The authentication level. One of 'none', 'simple' and 'strong' */
     private AuthenticationLevel authenticationLevel;
 
 
     /**
      * Creates a new instance
      * 
-     * @param identificationTag
-     *            the id string of this item
-     * @param precedence
-     *            the precedence of this item
-     * @param authenticationLevel
-     *            the level of authentication required to this item
+     * @param identificationTag the id string of this item
+     * @param precedence the precedence of this item
+     * @param authenticationLevel the level of authentication required to this item
      */
-    protected ACIItem(String identificationTag, int precedence, AuthenticationLevel authenticationLevel)
+    protected ACIItem( String identificationTag, int precedence, AuthenticationLevel authenticationLevel
)
     {
         if ( identificationTag == null )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04001 ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04001_NULL_IDENTIFICATION_TAG
) );
         }
         
-        if ( precedence < 0 || precedence > 255 )
+        if ( ( precedence < 0 ) || ( precedence > 255 ) )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04002, precedence ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04002_BAD_PRECENDENCE,
precedence ) );
         }
         
         if ( authenticationLevel == null )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04003 ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04003_NULL_AUTHENTICATION_LEVEL
) );
         }
 
         this.identificationTag = identificationTag;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACITuple.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACITuple.java?rev=957843&r1=957842&r2=957843&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACITuple.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACITuple.java
Fri Jun 25 08:40:33 2010
@@ -80,12 +80,12 @@ public class ACITuple implements Seriali
     {
         if ( authenticationLevel == null )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04003) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04003_NULL_AUTHENTICATION_LEVEL
) );
         }
 
         if ( precedence < 0 || precedence > 255 )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_04002, precedence ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_04002_BAD_PRECENDENCE,
precedence ) );
         }
 
         this.userClasses = Collections.unmodifiableCollection( new ArrayList<UserClass>(
userClasses ) );



Mime
View raw message